/* Su Compañía — Gestión
   Tokens en :root; el modo oscuro los redefine. La marca (--brand, --navy,
   --brand-soft) la completa scripts/generar.py con el color de la empresa. */

:root {
  --brand: #23397f;
  --brand-ink: #ffffff;
  --brand-soft: #e5e7f0;
  --navy: #14214a;
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #eef0f5;
  --line: #dde1ea;
  --line-strong: #c3c9d6;
  --ink: #121a2e;
  --ink-2: #48526a;
  --ink-3: #737c92;
  --ok: #157a4a;
  --ok-soft: #e2f3ea;
  --warn: #9a5b00;
  --warn-soft: #fbefd9;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --info: #1f5f9e;
  --info-soft: #e5eef8;
  --shadow: 0 1px 2px rgba(20, 35, 30, .06), 0 4px 16px rgba(20, 35, 30, .06);
  --radius: 10px;
  --radius-sm: 7px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --side: 248px;
  --top: 56px;
  --tabbar: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #9ca6c5;
    --brand-ink: #0b1224;
    --brand-soft: #121c3c;
    --bg: #0b1020;
    --surface: #121a2e;
    --surface-2: #18223a;
    --line: #26304a;
    --line-strong: #38435f;
    --ink: #e8ecf5;
    --ink-2: #b0b9cc;
    --ink-3: #848ea6;
    --ok: #4cc38a; --ok-soft: #15301f;
    --warn: #e6a23c; --warn-soft: #33270f;
    --bad: #f47067; --bad-soft: #3a1714;
    --info: #6aa9e9; --info-soft: #14263a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #9ca6c5; --brand-ink: #0b1224; --brand-soft: #121c3c;
  --bg: #0b1020; --surface: #121a2e; --surface-2: #18223a; --line: #26304a; --line-strong: #38435f;
  --ink: #e8ecf5; --ink-2: #b0b9cc; --ink-3: #848ea6;
  --ok: #4cc38a; --ok-soft: #15301f; --warn: #e6a23c; --warn-soft: #33270f;
  --bad: #f47067; --bad-soft: #3a1714; --info: #6aa9e9; --info-soft: #14263a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 640; }
h3 { font-size: 15px; font-weight: 620; }
p { margin: 0 0 .6em; }
small, .small { font-size: 12.5px; }
.muted { color: var(--ink-3); }
.ink2 { color: var(--ink-2); }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 13px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.pos { color: var(--ok); }
.neg { color: var(--bad); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- Layout ---------- */
.app { min-height: 100dvh; }
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 30;
}
.side .brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.side .brand img { width: 34px; height: 34px; border-radius: 8px; }
.side .brand b { font-size: 14.5px; display: block; line-height: 1.15; }
.side .brand span { font-size: 11.5px; color: var(--ink-3); }
.side nav { overflow-y: auto; padding: 4px 8px 16px; flex: 1; }
.side .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); padding: 14px 10px 5px; }
.side nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px;
  color: var(--ink-2); font-size: 14px; text-decoration: none;
}
.side nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.side nav a:hover { background: var(--surface-2); color: var(--ink); }
.side nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.side nav a .badge { margin-left: auto; }
.side .me { border-top: 1px solid var(--line); padding: 10px 12px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.main { margin-left: var(--side); min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--top); display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .back { display: none; }
.content { padding: 20px 24px 48px; max-width: 1280px; width: 100%; }
.tabbar { display: none; }

.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.sync.off i { background: var(--warn); }
.sync.busy i { background: var(--info); animation: pulse 1s infinite; }
.sync.err i { background: var(--bad); }
@keyframes pulse { 50% { opacity: .35; } }

@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .main { margin-left: 0; }
  .topbar { padding: 0 12px; padding-top: env(safe-area-inset-top); height: calc(var(--top) + env(safe-area-inset-top)); }
  .topbar .back { display: inline-flex; }
  .content { padding: 14px 16px calc(var(--tabbar) + 28px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface);
    border-top: 1px solid var(--line); height: calc(var(--tabbar) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 11px; color: var(--ink-3); text-decoration: none; position: relative;
  }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--brand); font-weight: 600; }
  .tabbar a .badge { position: absolute; top: 6px; left: 55%; }
}


.side .brand { color: inherit; text-decoration: none !important; border-radius: 10px; margin: 4px 6px 0; }
.side .brand:hover { background: var(--surface-2); }
.side .brand:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Componentes ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 500 14px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); }
.btn svg { width: 17px; height: 17px; }
.btn.pri { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.pri:hover { filter: brightness(1.07); }
.btn.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { padding: 0; width: 36px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
@media (max-width: 900px) { .btn { min-height: 42px; } .btn.sm { min-height: 36px; } .btn.icon { width: 42px; } }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 14px; }
.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)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px) { .g2, .g3 { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card > h2, .card > .card-h { margin-bottom: 12px; }
.card-h { display: flex; align-items: center; gap: 10px; }
.card-h h2 { flex: 1; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-h { padding: 14px 16px 0; }

.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kpi .l { font-size: 12.5px; color: var(--ink-3); }
.kpi .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
@media (max-width: 640px) { .kpi .v { font-size: 19px; } }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 550;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap; line-height: 1.6;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.dot { min-width: 18px; justify-content: center; padding: 0 5px; background: var(--bad); color: #fff; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 14px; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert a { color: inherit; text-decoration: underline; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; }
.tabs a { padding: 9px 12px; font-size: 14px; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.on { color: var(--brand); border-color: var(--brand); font-weight: 600; }

/* ---------- Tablas (en celular pasan a tarjetas) ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 550; font-size: 12.5px; color: var(--ink-3); padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; white-space: nowrap; }
.tbl th.sortable { cursor: pointer; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--surface-2); }
.tbl tfoot td { font-weight: 650; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.tbl tr.sub td { font-size: 13px; color: var(--ink-2); }
.tbl .strong { font-weight: 600; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-3); font-size: 14px; }

@media (max-width: 720px) {
  table.tbl.cards thead { display: none; }
  table.tbl.cards, .tbl.cards tbody, .tbl.cards tr, .tbl.cards td { display: block; width: 100%; }
  .tbl.cards tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .tbl.cards td { border: 0; padding: 2px 0; text-align: left; display: flex; gap: 10px; justify-content: space-between; }
  .tbl.cards td::before { content: attr(data-l); color: var(--ink-3); font-size: 12.5px; flex: none; }
  .tbl.cards td.first { font-weight: 600; font-size: 15px; }
  .tbl.cards td.first::before { content: none; }
  .tbl.cards td:empty { display: none; }
  .tbl.cards tfoot tr { background: var(--surface-2); }
}

/* ---------- Formularios ---------- */
.form { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 12px 14px; }
.f { grid-column: span 6; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f.s12 { grid-column: span 12; } .f.s3 { grid-column: span 3; } .f.s4 { grid-column: span 4; } .f.s8 { grid-column: span 8; } .f.s2 { grid-column: span 2; }
@media (max-width: 720px) { .f, .f.s3, .f.s4, .f.s8, .f.s2 { grid-column: span 12; } .f.half { grid-column: span 6; } }
.f > label { font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.f .hint { font-size: 12px; color: var(--ink-3); }
.f .err { font-size: 12px; color: var(--bad); }
.sec { grid-column: span 12; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; }
input, select, textarea {
  font: 15px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 8px 10px; min-height: 38px; width: 100%; min-width: 0;
}
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 0; border-color: var(--brand); }
input[readonly] { background: var(--surface-2); }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 38px; }
@media (max-width: 900px) { input, select, textarea { font-size: 16px; min-height: 44px; } }

.search { position: relative; flex: 1; min-width: 180px; max-width: 360px; }
.search input { padding-left: 32px; }
.search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-3); }
@media (max-width: 720px) { .search { max-width: none; flex-basis: 100%; } }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar select { width: auto; }

/* líneas de comprobante */
.lines { width: 100%; border-collapse: collapse; }
.lines th { font-size: 12px; color: var(--ink-3); text-align: left; padding: 4px 6px; font-weight: 550; }
.lines td { padding: 3px 4px; vertical-align: top; }
.lines input, .lines select { min-height: 34px; padding: 5px 8px; }
@media (max-width: 720px) {
  .lines thead { display: none; }
  .lines, .lines tbody, .lines tr, .lines td { display: block; width: 100%; }
  .lines tr { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; }
  .lines td::before { content: attr(data-l); display: block; font-size: 12px; color: var(--ink-3); }
}

/* ---------- Modal / hoja ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 18, 15, .45); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); width: 100%; max-width: 760px; }
.modal.wide { max-width: 1040px; }
.modal.narrow { max-width: 460px; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px; }
.modal-h h2 { flex: 1; }
.modal-b { padding: 6px 18px 16px; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); border-radius: 0 0 14px 14px; flex-wrap: wrap; }
@media (max-width: 720px) {
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 94dvh; overflow-y: auto; max-width: none !important; }
  .modal-f { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1; }
}

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 9px; font-size: 14px; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); color: #fff; }
@media (max-width: 900px) { .toasts { left: 16px; right: 16px; bottom: calc(var(--tabbar) + 12px + env(safe-area-inset-bottom)); } }

/* ---------- Varios ---------- */
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .t { font-weight: 560; }
.list-item .grow { flex: 1; min-width: 0; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; }
.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.chart .grid-l { stroke: var(--line); }
.drop { border: 1.5px dashed var(--line-strong); border-radius: 10px; padding: 18px; text-align: center; color: var(--ink-2); cursor: pointer; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.attach { display: flex; flex-wrap: wrap; gap: 8px; }
.attach a, .attach span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.pill-sel { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.pill-sel button { border: 0; background: var(--surface); padding: 6px 12px; font: 13px var(--font); color: var(--ink-2); cursor: pointer; }
.pill-sel button.on { background: var(--brand); color: var(--brand-ink); }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { width: 100%; max-width: 400px; padding: 28px; }
.login .logo { width: 52px; height: 52px; border-radius: 12px; margin-bottom: 14px; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 4px; }
.cal .d { min-height: 84px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; font-size: 12px; background: var(--surface); overflow: hidden; }
.cal .d.out { opacity: .45; }
.cal .d.today { border-color: var(--brand); }
.cal .d b { display: block; font-size: 12px; color: var(--ink-3); }
.cal .d a { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
.cal .h { font-size: 11px; color: var(--ink-3); text-align: center; }
@media (max-width: 720px) { .cal .d { min-height: 54px; } .cal .d a { font-size: 10px; } }

@media print {
  .side, .topbar, .tabbar, .toolbar, .btn { display: none !important; }
  .main { margin: 0; }
  .card { border: 0; }
}

/* ---------- Divisores regulables (sólo escritorio) ----------
   Barra lateral: se arrastra su borde derecho o se pliega a una columna de íconos.
   Lista | ficha: en las pantallas con ficha, la ficha se abre a la derecha de la lista. */
.divisor { position: absolute; top: 0; bottom: 0; width: 12px; cursor: col-resize; z-index: 5; touch-action: none; outline: none; }
.divisor::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; transform: translateX(-.5px); background: transparent; transition: background .15s, width .15s; }
.divisor:hover::before, .divisor.arrastrando::before, .divisor:focus-visible::before { width: 3px; transform: translateX(-1.5px); background: color-mix(in srgb, var(--brand) 55%, transparent); }
.divisor .plegar {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 22px; height: 44px; padding: 0;
  display: grid; place-items: center; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); cursor: pointer; opacity: 0; transition: opacity .15s; box-shadow: var(--shadow);
}
.divisor:hover .plegar, .divisor:focus-within .plegar, .divisor .plegar:focus-visible { opacity: 1; }
.divisor .plegar svg { width: 14px; height: 14px; }
.side > .divisor { right: -6px; }
body.redimensionando, body.redimensionando * { cursor: col-resize !important; user-select: none !important; }

/* barra lateral plegada: sólo íconos (en el celular el menú siempre es completo) */
@media (min-width: 901px) {
  .app.riel { --side: 68px; }
  .app.riel .side .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .app.riel .side .brand > div, .app.riel .side .grp, .app.riel .side nav a > span:not(.badge), .app.riel .side .me .grow { display: none; }
  .app.riel .side nav { padding: 4px 10px 16px; }
  .app.riel .side nav a { justify-content: center; padding: 9px 0; position: relative; }
  .app.riel .side nav a .badge { position: absolute; top: 2px; right: 4px; margin: 0; }
  .app.riel .side nav a + .grp, .app.riel .side .grp + a { margin-top: 0; }
  .app.riel .side nav .grp + a { margin-top: 10px; }
  .app.riel .side .me { justify-content: center; }
  .side, .main { transition: width .2s ease, margin-left .2s ease; }
  body.redimensionando .side, body.redimensionando .main { transition: none; }
}
@media (max-width: 900px) { .side > .divisor { display: none; } }

/* lista | ficha */
.main > .content.con-split { padding: 0; max-width: none; }
.split { display: grid; grid-template-columns: var(--split-lista, 40%) 0 minmax(0, 1fr); height: calc(100dvh - var(--top)); }
.split > .panel { overflow: auto; min-width: 0; overscroll-behavior: contain; }
.split > .lista { padding: 16px 16px 40px 24px; border-right: 1px solid var(--line); }
.split > .ficha { padding: 16px 24px 48px; }
.split > .divisor { position: relative; width: 0; }
.split > .divisor > .zona { position: absolute; top: 0; bottom: 0; left: -6px; width: 12px; }
.split.sin-lista { grid-template-columns: 0 0 minmax(0, 1fr); }
.split.sin-lista > .lista { visibility: hidden; padding: 0; border: 0; }
.split .lista .tbl tr.sel td { background: var(--brand-soft); }
.split .lista .tbl tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.split .lista .toolbar { position: sticky; top: -16px; z-index: 2; background: var(--bg); padding-top: 8px; margin-top: -8px; }

/* ---------- Configuración → Apariencia ---------- */
.opcion-tema { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.opcion-tema:hover { border-color: var(--line-strong); }
.opcion-tema.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.opcion-tema:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.opcion-tema .t { font-weight: 600; display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.miniatura { display: grid; grid-template-columns: 26% 1fr; aspect-ratio: 16 / 10; width: 100%; border-radius: 9px; overflow: hidden; background: var(--f); border: 1px solid rgba(128,128,128,.25); }
.miniatura i { display: block; font-style: normal; }
.miniatura .m-lat { background: var(--l); padding: 12% 12%; display: flex; flex-direction: column; gap: 9%; }
.miniatura .m-lat b { display: block; height: 6%; min-height: 4px; border-radius: 3px; background: color-mix(in srgb, var(--x) 22%, transparent); }
.miniatura .m-lat b.on { background: var(--a); }
.miniatura .m-cont { padding: 8% 8%; display: flex; flex-direction: column; gap: 7%; }
.miniatura .m-tit { height: 8%; width: 45%; border-radius: 3px; background: var(--x); opacity: .85; }
.miniatura .m-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6%; height: 26%; }
.miniatura .m-kpis i, .miniatura .m-card { background: var(--t); border-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.miniatura .m-card { flex: 1; }
/* lista angosta al lado de la ficha: renglones compactos de una línea */
.split .lista .tbl { font-size: 13px; }
.split .lista .tbl th, .split .lista .tbl td { padding: 8px 12px; white-space: nowrap; }
.split .lista .tbl td { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.split .lista .toolbar { gap: 6px; }
.split .lista .toolbar .btn { min-height: 32px; padding: 0 11px; font-size: 13px; }
.split .lista .tabs { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }

/* Globo de ayuda de los botones (js/ayuda.js) */
.globo-ayuda { position: fixed; top: 0; left: 0; z-index: 200; max-width: 280px; padding: 7px 10px; border-radius: 8px;
  background: var(--ink); color: var(--surface); font: 500 12.5px/1.4 var(--font); letter-spacing: 0; text-transform: none;
  box-shadow: 0 6px 20px rgba(8, 12, 28, .22); pointer-events: none; text-wrap: pretty; }
@media (prefers-reduced-motion: no-preference) { .globo-ayuda:not([hidden]) { animation: globo-entra .12s ease-out; } @keyframes globo-entra { from { opacity: 0; } } }

/* ---------- Inicio: disposiciones (js/pages/portada.js) ---------- */
.inicio-split { display: grid; grid-template-columns: var(--res-ancho, 300px) 24px minmax(0, 1fr); align-items: start; }
.inicio-split > .divisor { position: relative; width: auto; align-self: stretch; }
.res-col { position: sticky; top: calc(var(--top) + 14px); max-height: calc(100dvh - var(--top) - 28px); overflow: auto; padding: 6px 16px 14px; }
.res-grupo { padding-block: 12px 10px; display: grid; gap: 2px; }
.res-grupo + .res-grupo { border-top: 1px solid var(--line); }
.res-t { font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.res-fila { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: baseline; padding: 6px 8px; margin-inline: -8px; border-radius: 8px; color: inherit; text-decoration: none !important; }
.res-fila:hover { background: var(--surface-2); }
.res-fila:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.res-fila .l { font-size: 13px; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-fila .v { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
.res-fila .v.neg { color: var(--bad); } .res-fila .v.pos { color: var(--ok); }
.res-fila .s { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); }
.res-dia { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; padding: 5px 8px; margin-inline: -8px; border-radius: 8px; font-size: 13px; color: var(--ink); text-decoration: none !important; }
.res-dia:hover { background: var(--surface-2); }
.res-dia .fd { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.res-dia .fd.neg { color: var(--bad); font-weight: 600; }
.res-detalle .g2 { grid-template-columns: repeat(auto-fit, minmax(min(560px, 100%), 1fr)); }
.res-detalle .g3 { grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); }
.res-card { padding: 8px 16px; }
.inicio-dos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.inicio-col-t { font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
@media (max-width: 1099px) {
  .inicio-split { display: flex; flex-direction: column; gap: 14px; }
  .inicio-split > .divisor { display: none; }
  .res-col { position: static; max-height: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); column-gap: 24px; }
  .res-grupo + .res-grupo { border-top: 0; }
  .inicio-dos { grid-template-columns: minmax(0, 1fr); }
}
/* Configuración → Inicio */
.bloques-inicio { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 6px 18px; }
