/* =====================================================================
   CHECK-IN · Portal de administración
   Sistema de diseño: claro / oscuro, tarjetas suaves, acentos índigo.
   ===================================================================== */
:root {
  --bg: #f3f5fb;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(99,102,241,.10), transparent 60%),
             radial-gradient(900px 500px at -10% 110%, rgba(16,185,129,.08), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e5e9f2;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --primary-soft: rgba(79,70,229,.10);
  --in: #10b981;
  --in-soft: rgba(16,185,129,.12);
  --out: #f97316;
  --out-soft: rgba(249,115,22,.12);
  --danger: #ef4444;
  --danger-soft: rgba(239,68,68,.12);
  --warn: #f59e0b;
  --warn-soft: rgba(245,158,11,.14);
  --info: #0ea5e9;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
  --shadow-lg: 0 24px 60px rgba(15,23,42,.18);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar: 264px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0a0f1e;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(99,102,241,.16), transparent 60%),
             radial-gradient(900px 500px at -10% 110%, rgba(16,185,129,.08), transparent 60%);
  --surface: #111a2e;
  --surface-2: #0f1729;
  --surface-3: #1a2540;
  --border: #1e2a46;
  --text: #e6ebf5;
  --text-2: #cbd5e1;
  --muted: #8a9bb8;
  --primary-soft: rgba(129,140,248,.16);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; color: var(--text);
  background: var(--bg); background-image: var(--bg-grad); background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
svg.lucide { width: 18px; height: 18px; stroke-width: 2; flex-shrink: 0; }

/* ------------------------------------------------------------ layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, #0b1124 0%, #141a3a 60%, #1e1b4b 100%);
  color: #cbd5e1; display: flex; flex-direction: column; padding: 18px 14px; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 22px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff;
  background: conic-gradient(from 210deg, #6366f1, #8b5cf6, #10b981, #6366f1);
  box-shadow: 0 8px 24px rgba(99,102,241,.45);
}
.brand-logo svg { width: 22px; height: 22px; }
.brand b { display: block; color: #fff; font-size: 15px; letter-spacing: .2px; }
.brand small { color: #8b93b8; font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.4px; color: #6b7399; padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: #b4bcd8; font-weight: 500; transition: background .15s, color .15s; position: relative;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: linear-gradient(90deg, rgba(99,102,241,.35), rgba(99,102,241,.08)); color: #fff; }
.nav a.active::before { content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: #818cf8; }
.nav .count { margin-left: auto; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; display: flex; align-items: center; gap: 10px; }
.sidebar-foot .chain-pill { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #a7f3d0; background: rgba(16,185,129,.12); padding: 8px 10px; border-radius: 10px; width: 100%; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 14px 28px; background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -.2px; }
.topbar .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.topbar .spacer { flex: 1; }
.content { padding: 24px 28px 48px; max-width: 1560px; width: 100%; }
.menu-btn { display: none; }

/* ------------------------------------------------------------ componentes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 650; }
.card-h .spacer { flex: 1; }
.card-b { padding: 16px 18px 18px; }
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.mt { margin-top: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font-weight: 600; font-size: 13px; transition: transform .08s, box-shadow .15s, background .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(79,70,229,.32); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.success { background: var(--in); color: #fff; border-color: transparent; }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { width: 38px; padding: 0; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.input, select.input, textarea.input {
  height: 40px; width: 100%; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); outline: none; transition: border .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.input.err { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field .error { font-size: 11.5px; color: var(--danger); font-weight: 500; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 11px; color: var(--muted); width: 16px; height: 16px; }
.search .input { padding-left: 34px; }

.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 999px; transition: .2s; cursor: pointer; border: 1px solid var(--border); }
.switch span::after { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--in); border-color: var(--in); }
.switch input:checked + span::after { transform: translateX(18px); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.badge.in { background: var(--in-soft); color: #059669; }
.badge.out { background: var(--out-soft); color: #ea580c; }
.badge.ok { background: var(--in-soft); color: #059669; }
.badge.warn { background: var(--warn-soft); color: #b45309; }
.badge.danger { background: var(--danger-soft); color: #dc2626; }
.badge.info { background: rgba(14,165,233,.12); color: #0284c7; }
.badge.muted { background: var(--surface-3); color: var(--muted); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }
[data-theme="dark"] .badge.in, [data-theme="dark"] .badge.ok { color: #34d399; }
[data-theme="dark"] .badge.out { color: #fb923c; }
[data-theme="dark"] .badge.danger { color: #f87171; }
[data-theme="dark"] .badge.warn { color: #fbbf24; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 550; font-size: 12.5px; }
.chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }

.avatar { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0; }
.avatar.lg { width: 64px; height: 64px; border-radius: 20px; font-size: 22px; }

/* KPI */
.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; }
.kpi .v { font-size: 28px; font-weight: 750; letter-spacing: -.8px; margin-top: 12px; line-height: 1; }
.kpi .v small { font-size: 14px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.kpi .l { color: var(--muted); font-size: 12.5px; margin-top: 6px; font-weight: 500; }
.kpi .ring { position: absolute; right: 14px; top: 14px; }
.kpi::after { content: ''; position: absolute; right: -40px; bottom: -40px; width: 120px; height: 120px; border-radius: 50%; background: currentColor; opacity: .05; }

/* tabla */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 650; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 0; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr:last-child td { border-bottom: none; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person b { display: block; font-weight: 600; }
.person small { color: var(--muted); font-size: 12px; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--border); }

/* feed */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--border); cursor: pointer; }
.feed-item:last-child { border-bottom: none; }
.feed-item .meta { flex: 1; min-width: 0; }
.feed-item .meta b { font-weight: 600; }
.feed-item .meta div { color: var(--muted); font-size: 12px; }
.time { font-variant-numeric: tabular-nums; font-weight: 650; }

/* mapas */
.map { height: 360px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-3); }
.map.tall { height: 520px; }
.map.short { height: 220px; }
.leaflet-container { font-family: var(--font); }
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.pin span { transform: rotate(45deg); color: #fff; font-size: 11px; font-weight: 800; }
.pulse { position: relative; }
.pulse::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid currentColor; animation: pulse 1.8s infinite; }
@keyframes pulse { from { transform: scale(.6); opacity: .8; } to { transform: scale(1.6); opacity: 0; } }

/* drawer / modal */
.overlay { position: fixed; inset: 0; background: rgba(2,6,23,.45); backdrop-filter: blur(3px); z-index: 60; opacity: 0; transition: opacity .2s; }
.overlay.show { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100%); background: var(--surface); z-index: 61; box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; }
.drawer.show { transform: none; }
.drawer-h { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer-h h2 { margin: 0; font-size: 17px; }
.drawer-b { padding: 20px 22px 40px; overflow-y: auto; flex: 1; }
.modal { position: fixed; left: 50%; top: 50%; width: min(680px, calc(100% - 32px)); max-height: calc(100% - 48px); overflow: auto; background: var(--surface); border-radius: 20px; z-index: 61; box-shadow: var(--shadow-lg); transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: .22s cubic-bezier(.2,.8,.2,1); }
.modal.show { transform: translate(-50%, -50%); opacity: 1; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-h h2 { margin: 0; font-size: 17px; flex: 1; }
.modal-b { padding: 20px 22px; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 20px 20px; position: sticky; bottom: 0; }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.kv > div { background: var(--surface); padding: 12px 14px; }
.kv dt { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 650; margin-bottom: 4px; }
.kv dd { margin: 0; font-weight: 550; word-break: break-word; }
.section-t { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }

.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); animation: rise .35s both; }
.check .ci { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.check.ok .ci { background: var(--in); }
.check.bad .ci { background: var(--danger); }
.check .ci svg { width: 15px; height: 15px; stroke-width: 3; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.flag { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--warn-soft); margin-bottom: 6px; font-weight: 550; }
.flag .w { margin-left: auto; font-size: 12px; color: var(--muted); }

.code { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto; }
.hash { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo { border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-3); aspect-ratio: 3/4; display: grid; place-items: center; position: relative; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo span { position: absolute; left: 10px; bottom: 10px; background: rgba(15,23,42,.7); color: #fff; font-size: 11px; padding: 4px 8px; border-radius: 8px; }

.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--primary-2)); }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .big { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center; background: var(--surface-3); }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; width: fit-content; flex-wrap: wrap; }
.tabs button { border: none; background: transparent; padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast { min-width: 280px; max-width: 420px; background: #0f172a; color: #fff; padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; animation: rise .25s both; }
.toast.ok svg { color: #34d399; }
.toast.err svg { color: #f87171; }

/* charts */
.chart { width: 100%; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 60px; gap: 12px; align-items: center; padding: 7px 0; }
.bar-row .track { height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar-row .track i { display: block; height: 100%; border-radius: 999px; transition: width .8s cubic-bezier(.2,.8,.2,1); }

/* asistente */
.chat { display: flex; flex-direction: column; height: calc(100vh - 170px); min-height: 520px; }
.chat-log { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 78%; padding: 12px 16px; border-radius: 16px; line-height: 1.55; animation: rise .25s both; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.bot ul { margin: 6px 0; padding-left: 20px; }
.msg.bot p { margin: 0 0 6px; }
.msg .who { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.chat-input { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); }
.chat-input textarea { flex: 1; resize: none; height: 46px; padding: 12px 14px; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.typing span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin-right: 4px; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* integridad */
.shield { width: 120px; height: 120px; border-radius: 36px; display: grid; place-items: center; color: #fff; margin: 0 auto; position: relative; }
.shield.ok { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 20px 50px rgba(16,185,129,.4); }
.shield.bad { background: linear-gradient(135deg, #ef4444, #b91c1c); box-shadow: 0 20px 50px rgba(239,68,68,.4); }
.shield.idle { background: linear-gradient(135deg, #6366f1, #7c3aed); box-shadow: 0 20px 50px rgba(99,102,241,.35); }
.shield svg { width: 56px; height: 56px; }
.chain { display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 10px 2px 16px; }
.block { min-width: 170px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px; font-size: 12px; animation: rise .4s both; }
.block b { display: block; margin-bottom: 6px; }
.link { width: 38px; height: 2px; background: linear-gradient(90deg, var(--primary), var(--in)); flex-shrink: 0; position: relative; }
.link::after { content: ''; position: absolute; right: -2px; top: -4px; border: 5px solid transparent; border-left-color: var(--in); }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(800px 500px at 20% 20%, rgba(99,102,241,.55), transparent 60%),
              radial-gradient(700px 500px at 80% 80%, rgba(16,185,129,.35), transparent 60%), #0b1124; }
.login-art h2 { font-size: 40px; line-height: 1.1; letter-spacing: -1px; margin: 0 0 14px; max-width: 520px; }
.login-art p { color: #c7cce6; font-size: 16px; max-width: 460px; line-height: 1.6; }
.float-card { position: absolute; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(10px); border-radius: 16px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; animation: float 6s ease-in-out infinite; box-shadow: 0 20px 40px rgba(0,0,0,.25); }
.float-card small { color: #c7cce6; display: block; font-size: 11.5px; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.login-form { display: grid; place-items: center; padding: 32px; background: var(--surface); }
.login-form form { width: min(380px, 100%); }
.login-form h1 { font-size: 26px; margin: 18px 0 6px; letter-spacing: -.4px; }
.features { display: flex; gap: 22px; flex-wrap: wrap; color: #c7cce6; font-size: 13px; }
.features span { display: inline-flex; align-items: center; gap: 8px; }

/* responsive */
@media (max-width: 1280px) { .g-6 { grid-template-columns: repeat(3, 1fr); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 1024px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex; }
  .g-3, .g-4 { grid-template-columns: repeat(2, 1fr); }
  .login { grid-template-columns: 1fr; } .login-art { display: none; }
}
@media (max-width: 680px) {
  .content { padding: 16px; } .topbar { padding: 10px 12px; gap: 6px; }
  .topbar h1 { font-size: 17px; } .topbar .sub, .topbar .who-name, #page-actions .btn > span { display: none; }
  .topbar .user-chip { padding-left: 4px !important; gap: 4px !important; }
  .g-2, .g-3, .g-4, .form-grid, .kv { grid-template-columns: 1fr; }
  .g-6 { grid-template-columns: 1fr 1fr; }
  .kpi .v { font-size: 26px; }
  .msg { max-width: 92%; }
}

/* ------------------------------------------------------------ visualización (paleta validada) */
:root { --viz-in: #10b981; --viz-out: #f97316; --viz-accent: #4f46e5; }
[data-theme="dark"] { --viz-in: #10b981; --viz-out: #e76624; --viz-accent: #818cf8; }
.chart .bar { transition: opacity .15s; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart g.col:hover .bar { opacity: .82; }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; opacity: 0; }
.chart-wrap { position: relative; }
.chart-wrap.loading { opacity: .5; transition: opacity .2s; }
.viz-tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 120px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); padding: 8px 10px; font-size: 12px; opacity: 0; transition: opacity .1s;
}
.viz-tip.show { opacity: 1; }
.viz-tip .t { color: var(--muted); margin-bottom: 4px; }
.viz-tip .r { display: flex; align-items: center; gap: 8px; }
.viz-tip .r i { width: 12px; height: 2px; border-radius: 2px; display: inline-block; }
.viz-tip .r b { font-variant-numeric: tabular-nums; min-width: 24px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .ln { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }
details.table-view { margin-top: 10px; }
details.table-view summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600; list-style: none; display: inline-flex; gap: 6px; align-items: center; }
details.table-view summary::-webkit-details-marker { display: none; }
details.table-view table { margin-top: 8px; font-size: 12px; }
details.table-view td, details.table-view th { padding: 6px 10px; }
.kpi .v { font-variant-numeric: normal; }
.demo-ribbon { background: linear-gradient(90deg, #f59e0b, #f97316); color: #fff; font-size: 12px; font-weight: 600; padding: 6px 28px; display: flex; gap: 10px; align-items: center; }
.demo-ribbon button { margin-left: auto; background: rgba(255,255,255,.2); border: none; color: #fff; padding: 4px 10px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.code-big { font-family: var(--mono); font-size: 34px; letter-spacing: 6px; font-weight: 700; text-align: center; padding: 22px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); }
.setting { display: flex; gap: 16px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting:last-child { border-bottom: none; }
.setting .txt { flex: 1; }
.setting .txt b { display: block; font-weight: 600; }
.setting .txt small { color: var(--muted); }
.setting .ctl { width: 260px; flex-shrink: 0; display: flex; justify-content: flex-end; }
.co-card { overflow: hidden; }
.co-card .stripe { height: 6px; }
.co-card .logo { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 16px; }
.site-item { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; }
.site-item:hover, .site-item.active { background: var(--surface-2); border-color: var(--border); }
.inline-err { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 10px; font-weight: 550; display: flex; gap: 8px; align-items: center; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }
.msg.bot table { border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.msg.bot th, .msg.bot td { border: 1px solid var(--border); padding: 5px 8px; text-align: left; }
.msg.bot code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
@media (max-width: 680px) { .setting { flex-direction: column; } .setting .ctl { width: 100%; justify-content: flex-start; } }
/* modo oscuro con teselas claras: se invierten (los pines no se ven afectados) */
.tiles-inverted { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.88) saturate(.6); }
.leaflet-container { background: var(--surface-3); }
/* Leaflet usa z-index internos altos: el contenedor crea su propio contexto para no tapar cajones ni modales */
.map { position: relative; isolation: isolate; z-index: 0; }
