/* ============================================================
   AGROCAMPO — Hoja de estilos principal
   Paleta: verde tierra, ocre, marrón oscuro, crema
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@300;400;500;600;700;800&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

/* ─── Variables ─────────────────────────────────────────────── */
:root {
  --verde-oscuro:   #1a3d2b;
  --verde-medio:    #2d6a4f;
  --verde-claro:    #40916c;
  --verde-suave:    #74c69d;
  --verde-palo:     #b7e4c7;
  --verde-fondo:    #d8f3dc;
  --ocre:           #c9a94a;
  --ocre-claro:     #e8c97a;
  --tierra:         #6b4226;
  --crema:          #f5f0e8;
  --crema-oscura:   #ede4d0;
  --blanco:         #ffffff;
  --gris-texto:     #4a4a4a;
  --gris-suave:     #9e9e9e;
  --rojo-alerta:    #c0392b;
  --naranja:        #e67e22;
  --azul-agua:      #2980b9;

  --sombra-sm:  0 2px 8px rgba(26,61,43,0.10);
  --sombra-md:  0 4px 20px rgba(26,61,43,0.15);
  --sombra-lg:  0 8px 40px rgba(26,61,43,0.20);

  --radio-sm:  8px;
  --radio-md:  14px;
  --radio-lg:  22px;
  --radio-xl:  32px;

  --transition: 0.22s cubic-bezier(.4,0,.2,1);
  --nav-h: 64px;
  --sidebar-w: 260px;
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Raleway', sans-serif;
  background: var(--crema);
  color: var(--gris-texto);
  min-height: 100vh;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ─── Scrollbar personalizada ────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--crema-oscura); }
::-webkit-scrollbar-thumb { background: var(--verde-suave); border-radius: 3px; }

/* ─── PANTALLA DE CARGA ──────────────────────────────────────── */
#loading-screen {
  position: fixed; inset: 0;
  background: var(--verde-oscuro);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s ease;
}
#loading-screen.hide { opacity: 0; pointer-events: none; }
.loading-logo {
  font-family: 'Lora', serif;
  font-size: 2.4rem;
  color: var(--crema);
  letter-spacing: 2px;
  margin-bottom: 12px;
}
.loading-logo span { color: var(--ocre); }
.loading-bar {
  width: 180px; height: 3px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 24px;
}
.loading-bar-fill {
  height: 100%;
  background: var(--ocre);
  border-radius: 2px;
  animation: loading-anim 1.6s ease-in-out infinite;
}
@keyframes loading-anim {
  0%   { width: 0%; margin-left: 0; }
  50%  { width: 70%; margin-left: 15%; }
  100% { width: 0%; margin-left: 100%; }
}

/* ─── AUTH SCREEN ────────────────────────────────────────────── */
#auth-screen {
  display: none;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--verde-oscuro) 0%, var(--verde-medio) 60%, var(--verde-claro) 100%);
  position: relative;
  overflow: hidden;
}
#auth-screen::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(201,169,74,0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(116,198,157,0.10) 0%, transparent 50%);
}
.auth-pattern {
  position: absolute; top: 0; right: 0;
  width: 50%; height: 100%;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
  opacity: 0.4;
}
.auth-container {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.auth-card {
  background: rgba(255,255,255,0.97);
  border-radius: var(--radio-xl);
  padding: 48px 44px;
  width: 100%; max-width: 440px;
  box-shadow: var(--sombra-lg);
}
.auth-logo {
  text-align: center; margin-bottom: 36px;
}
.auth-logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--verde-medio), var(--verde-claro));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 4px 16px rgba(45,106,79,0.3);
}
.auth-logo-icon svg { width: 36px; height: 36px; fill: white; }
.auth-title {
  font-family: 'Lora', serif;
  font-size: 1.8rem; color: var(--verde-oscuro);
}
.auth-title span { color: var(--ocre); }
.auth-subtitle { color: var(--gris-suave); font-size: 0.9rem; margin-top: 4px; }

.auth-tabs {
  display: flex; gap: 4px;
  background: var(--crema-oscura);
  border-radius: var(--radio-md);
  padding: 4px; margin-bottom: 28px;
}
.auth-tab {
  flex: 1; padding: 10px; border-radius: var(--radio-sm);
  font-weight: 600; font-size: 0.9rem;
  color: var(--gris-suave);
  transition: var(--transition);
}
.auth-tab.active {
  background: var(--blanco);
  color: var(--verde-oscuro);
  box-shadow: var(--sombra-sm);
}

/* ─── FORMULARIOS ────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 0.82rem; font-weight: 600;
  color: var(--verde-oscuro); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.form-control {
  width: 100%; padding: 12px 16px;
  border: 2px solid var(--crema-oscura);
  border-radius: var(--radio-md);
  font-size: 0.95rem; color: var(--gris-texto);
  background: var(--blanco);
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--verde-claro);
  box-shadow: 0 0 0 3px rgba(64,145,108,0.12);
}
.form-control.error { border-color: var(--rojo-alerta); }
.form-select {
  width: 100%; padding: 12px 16px;
  border: 2px solid var(--crema-oscura);
  border-radius: var(--radio-md);
  font-size: 0.95rem; color: var(--gris-texto);
  background: var(--blanco);
  cursor: pointer; outline: none;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%232d6a4f' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.form-select:focus { border-color: var(--verde-claro); box-shadow: 0 0 0 3px rgba(64,145,108,0.12); }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ─── BOTONES ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 12px 24px;
  border-radius: var(--radio-md);
  font-size: 0.9rem; font-weight: 700;
  transition: var(--transition);
  letter-spacing: 0.3px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--verde-medio), var(--verde-claro));
  color: white;
  box-shadow: 0 4px 14px rgba(45,106,79,0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45,106,79,0.45);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--crema-oscura);
  color: var(--verde-oscuro);
}
.btn-secondary:hover { background: var(--verde-palo); }
.btn-danger {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  color: white;
  box-shadow: 0 4px 14px rgba(192,57,43,0.3);
}
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(192,57,43,0.4); }
.btn-ocre {
  background: linear-gradient(135deg, var(--ocre), var(--ocre-claro));
  color: var(--verde-oscuro);
  box-shadow: 0 4px 14px rgba(201,169,74,0.35);
}
.btn-ocre:hover { transform: translateY(-2px); }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; }
.btn-lg { padding: 16px 32px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 10px; border-radius: var(--radio-sm); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none !important; }

/* ─── APP LAYOUT ─────────────────────────────────────────────── */
#app { display: none; min-height: 100vh; }

/* Sidebar */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--verde-oscuro);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}
.sidebar-header {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo {
  font-family: 'Lora', serif;
  font-size: 1.4rem;
  color: var(--crema);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--verde-claro), var(--ocre));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-icon svg { width: 20px; height: 20px; fill: white; }
.sidebar-logo-text span { color: var(--ocre); }

.sidebar-user {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user-name {
  font-weight: 700; color: var(--crema); font-size: 0.95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-rol {
  font-size: 0.75rem; color: var(--verde-suave);
  text-transform: uppercase; letter-spacing: 0.8px; margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 16px 12px; }
.nav-section-label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1.2px;
  color: rgba(255,255,255,0.35); padding: 12px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radio-md);
  color: rgba(255,255,255,0.65);
  font-size: 0.9rem; font-weight: 500;
  transition: var(--transition);
  cursor: pointer; margin-bottom: 2px;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.07); color: white; }
.nav-item.active {
  background: linear-gradient(135deg, var(--verde-claro), rgba(64,145,108,0.5));
  color: white;
  box-shadow: 0 2px 10px rgba(64,145,108,0.3);
}
.nav-badge {
  margin-left: auto;
  background: var(--rojo-alerta);
  color: white; font-size: 0.68rem; font-weight: 700;
  padding: 1px 7px; border-radius: 10px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* Main content */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.topbar {
  height: var(--nav-h);
  background: var(--blanco);
  border-bottom: 1px solid var(--crema-oscura);
  display: flex; align-items: center;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
  gap: 16px;
}
.topbar-menu-btn {
  display: none;
  width: 40px; height: 40px;
  border-radius: var(--radio-sm);
  align-items: center; justify-content: center;
  color: var(--verde-oscuro);
  transition: var(--transition);
}
.topbar-menu-btn:hover { background: var(--crema-oscura); }
.topbar-menu-btn svg { width: 22px; height: 22px; }
.topbar-title {
  font-family: 'Lora', serif;
  font-size: 1.2rem; color: var(--verde-oscuro);
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--verde-oscuro);
  transition: var(--transition); position: relative;
}
.topbar-btn:hover { background: var(--crema-oscura); }
.topbar-btn svg { width: 20px; height: 20px; }
.notif-dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--rojo-alerta);
  border: 2px solid white;
}

.page-content {
  flex: 1; padding: 28px;
  overflow-y: auto;
}

/* Overlay para móvil */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 99;
}

/* ─── SECCIONES / PÁGINAS ────────────────────────────────────── */
.page-section { display: none; }
.page-section.active { display: block; }

/* ─── DASHBOARD ──────────────────────────────────────────────── */
.dashboard-header {
  margin-bottom: 28px;
}
.dashboard-greeting {
  font-family: 'Lora', serif;
  font-size: 1.7rem; color: var(--verde-oscuro);
}
.dashboard-date { color: var(--gris-suave); font-size: 0.9rem; margin-top: 4px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  padding: 22px 24px;
  box-shadow: var(--sombra-sm);
  display: flex; align-items: flex-start; gap: 16px;
  transition: var(--transition);
  cursor: pointer;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--sombra-md); }
.stat-icon {
  width: 52px; height: 52px; border-radius: var(--radio-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 26px; height: 26px; }
.stat-icon.verde { background: var(--verde-fondo); }
.stat-icon.verde svg { fill: var(--verde-claro); }
.stat-icon.ocre { background: rgba(201,169,74,0.15); }
.stat-icon.ocre svg { fill: var(--ocre); }
.stat-icon.rojo { background: rgba(192,57,43,0.1); }
.stat-icon.rojo svg { fill: var(--rojo-alerta); }
.stat-icon.azul { background: rgba(41,128,185,0.1); }
.stat-icon.azul svg { fill: var(--azul-agua); }
.stat-number { font-size: 2rem; font-weight: 800; color: var(--verde-oscuro); line-height: 1; }
.stat-label { font-size: 0.82rem; color: var(--gris-suave); margin-top: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.dash-card {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  padding: 22px;
  box-shadow: var(--sombra-sm);
}
.dash-card-title {
  font-size: 0.9rem; font-weight: 700;
  color: var(--verde-oscuro); margin-bottom: 16px;
  text-transform: uppercase; letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 8px;
}
.dash-card-title svg { width: 16px; height: 16px; fill: var(--verde-claro); }

/* ─── LISTA ITEMS ────────────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; gap: 10px; }
.activity-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--crema-oscura);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.activity-dot.verde { background: var(--verde-claro); }
.activity-dot.ocre { background: var(--ocre); }
.activity-dot.rojo { background: var(--rojo-alerta); }
.activity-dot.azul { background: var(--azul-agua); }
.activity-text { font-size: 0.88rem; flex: 1; color: var(--gris-texto); }
.activity-time { font-size: 0.75rem; color: var(--gris-suave); white-space: nowrap; }

/* ─── PARCELAS ───────────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; flex-wrap: wrap; gap: 12px;
}
.section-title {
  font-family: 'Lora', serif;
  font-size: 1.5rem; color: var(--verde-oscuro);
}
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--blanco);
  border: 2px solid var(--crema-oscura);
  border-radius: var(--radio-md);
  padding: 8px 14px;
  transition: var(--transition);
}
.search-bar:focus-within { border-color: var(--verde-claro); }
.search-bar svg { width: 16px; height: 16px; fill: var(--gris-suave); flex-shrink: 0; }
.search-bar input {
  border: none; background: none; outline: none;
  font-size: 0.9rem; color: var(--gris-texto);
  width: 200px;
}

.parcelas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.parcela-card {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  overflow: hidden;
  box-shadow: var(--sombra-sm);
  transition: var(--transition);
  cursor: pointer;
}
.parcela-card:hover { transform: translateY(-4px); box-shadow: var(--sombra-md); }
.parcela-card-header {
  height: 10px;
}
.parcela-card-body { padding: 20px; }
.parcela-name {
  font-weight: 700; font-size: 1.1rem;
  color: var(--verde-oscuro); margin-bottom: 6px;
}
.parcela-cultivo {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--verde-fondo);
  color: var(--verde-claro);
  font-size: 0.78rem; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  margin-bottom: 12px;
}
.parcela-info { display: flex; flex-direction: column; gap: 6px; }
.parcela-info-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; color: var(--gris-suave);
}
.parcela-info-item svg { width: 14px; height: 14px; fill: var(--verde-suave); flex-shrink: 0; }
.parcela-card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--crema-oscura);
  display: flex; justify-content: space-between; align-items: center;
}
.parcela-actions { display: flex; gap: 6px; }

/* ─── MAPA ───────────────────────────────────────────────────── */
#map-container {
  height: calc(100vh - var(--nav-h) - 56px);
  border-radius: var(--radio-lg);
  overflow: hidden;
  position: relative;
  box-shadow: var(--sombra-md);
}
#map { width: 100%; height: 100%; }
.map-controls {
  position: absolute; top: 16px; right: 16px; z-index: 400;
  display: flex; flex-direction: column; gap: 8px;
}
.map-btn {
  width: 42px; height: 42px;
  background: white;
  border-radius: var(--radio-sm);
  box-shadow: var(--sombra-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
  color: var(--verde-oscuro);
}
.map-btn:hover { background: var(--crema); transform: scale(1.05); }
.map-btn svg { width: 18px; height: 18px; }
.map-btn.active { background: var(--verde-medio); color: white; }
.map-mode-bar {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 400;
  background: white;
  border-radius: var(--radio-xl);
  padding: 6px;
  display: flex; gap: 4px;
  box-shadow: var(--sombra-md);
}
.map-mode-btn {
  padding: 8px 18px; border-radius: var(--radio-xl);
  font-size: 0.82rem; font-weight: 600;
  transition: var(--transition); color: var(--gris-suave);
}
.map-mode-btn.active {
  background: var(--verde-medio); color: white;
}

/* ─── MODAL ──────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--blanco);
  border-radius: var(--radio-xl);
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--sombra-lg);
  animation: modal-in 0.28s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 24px 28px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title {
  font-family: 'Lora', serif;
  font-size: 1.3rem; color: var(--verde-oscuro);
}
.modal-close {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gris-suave); transition: var(--transition);
}
.modal-close:hover { background: var(--crema-oscura); color: var(--gris-texto); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: 20px 28px; }
.modal-footer {
  padding: 0 28px 24px;
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ─── INCIDENCIAS ────────────────────────────────────────────── */
.incidencias-list { display: flex; flex-direction: column; gap: 14px; }
.incidencia-card {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  padding: 18px 20px;
  box-shadow: var(--sombra-sm);
  display: flex; gap: 14px; align-items: flex-start;
  transition: var(--transition);
}
.incidencia-card:hover { box-shadow: var(--sombra-md); }
.incidencia-estado {
  padding: 4px 12px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  white-space: nowrap;
}
.estado-pendiente { background: rgba(230,126,34,0.15); color: var(--naranja); }
.estado-en_proceso { background: rgba(41,128,185,0.15); color: var(--azul-agua); }
.estado-resuelta { background: var(--verde-fondo); color: var(--verde-claro); }
.incidencia-prioridad-dot {
  width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex-shrink: 0;
}
.prioridad-baja { background: var(--verde-suave); }
.prioridad-media { background: var(--ocre); }
.prioridad-alta { background: var(--naranja); }
.prioridad-urgente { background: var(--rojo-alerta); animation: pulse-dot 1s infinite; }
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.7; }
}
.incidencia-title { font-weight: 700; color: var(--verde-oscuro); margin-bottom: 4px; }
.incidencia-meta { font-size: 0.82rem; color: var(--gris-suave); display: flex; gap: 10px; flex-wrap: wrap; }

/* ─── HISTORIAL ──────────────────────────────────────────────── */
.historial-list { display: flex; flex-direction: column; }
.historial-item {
  display: flex; gap: 14px; padding: 16px 0;
  border-bottom: 1px solid var(--crema-oscura);
  position: relative;
}
.historial-item:last-child { border-bottom: none; }
.historial-timeline-dot {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}
.historial-timeline-dot svg { width: 16px; height: 16px; }
.tipo-poda { background: rgba(116,198,157,0.2); }
.tipo-poda svg { fill: var(--verde-claro); }
.tipo-tratamiento { background: rgba(41,128,185,0.15); }
.tipo-tratamiento svg { fill: var(--azul-agua); }
.tipo-riego { background: rgba(41,128,185,0.1); }
.tipo-riego svg { fill: #3498db; }
.tipo-cosecha { background: rgba(201,169,74,0.15); }
.tipo-cosecha svg { fill: var(--ocre); }
.tipo-abonado { background: rgba(107,66,38,0.12); }
.tipo-abonado svg { fill: var(--tierra); }
.tipo-siembra { background: var(--verde-fondo); }
.tipo-siembra svg { fill: var(--verde-medio); }
.tipo-otro { background: var(--crema-oscura); }
.tipo-otro svg { fill: var(--gris-suave); }
.historial-content { flex: 1; }
.historial-tipo { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--gris-suave); }
.historial-desc { font-weight: 600; color: var(--verde-oscuro); margin: 3px 0; }
.historial-meta { font-size: 0.82rem; color: var(--gris-suave); }

/* ─── GALERÍA ────────────────────────────────────────────────── */
.galeria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.galeria-item {
  aspect-ratio: 1;
  border-radius: var(--radio-md);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  box-shadow: var(--sombra-sm);
  transition: var(--transition);
}
.galeria-item:hover { transform: scale(1.03); box-shadow: var(--sombra-md); }
.galeria-item img { width: 100%; height: 100%; object-fit: cover; }
.galeria-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(26,61,43,0.7) 0%, transparent 60%);
  opacity: 0; transition: var(--transition);
  display: flex; align-items: flex-end; padding: 10px;
}
.galeria-item:hover .galeria-overlay { opacity: 1; }
.galeria-overlay-text { color: white; font-size: 0.78rem; font-weight: 600; }

/* ─── TAREAS ─────────────────────────────────────────────────── */
.tareas-list { display: flex; flex-direction: column; gap: 10px; }
.tarea-item {
  background: var(--blanco);
  border-radius: var(--radio-md);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--sombra-sm);
  transition: var(--transition);
}
.tarea-item:hover { box-shadow: var(--sombra-md); }
.tarea-check {
  width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid var(--verde-suave);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer; transition: var(--transition);
}
.tarea-check.done { background: var(--verde-claro); border-color: var(--verde-claro); }
.tarea-check.done::after {
  content: '✓'; color: white; font-size: 0.8rem; font-weight: 700;
}
.tarea-text { flex: 1; }
.tarea-titulo { font-weight: 600; color: var(--verde-oscuro); }
.tarea-titulo.done { text-decoration: line-through; color: var(--gris-suave); }
.tarea-fecha { font-size: 0.78rem; color: var(--gris-suave); margin-top: 2px; }
.tarea-tipo-badge {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  padding: 3px 8px; border-radius: 12px;
  background: var(--verde-fondo); color: var(--verde-claro);
}

/* ─── TOAST / NOTIFICACIONES ─────────────────────────────────── */
#toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--verde-oscuro); color: white;
  padding: 12px 20px; border-radius: var(--radio-md);
  font-size: 0.88rem; font-weight: 500;
  box-shadow: var(--sombra-md);
  animation: toast-in 0.3s ease;
  display: flex; align-items: center; gap: 10px;
  pointer-events: all; max-width: 320px;
}
.toast.error { background: var(--rojo-alerta); }
.toast.warning { background: var(--naranja); }
.toast.success { background: var(--verde-claro); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
}
.empty-state-icon {
  font-size: 3rem; margin-bottom: 16px;
}
.empty-state-title {
  font-family: 'Lora', serif;
  font-size: 1.3rem; color: var(--verde-oscuro);
  margin-bottom: 8px;
}
.empty-state-text { color: var(--gris-suave); margin-bottom: 24px; }

/* ─── CHIPS / TAGS ───────────────────────────────────────────── */
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  padding: 6px 16px; border-radius: 20px;
  font-size: 0.82rem; font-weight: 600;
  background: var(--crema-oscura); color: var(--gris-texto);
  cursor: pointer; transition: var(--transition);
}
.chip.active { background: var(--verde-medio); color: white; }
.chip:hover { background: var(--verde-palo); }

/* ─── RESPONSIVE MÓVIL ───────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }
  .main-wrapper { margin-left: 0; }
  .topbar-menu-btn { display: flex; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .parcelas-grid { grid-template-columns: 1fr; }
  .galeria-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-card { padding: 32px 24px; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .search-bar input { width: 140px; }
}

/* ─── UTILIDADES ─────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.text-sm { font-size: 0.85rem; }
.text-muted { color: var(--gris-suave); }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Leaflet popup customización */
.leaflet-popup-content-wrapper {
  border-radius: var(--radio-md) !important;
  box-shadow: var(--sombra-md) !important;
}
.leaflet-popup-content { font-family: 'Raleway', sans-serif !important; }
.popup-title { font-weight: 700; color: var(--verde-oscuro); font-size: 0.95rem; margin-bottom: 4px; }
.popup-sub { font-size: 0.82rem; color: var(--gris-suave); }
.popup-actions { display: flex; gap: 6px; margin-top: 10px; }
.popup-btn {
  flex: 1; padding: 6px; border-radius: var(--radio-sm);
  font-size: 0.78rem; font-weight: 600; text-align: center;
  background: var(--verde-fondo); color: var(--verde-claro); cursor: pointer;
  transition: var(--transition);
}
.popup-btn:hover { background: var(--verde-palo); }

/* Rol color badges */
.rol-badge {
  padding: 2px 10px; border-radius: 12px;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase;
}
.rol-administrador { background: rgba(201,169,74,0.2); color: var(--ocre); }
.rol-tecnico { background: rgba(41,128,185,0.15); color: var(--azul-agua); }
.rol-agricultor { background: var(--verde-fondo); color: var(--verde-claro); }
