/* =========================================================================
   Asesor Group · Sistema Operativo de Créditos
   Paleta del manual de marca: Pantone 300 C (#005EB8) y 2985 C (#5BC2E7)
   Diseño: AIBRIX
   ========================================================================= */
/* Tipografías servidas desde el propio portal (Inter y Lexend, licencia SIL OFL) */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal.f837d382a885.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500-normal.42b95430773b.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-600-normal.75fb76ec3559.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/inter-latin-700-normal.3714175d15f3.woff2") format("woff2"); }
@font-face { font-family: "Lexend"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/lexend-latin-400-normal.dfb511ce66d1.woff2") format("woff2"); }
@font-face { font-family: "Lexend"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/lexend-latin-500-normal.6a18e7ab9174.woff2") format("woff2"); }
@font-face { font-family: "Lexend"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/lexend-latin-600-normal.0c7d09a39bbb.woff2") format("woff2"); }
@font-face { font-family: "Lexend"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/lexend-latin-700-normal.18e0e333dc1c.woff2") format("woff2"); }

:root {
  --brand: #005EB8;
  --brand-2: #5BC2E7;
  --brand-ink: #003F7D;
  --bg: #F3F6FB;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --surface-3: #EEF3F9;
  --text: #0E1B2E;
  --muted: #5A6A82;
  --faint: #8A98AD;
  --border: #E1E8F1;
  --ring: rgba(0, 94, 184, .28);
  --ok: #0E9F6E; --ok-bg: #E6F6EF;
  --warn: #B7791F; --warn-bg: #FDF4E3;
  --danger: #D33A4B; --danger-bg: #FCEBED;
  --info: #0B7EA8; --info-bg: #E5F5FB;
  --brand-bg: #E6F0FA;
  --muted-bg: #EEF1F5;
  --shadow: 0 1px 2px rgba(14, 27, 46, .05), 0 4px 16px rgba(14, 27, 46, .05);
  --shadow-lg: 0 12px 40px rgba(14, 27, 46, .14);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar: 256px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Lexend", "Inter", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --brand: #3D9BF0;
  --brand-2: #5BC2E7;
  --brand-ink: #9CCBFA;
  --bg: #08111F;
  --surface: #0F1A2B;
  --surface-2: #132036;
  --surface-3: #18283F;
  --text: #E6EDF7;
  --muted: #9AA9BF;
  --faint: #6B7C95;
  --border: #213350;
  --ring: rgba(61, 155, 240, .35);
  --ok: #34D399; --ok-bg: rgba(52, 211, 153, .12);
  --warn: #F6C35B; --warn-bg: rgba(246, 195, 91, .12);
  --danger: #F87185; --danger-bg: rgba(248, 113, 133, .12);
  --info: #5BC2E7; --info-bg: rgba(91, 194, 231, .12);
  --brand-bg: rgba(61, 155, 240, .14);
  --muted-bg: rgba(154, 169, 191, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 600; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.ic { width: 16px; height: 16px; vertical-align: -3px; flex: none; }
.logo { width: 40px; height: 40px; flex: none; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand svg { width: 38px; height: 38px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 16px; line-height: 1.1; }
.brand-name b { color: var(--brand); font-weight: 600; }
.brand-name span { color: var(--brand-2); }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.nav-group { margin-top: 14px; }
.nav-title { font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); padding: 0 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: 13.5px; text-decoration: none;
}
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--brand-bg); color: var(--brand); }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav .count {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--muted); font-size: 11.5px; font-weight: 600; text-align: center;
}
.nav a.active .count { background: var(--brand); color: #fff; }
.nav .count.alert { background: var(--danger-bg); color: var(--danger); }
.sidebar-foot { margin-top: auto; padding: 14px 10px 0; font-size: 11px; color: var(--faint); border-top: 1px solid var(--border); }
.sidebar-foot b { color: var(--brand); }
.sidebar-foot > div + div { margin-top: 2px; }
/* Firma AIBRIX: degradado violeta → cian → magenta en movimiento suave */
.aibrix {
  font-family: var(--font-display); font-weight: 700; letter-spacing: .14em;
  background: linear-gradient(90deg, #6D28D9, #0891B2, #DB2777, #6D28D9);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: aibrix-flow 6s ease-in-out infinite;
}
:root[data-theme="dark"] .aibrix { background-image: linear-gradient(90deg, #A78BFA, #22D3EE, #F472B6, #A78BFA); }
@keyframes aibrix-flow { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .search { flex: 1; max-width: 460px; position: relative; }
.topbar .search input { padding-left: 36px; background: var(--surface); }
.topbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.topbar .spacer { flex: 1; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--faint); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-toggle { display: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.avatar {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 600; font-size: 12.5px;
}
.user-chip .who { line-height: 1.15; font-size: 12.5px; }
.user-chip .who small { color: var(--muted); font-size: 11px; }
.user-chip form { margin: 0; }

.content { padding: 24px 28px 48px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* ---------- Cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.card-body { padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .t { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .v { font-family: var(--font-display); font-size: 26px; font-weight: 600; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 11.5px; color: var(--faint); }
.kpi::after { content: ""; position: absolute; right: -24px; top: -24px; width: 80px; height: 80px; border-radius: 50%; background: var(--brand-bg); }
.kpi:nth-child(even)::after { background: var(--info-bg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font: 500 13.5px var(--font); cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { background: color-mix(in srgb, var(--ok) 88%, #000); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--faint); }
.btn-soft { background: var(--brand-bg); color: var(--brand); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
label, .label { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: 14px var(--font); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); background: var(--surface); }
textarea { resize: vertical; min-height: 70px; }
textarea.plantilla { font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.6; min-height: 340px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); vertical-align: middle; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field.full { grid-column: 1 / -1; }
.field .help { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.field .errors { color: var(--danger); font-size: 12px; margin-top: 4px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); background: var(--danger-bg); }
.field.changed input, .field.changed select { border-color: var(--warn); }
.field .hint-raw { font-size: 11.5px; color: var(--warn); margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); margin: 0; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.filters .f { min-width: 140px; flex: 1; }
.filters .f.wide { flex: 2; min-width: 200px; }
.filters label { font-size: 11.5px; margin-bottom: 3px; }
.filters input, .filters select { padding: 7px 10px; font-size: 13px; }

/* Selector segmentado (Viable / No viable) */
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.segmented > div { margin: 0; }
.segmented label { margin: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label span {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 8px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--border); background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 13px; text-align: center;
}
.segmented input:checked + span { border-color: var(--brand); background: var(--brand-bg); color: var(--brand); }
.segmented .opt-VIABLE input:checked + span { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.segmented .opt-NO_VIABLE input:checked + span { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.segmented input:focus-visible + span { box-shadow: 0 0 0 3px var(--ring); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--faint); padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table .strong { font-weight: 600; color: var(--text); }
.table .sub { display: block; font-size: 11.5px; color: var(--muted); }
.table.compact td, .table.compact th { padding: 8px 12px; }
.table tr.top td { background: color-mix(in srgb, var(--ok-bg) 60%, transparent); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-brand { background: var(--brand-bg); color: var(--brand); }
.badge-muted { background: var(--muted-bg); color: var(--muted); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; font-weight: 500; }
.tag-top { background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; }
.aging { display: inline-block; min-width: 44px; text-align: center; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.aging-ok { background: var(--ok-bg); color: var(--ok); }
.aging-warn { background: var(--warn-bg); color: var(--warn); }
.aging-danger { background: var(--danger-bg); color: var(--danger); }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 12px; padding: 12px 16px; border-radius: 12px; border: 1px solid transparent; margin-bottom: 14px; font-size: 13.5px; }
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert .alert-body { color: var(--text); }
.alert .alert-body b { color: inherit; }
.messages { position: fixed; right: 20px; bottom: 20px; z-index: 50; width: min(420px, calc(100vw - 32px)); }
.messages .alert { box-shadow: var(--shadow-lg); background: var(--surface); animation: slidein .25s ease-out; }
@keyframes slidein { from { opacity: 0; transform: translateY(10px); } }

/* Comparación de datos (celular duplicado) */
.compare { border: 1.5px solid var(--warn); border-radius: var(--radius); background: var(--warn-bg); padding: 18px 20px; margin-bottom: 18px; }
.compare h2 { color: var(--warn); display: flex; align-items: center; gap: 10px; }
.compare table { background: var(--surface); border-radius: 10px; overflow: hidden; margin-top: 14px; }
.compare td.diff { background: var(--warn-bg); font-weight: 600; }
.compare .arrow { color: var(--faint); }

/* ---------- Pipeline (stepper) ---------- */
.pipeline { display: flex; gap: 4px; overflow-x: auto; padding: 4px 0 2px; }
.pipeline .step { flex: 1; min-width: 110px; position: relative; padding: 10px 12px 10px 18px; background: var(--surface-3); color: var(--faint); font-size: 11.5px; font-weight: 600;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); }
.pipeline .step:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: 8px 0 0 8px; }
.pipeline .step.done { background: var(--brand-bg); color: var(--brand); }
.pipeline .step.now { background: var(--brand); color: #fff; }
.pipeline .step.bad { background: var(--danger); color: #fff; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: -6px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); }
.timeline .when { font-size: 11.5px; color: var(--faint); }
.timeline .what { font-weight: 600; font-size: 13px; }
.timeline .who { font-size: 12px; color: var(--muted); }

/* Datos clave/valor */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.tabs a { padding: 12px 12px; color: var(--muted); font-weight: 500; font-size: 13px; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs a .count { margin-left: 6px; font-size: 11px; background: var(--surface-3); padding: 1px 7px; border-radius: 999px; }

/* Barras simples */
.bar { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: inherit; }
.bar.danger > i { background: var(--danger); }
.bar.ok > i { background: var(--ok); }

/* Embudo visual */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel .lvl { display: grid; grid-template-columns: 180px 1fr 90px; gap: 12px; align-items: center; font-size: 12.5px; }
.funnel .lvl .name { color: var(--muted); font-weight: 500; }
.funnel .lvl .track { height: 30px; background: var(--surface-3); border-radius: 8px; overflow: hidden; }
.funnel .lvl .fill { height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); display: flex; align-items: center; padding-left: 10px; color: #fff; font-weight: 700; min-width: 34px; }
.funnel .lvl .conv { text-align: right; font-variant-numeric: tabular-nums; }
.funnel .lvl .conv small { display: block; color: var(--faint); }

.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }

/* Empty state */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; color: var(--faint); margin-bottom: 10px; }

/* Pagination */
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.pager .row { gap: 6px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art {
  position: relative; overflow: hidden; color: #fff; padding: 48px;
  background: radial-gradient(800px 500px at 0% 0%, #0a74d6 0%, transparent 60%), linear-gradient(160deg, #005EB8 0%, #003F7D 100%);
  display: flex; flex-direction: column; justify-content: space-between;
}
.login-art .arc { position: absolute; border-radius: 50%; border: 56px solid; opacity: .9; }
.login-art .arc.a { width: 520px; height: 520px; right: -200px; bottom: -220px; border-color: #5BC2E7; }
.login-art .arc.b { width: 360px; height: 360px; left: -150px; top: 30%; border-color: rgba(255, 255, 255, .9); clip-path: inset(0 50% 0 0); }
.login-art .arc.c { width: 300px; height: 300px; right: 80px; top: -170px; border-color: rgba(91, 194, 231, .55); }
.login-art h1 { font-size: 40px; line-height: 1.1; font-weight: 600; max-width: 460px; position: relative; }
.login-art p { max-width: 420px; color: rgba(255, 255, 255, .82); font-size: 15px; position: relative; }
.login-art .logo-w { display: flex; align-items: center; gap: 12px; position: relative; font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.login-art .logo-w svg { width: 52px; height: 52px; }
.login-art .foot { position: relative; font-size: 12px; color: rgba(255, 255, 255, .7); }
.login-form { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.login-card { width: min(400px, 100%); }
.login-card h2 { font-size: 24px; margin-bottom: 6px; }
.login-card .field { margin-bottom: 14px; }
.theme-float { position: fixed; top: 16px; right: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 30; }
  .menu-toggle { display: inline-grid; }
  .g2, .g3, .g4, .g-main { grid-template-columns: minmax(0, 1fr); }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .user-chip .who { display: none; }
  .content { padding: 18px 16px 40px; }
  .topbar { padding: 10px 16px; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .segmented { grid-template-columns: repeat(2, 1fr); }
  .funnel .lvl { grid-template-columns: 1fr 70px; }
  .funnel .lvl .name { grid-column: 1 / -1; }
  .kv { grid-template-columns: 110px 1fr; }
}
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .app { display: block; }
}

/* =========================================================================
   Guía de uso, recorrido interactivo y seguridad (v1.2)
   ========================================================================= */
.btn-lg { padding: 12px 20px; font-size: 14.5px; border-radius: 12px; }
.icon-btn.icon-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.icon-btn.icon-ok { color: var(--ok); }

/* Menú «Guía de uso» destacado */
.nav a.guia-link.destacado { position: relative; color: var(--brand); background: linear-gradient(90deg, var(--brand-bg), transparent); }
.nav a.guia-link.destacado::after {
  content: ""; position: absolute; inset: 0; border-radius: 10px; pointer-events: none;
  animation: guia-pulso 2.2s ease-out infinite;
}
.nav .count.nuevo { background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; font-size: 10.5px; letter-spacing: .02em; }
@keyframes guia-pulso { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 50%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Tarjeta de bienvenida (coach mark) */
.coach {
  position: fixed; left: calc(var(--sidebar) + 18px); top: 97px; z-index: 45; width: 340px;
  display: flex; gap: 12px; padding: 16px; border-radius: 16px; background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--border)); box-shadow: var(--shadow-lg);
  animation: coach-in .5s cubic-bezier(.2, .9, .3, 1.2);
}
.coach[hidden] { display: none; }
.coach::before { content: ""; position: absolute; left: -8px; top: 22px; width: 14px; height: 14px; background: var(--surface); border-left: 1px solid color-mix(in srgb, var(--brand) 35%, var(--border)); border-bottom: 1px solid color-mix(in srgb, var(--brand) 35%, var(--border)); transform: rotate(45deg); }
.coach p { margin: 4px 0 10px; color: var(--muted); font-size: 12.5px; }
.coach-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.coach-ico .ic { width: 20px; height: 20px; }
@keyframes coach-in { from { opacity: 0; transform: translateX(-12px) scale(.96); } }
@media (max-width: 980px) { .coach { left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; } .coach::before { display: none; } }

/* Banner recomendación 2FA */
.banner-2fa { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 16px; border-radius: 12px; font-size: 13px; flex-wrap: wrap;
  background: linear-gradient(90deg, var(--brand-bg), var(--info-bg)); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.banner-2fa > .ic { color: var(--brand); width: 20px; height: 20px; }
.banner-2fa > div { flex: 1; min-width: 220px; }
.banner-2fa[hidden] { display: none; }

/* Hero de la guía */
.guia-hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: center; padding: 28px; border-radius: 20px; color: #fff; overflow: hidden; position: relative;
  background: radial-gradient(600px 300px at 0% 0%, #0a74d6 0%, transparent 60%), linear-gradient(140deg, #005EB8, #003F7D); }
.guia-hero::after { content: ""; position: absolute; width: 360px; height: 360px; right: -120px; bottom: -200px; border-radius: 50%; border: 44px solid rgba(91, 194, 231, .55); }
.guia-hero h1 { font-size: 30px; margin: 10px 0 8px; }
.guia-hero p { color: rgba(255, 255, 255, .85); max-width: 560px; margin: 0; }
.guia-hero .btn-ghost { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .3); }
.guia-hero .btn-primary { background: #fff; color: #005EB8; }
.guia-hero-art { display: flex; flex-direction: column; gap: 8px; position: relative; z-index: 1; max-height: 260px; overflow: hidden; mask-image: linear-gradient(#000 70%, transparent); -webkit-mask-image: linear-gradient(#000 70%, transparent); }
.hero-chip { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .12); backdrop-filter: blur(6px); font-size: 12.5px; font-weight: 500;
  animation: chip-in .6s both; animation-delay: calc(var(--i) * 70ms); }
@keyframes chip-in { from { opacity: 0; transform: translateX(20px); } }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.check-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.check-list .ic { color: var(--ok); margin-top: 2px; }
.guia-indice { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.guia-item { display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; }
.guia-item:hover { border-color: var(--brand); background: var(--brand-bg); }
.guia-item small { display: block; color: var(--muted); font-size: 11.5px; }
.guia-item.ajeno { opacity: .62; }
.gi-ico { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-bg); color: var(--brand); }
.gi-ico .ic { width: 18px; height: 18px; }

/* Recorrido (modal) */
.tour { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(5, 14, 28, .62); backdrop-filter: blur(4px); animation: fade .2s; }
.tour[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.tour-box { width: min(1060px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.tour-top { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.tour-prog { flex: 1; height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.tour-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .35s ease; }
.tour-step { display: grid; grid-template-columns: 1.05fr 1fr; gap: 26px; padding: 24px 26px; animation: step-in .35s ease; }
.tour-step[hidden] { display: none; }
@keyframes step-in { from { opacity: 0; transform: translateX(16px); } }
.tour-text h2 { font-size: 22px; margin: 12px 0 14px; }
.tour-block { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 10px; }
.tour-block h4 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); display: flex; gap: 6px; align-items: center; }
.tour-block p { margin: 0; font-size: 13.5px; }
.tour-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }
.tour-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.tour-dots button { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 0; background: var(--surface-3); cursor: pointer; transition: width .2s; }
.tour-dots button.on { background: var(--brand); width: 22px; border-radius: 6px; }
.tour-fin { grid-template-columns: 1fr; text-align: center; padding: 48px 24px; }
.fin-badge { width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 22px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); animation: pop .6s cubic-bezier(.2, .9, .3, 1.4); }
.fin-badge .ic { width: 36px; height: 36px; }
@keyframes pop { from { transform: scale(.3) rotate(-20deg); opacity: 0; } }
@media (max-width: 860px) { .tour-step, .guia-hero { grid-template-columns: 1fr; } .guia-hero-art { display: none; } }

/* Maquetas del recorrido */
.mock { border-radius: 14px; border: 1px solid var(--border); background: var(--bg); overflow: hidden; box-shadow: var(--shadow); font-size: 12.5px; }
.mock-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: var(--surface-3); border-bottom: 1px solid var(--border); }
.mock-bar i { width: 9px; height: 9px; border-radius: 50%; background: #F87171; }
.mock-bar i:nth-child(2) { background: #FBBF24; }
.mock-bar i:nth-child(3) { background: #34D399; }
.mock-bar span { margin-left: 8px; font-weight: 600; color: var(--muted); font-size: 12px; }
.mock-bar em { margin-left: auto; font-style: normal; }
.mock-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.mk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mk-grid .full { grid-column: 1 / -1; }
.mk-label, .mk-field > span { font-size: 11px; font-weight: 600; color: var(--muted); }
.mk-field { display: flex; flex-direction: column; gap: 4px; padding: 4px; border-radius: 10px; }
.mk-field small.ok { color: var(--ok); font-size: 11px; }
.mk-field small.err { color: var(--danger); font-size: 11px; }
.mk-field.bad .mk-input { border-color: var(--danger); background: var(--danger-bg); }
.mk-input { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-weight: 500; }
.mk-text { margin: 0; padding: 10px; border-radius: 8px; border: 1px dashed var(--border); background: var(--surface); font: 11.5px/1.55 ui-monospace, Consolas, monospace; white-space: pre-wrap; }
.mk-right { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.mk-btn { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; }
.mk-btn.primary { background: var(--brand); color: #fff; border-color: transparent; }
.mk-btn.ok { background: var(--ok); color: #fff; border-color: transparent; }
.mk-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--muted-bg); color: var(--muted); }
.mk-chip.ok { background: var(--ok-bg); color: var(--ok); }
.mk-chip.warn { background: var(--warn-bg); color: var(--warn); }
.mk-chip.danger { background: var(--danger-bg); color: var(--danger); }
.mk-chip.brand { background: var(--brand-bg); color: var(--brand); }
.mk-chip.info { background: var(--info-bg); color: var(--info); }
.mk-chip.top { background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; }
.mk-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.mk-alert { padding: 8px 10px; border-radius: 8px; font-size: 12px; }
.mk-alert.danger { background: var(--danger-bg); color: var(--danger); }
.mk-alert.warn { background: var(--warn-bg); color: var(--warn); }
.mk-alert.info { background: var(--info-bg); color: var(--info); }
.mk-compare { display: grid; grid-template-columns: 70px 1fr 16px 1fr; gap: 6px; padding: 8px 10px; border-radius: 8px; background: var(--warn-bg); }
.mk-check { padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-weight: 600; }
.mk-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mk-seg span { text-align: center; padding: 9px 4px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); font-weight: 600; color: var(--muted); font-size: 11.5px; }
.mk-seg .on-ok { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.mk-note { font-size: 11.5px; color: var(--muted); padding: 6px 2px; }
.mk-age { padding: 2px 8px; border-radius: 6px; font-weight: 700; font-size: 11px; }
.mk-age.ok { background: var(--ok-bg); color: var(--ok); }
.mk-age.warn { background: var(--warn-bg); color: var(--warn); }
.mk-age.danger { background: var(--danger-bg); color: var(--danger); }
.mk-map { display: flex; align-items: center; gap: 8px; color: var(--faint); }
.mk-map > span:first-child { min-width: 170px; color: var(--text); font-weight: 600; font-size: 11.5px; }
.mk-map small { color: var(--faint); }
.mk-flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--faint); }
.mk-done { text-align: center; padding: 12px; border-radius: 10px; background: var(--ok-bg); color: var(--ok); font-weight: 700; }
.mk-funnel { align-items: center; gap: 4px; }
.mk-stage { padding: 8px 12px; border-radius: 10px; color: #fff; font-weight: 600; display: flex; gap: 10px; }
.mk-stage b { width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, .25); display: grid; place-items: center; font-size: 11px; }
.mk-stage.s1 { background: #0B7EA8; width: 100%; }
.mk-stage.s2 { background: #0a6fc9; width: 92%; }
.mk-stage.s3 { background: #005EB8; width: 84%; }
.mk-stage.s4 { background: #1f4fa8; width: 76%; }
.mk-stage.s5 { background: #2a4596; width: 68%; }
.mk-stage.s6 { background: #0E9F6E; width: 60%; }
.mk-arrow { color: var(--faint); line-height: 1; }
.mk-side { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.mk-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mk-kpis > div { padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.mk-kpis small { display: block; color: var(--muted); font-size: 10.5px; }
.mk-kpis b { font-family: var(--font-display); font-size: 18px; }
.mk-bars { display: flex; flex-direction: column; gap: 5px; }
.mk-bars span { width: var(--w); min-width: 34px; padding: 4px 8px; border-radius: 6px; color: #fff; font-weight: 700; font-size: 11px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.mk-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mk-tiles > div { padding: 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-weight: 600; }
.mk-tiles small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.mk-sec { flex-direction: row; align-items: center; gap: 16px; }
.mk-qr { flex: none; width: 110px; height: 110px; border-radius: 10px; background: conic-gradient(var(--text) 25%, transparent 0 50%, var(--text) 0 75%, transparent 0) 0 0 / 22px 22px, var(--surface); border: 8px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.mk-otp { display: flex; gap: 6px; margin-top: 4px; }
.mk-otp span { width: 30px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: var(--surface); border: 1.5px solid var(--brand); font: 700 17px var(--font-display); }
/* Resaltado animado del elemento clave de cada paso */
.hl { position: relative; outline: 2px solid var(--brand-2); outline-offset: 2px; border-radius: 10px; animation: hl-pulso 1.8s ease-in-out infinite; }
@keyframes hl-pulso { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-2) 55%, transparent); } 50% { box-shadow: 0 0 0 7px transparent; } }

/* 2FA */
.otp-input { font: 600 22px var(--font-display) !important; letter-spacing: .35em; text-align: center; }
.otp-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); margin-bottom: 14px; }
.otp-icon .ic { width: 26px; height: 26px; }
.qr-box { display: inline-block; padding: 10px; background: #fff; border-radius: 14px; box-shadow: var(--shadow); }
.qr-box svg { width: 220px; height: 220px; display: block; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.codes span { font: 600 16px ui-monospace, Consolas, monospace; text-align: center; padding: 10px; border-radius: 10px; background: var(--surface-3); letter-spacing: .08em; }
.steps-list { margin: 0 0 16px; padding-left: 20px; line-height: 1.8; font-size: 13.5px; }
.faq dt { font-weight: 600; margin-top: 10px; font-size: 13px; }
.faq dd { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

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

/* =========================================================================
   Celular: nada puede ser más ancho que la pantalla (v1.3)
   ========================================================================= */
html, body { max-width: 100%; overflow-x: clip; }
.main, .content, .grid > *, .card, .stack > *, .form-grid > *, .field { min-width: 0; }
pre, img, svg, canvas, video, iframe { max-width: 100%; }
input, select, textarea, .btn { max-width: 100%; }
.kv dd, .table .sub, .alert-body { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .page-head { align-items: flex-start; }
  .page-head .row { width: 100%; }
  .page-head .row .btn { flex: 1; }
  .card-head { flex-wrap: wrap; }
  .filters .f, .filters .f.wide { min-width: 100%; }
  .filters .row { width: 100%; }
  .user-chip { gap: 6px; }
  .topbar { gap: 8px; }
  .topbar .search input::placeholder { font-size: 12px; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { flex: 1 1 auto; }
  .pager { flex-direction: column; gap: 8px; }
  .mk-map > span:first-child { min-width: 0; }
  .mk-compare { grid-template-columns: 1fr; }
  .mk-seg, .mk-tiles, .mk-kpis { grid-template-columns: repeat(2, 1fr); }
  .mk-sec { flex-direction: column; }
  .codes { grid-template-columns: 1fr; }
  .tour { padding: 0; }
  .tour-box { max-height: 100vh; border-radius: 0; }
  .tour-step { padding: 16px; gap: 16px; }
  .tour-nav .btn { padding: 8px 10px; }
  .guia-hero { padding: 20px; }
  .guia-hero h1 { font-size: 24px; }
  .guia-hero .row .btn { width: 100%; }
  .qr-box svg { width: 180px; height: 180px; }
  .compare { padding: 14px; }
}
.timeline li.vacio { padding-left: 0; color: var(--muted); font-size: 12.5px; }
.timeline li.vacio::before, .timeline li.vacio::after { display: none; }

/* =========================================================================
   Menú lateral plegable (escritorio)
   ========================================================================= */
.nav-colapsar {
  position: absolute; top: 24px; right: 10px; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; transition: transform .2s, color .15s;
}
.nav-colapsar:hover { color: var(--brand); border-color: var(--brand); }
.app { transition: grid-template-columns .2s ease; }
@media (min-width: 981px) {
  :root[data-nav="plegado"] { --sidebar: 76px; }
  :root[data-nav="plegado"] .sidebar { padding: 18px 10px; overflow-x: hidden; }
  :root[data-nav="plegado"] .sidebar .txt { display: none; }
  :root[data-nav="plegado"] .brand { justify-content: center; padding: 4px 0 52px; }
  :root[data-nav="plegado"] .nav-colapsar { right: 50%; transform: translateX(50%) rotate(180deg); top: 70px; }
  :root[data-nav="plegado"] .nav a { justify-content: center; padding: 10px 0; position: relative; }
  :root[data-nav="plegado"] .nav a .ic { width: 20px; height: 20px; }
  :root[data-nav="plegado"] .nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
  :root[data-nav="plegado"] .nav .count { position: absolute; top: 3px; right: 8px; min-width: 0; padding: 0 4px; font-size: 9.5px; line-height: 15px; }
  :root[data-nav="plegado"] .nav .count.nuevo { width: 9px; height: 9px; padding: 0; font-size: 0; }
  :root[data-nav="plegado"] .coach { left: calc(76px + 18px); }
}
@media (max-width: 980px) { .nav-colapsar { display: none; } }
[hidden] { display: none !important; }

/* Barra de acciones masivas */
.bulkbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; background: var(--brand-bg); border-bottom: 1px solid var(--border); position: sticky; top: 63px; z-index: 5; }
.bulkbar .spacer { flex: 1; }
.table tr.sel td { background: color-mix(in srgb, var(--brand-bg) 70%, transparent); }

/* Listas desplegables con búsqueda */
.bsel { position: relative; width: 100%; }
.bsel-nativo { position: absolute !important; inset: 0; opacity: 0; pointer-events: none; width: 100% !important; height: 100% !important; }
.bsel-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 14px var(--font); text-align: left; cursor: pointer; }
.bsel-btn:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); background: var(--surface); }
.bsel-btn.vacio .bsel-txt { color: var(--faint); }
.bsel-btn:disabled { opacity: .6; cursor: not-allowed; }
.bsel-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bsel-btn svg { width: 16px; height: 16px; flex: none; color: var(--faint); transition: transform .15s; }
.bsel.abierto .bsel-btn svg { transform: rotate(180deg); }
.bsel-sm .bsel-btn { padding: 7px 10px; font-size: 13px; }
.has-error .bsel-btn { border-color: var(--danger); background: var(--danger-bg); }
.bsel-panel { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px; }
.bsel.arriba .bsel-panel { top: auto; bottom: calc(100% + 4px); }
.bsel-buscar { width: 100%; padding: 8px 10px !important; font-size: 13px !important; margin-bottom: 6px; }
.bsel-lista { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; overscroll-behavior: contain; }
.bsel-lista li { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.bsel-lista li:hover, .bsel-lista li.act { background: var(--surface-3); }
.bsel-lista li.sel { color: var(--brand); font-weight: 600; }
.bsel-lista li.nulo { color: var(--faint); }
.bsel-vacio { padding: 10px; color: var(--muted); font-size: 13px; text-align: center; }

/* =========================================================================
   Alertas y notificaciones
   ========================================================================= */
.nivel-critica { --nv: var(--danger); --nv-bg: var(--danger-bg); }
.nivel-alta { --nv: var(--warn); --nv-bg: var(--warn-bg); }
.nivel-media { --nv: var(--brand); --nv-bg: var(--brand-bg); }
.nivel-info { --nv: var(--muted); --nv-bg: var(--muted-bg); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--nv, var(--brand)); flex: none; }
.campana { position: relative; }
.campana .icon-btn { position: relative; }
.campana-n { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--brand); color: #fff; font: 700 10.5px/19px var(--font); text-align: center; border: 2px solid var(--bg); }
.campana-n.alta { background: var(--warn); }
.campana-n.critica { background: var(--danger); animation: campana-pulso 2s infinite; }
@keyframes campana-pulso { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 50%, transparent); } 60% { box-shadow: 0 0 0 7px transparent; } }
.campana-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: calc(100vw - 24px); z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.campana-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.campana-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: var(--text); text-decoration: none !important; border-left: 3px solid var(--nv); }
.campana-item:hover { background: var(--surface-2); }
.ci-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--nv-bg); color: var(--nv); flex: none; }
.ci-txt { flex: 1; min-width: 0; font-size: 13px; }
.ci-txt b { display: block; font-weight: 600; }
.ci-txt small { color: var(--muted); font-size: 11px; }
.ci-n { font: 700 14px var(--font-display); color: var(--nv); }
.campana-vacia { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px; color: var(--ok); text-align: center; }
.campana-vacia small { color: var(--muted); }
.campana-pie { display: block; padding: 11px 14px; text-align: center; font-weight: 600; font-size: 13px; border-top: 1px solid var(--border); background: var(--surface-2); }

.resumen-login { position: fixed; right: 20px; top: 76px; z-index: 55; width: 380px; max-width: calc(100vw - 32px); display: flex; gap: 12px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: coach-in .5s cubic-bezier(.2, .9, .3, 1.2); }
.resumen-login ul { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 5px; font-size: 13px; }
.resumen-login li { display: flex; align-items: center; gap: 8px; }
.rl-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; background: var(--brand); }
.rl-ico.critica { background: var(--danger); } .rl-ico.alta { background: var(--warn); } .rl-ico.ok { background: var(--ok); }
.rl-ico .ic { width: 20px; height: 20px; }
.rl-txt { flex: 1; min-width: 0; }
.rl-x { position: absolute; top: 8px; right: 8px; border: 0; background: none; color: var(--faint); cursor: pointer; padding: 4px; }

.alertas-resumen { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.ar-chip { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px; background: var(--nv-bg); color: var(--nv); text-decoration: none !important; border: 1px solid color-mix(in srgb, var(--nv) 30%, transparent); }
.ar-chip b { font: 700 22px var(--font-display); }
.ar-chip span { font-weight: 600; font-size: 13px; }
.alertas-grupo { margin-bottom: 22px; scroll-margin-top: 80px; }
.ag-titulo { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 16px; }
.card.alerta { border-top: 3px solid var(--nv); }
.al-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--nv-bg); color: var(--nv); flex: none; }
.al-ico .ic { width: 19px; height: 19px; }
.al-n { font: 700 26px var(--font-display); color: var(--nv); }
.al-caso { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--text); text-decoration: none !important; }
.al-caso:hover { background: var(--surface-3); }
.al-caso small { display: block; color: var(--muted); font-size: 11.5px; }
@media (max-width: 640px) { .resumen-login { right: 16px; left: 16px; width: auto; top: 70px; } }

/* =========================================================================
   MOBILE FIRST (v1.4) — reglas finales para celular. Van al final a propósito.
   ========================================================================= */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Campos de fecha: Safari (iPhone) les da un ancho mínimo propio y centra el texto */
input[type="date"], input[type="time"], input[type="datetime-local"] {
  -webkit-appearance: none; appearance: none; display: block;
  width: 100%; min-width: 0; max-width: 100%; min-height: 40px; line-height: 1.3; text-align: left;
}
input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; min-height: 1.3em; }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }

/* Elementos solo para celular / solo para escritorio */
.solo-movil { display: none !important; }
.filtros-toggle { display: none; }

@media (max-width: 980px) {
  .solo-movil { display: revert !important; }
  .nav .nav-group.solo-movil { display: block !important; }
  .solo-escritorio { display: none !important; }
  .main { min-height: 100vh; }
  .topbar .search { flex: 1; max-width: none; min-width: 0; }
  .user-chip { padding: 3px; border: 0; background: none; }
}

@media (max-width: 640px) {
  /* iPhone no hace zoom al escribir si el texto mide 16 px o más */
  input, select, textarea, .bsel-btn, .bsel-buscar, .otp-input { font-size: 16px !important; }
  input[type="date"] { min-height: 44px; }
  .btn { min-height: 40px; }
  h1 { font-size: 22px; }
  .content { padding: 16px 14px 40px; }
  .card-head, .card-body, .card-pad { padding-left: 14px; padding-right: 14px; }
  .topbar { padding: 10px 14px; }
  .topbar .icon-btn { width: 40px; height: 40px; }

  /* Filtros: en celular se pliegan detrás de un botón */
  .filters { padding: 12px 14px; gap: 10px; }
  .filters.plegable .filtros-toggle { display: inline-flex; }
  .filters.plegable:not(.abierta) > .f:not(.wide) { display: none; }
  .filters .f:has(input[type="date"]) { flex: 1 1 calc(50% - 5px); min-width: 0 !important; }
  .filters .f.wide { flex: 1 1 100%; }
  .filters .row { flex-wrap: wrap; }
  .filters .row .btn { flex: 1 1 auto; }

  .kpi .v { font-size: 22px; }
  .page-head p { font-size: 13.5px; }
  .resumen-login { top: auto; bottom: 16px; }
}
.nav .nav-boton { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: var(--muted); font: 500 13.5px var(--font); cursor: pointer; text-align: left; }
.nav .nav-boton:hover { background: var(--surface-3); color: var(--danger); }
.nav .nav-boton .ic { width: 18px; height: 18px; }
.tour-box { overflow-x: hidden; }

/* IA */
.tag-ia { background: linear-gradient(90deg, #6D28D9, #0891B2); color: #fff; font-weight: 700; letter-spacing: .06em; }
.ia-card { border-top: 3px solid #6D28D9; }
.ia-cargando { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--brand-bg); color: var(--brand); font-weight: 500; font-size: 13.5px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: girar .8s linear infinite; flex: none; }
@keyframes girar { to { transform: rotate(360deg); } }
input[type="file"] { width: 100%; max-width: 100%; padding: 9px; border-radius: var(--radius-sm); border: 1px dashed var(--border); background: var(--surface-2); color: var(--text); font: 14px var(--font); }
.kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) { .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
