/* ============================================================
   RONAMI FIELD MANAGER — Estilos globales
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #1A56DB;
  --primary-dark: #1341B0;
  --primary-light: #EBF2FF;
  --sidebar-bg: #0F172A;
  --sidebar-width: 240px;
  --header-h: 60px;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-3: #F1F5F9;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --success: #16A34A;
  --warning: #D97706;
  --danger: #DC2626;
  --info: #0284C7;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.05);
  --transition: all 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface-2);
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ───────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
}

.sidebar-logo {
  padding: 0 16px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.sidebar-logo .logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  display: flex; flex-direction: column;
}
.sidebar-logo .logo-text strong {
  font-size: 13px; font-weight: 700; color: #fff; line-height: 1.2;
}
.sidebar-logo .logo-text span {
  font-size: 10px; color: #64748B; font-weight: 400; line-height: 1.2;
}

.sidebar-project-selector {
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.project-select-btn {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: #fff;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: var(--transition);
}
.project-select-btn:hover { background: rgba(255,255,255,.1); }
.project-select-btn .proj-name {
  flex: 1; text-align: left; font-weight: 500; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.project-select-btn .proj-badge {
  font-size: 9px; padding: 2px 6px; border-radius: 20px;
  background: #16A34A22; color: #4ADE80; font-weight: 600; flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.nav-section-label {
  padding: 12px 16px 4px;
  font-size: 10px; font-weight: 600;
  color: #475569; text-transform: uppercase; letter-spacing: .08em;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px;
  color: #94A3B8;
  cursor: pointer;
  border-radius: 0;
  transition: var(--transition);
  font-size: 13px; font-weight: 400;
  border-left: 3px solid transparent;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #CBD5E1; }
.nav-item.active {
  background: rgba(26,86,219,.15);
  color: #93C5FD;
  border-left-color: var(--primary);
  font-weight: 500;
}
.nav-item .nav-icon { font-size: 15px; width: 20px; text-align: center; }
.nav-item .nav-label { flex: 1; }
.nav-item .nav-badge {
  font-size: 10px; min-width: 18px; height: 18px; padding: 0 5px;
  background: #DC262620; color: #FCA5A5; border-radius: 20px;
  display: flex; align-items: center; justify-content: center; font-weight: 600;
}

.nav-sub-item {
  padding-left: 44px;
  font-size: 12px;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.user-card {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; border-radius: var(--radius);
  cursor: pointer; transition: var(--transition);
}
.user-card:hover { background: rgba(255,255,255,.05); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-info { flex: 1; overflow: hidden; }
.user-info strong { display: block; font-size: 12px; color: #E2E8F0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info span { font-size: 10px; color: #64748B; }

/* ── MAIN AREA ────────────────────────────────────────────── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── TOP HEADER ───────────────────────────────────────────── */
.top-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 12px;
  flex-shrink: 0;
  z-index: 50;
}

.header-title {
  font-size: 16px; font-weight: 600; color: var(--text-primary);
  flex: 1;
}

.search-global {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  width: 260px;
  transition: var(--transition);
}
.search-global:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.search-global input {
  border: none; background: transparent; outline: none;
  font-size: 13px; color: var(--text-primary); font-family: inherit;
  width: 100%;
}
.search-global .search-icon { color: var(--text-muted); font-size: 14px; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
  font-size: 16px; color: var(--text-secondary);
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn .notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; background: var(--danger);
  border-radius: 50%; border: 1.5px solid #fff;
}

/* ── PAGE CONTENT ─────────────────────────────────────────── */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.page { display: none; }
.page.active { display: block; }

/* ── CARDS / SURFACES ─────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
}
.card-body { padding: 20px; }

/* ── KPI CARDS ────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.kpi-card .kpi-label {
  font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em;
}
.kpi-card .kpi-value {
  font-size: 26px; font-weight: 700; color: var(--text-primary); line-height: 1.1;
}
.kpi-card .kpi-sub {
  font-size: 11px; color: var(--text-secondary);
}
.kpi-card .kpi-trend {
  font-size: 11px; font-weight: 600;
}
.kpi-card .kpi-trend.up { color: var(--success); }
.kpi-card .kpi-trend.down { color: var(--danger); }
.kpi-card.highlight {
  background: var(--primary);
  border-color: var(--primary-dark);
}
.kpi-card.highlight .kpi-label,
.kpi-card.highlight .kpi-sub { color: rgba(255,255,255,.7); }
.kpi-card.highlight .kpi-value { color: #fff; }

/* ── STATUS BADGE ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}

/* ── SCORING BAR ──────────────────────────────────────────── */
.scoring-bar {
  display: flex; align-items: center; gap: 8px;
}
.scoring-bar .bar-track {
  flex: 1; height: 6px; background: var(--surface-3);
  border-radius: 3px; overflow: hidden;
}
.scoring-bar .bar-fill { height: 100%; border-radius: 3px; }
.scoring-num {
  font-size: 11px; font-weight: 700; min-width: 28px; text-align: right;
}

/* ── TABLES ───────────────────────────────────────────────── */
.data-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%; border-collapse: collapse;
  background: var(--surface);
  font-size: 13px;
}
.data-table thead tr {
  border-bottom: 1px solid var(--border);
}
.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em;
  background: var(--surface-2); white-space: nowrap;
  cursor: pointer; user-select: none;
}
.data-table th:hover { background: var(--surface-3); }
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-primary);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: var(--transition); cursor: pointer; }
.data-table tbody tr:hover { background: var(--primary-light); }
.data-table .mono { font-family: monospace; font-size: 12px; color: var(--text-secondary); }

/* ── FILTERS BAR ──────────────────────────────────────────── */
.filters-bar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 13px; font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  outline: none; transition: var(--transition);
}
.filter-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.filter-select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 13px; font-family: inherit;
  color: var(--text-primary); background: var(--surface);
  outline: none; cursor: pointer; transition: var(--transition);
}
.filter-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: var(--transition);
  border: none; outline: none; white-space: nowrap;
}
.btn-primary {
  background: var(--primary); color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: var(--surface); color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: #FEE2E2; color: var(--danger); }
.btn-danger:hover { background: #FECACA; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost {
  background: transparent; color: var(--text-secondary);
  padding: 4px 8px;
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text-primary); }

/* ── TABS ─────────────────────────────────────────────────── */
.tab-bar {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab-item {
  padding: 10px 18px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer; transition: var(--transition);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px; white-space: nowrap;
  user-select: none;
}
.tab-item:hover { color: var(--text-primary); }
.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── SECTION HEADER ───────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-header h2 {
  font-size: 18px; font-weight: 700; color: var(--text-primary);
}
.section-header .actions { display: flex; gap: 8px; }

/* ── FINCA HEADER ─────────────────────────────────────────── */
.finca-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  display: flex; align-items: flex-start; gap: 20px;
}
.finca-hero-main { flex: 1; }
.finca-hero-main .finca-ref {
  font-family: monospace; font-size: 12px; color: var(--text-muted);
  margin-bottom: 4px;
}
.finca-hero-main h1 {
  font-size: 20px; font-weight: 700; margin-bottom: 8px;
}
.finca-hero-meta {
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
}
.finca-hero-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.scoring-gauge {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
}
.scoring-gauge .gauge-num {
  font-size: 28px; font-weight: 800;
}
.scoring-gauge .gauge-label {
  font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em;
}

/* ── TIMELINE ─────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: '';
  position: absolute; left: 7px; top: 8px; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item {
  position: relative;
  padding: 0 0 20px;
}
.timeline-item::before {
  content: '';
  position: absolute; left: -20px; top: 6px;
  width: 10px; height: 10px;
  border-radius: 50%; background: var(--border-strong);
  border: 2px solid var(--surface);
}
.timeline-item.green::before { background: #4CAF50; }
.timeline-item.orange::before { background: #FF9800; }
.timeline-item.red::before { background: #F44336; }
.timeline-item.blue::before { background: #2196F3; }

.timeline-date {
  font-size: 11px; color: var(--text-muted); margin-bottom: 4px;
}
.timeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.timeline-card .tc-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.timeline-card .tc-body {
  font-size: 12px; color: var(--text-secondary); line-height: 1.5;
}
.timeline-card .tc-meta {
  display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap;
}
.timeline-card .tc-meta-item {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--text-muted);
}

/* ── PROP CARD ────────────────────────────────────────────── */
.prop-card {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  cursor: pointer;
}
.prop-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.prop-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.prop-info { flex: 1; }
.prop-info strong { display: block; font-size: 13px; font-weight: 600; }
.prop-info .prop-meta {
  display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap;
}

/* ── GRID LAYOUTS ─────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

/* ── DL DEFINITION LIST ───────────────────────────────────── */
.dl-grid {
  display: grid; grid-template-columns: 140px 1fr;
  gap: 6px 12px; align-items: start;
}
.dl-grid dt {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em; padding-top: 1px;
}
.dl-grid dd {
  font-size: 13px; color: var(--text-primary);
}

/* ── AFECCIONES TABLE ─────────────────────────────────────── */
.afec-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.afec-table th {
  background: var(--surface-2); padding: 8px 12px;
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
.afec-table td {
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.afec-table tr:last-child td { border-bottom: none; font-weight: 600; }

/* ── VALORACION ───────────────────────────────────────────── */
.val-row {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.val-row:last-child { border-bottom: none; }
.val-concepto { flex: 1; font-size: 13px; }
.val-num { font-size: 13px; text-align: right; color: var(--text-secondary); min-width: 80px; }
.val-importe { font-size: 13px; font-weight: 600; text-align: right; min-width: 90px; }
.val-total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0 0;
  font-size: 15px; font-weight: 700;
}
.val-acordado {
  display: flex; justify-content: space-between;
  padding: 8px 12px; margin-top: 12px;
  background: #E8F5E9; border-radius: var(--radius);
  font-size: 13px;
}

/* ── WIZARD ───────────────────────────────────────────────── */
.wizard-steps {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 28px; overflow-x: auto;
}
.wizard-step {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  font-size: 12px; font-weight: 500;
  color: var(--text-muted); white-space: nowrap;
}
.wizard-step .step-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.wizard-step.done .step-num { background: var(--primary); color: #fff; }
.wizard-step.active .step-num { background: var(--primary); color: #fff; box-shadow: 0 0 0 3px var(--primary-light); }
.wizard-step.active { color: var(--primary); font-weight: 600; }
.wizard-step.done { color: var(--text-secondary); }
.wizard-connector {
  flex: 1; height: 1px; background: var(--border); min-width: 20px;
}

/* ── PRESUPUESTO ──────────────────────────────────────────── */
.budget-tramo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  overflow: hidden;
}
.budget-tramo-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--surface-2);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.budget-tramo-header:hover { background: var(--surface-3); }
.budget-tramo-header h4 { flex: 1; font-size: 14px; font-weight: 600; }
.budget-tramo-fincas {
  font-size: 12px; color: var(--text-secondary); padding: 0 18px;
}

/* ── CAMPO / MOBILE ───────────────────────────────────────── */
.campo-view {
  max-width: 480px; margin: 0 auto;
}
.campo-header {
  background: var(--primary);
  color: #fff; padding: 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.campo-header h2 { font-size: 16px; font-weight: 700; }
.campo-header p { font-size: 12px; opacity: .8; margin-top: 2px; }

.campo-finca-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  display: flex; align-items: flex-start; gap: 12px;
  cursor: pointer; transition: var(--transition);
}
.campo-finca-card:hover { border-color: var(--primary); }
.campo-finca-card .cfc-main { flex: 1; }
.campo-finca-card .cfc-ref { font-size: 11px; color: var(--text-muted); }
.campo-finca-card .cfc-name { font-size: 13px; font-weight: 600; }
.campo-finca-card .cfc-loc { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.sync-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 20px;
}
.sync-badge.online { background: #E8F5E9; color: #2E7D32; }
.sync-badge.offline { background: #FFF3E0; color: #E65100; }
.sync-badge.pending { background: #FEF3C7; color: #92400E; }

.campo-form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.campo-form-section h4 {
  font-size: 13px; font-weight: 600; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}

/* ── OFFLINE INDICATOR ────────────────────────────────────── */
.offline-bar {
  display: flex; align-items: center; gap: 8px;
  background: #FFF3E0; border: 1px solid #FED7AA;
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12px; font-weight: 500; color: #92400E;
  margin-bottom: 12px;
}

/* ── DROPZONE ─────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  cursor: pointer; transition: var(--transition);
}
.dropzone:hover, .dropzone.over {
  border-color: var(--primary); background: var(--primary-light);
}
.dropzone .dz-icon { font-size: 36px; margin-bottom: 8px; }
.dropzone h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.dropzone p { font-size: 12px; color: var(--text-muted); }

/* ── MAP PLACEHOLDER ──────────────────────────────────────── */
.map-placeholder {
  background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px;
  position: relative; overflow: hidden;
}
.map-placeholder::before {
  content: '';
  position: absolute; inset: 0;
  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='%232196F3' fill-opacity='0.06'%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");
}
.map-placeholder .map-label {
  font-size: 13px; font-weight: 600; color: #1565C0; position: relative;
}
.map-placeholder .map-sub {
  font-size: 11px; color: #42A5F5; position: relative;
}

/* ── MAP LEGEND ───────────────────────────────────────────── */
.map-legend {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.map-legend-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-secondary);
}
.map-legend-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}

/* ── CHART CONTAINERS ─────────────────────────────────────── */
.chart-container {
  position: relative;
}

/* ── ALERT BOX ────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 12px; line-height: 1.5;
  margin-bottom: 12px;
}
.alert-warning { background: #FFF3E0; border: 1px solid #FED7AA; color: #92400E; }
.alert-danger { background: #FFEBEE; border: 1px solid #FECACA; color: #C62828; }
.alert-info { background: #E3F2FD; border: 1px solid #BFDBFE; color: #1565C0; }
.alert-success { background: #E8F5E9; border: 1px solid #BBF7D0; color: #166534; }

/* ── IA PANEL ─────────────────────────────────────────────── */
.ia-panel {
  background: linear-gradient(135deg, #1A56DB08, #7C3AED08);
  border: 1px solid #E9D5FF;
  border-radius: var(--radius-lg);
  padding: 14px;
}
.ia-panel .ia-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; color: #7C3AED;
  margin-bottom: 10px;
}
.ia-sugerencia {
  font-size: 12px; color: var(--text-secondary); line-height: 1.6;
}
.ia-acciones { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.ia-accion-btn {
  font-size: 11px; padding: 4px 10px;
  background: #7C3AED; color: #fff; border-radius: 20px;
  border: none; cursor: pointer; font-family: inherit; font-weight: 500;
  transition: var(--transition);
}
.ia-accion-btn:hover { background: #6D28D9; }
.ia-accion-btn.outline {
  background: transparent; border: 1px solid #7C3AED; color: #7C3AED;
}
.ia-accion-btn.outline:hover { background: #F3E8FF; }

/* ── MISC ─────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.text-muted { color: var(--text-muted); font-size: 12px; }
.text-mono { font-family: monospace; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.gap-8 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }

.empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state .es-icon { font-size: 40px; margin-bottom: 10px; }
.empty-state p { font-size: 13px; }

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── TOOLTIP ──────────────────────────────────────────────── */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: var(--sidebar-bg); color: #fff;
  font-size: 11px; padding: 4px 8px; border-radius: 4px;
  white-space: nowrap; z-index: 999; pointer-events: none;
}

/* ── MODAL ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
  z-index: 1000;
  display: none; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 90%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .18s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 15px; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ── FORM FIELDS ──────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 5px;
}
.form-control {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px; font-family: inherit;
  color: var(--text-primary); background: var(--surface);
  outline: none; transition: var(--transition);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── CHECKBOX / TAG GRID ──────────────────────────────────── */
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.check-tag input[type=checkbox] { display: none; }
.check-tag label {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12px; cursor: pointer; transition: var(--transition);
}
.check-tag input:checked + label {
  background: var(--primary-light); border-color: var(--primary);
  color: var(--primary); font-weight: 600;
}

/* ── PROGRESS BAR ─────────────────────────────────────────── */
.progress-bar {
  height: 8px; background: var(--surface-3);
  border-radius: 4px; overflow: hidden;
}
.progress-bar .pb-fill {
  height: 100%; border-radius: 4px;
  background: var(--primary);
  transition: width .4s ease;
}

/* ── TOGGLE SWITCH ────────────────────────────────────────── */
.toggle-switch {
  position: relative; display: inline-block;
  width: 38px; height: 22px; cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #CBD5E1; border-radius: 22px;
  transition: .25s;
}
.toggle-slider::before {
  content: '';
  position: absolute; width: 16px; height: 16px;
  left: 3px; bottom: 3px;
  background: white; border-radius: 50%;
  transition: .25s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: #16A34A; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── USUARIOS — avatar coloreado ─────────────────────────── */
.usr-avatar-ring {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}

/* ── MODAL MAPA — asegurar z-index Leaflet ────────────────── */
#modal-mapa-satelite .modal {
  padding: 0;
  overflow: hidden;
}
#modal-mapa-satelite .modal-header {
  background: var(--sidebar-bg);
  border-bottom-color: rgba(255,255,255,.08);
}
#modal-mapa-satelite .modal-header h3 { color: #E2E8F0; }
.leaflet-pane { z-index: 400 !important; }
.leaflet-top, .leaflet-bottom { z-index: 500 !important; }

/* ── PLANTILLAS — sticky sidebar scroll ───────────────────── */
#page-plantillas .card[style*="sticky"] {
  top: 0;
}

/* ── RESPONSIVE (tablet) ──────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 56px; }
  .sidebar .logo-text, .sidebar .nav-label, .sidebar .nav-badge,
  .sidebar .nav-section-label, .sidebar .project-select-btn .proj-name,
  .sidebar .project-select-btn .proj-badge, .sidebar .user-info { display: none; }
  .sidebar .project-select-btn { justify-content: center; padding: 8px; }
  .sidebar .nav-item { justify-content: center; padding: 10px; }
  .sidebar .nav-item .nav-icon { width: auto; }
  .sidebar .user-card { justify-content: center; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
