/* USMP-ADN — portal de equipos
   Tema oscuro de piso de operación. El color de acento cambia con la fuente elegida:
   verde = Phonecheck (diagnóstico), azul = Securaze (borrado), como sus logos. Así siempre se sabe qué datos se están viendo.
   Colores por tipo de equipo: iOS azul, Android naranja, Mac rosa. Resultados: pasa verde, falla rojo, en espera ámbar. */

@font-face { font-family: 'Plex Sans'; src: url('/fonts/plex-sans-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Sans'; src: url('/fonts/plex-sans-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Plex Sans'; src: url('/fonts/plex-sans-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('/fonts/plex-mono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('/fonts/plex-mono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0f1216;
  --rail: #0b0d10;
  --panel: #161a20;
  --panel-2: #1c2129;
  --raise: #232933;
  --line: #2a313c;
  --line-soft: #20262e;
  --ink: #e8ebf0;
  --muted: #8d97a7;
  --faint: #5f6977;

  --pc: #3ecf7a;
  --pc-ink: #03200f;
  --sz: #2f2fc4;
  --sz-ink: #ffffff;
  --accent: var(--pc);
  --accent-ink: var(--pc-ink);
  --accent-tint: rgba(62, 207, 122, 0.12);
  --accent-text: var(--accent);

  --ios: #5b9bd5;
  --android: #e8773d;
  --mac: #e06c9f;
  --other: #7d8796;

  --pass: #3cc47c;
  --pass-tint: rgba(60, 196, 124, 0.14);
  --fail: #f0564f;
  --fail-tint: rgba(240, 86, 79, 0.14);
  --hold: #e9b730;
  --hold-tint: rgba(233, 183, 48, 0.14);

  --radius: 8px;
  --radius-lg: 12px;
  --sans: 'Plex Sans', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-text);
}
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f3f5f8;
  --rail: #ffffff;
  --panel: #ffffff;
  --panel-2: #f2f4f7;
  --raise: #e7ebf0;
  --line: #d6dce4;
  --line-soft: #e5e9ef;
  --ink: #17202b;
  --muted: #586374;
  --faint: #7f8a99;

  --pc: #1f9d57;
  --pc-ink: #ffffff;
  --accent-tint: rgba(31, 157, 87, 0.12);
  --accent-text: #15803d;

  --ios: #3b82c4;
  --android: #db6526;
  --mac: #cc4d86;
  --other: #8a94a3;

  --pass: #188a4b;
  --pass-tint: rgba(24, 138, 75, 0.12);
  --fail: #d33a32;
  --fail-tint: rgba(211, 58, 50, 0.1);
  --hold: #a87505;
  --hold-tint: rgba(214, 160, 20, 0.16);
}
:root[data-theme='light'][data-source='securaze'] {
  --accent-tint: rgba(47, 47, 196, 0.1);
  --accent-text: #2f2fc4;
}
:root[data-source='securaze'] {
  --accent: var(--sz);
  --accent-ink: var(--sz-ink);
  --accent-tint: rgba(76, 76, 230, 0.2);
  --accent-text: #8f8fff;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  font-feature-settings: 'tnum' 1;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; }
h1 { font-size: 28px; letter-spacing: -0.015em; }
h2 { font-size: 17px; margin-bottom: 14px; }
h3 { font-size: 15px; margin-bottom: 10px; }
p { margin: 0 0 12px; }
a { color: var(--accent-text); }
code { font-family: var(--mono); font-size: 0.92em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--panel); padding: 8px 12px; border-radius: var(--radius); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.mono { font-family: var(--mono); }
.right { text-align: right; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.main { padding: 22px 36px 64px; min-width: 0; max-width: 1680px; }

.sidebar {
  background: var(--rail);
  border-right: 1px solid var(--line-soft);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 12px;
  gap: 18px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 16px;
  transition: background-color 0.25s;
}
.brand-name { font-weight: 600; color: var(--ink); letter-spacing: 0.02em; }
.brand-sub { font-size: 12.5px; color: var(--faint); }
.menu-toggle { display: none; margin-left: auto; color: var(--ink); }

.lang { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 3px; gap: 2px; }
.lang button {
  border: 0; background: transparent; color: var(--muted);
  padding: 4px 12px; border-radius: 5px; cursor: pointer; font-weight: 500; font-size: 12.5px; letter-spacing: 0.04em;
}
.lang button.active { background: var(--raise); color: var(--ink); }
.sidebar-section { padding: 0 6px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-heading { margin: 18px 10px 6px; font-size: 12.5px; color: var(--faint); }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--radius);
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14.5px;
  border: 0; background: transparent; cursor: pointer; width: 100%; text-align: left;
}
.nav-link:hover { background: var(--panel); color: var(--ink); }
.nav-link.active { background: var(--panel-2); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }
.nav-link.active .icon { color: var(--accent-text); }

.sidebar-foot { border-top: 1px solid var(--line-soft); padding-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); text-decoration: none; color: inherit; }
.user-chip:hover, .user-chip.active { background: var(--panel); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--raise); color: var(--ink); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-name { color: var(--ink); font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-group { font-size: 12.5px; color: var(--faint); }
.logout { font-size: 14px; }

/* ---------- Barra superior con el switch de fuente ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-bottom: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--line-soft);
}
.topbar-note { color: var(--muted); font-size: 13.5px; }
.source-switch {
  display: inline-flex; padding: 4px; gap: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.source-switch button {
  display: inline-flex; align-items: center; gap: 9px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 8px 18px; border-radius: 7px; font-weight: 600; font-size: 14.5px;
  transition: background-color 0.2s, color 0.2s;
}
.source-switch button:hover { color: var(--ink); }
.source-switch .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; opacity: 0.6; }
.source-switch button[data-src='phonecheck'].active { background: var(--pc); color: var(--pc-ink); }
.source-switch button[data-src='securaze'].active { background: var(--sz); color: var(--sz-ink); }
.source-switch button.active .dot { opacity: 1; }

/* ---------- Encabezados y barras ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-head p { margin: 6px 0 0; max-width: 70ch; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--pass); box-shadow: 0 0 0 3px var(--pass-tint); flex: none; }
.status-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.status-line .status-live { display: inline-flex; align-items: center; gap: 8px; color: var(--pass); font-weight: 500; }
.status-line .status-off { color: var(--hold); }

/* ---------- Botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 8px 14px; font-weight: 500; font-size: 14.5px; cursor: pointer; white-space: nowrap;
  text-decoration: none; line-height: 1.2;
}
.btn:disabled { opacity: 0.5; cursor: progress; }
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-secondary { background: var(--panel-2); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { border-color: var(--faint); background: var(--raise); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-2); color: var(--ink); }
.btn-danger-ghost { background: transparent; color: var(--fail); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--fail-tint); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-block { width: 100%; }
.btn-icon { border: 0; background: transparent; cursor: pointer; padding: 6px; border-radius: var(--radius); font-size: 22px; line-height: 1; color: var(--muted); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row.right { justify-content: flex-end; }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line-soft); border-radius: 7px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 4px 11px; border-radius: 5px; font-size: 13px; font-weight: 500; cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--accent); color: var(--accent-ink); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .field .label { font-weight: 500; font-size: 14px; }
input[type='text'], input[type='email'], input[type='password'], input[type='search'], input[type='number'], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
  padding: 9px 11px; font-size: 15px; color: var(--ink);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:disabled { background: var(--panel-2); color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-tint); }
textarea { resize: vertical; font-family: var(--mono); font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); }
.form-error { color: var(--fail); font-size: 14px; min-height: 1em; margin-bottom: 10px; }
.form-error:empty { margin: 0; min-height: 0; }
.check { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 12px; cursor: pointer; font-size: 14.5px; }
.check input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grow { flex: 1; }
.narrow { max-width: 220px; }

/* ---------- Pantalla de acceso ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px 28px 22px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; gap: 12px; }
.auth-card .brand { padding: 0; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card form { margin-top: 18px; }
.auth-card .btn-ghost { margin-top: 8px; }

/* ---------- Paneles del Dashboard ---------- */
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 18px 20px 20px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.panel-head h2 { margin: 0; font-size: 15px; }
.panel-head p { margin: 3px 0 0; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dash { display: flex; flex-direction: column; gap: 16px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; }
.dash-grid.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 15px 16px 14px; min-width: 0; }
.kpi:first-child { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-soft)); }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-hint { color: var(--faint); font-size: 12.5px; margin-top: 6px; }
.kpi-ok .kpi-value { color: var(--pass); }
.kpi-bad .kpi-value { color: var(--fail); }
.kpi-warn .kpi-value { color: var(--hold); }

.floor { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.floor-tile { background: var(--panel-2); border-radius: var(--radius); padding: 12px 14px; border-left: 3px solid var(--faint); }
.floor-tile .n { font-size: 26px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.floor-tile .l { font-weight: 500; margin-top: 4px; font-size: 14px; }
.floor-tile .d { color: var(--muted); font-size: 12.5px; }
.floor-tile.s0 { border-left-color: var(--accent); }
.floor-tile.s1 { border-left-color: var(--ios); }
.floor-tile.s2 { border-left-color: var(--pass); }
.floor-tile.s3 { border-left-color: var(--mac); }
.floor-tile.attn { border-left-color: var(--hold); }
.floor-tile.idle { border-left-color: var(--faint); }

/* Gráfica por hora (SVG) */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis { fill: var(--faint); font: 11px var(--sans); }
.chart .peak { fill: var(--ink); font: 600 11px var(--sans); }
.chart .now { stroke: var(--accent); stroke-dasharray: 3 3; }
.seg-ios { fill: var(--ios); background: var(--ios); }
.seg-android { fill: var(--android); background: var(--android); }
.seg-mac { fill: var(--mac); background: var(--mac); }
.seg-other { fill: var(--other); background: var(--other); }
.seg-passed { background: var(--pass); }
.seg-failed { background: var(--fail); }
.seg-pending { background: var(--hold); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13px; margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Barras horizontales */
.hbar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--panel-2); }
.hbar > span { display: block; height: 100%; min-width: 0; }
.hbar.thick { height: 14px; }
.bar-rows { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.bar-row .label { display: flex; align-items: center; gap: 8px; font-weight: 500; min-width: 0; }
.bar-row .value { display: flex; gap: 10px; justify-content: flex-end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-row .value .muted { min-width: 52px; text-align: right; }
.bar-track { position: relative; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.outcome-big { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.outcome-big .v { font-size: 40px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.outcome-row { margin-bottom: 14px; }
.outcome-row .top { display: flex; justify-content: space-between; margin-bottom: 7px; font-weight: 500; }
.footnote { color: var(--muted); font-size: 13px; margin: 14px 0 0; }

/* Operadores */
.people { width: 100%; border-collapse: collapse; }
.people th { text-align: left; color: var(--faint); font-weight: 500; font-size: 12.5px; padding: 0 10px 10px; border-bottom: 1px solid var(--line-soft); }
.people td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.people tr:last-child td { border-bottom: 0; }
.people .rank { color: var(--faint); width: 34px; font-variant-numeric: tabular-nums; }
.people .who { font-weight: 600; }
.people .sub { color: var(--muted); font-size: 12.5px; }
.people .sub .time { color: var(--accent-text); font-family: var(--mono); font-size: 12px; }
.people .bar-cell { width: 42%; min-width: 140px; }
.people .big { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.people td.r, .people th.r { text-align: right; white-space: nowrap; }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 4px; background: var(--raise); color: var(--muted); margin-left: 6px; vertical-align: 1px; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mini-table th { text-align: right; color: var(--faint); font-weight: 500; font-size: 12.5px; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
.mini-table th:first-child, .mini-table td:first-child { text-align: left; }
.mini-table td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }

/* ---------- Fuentes ---------- */
.sources { display: flex; gap: 8px; flex-wrap: wrap; }
.source { display: inline-flex; align-items: center; gap: 7px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 10px; font-size: 13.5px; font-weight: 500; }
.source .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.source-ok .dot { background: var(--pass); }
.source-bad .dot { background: var(--fail); }
.source-warn .dot { background: var(--hold); }
.source .muted { font-weight: 400; }

.filter { max-width: 360px; }

/* ---------- Etiqueta de IMEI ---------- */
.idtag {
  display: inline-flex; align-items: stretch;
  font-family: var(--mono); font-size: 13.5px; font-weight: 500;
  border: 1px solid var(--line); border-radius: 5px; background: var(--bg);
  overflow: hidden; white-space: nowrap;
}
.idtag > span { padding: 2px 6px; }
.idtag-tac { color: var(--muted); }
.idtag-snr { color: var(--ink); padding-left: 0 !important; }
.idtag-cd { background: var(--panel-2); color: var(--muted); border-left: 1px solid var(--line); }
.idtag-plain { padding: 2px 7px; }
.idtag-big { font-size: 18px; }
.idtag-big > span { padding: 4px 9px; }
.serial { margin-top: 4px; }

/* ---------- Tablas ---------- */
.table-wrap { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-weight: 500; color: var(--faint); font-size: 12.5px; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.row-click { cursor: pointer; }
.row-click:hover td { background: var(--panel-2); }
.row-click.open td { background: var(--accent-tint); }
.row-alert td:first-child { box-shadow: inset 3px 0 0 var(--fail); }
.detail-row td { background: var(--bg); padding: 16px 18px 18px; }
.stack { display: flex; flex-direction: column; }
.more { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 14px; color: var(--muted); font-size: 13.5px; border-top: 1px solid var(--line-soft); }

.chip {
  display: inline-block; padding: 2px 9px; border-radius: 5px; font-size: 13px; font-weight: 500;
  background: var(--raise); color: var(--muted); white-space: nowrap; border: 1px solid transparent;
}
.chip-ok { background: var(--pass-tint); color: var(--pass); }
.chip-bad { background: var(--fail-tint); color: var(--fail); }
.chip-warn { background: var(--hold-tint); color: var(--hold); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.type-dot { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

.empty { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius-lg); padding: 40px 20px; text-align: center; color: var(--muted); }
.empty.error { color: var(--fail); border-color: rgba(240, 86, 79, 0.4); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }

/* ---------- Detalle de equipo ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; max-width: 760px; }
.detail-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px 16px; }
.detail-card h3 { color: var(--accent-text); }
.detail-card dl { margin: 0 0 10px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.other-source { color: var(--muted); font-size: 13.5px; margin: 10px 0 0; }

/* ---------- Búsqueda ---------- */
.search-bar { display: flex; gap: 10px; margin-bottom: 20px; max-width: 720px; }
.search-input { font-family: var(--mono); font-size: 18px !important; padding: 12px 14px !important; }
.search-bar .btn { padding: 0 20px; }
.search-results .sources { margin-bottom: 14px; }
.result-list { display: flex; flex-direction: column; gap: 16px; }
.result { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 18px; }
.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.result-model { color: var(--muted); margin-top: 8px; }
.result .detail-card { background: var(--panel-2); }

/* ---------- Importación por lote ---------- */
.bulk-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 18px; }
.bulk-input { min-height: 200px; }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius); padding: 26px 16px; color: var(--muted); cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); color: var(--ink); background: var(--accent-tint); }
.drop .icon { width: 26px; height: 26px; color: var(--accent-text); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.steps { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.steps li { margin-bottom: 6px; }
.progress { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; margin: 12px 0 4px; }
.progress > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.2s; }
.bulk-summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Tarjetas de administración ---------- */
.card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 20px 22px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.group-list { display: flex; flex-direction: column; gap: 16px; }
.group-head { display: flex; gap: 16px; align-items: flex-start; }
.group-head .chips { padding-top: 30px; }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; padding: 14px 0 6px; border-top: 1px solid var(--line-soft); margin-bottom: 8px; }
.perm input:disabled + * { opacity: 0.7; }
.integ-list { list-style: none; margin: 0 0 16px; padding: 0; }
.integ-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }

/* ---------- Diálogos y avisos ---------- */
.modal { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); color: var(--ink); background: var(--panel); }
.modal-wide { width: min(640px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(0, 0, 0, 0.6); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.modal-body { padding: 18px 20px 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.cred { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0 0 14px; align-items: center; }
.cred dt { color: var(--muted); }
.cred dd { margin: 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.secret { font-size: 18px; background: var(--bg); padding: 4px 10px; border-radius: 5px; letter-spacing: 0.03em; }
.notice { padding: 10px 12px; border-radius: var(--radius); font-size: 14px; }
.notice-ok { background: var(--pass-tint); color: var(--pass); }
.notice-warn { background: var(--hold-tint); color: var(--hold); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 16px); opacity: 0;
  background: var(--raise); color: var(--ink); border: 1px solid var(--line); padding: 11px 18px; border-radius: var(--radius); font-size: 14.5px; z-index: 50;
  transition: opacity 0.2s, transform 0.2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-bad { background: var(--fail); color: #fff; border-color: transparent; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .dash-grid, .dash-grid.even, .bulk-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 12px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .menu-toggle { display: inline-flex; }
  .sidebar .nav, .sidebar .sidebar-foot, .sidebar .sidebar-section { display: none; }
  .sidebar.open .nav, .sidebar.open .sidebar-foot, .sidebar.open .sidebar-section { display: flex; }
  .main { padding: 18px 16px 48px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .grid-2, .perm-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 24px; }
  .kv { grid-template-columns: 120px 1fr; }
  .search-bar { flex-direction: column; }
  .search-bar .btn { padding: 11px; }
  .group-head { flex-direction: column; }
  .group-head .chips { padding-top: 0; }
  .bar-row { grid-template-columns: 84px minmax(0, 1fr); }
  .bar-row .value { grid-column: 2; justify-content: flex-start; }
  .people .bar-cell { display: none; }
  .source-switch { width: 100%; }
  .source-switch button { flex: 1; justify-content: center; padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .toast, .source-switch button, .brand-mark, .progress > span { transition: none; }
}

/* Columnas de tablas */
.col-model { min-width: 170px; }
.col-alerts { min-width: 190px; }
.btn-square { padding: 6px; }
.btn-square[aria-busy="true"] { opacity: .55; cursor: progress; }
.col-actions .btn-row { flex-wrap: nowrap; }
.nowrap { white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.bulk-actions { margin: 12px 0 0; }

/* ---------- Menú: Dashboard con subsección plegable ---------- */
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-row { display: flex; align-items: center; gap: 2px; }
.nav-row .nav-link { flex: 1; }
.nav-arrow {
  flex: none; width: 30px; height: 34px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--muted); border-radius: var(--radius); cursor: pointer;
}
.nav-arrow:hover { background: var(--panel); color: var(--ink); }
.nav-arrow .icon { transition: transform .15s ease; }
.nav-arrow.open .icon { transform: rotate(90deg); }
.nav-sub { display: flex; flex-direction: column; gap: 2px; margin-left: 18px; padding-left: 10px; border-left: 1px solid var(--line-soft); }
.nav-sub[hidden] { display: none; }
.nav-child { font-size: 14px; padding: 7px 10px; }

/* ---------- Selector de periodo: Día | Semana ▾ | Mes ▾ | Total ▾ + fechas ---------- */
.period { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.range-switch {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
}
.range-seg { display: inline-flex; align-items: center; border-radius: 999px; }
.range-seg button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; }
.range-seg .main { padding: 7px 16px; border-radius: 999px; font-size: 14px; font-weight: 500; }
.range-seg.has-menu .main { padding-right: 6px; border-radius: 999px 0 0 999px; }
.range-seg .chev {
  display: grid; place-items: center; width: 28px; align-self: stretch;
  border-radius: 0 999px 999px 0; padding: 0 8px 0 2px;
}
.range-seg .chev .icon { width: 15px; height: 15px; transition: transform .15s ease; }
.range-seg .chev[aria-expanded="true"] .icon { transform: rotate(180deg); }
.range-seg:hover button { color: var(--ink); }
.range-seg.active { background: var(--accent); }
.range-seg.active button { color: var(--accent-ink); }
.range-seg.active .chev { border-left: 1px solid color-mix(in srgb, var(--accent-ink) 22%, transparent); }
.range-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.period-chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-soft); background: transparent; color: var(--muted);
  padding: 4px 10px; border-radius: 999px; font: inherit; font-size: 13px; cursor: pointer;
}
.period-chip .icon { width: 15px; height: 15px; }
.period-chip:hover { color: var(--ink); border-color: var(--line); }
.period-chip.custom { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

.period-menu {
  position: absolute; z-index: 60; width: 340px; max-width: calc(100vw - 24px);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45); padding: 8px;
}
.period-menu-title { font-size: 12.5px; color: var(--faint); padding: 6px 10px 4px; }
.period-list { display: flex; flex-direction: column; }
.period-item {
  display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 8px;
  border: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer;
  padding: 8px 10px; border-radius: 8px; font: inherit; font-size: 14px;
}
.period-item:hover, .period-item:focus-visible { background: var(--raise); outline: none; }
.period-item .check { color: var(--accent-text); font-weight: 600; }
.period-item .dates { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.period-item.active .label { color: var(--accent-text); font-weight: 600; }
.period-sep { height: 1px; background: var(--line-soft); margin: 6px 4px; }
.period-custom { padding: 6px 6px 4px; }
.period-custom-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin: 2px 4px 10px; }
.period-custom-title .icon { width: 16px; height: 16px; color: var(--accent-text); }
.period-dates { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; }
.period-dates label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.period-dates input {
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 8px; font: inherit; font-size: 13.5px; color-scheme: dark; min-width: 0;
}
.period-dates input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.period-dates .arrow { color: var(--faint); padding-bottom: 8px; }
.period-custom .hint { margin: 8px 4px 0; }
.period-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.hist-note {
  margin: -6px 0 14px; padding: 8px 12px; border-radius: 8px; font-size: 13px;
  background: var(--hold-tint); color: var(--hold);
}
.page-actions { align-items: flex-start; }
.status-note { color: var(--hold); }

/* ---------- Recuperar contraseña ---------- */
.link { color: var(--accent-text); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }
.notice p { margin: 6px 0 0; }
.notice-bad { background: var(--fail-tint); color: var(--fail); }
.auth .notice + .hint, .auth .notice + .btn { margin-top: 14px; }
.period-dates.one { grid-template-columns: 1fr; }

/* ---------- Tema claro / oscuro ---------- */
:root[data-theme='light'] .modal::backdrop { background: rgba(15, 23, 42, 0.35); }
:root[data-theme='light'] .period-menu { box-shadow: 0 16px 36px rgba(15, 23, 42, .16); }
.theme-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; margin: 0 2px 8px;
  border: 1px solid var(--line-soft); background: var(--bg); border-radius: 999px; cursor: pointer; font: inherit;
}
.theme-toggle .opt {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 5px 8px; border-radius: 999px; color: var(--muted); font-size: 13px; font-weight: 500;
}
.theme-toggle .opt .icon { width: 15px; height: 15px; }
.theme-toggle .opt.on { background: var(--raise); color: var(--ink); }
.theme-toggle .opt.on .icon { color: var(--accent-text); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Estaciones ---------- */
.week-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.week-strip .days { display: flex; gap: 6px; flex-wrap: wrap; }
.week-nav {
  width: 34px; height: 52px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--line-soft); background: var(--panel); color: var(--muted); cursor: pointer;
}
.week-nav:hover:not(:disabled) { color: var(--ink); border-color: var(--line); }
.week-nav:disabled { opacity: .35; cursor: default; }
.day-btn {
  position: relative; min-width: 62px; height: 52px; padding: 4px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  border: 1px solid var(--line-soft); background: var(--panel); color: var(--muted);
  border-radius: 10px; cursor: pointer; font: inherit;
}
.day-btn .dow { font-size: 12px; text-transform: capitalize; }
.day-btn .dom { font-size: 17px; font-weight: 600; color: var(--ink); line-height: 1.15; }
.day-btn .today-dot { position: absolute; top: -8px; right: 6px; font-size: 10.5px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.day-btn:hover:not(:disabled) { border-color: var(--line); color: var(--ink); }
.day-btn.active { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-text); }
.day-btn.active .dom { color: var(--accent-text); }
.day-btn:disabled { opacity: .35; cursor: default; }
.week-label { color: var(--faint); font-size: 13px; margin-left: 4px; }

.table.stations { font-variant-numeric: tabular-nums; }
.table.stations th.hr, .table.stations td.hr { text-align: center; width: 58px; padding-left: 4px; padding-right: 4px; }
.table.stations th.off { color: var(--hold); }
.table.stations td.off { background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--line-soft) 6px 7px); }
.table.stations th.tot, .table.stations td.tot { text-align: right; font-weight: 600; font-size: 16px; padding-right: 18px; border-left: 1px solid var(--line-soft); position: sticky; right: 0; background: var(--panel); }
.table.stations .st-col { position: sticky; left: 0; background: var(--panel); min-width: 230px; z-index: 1; }
.table.stations .code { font-family: var(--mono); font-size: 13.5px; font-weight: 500; }
.st-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.st-name .who { color: var(--accent-text); font-weight: 600; }
.st-name .tag { margin-left: 0; }
.st-edit { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.st-edit input { width: 150px; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 3px; border-radius: 5px; display: inline-grid; place-items: center; }
.icon-btn .icon { width: 15px; height: 15px; }
.icon-btn:hover { color: var(--accent-text); background: var(--raise); }
button.link { border: 0; background: transparent; padding: 0; cursor: pointer; font: inherit; }
.link.small { font-size: 12.5px; }
.table.stations td.h1 { background-color: color-mix(in srgb, var(--accent) 10%, transparent); }
.table.stations td.h2 { background-color: color-mix(in srgb, var(--accent) 20%, transparent); }
.table.stations td.h3 { background-color: color-mix(in srgb, var(--accent) 32%, transparent); }
.table.stations td.h4 { background-color: color-mix(in srgb, var(--accent) 46%, transparent); font-weight: 600; }
.table.stations .zero { color: var(--faint); }
.table.stations tr.idle .code { color: var(--muted); }
.table.stations tfoot th, .table.stations tfoot td { border-top: 2px solid var(--line); font-weight: 600; padding-top: 10px; padding-bottom: 10px; background: var(--panel-2); }
.table.stations tfoot .st-col, .table.stations tfoot .tot { background: var(--panel-2); }
.section-gap { margin-top: 22px; }
.narrow-2 { max-width: 360px; }

/* ---------- ADN: licencias ---------- */
:root { --lic-gsma: #2dd4bf; --lic-diagnostic: #5b9bd5; --lic-erasure: #3cc47c; --lic-esn: #e9b730; --lic-carrier: #e8773d; --lic-icloud: #a78bfa; --lic-mdm: #e06c9f; }
:root[data-theme='light'] { --lic-gsma: #0f9488; --lic-diagnostic: #3b82c4; --lic-erasure: #188a4b; --lic-esn: #b98a06; --lic-carrier: #d1621f; --lic-icloud: #7c5cd6; --lic-mdm: #c94784; }
.lic-diagnostic { --lic: var(--lic-diagnostic); }
.lic-erasure { --lic: var(--lic-erasure); }
.lic-esn { --lic: var(--lic-esn); }
.lic-gsma { --lic: var(--lic-gsma); }
.lic-carrier { --lic: var(--lic-carrier); }
.lic-icloud { --lic: var(--lic-icloud); }
.lic-mdm { --lic: var(--lic-mdm); }
.chart rect[class^='lic-'] { fill: var(--lic); }
.legend i[class^='lic-'] { background: var(--lic); }
.lic-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.lic-card {
  position: relative; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 12px;
  padding: 14px 14px 12px; border-top: 3px solid var(--lic); min-width: 0;
}
.lic-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.lic-top .swatch { width: 9px; height: 9px; border-radius: 3px; background: var(--lic); }
.lic-n { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin-top: 6px; color: var(--ink); }
.lic-pct { font-size: 12.5px; color: var(--muted); }
.lic-bar { height: 6px; border-radius: 4px; background: var(--lic); margin: 10px 0 8px; min-width: 2px; opacity: .9; }
.lic-hint { font-size: 12px; color: var(--faint); }
.lic-total { display: flex; justify-content: flex-end; align-items: baseline; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 14px; }
.lic-total strong { font-size: 22px; color: var(--ink); }
.lic-chip { background: color-mix(in srgb, var(--lic) 16%, transparent); color: var(--lic); font-weight: 600; }
.seg-accent { background: var(--accent); }
.adn-export { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -4px 0 14px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 10px; }
.adn-export .btn .icon { width: 17px; height: 17px; }
.kpi-accent .kpi-value { color: var(--accent-text); }
.bar-row .who { color: var(--accent-text); font-weight: 600; }
@media (max-width: 1280px) { .lic-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) { .lic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
