/* MiGranjApp - Sistema de Diseño Agroecológico & Ergonómico Rural */
:root {
  --primary: #2e7d32;
  --primary-dark: #1b5e20;
  --primary-light: #e8f5e9;
  --primary-hover: #388e3c;
  
  --secondary: #d97706;
  --secondary-light: #fef3c7;
  
  --earth: #795548;
  --earth-light: #efebe9;
  
  --water: #0288d1;
  --water-light: #e1f5fe;
  
  --bg-main: #f6f8f5;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f0;
  
  --text-main: #1f2937;
  --text-muted: #4b5563;
  --text-light: #6b7280;
  
  --border-color: #d1d5db;
  --border-focus: #1b5e20;
  
  --zone-0: #f59e0b; /* Vivienda */
  --zone-1: #10b981; /* Huerto intensivo */
  --zone-2: #84cc16; /* Pecuario & biofábrica */
  --zone-3: #15803d; /* Agroforestería */
  --zone-4: #065f46; /* Bosque protector */
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
  
  --touch-target: 48px;
  --font-base: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Modo Sol Campesino (High Contrast Sun Mode para visibilidad en campo) */
body.sun-mode {
  --primary: #000000;
  --primary-dark: #000000;
  --primary-light: #fff59d;
  --primary-hover: #212121;
  
  --bg-main: #ffffff;
  --bg-card: #fffffe;
  --bg-subtle: #fffde7;
  
  --text-main: #000000;
  --text-muted: #111111;
  --text-light: #222222;
  
  --border-color: #000000;
  --border-focus: #000000;
  
  --zone-0: #ffb300;
  --zone-1: #00c853;
  --zone-2: #7cb342;
  --zone-3: #2e7d32;
  --zone-4: #1b5e20;
}

body.sun-mode * {
  border-width: 2px !important;
}

body.sun-mode .badge,
body.sun-mode .btn,
body.sun-mode .card,
body.sun-mode input,
body.sun-mode select {
  border-color: #000000 !important;
  font-weight: 700 !important;
}

/* Modo Oscuro Nocturno Campesino */
body.dark-mode {
  --primary: #4caf50;
  --primary-dark: #81c784;
  --primary-light: #1e3321;
  --primary-hover: #66bb6a;
  
  --bg-main: #121613;
  --bg-card: #1c221e;
  --bg-subtle: #242c26;
  
  --text-main: #e8ede6;
  --text-muted: #b0beb3;
  --text-light: #8fa093;
  
  --border-color: #313d34;
  --border-focus: #4caf50;
}

/* Reset y base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px; /* Mínimo 16px para accesibilidad rural */
  font-family: var(--font-base);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Tipografía ergonómica */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-main);
}

h1 { font-size: 1.65rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }
p, li, label, input, button, select {
  font-size: 1rem;
}

/* Header & Barra Superior */
.app-header {
  background-color: var(--primary-dark);
  color: #ffffff;
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: #ffffff;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  flex-shrink: 0;
}

.brand-info h1 {
  font-size: 1.25rem;
  margin: 0;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.brand-info p {
  font-size: 0.75rem;
  opacity: 0.88;
  margin: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Botones Accesibles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--touch-target);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background-color: var(--bg-subtle);
}

.btn-accent {
  background-color: var(--secondary);
  color: #ffffff;
}

.btn-sun {
  background-color: #fef08a;
  color: #854d0e;
  border: 1px solid #facc15;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.btn-sun.active {
  background-color: #000000;
  color: #fef08a;
  border-color: #000000;
}

.btn-icon {
  width: var(--touch-target);
  height: var(--touch-target);
  padding: 0;
  border-radius: 50%;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.badge.offline {
  background-color: #fef3c7;
  color: #b45309;
}

.badge.online {
  background-color: #d1fae5;
  color: #065f46;
}

/* Barra de Navegación por Pestañas (Tabs ergonómicos) */
.nav-tabs-wrapper {
  background-color: var(--bg-card);
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 56px;
  z-index: 90;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-tabs {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  padding: 0.25rem 0.5rem;
  gap: 0.35rem;
  white-space: nowrap;
}

.tab-btn {
  flex: 1;
  min-height: var(--touch-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

.tab-btn.active {
  background-color: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
  border-bottom: 3px solid var(--primary);
}

/* Contenido Principal */
.main-content {
  max-width: 1200px;
  width: 100%;
  margin: 1rem auto;
  padding: 0 1rem;
  flex: 1;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tarjetas y Layout */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

/* Elementos del Formulario / Asistente Wizard */
.wizard-step {
  margin-bottom: 1.75rem;
}

.step-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.slider-container {
  background-color: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.slider-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.range-input {
  width: 100%;
  height: 12px;
  border-radius: 6px;
  background: #cbd5e1;
  outline: none;
  cursor: pointer;
  accent-color: var(--primary);
}

/* Tarjetas Táctiles de Selección (Touch Selectable Tiles) */
.tile-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.tile-choice {
  background-color: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease-in-out;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-height: 80px;
  justify-content: center;
  user-select: none;
}

.tile-choice:hover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.tile-choice.selected {
  border-color: var(--primary);
  background-color: var(--primary-light);
  box-shadow: 0 0 0 2px var(--primary);
}

.tile-icon {
  font-size: 1.6rem;
}

.tile-label {
  font-weight: 700;
  font-size: 0.95rem;
}

.tile-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Resumen Rápido / Banner Métrico */
.summary-banner {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.stat-box {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  text-align: center;
}

.stat-box .val {
  font-size: 1.3rem;
  font-weight: 800;
}

.stat-box .lbl {
  font-size: 0.75rem;
  opacity: 0.9;
}

/* Mapa / Esquema Interactivo 2D */
.map-container {
  background-color: #ffffff;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  padding: 0.5rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.farm-svg {
  width: 100%;
  height: 400px;
  display: block;
  border-radius: var(--radius-sm);
  background: #fbfbf8;
}

.zone-polygon {
  cursor: pointer;
  transition: fill-opacity 0.2s, stroke-width 0.2s;
}

.zone-polygon:hover {
  fill-opacity: 0.85;
  stroke: #000;
  stroke-width: 3px;
}

.zone-polygon.active {
  stroke: #ffeb3b;
  stroke-width: 4px;
}

/* Leyenda de Zonas */
.zone-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

/* Tarjetas Informativas de Cultivos y Especies */
.crop-card, .animal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: transform 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.crop-card:hover, .animal-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.crop-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.crop-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

.crop-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.3rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

/* Checklists y Tareas */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-subtle);
  margin-bottom: 0.5rem;
  border: 1px solid var(--border-color);
}

.task-item input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
  margin-top: 0.15rem;
  cursor: pointer;
}

.task-content {
  flex: 1;
}

.task-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.task-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.task-item.completed {
  opacity: 0.6;
  text-decoration: line-through;
  background-color: #e2e8f0;
}

/* Calendario Lunar */
.lunar-phase-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  background-color: var(--bg-card);
}

.lunar-phase-card.active {
  border-color: var(--secondary);
  background-color: var(--secondary-light);
}

/* Tabla Financiera y Flujo de Caja */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.finance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.finance-table th, .finance-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.finance-table th {
  background-color: var(--bg-subtle);
  font-weight: 700;
  color: var(--text-main);
}

.finance-table tr:hover {
  background-color: var(--primary-light);
}

.text-right {
  text-align: right !important;
}

.badge-fin-positive {
  background-color: #dcfce7;
  color: #15803d;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
}

/* Modales y Paneles Deslizantes */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--border-color);
}

/* Estilos de Impresión / Reporte Técnico PDF */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
  }
  
  .app-header, .nav-tabs-wrapper, .btn, .no-print {
    display: none !important;
  }
  
  .tab-panel {
    display: block !important;
    page-break-after: always;
  }
  
  .card {
    border: 1px solid #666666 !important;
    box-shadow: none !important;
    break-inside: avoid;
    margin-bottom: 1rem;
  }
  
  .print-only {
    display: block !important;
  }
  
  .farm-svg {
    height: 300px;
  }
}

.print-only {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .farm-svg {
    height: 280px;
  }
  .tab-btn {
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
  }
}

/* Sinergia con Ecosistema Comunidades Inteligentes */
.eco-badge {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: #ffffff;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
  transition: transform 0.15s ease;
}
.eco-badge:hover {
  transform: translateY(-1px);
}

.ecosystem-header-banner {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border-bottom: 2px solid #3b82f6;
  color: #94a3b8;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ecosystem-header-banner a {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.ecosystem-header-banner a:hover {
  color: #93c5fd;
  text-decoration: underline;
}

.eco-app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.eco-app-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  transition: all 0.2s ease;
  text-decoration: none;
  color: var(--text-main);
}
.eco-app-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.12);
  transform: translateY(-2px);
}

.eco-app-icon {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}

.eco-app-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.eco-app-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.eco-btn-action {
  font-size: 0.85rem;
  font-weight: 600;
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: auto;
}

.sync-card {
  border: 2px dashed #3b82f6;
  background: rgba(59, 130, 246, 0.04);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1rem;
}



/* === MIGRANJAPP + COMUNIDADES_BACKEND IA STYLES === */

/* Selector de Proyectos en Header */
.project-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.15);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.project-select-input {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 170px;
  cursor: pointer;
}

.btn-new-proj {
  background: #10b981;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  min-height: 32px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-new-proj:hover {
  background: #059669;
}

/* Botones y Badges con IA */
.btn-ia {
  background: linear-gradient(135deg, #10b981, #047857);
  color: #ffffff;
  border: none;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-ia:hover {
  background: linear-gradient(135deg, #059669, #065f46);
}

.badge-ia {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Chips / Sugerencias de Cultivos */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 1rem 0;
}

.chip-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.chip-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* Modales amplios para Paso a Paso y Proyectos */
.modal-content-lg {
  max-width: 800px;
}

/* Fases del Paso a Paso */
.step-phase-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1rem;
  transition: box-shadow 0.2s;
}

.step-phase-card:hover {
  box-shadow: var(--shadow-sm);
}

.step-phase-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.step-phase-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.step-phase-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.lunar-badge {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.duration-badge {
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
}

/* Bioinsumos */
.bioinputs-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0;
  font-size: 0.8rem;
}

.bioinput-tag {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-weight: 600;
}

/* Tareas interactivas del Paso a Paso */
.step-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.75rem 0;
}

.step-task-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem;
  background: var(--bg-subtle);
  border-radius: 6px;
  font-size: 0.88rem;
}

.step-task-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.step-task-row.done {
  opacity: 0.65;
  text-decoration: line-through;
  background: #e2e8f0;
}

.step-peasant-tip {
  background: #fefce8;
  border-left: 3px solid #eab308;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  color: #713f12;
  border-radius: 0 6px 6px 0;
  margin-top: 0.5rem;
}

/* Barra de Progreso del Proyecto */
.project-progress-bar {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 5px;
  overflow: hidden;
  margin: 0.5rem 0 1rem 0;
}

.project-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.3s ease;
}

/* Estilos de Botones de Cultivo */
.crop-card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

.crop-card-actions button {
  flex: 1;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  min-height: 36px;
}

/* Animación de carga IA */
.ia-loading-spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(16, 185, 129, 0.3);
  border-radius: 50%;
  border-top-color: #10b981;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Modo Sol Campesino overrides */
body.sun-mode .project-selector-wrapper {
  background: #fffffe;
  border: 2px solid #000000;
}
body.sun-mode .step-phase-card {
  border: 2px solid #000000 !important;
  background: #ffffff;
}
body.sun-mode .step-task-row {
  border: 1px solid #000000;
  background: #ffffff;
}


/* ===================================================
   MOBILE RESPONSIVE OVERRIDES (<= 768px & <= 480px)
   =================================================== */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
    }

    .app-header {
        padding: 12px 14px;
    }

    .header-top {
        flex-wrap: wrap;
        gap: 8px;
    }

    .logo-title {
        font-size: 18px;
    }

    .logo-subtitle {
        font-size: 11px;
    }

    .header-actions {
        gap: 6px;
        flex-wrap: wrap;
    }

    .header-btn {
        width: 36px;
        height: 36px;
    }

    .header-stats {
        gap: 6px;
        padding: 8px 6px;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .stat-pill {
        padding: 6px 4px;
    }

    .stat-num {
        font-size: 16px;
    }

    .stat-lbl {
        font-size: 9px;
    }

    .stat-divider {
        display: none;
    }

    .nav-tabs {
        padding: 8px 10px 0;
        gap: 2px;
    }

    .nav-tab {
        padding: 8px 10px;
        font-size: 12px;
    }

    .app-main {
        padding: 12px 12px 100px;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .section-title {
        font-size: 19px;
    }

    .search-filter-bar {
        flex-direction: column;
        gap: 8px;
    }

    .filter-select {
        width: 100%;
    }

    .animals-grid,
    .crops-grid,
    .records-grid,
    .reports-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    .finance-summary {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .form-row {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .modal-card {
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
    }

    .modal-form {
        padding: 16px;
    }

    .fab-btn {
        bottom: 20px;
        right: 16px;
        width: 52px;
        height: 52px;
    }

    #donar-banner-top {
        padding: 6px 10px !important;
        font-size: 11px !important;
        gap: 6px !important;
    }
}
