:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #101827;
  --muted: #647084;
  --line: #e2e8f0;
  --soft: #eef4ff;
  --dark: #0f172a;
  --blue: #2563eb;
  --green: #16a34a;
  --amber: #f59e0b;
  --red: #dc2626;
  --purple: #7c3aed;
  --shadow: 0 24px 70px rgba(15, 23, 42, .11);
  --radius: 26px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, .13), transparent 34rem),
    radial-gradient(circle at top right, rgba(22, 163, 74, .10), transparent 36rem),
    var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(760px, 100%);
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 34px;
  padding: 42px;
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
}

.brand-mark {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--red), #fb7185);
  color: white;
  font-weight: 950;
  letter-spacing: -1px;
  box-shadow: 0 18px 34px rgba(220, 38, 38, .26);
}

.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .22em;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(38px, 6vw, 70px); line-height: .95; letter-spacing: -.05em; margin-bottom: 12px; }
h2 { font-size: 22px; letter-spacing: -.03em; margin-bottom: 4px; }
h3 { font-size: 16px; margin: 0 0 12px; }
.lead { color: var(--muted); font-size: 20px; line-height: 1.45; font-weight: 700; }

.field-label { display: block; font-size: 18px; font-weight: 900; margin: 28px 0 10px; }
.input, .select, .cc-input {
  width: 100%;
  border: 2px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 20px;
  padding: 18px 20px;
  font: inherit;
  font-weight: 850;
  color: var(--text);
  outline: none;
}
.input:focus, .select:focus, .cc-input:focus { border-color: var(--blue); box-shadow: 0 0 0 5px rgba(37, 99, 235, .12); }

.btn {
  border: 0;
  border-radius: 18px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.btn.primary { background: var(--green); color: white; box-shadow: 0 16px 28px rgba(22, 163, 74, .22); }
.btn.secondary { background: white; border: 1px solid var(--line); color: var(--text); }
.btn.ghost { background: #e2e8f0; color: #334155; }
.btn.full { width: 100%; margin-top: 18px; padding: 18px; font-size: 20px; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.message { min-height: 24px; font-weight: 900; color: var(--red); }
.hint { color: var(--muted); font-weight: 750; }

.app {
  width: min(1780px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 50px;
}
.topbar {
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  border-radius: 34px;
  padding: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  box-shadow: 0 20px 60px rgba(15,23,42,.08);
  position: sticky;
  top: 12px;
  z-index: 20;
  backdrop-filter: blur(14px);
}
.topbar h1 { font-size: clamp(34px, 4vw, 58px); margin-bottom: 6px; }
.subtitle { color: var(--muted); margin: 0; font-weight: 800; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.select { width: auto; min-width: 170px; padding: 13px 14px; border-radius: 16px; }
.cc-input { width: 110px; padding: 13px 14px; border-radius: 16px; text-transform: uppercase; }

.status-strip {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  color: var(--muted);
  font-weight: 850;
}
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 8px; }
.dot.ok { background: var(--green); box-shadow: 0 0 0 6px rgba(22,163,74,.13); }

.hero-grid, .kpi-grid, .grid { display: grid; gap: 18px; margin-bottom: 18px; }
.hero-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.grid.two { grid-template-columns: 1.35fr .9fr; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.hero-card, .kpi, .panel {
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 44px rgba(15,23,42,.07);
}
.hero-card {
  padding: 24px;
  min-height: 176px;
  overflow: hidden;
  position: relative;
}
.hero-card.dark { background: linear-gradient(135deg, #0f172a, #1e293b); color: white; }
.hero-card.alert { background: linear-gradient(135deg, #fff7ed, #fff); border-color: #fed7aa; }
.card-label { color: var(--muted); font-size: 13px; font-weight: 950; text-transform: uppercase; letter-spacing: .12em; }
.dark .card-label, .dark .hero-foot { color: #cbd5e1; }
.hero-number { font-size: clamp(38px, 5vw, 66px); line-height: 1; font-weight: 1000; letter-spacing: -.06em; margin: 16px 0 12px; }
.hero-foot { color: var(--muted); font-weight: 900; }

.kpi { padding: 17px; min-height: 106px; display: flex; flex-direction: column; justify-content: space-between; }
.kpi span { color: var(--muted); font-size: 12px; font-weight: 950; text-transform: uppercase; letter-spacing: .1em; }
.kpi strong { font-size: 28px; line-height: 1; letter-spacing: -.05em; }

.panel { padding: 22px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 14px; }
.panel-head p { margin: 0; color: var(--muted); font-weight: 760; max-width: 520px; }
.chart-box { position: relative; height: 310px; }
.chart-box.tall { height: 360px; }
.chart-box.small { height: 220px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

.sla-grid, .health-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.health-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.sla-card, .health {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
}
.sla-card span, .health span { display:block; color: var(--muted); font-size: 12px; font-weight: 950; text-transform: uppercase; letter-spacing: .09em; }
.sla-card strong, .health strong { display:block; font-size: 34px; letter-spacing: -.05em; margin: 10px 0 2px; }
.sla-card small, .health small { color: var(--muted); font-weight: 800; }

.table-panel { overflow: hidden; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 20px; }
table { width: 100%; border-collapse: collapse; background: white; min-width: 760px; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 950; text-transform: uppercase; letter-spacing: .08em; background: #f8fafc; }
td { font-weight: 760; color: #1f2937; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items:center; gap: 6px; padding: 5px 9px; border-radius: 999px; background: #e2e8f0; font-size: 12px; font-weight: 950; color: #334155; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.amber { background: #fef3c7; color: #92400e; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.dark { background: #e2e8f0; color: #0f172a; }
.empty { color: var(--muted); text-align: center; padding: 28px; font-weight: 850; }
.footer { color: var(--muted); display:flex; justify-content:space-between; gap:16px; padding: 22px; font-weight: 800; }

@media (max-width: 1300px) {
  .hero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app { width: min(100% - 24px, 1780px); padding-top: 12px; }
  .topbar { position: static; align-items: stretch; flex-direction: column; padding: 22px; border-radius: 26px; }
  .top-actions { justify-content: stretch; }
  .top-actions > * { flex: 1 1 100%; }
  .hero-grid, .kpi-grid, .sla-grid, .health-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px; border-radius: 28px; }
  .status-strip, .footer { flex-direction: column; align-items: flex-start; }
}

@media print {
  body { background: white; }
  .top-actions, .login-wrap { display: none !important; }
  .app { width: 100%; padding: 0; }
  .topbar, .hero-card, .kpi, .panel { box-shadow: none; break-inside: avoid; }
  .topbar { position: static; }
}

.select.compact {
  min-width: 120px;
}

.live-status {
  font-weight: 800;
  color: #166534;
}
.live-status.error {
  color: #b91c1c;
}
.live-status.ok {
  color: #166534;
}

/* Heatmap territorial */
.heat-map-grid {
  grid-template-columns: minmax(0, 2.25fr) minmax(430px, .75fr);
  align-items: stretch;
}
.map-panel {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.map-head {
  align-items: center;
}
.map-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.map-summary {
  display: flex;
  align-items: center;
  min-height: 46px;
  margin: 4px 0 12px;
  padding: 12px 16px;
  border: 1px solid #bfdbfe;
  border-radius: 18px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 900;
}
.municipal-map {
  height: 560px;
  width: 100%;
  border-radius: 24px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #e2e8f0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}
.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: inline-block;
}
.legend-dot.soft { background: #38bdf8; }
.legend-dot.mid { background: #f59e0b; }
.legend-dot.hot { background: #ef4444; }
.legend-ring {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-block;
  border: 3px solid #dc2626;
  background: #fee2e2;
}
.hotzones-panel {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.hotzones-panel .panel-head {
  flex: 0 0 auto;
  margin-bottom: 14px;
}
.hotzones-panel .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 20px;
}
.hotzones-panel table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.hotzones-panel th,
.hotzones-panel td {
  padding: 10px 9px;
  vertical-align: top;
  line-height: 1.18;
}
.hotzones-panel th {
  font-size: 10px;
  letter-spacing: .08em;
  white-space: nowrap;
}
.hotzones-panel td {
  font-size: 14px;
}
.hotzones-panel th:nth-child(1), .hotzones-panel td:nth-child(1) { width: 43%; }
.hotzones-panel th:nth-child(2), .hotzones-panel td:nth-child(2),
.hotzones-panel th:nth-child(3), .hotzones-panel td:nth-child(3) { width: 12%; text-align: center; }
.hotzones-panel th:nth-child(4), .hotzones-panel td:nth-child(4) { width: 17%; text-align: center; }
.hotzones-panel th:nth-child(5), .hotzones-panel td:nth-child(5) { width: 16%; white-space: nowrap; text-align: right; }
.hotzones-panel .badge {
  padding: 4px 8px;
  font-size: 10px;
  line-height: 1.05;
  max-width: 100%;
  justify-content: center;
  text-align: center;
  white-space: normal;
}
.hot-zone-cell {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.hot-zone-cell strong {
  line-height: 1.12;
  font-size: 13px;
  word-break: normal;
  overflow-wrap: anywhere;
}
.hot-zone-count,
.hot-zone-date {
  display: inline-block;
  font-weight: 950;
  white-space: nowrap;
}
.hot-zone-date {
  font-size: 12px;
  color: #1f2937;
}
.map-popup {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-width: 220px;
  line-height: 1.45;
}
.map-popup .badge {
  margin-top: 6px;
  margin-right: 4px;
}
.leaflet-container {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.leaflet-popup-content-wrapper {
  border-radius: 16px;
}

@media (max-width: 1300px) {
  .heat-map-grid { grid-template-columns: 1fr; }
  .municipal-map { height: 460px; }
}

@media (max-width: 720px) {
  .map-actions { width: 100%; justify-content: stretch; }
  .map-actions > * { flex: 1 1 100%; }
  .municipal-map { height: 380px; border-radius: 18px; }
}


/* Lucía floating assistant */
.lucia-widget {
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 90;
  pointer-events: none;
}
.lucia-widget > * { pointer-events: auto; }
.lucia-fab {
  min-width: 188px;
  min-height: 68px;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px 10px 10px;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  background: linear-gradient(135deg, #0f172a, #1d4ed8 62%, #16a34a);
  color: white;
  box-shadow: 0 26px 64px rgba(15, 23, 42, .30);
  cursor: pointer;
  position: relative;
  text-align: left;
  transform: translateZ(0);
}
.lucia-fab:hover { transform: translateY(-2px); box-shadow: 0 30px 72px rgba(15, 23, 42, .34); }
.lucia-fab-avatar {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.26);
  font-size: 25px;
}
.lucia-fab-avatar-female {
  background: linear-gradient(135deg, rgba(255,255,255,.26), rgba(255,255,255,.10));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.16), 0 10px 22px rgba(15, 23, 42, .18);
}
.lucia-fab-copy { display: grid; gap: 2px; line-height: 1.05; }
.lucia-fab-copy strong { font-size: 18px; font-weight: 1000; letter-spacing: -.03em; }
.lucia-fab-copy small { color: #dbeafe; font-size: 12px; font-weight: 900; }
.lucia-fab-badge {
  position: absolute;
  right: -4px;
  top: -6px;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #dc2626;
  border: 3px solid white;
  color: white;
  font-size: 12px;
  font-weight: 1000;
  box-shadow: 0 14px 28px rgba(220, 38, 38, .24);
}
.lucia-drawer {
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: calc(max(22px, env(safe-area-inset-bottom)) + 84px);
  width: min(560px, calc(100vw - 44px));
  max-height: min(780px, calc(100vh - 132px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 30px;
  border: 1px solid rgba(37, 99, 235, .20);
  background: rgba(255,255,255,.98);
  box-shadow: 0 36px 110px rgba(15,23,42,.30);
  backdrop-filter: blur(16px);
}
.lucia-drawer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 16px;
  color: white;
  background:
    radial-gradient(circle at 10% 0%, rgba(22, 163, 74, .38), transparent 32%),
    linear-gradient(135deg, #0f172a, #1e3a8a);
}
.lucia-drawer-head h2 { font-size: 34px; margin-bottom: 5px; }
.lucia-drawer-head p { margin: 0; color: #dbeafe; font-weight: 800; line-height: 1.35; }
.lucia-drawer-head .eyebrow { color: #bfdbfe; }
.lucia-close {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 16px;
  background: rgba(255,255,255,.12);
  color: white;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}
.lucia-box {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow: hidden;
}
.lucia-status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lucia-safety,
.lucia-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  font-weight: 950;
  font-size: 12px;
}
.lucia-safety { background: #dcfce7; color: #166534; }
.lucia-status-pill { background: #e0f2fe; color: #075985; }
.lucia-suggestions {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}
.chip {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 10px 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { border-color: var(--blue); box-shadow: 0 8px 22px rgba(37,99,235,.12); transform: translateY(-1px); }
.lucia-input-row { flex: 0 0 auto; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: stretch; }
.lucia-input {
  width: 100%;
  resize: vertical;
  min-height: 70px;
  max-height: 150px;
  border: 2px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 18px;
  padding: 14px 15px;
  font: inherit;
  font-weight: 750;
  outline: none;
}
.lucia-input:focus { border-color: var(--blue); box-shadow: 0 0 0 5px rgba(37, 99, 235, .10); }
.lucia-answer {
  flex: 0 0 auto;
  max-height: 170px;
  overflow: auto;
  background: #0f172a;
  color: white;
  border-radius: 20px;
  padding: 16px;
  font-weight: 850;
  line-height: 1.45;
  white-space: pre-wrap;
}
.lucia-answer.muted-answer { background: #e2e8f0; color: #334155; }
.lucia-meta { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-weight: 900; }
.lucia-report-actions { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 2px 0; }
.lucia-download { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.lucia-followups { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.lucia-followup { cursor: pointer; }
.lucia-table-wrap {
  flex: 1 1 auto;
  min-height: 160px;
  overflow: auto;
  background: rgba(255,255,255,.72);
  border-radius: 18px;
}
.lucia-table-wrap table { min-width: 620px; }
.ticket-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.mini-input { min-width: 260px; flex: 1; border: 1px solid var(--line); background: #f8fafc; border-radius: 16px; padding: 13px 14px; font: inherit; font-weight: 800; color: var(--text); outline: none; }
.mini-input:focus { border-color: var(--blue); box-shadow: 0 0 0 5px rgba(37, 99, 235, .10); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; color: var(--muted); font-weight: 950; }
.tickets-panel .table-wrap { min-height: 312px; }
.ticket-row{cursor:pointer}.ticket-row:hover td{background:#eff6ff}.ticket-detail-modal{position:fixed;inset:0;z-index:4000;background:rgba(15,23,42,.68);display:grid;place-items:center;padding:24px}.ticket-detail-modal.hidden{display:none}.ticket-detail-dialog{width:min(1100px,96vw);max-height:92vh;overflow:auto;background:#f8fafc;border-radius:28px;box-shadow:0 40px 100px rgba(0,0,0,.35)}.ticket-detail-header{position:sticky;top:0;z-index:2;display:flex;justify-content:space-between;align-items:center;padding:20px 24px;background:#0f172a;color:#fff}.ticket-detail-header h2{margin:4px 0 0}.ticket-detail-content{padding:22px;display:grid;gap:16px}.ticket-detail-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.ticket-detail-card{background:#fff;border:1px solid var(--line);border-radius:18px;padding:16px}.ticket-detail-card.wide{grid-column:1/-1}.ticket-timeline{display:grid;gap:10px}.ticket-timeline-item{border-left:4px solid #3b82f6;background:#f8fafc;border-radius:0 14px 14px 0;padding:11px 14px}.ticket-media{display:block;width:100%;max-width:620px;margin-top:10px}.ticket-video{max-height:360px;background:#0f172a;border-radius:14px}.qr-attribution{background:#e0f2fe!important;border-color:#7dd3fc!important}.detail-label{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:#64748b;font-weight:900}.detail-value{font-size:16px;font-weight:850;margin-top:4px;overflow-wrap:anywhere}@media(max-width:760px){.ticket-detail-grid{grid-template-columns:1fr}.ticket-detail-modal{padding:8px}}
@media (max-width: 820px) {
  .lucia-widget { right: 12px; bottom: 12px; }
  .lucia-fab { min-width: 0; padding-right: 12px; }
  .lucia-fab-copy small { display: none; }
  .lucia-drawer {
    right: 10px;
    bottom: 88px;
    width: calc(100vw - 20px);
    max-height: calc(100vh - 110px);
    border-radius: 24px;
  }
  .lucia-input-row { grid-template-columns: 1fr; }
  .ticket-tools { display: grid; }
  .mini-input { min-width: 0; }
}
@media print {
  .lucia-widget { display: none !important; }
}


/* ==========================================================================
   REDISEÑO UI/UX v13 — SOS-DASHBOARD: refresh "ejecutivo" moderno
   Capa 100% aditiva: ninguna regla anterior fue eliminada ni renombrada.
   No se tocó app.js ni ningún ID/contrato de datos. Solo presentación.
   ========================================================================== */

.app{ padding-bottom: 12px; }

/* Header ejecutivo: más peso visual, banda oscura de mando */
.topbar{
  background: linear-gradient(135deg, #0f172a, #1e3a8a 65%, #0f172a);
  color:#fff;
  border-radius: var(--radius);
  padding: 26px 30px;
  box-shadow: 0 30px 70px rgba(15,23,42,.28);
}
.topbar .subtitle{ color:#cbd5e1; }
.topbar h1{ letter-spacing:-.02em; }
.top-actions .select, .top-actions .cc-input{
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.22);
  color:#fff;
}
.top-actions .select option{ color:#111827; }
.top-actions .btn.secondary{ background:#fff; }

.status-strip{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.14);
  color:#e2e8f0;
}
.status-strip #updatedAt, .status-strip #periodLabel, .status-strip #liveStatus{ color:#e2e8f0; }

/* Sistema de tarjetas: elevación y ritmo consistentes en toda la app,
   para que se lea como un solo dashboard y no como tarjetas sueltas */
.hero-card, .kpi, .panel{
  border-radius: 22px;
  box-shadow: 0 16px 40px rgba(15,23,42,.08);
  transition: box-shadow .18s ease, transform .18s ease;
}
.hero-card:hover, .kpi:hover{ box-shadow: 0 20px 50px rgba(15,23,42,.12); }
.hero-card.dark{ box-shadow: 0 24px 60px rgba(15,23,42,.30); }
.hero-number{ letter-spacing:-.04em; }

.panel-head h2, .panel > h2{ letter-spacing:-.01em; }
.panel-head{ border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 18px; }

.kpi{ border-top: 3px solid var(--blue); }
.kpi:nth-child(2){ border-top-color: var(--green); }
.kpi:nth-child(3){ border-top-color: var(--amber); }
.kpi:nth-child(4){ border-top-color: var(--purple); }
.kpi:nth-child(5){ border-top-color: var(--red); }
.kpi:nth-child(6){ border-top-color: var(--blue); }
.kpi:nth-child(7){ border-top-color: var(--green); }
.kpi:nth-child(8){ border-top-color: var(--amber); }

/* Tablas: mejor escaneo visual */
.table-wrap table{ font-size: 14px; }
.table-wrap thead th{
  background: #f8fafc;
  position: sticky;
  top: 0;
}
.table-wrap tbody tr:hover{ background: #f8fafc; }

.badge{ font-weight: 950; }

/* --- Lucía: asistente ejecutiva, no widget improvisado --- */
.lucia-fab{
  min-width: 220px;
  border: 2px solid rgba(255,255,255,.18);
}
.lucia-fab-copy strong{ font-size: 17px; }
.lucia-fab-copy small{
  font-size: 13px;
  color:#fff;
  background: rgba(255,255,255,.14);
  border-radius: 999px;
  padding: 2px 9px;
  display:inline-block;
  margin-top: 2px;
}
.lucia-fab-badge{
  animation: luciaBadgePulse 2.2s ease-in-out infinite;
}
@keyframes luciaBadgePulse{
  0%, 100%{ box-shadow: 0 14px 28px rgba(220,38,38,.24), 0 0 0 0 rgba(220,38,38,.45); }
  50%{ box-shadow: 0 14px 28px rgba(220,38,38,.24), 0 0 0 8px rgba(220,38,38,0); }
}
.lucia-drawer-head{
  background: linear-gradient(135deg, #0f172a, #1d4ed8 70%, #16a34a);
}
.lucia-box{ background: #fbfdff; }

@media (prefers-reduced-motion: reduce){
  *{ animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; }
}
