/* Fox Finance — sistema de diseño institucional, mobile-first. Sin dependencias.
   Lenguaje: navy profundo + hairlines, numerales tabulares, acento oro sutil. */

:root {
  /* marca — línea gráfica Fox Finance: navy profundo + oro sobre crema */
  --ink: #0b1e30;            /* navy profundo (sidebar, botones, barras) */
  --brand: #143a5c;          /* azul institucional (acciones, activo) */
  --brand-strong: #0b2942;
  --brand-soft: #eef2f6;
  --accent: #b08a3a;         /* oro/bronce — acento de la marca */
  --accent-soft: #f3ead4;    /* oro muy claro (focus, superficies) */
  --gold: #c6a868;           /* oro puro (hairlines, monograma) */
  --gold-lt: #e4ce98;

  /* superficies (papel crema institucional) */
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #fbf9f3;
  --text: #132534;
  --text-2: #7a8894;
  --text-3: #9aa6b0;
  --line: #eae4d6;
  --line-strong: #e4decf;

  /* estado (idénticos a los chips del diseño) */
  --ok: #256b4c;   --ok-soft: #e5f1eb;
  --warn: #8a6a22; --warn-soft: #fbf1dc;
  --err: #9a3a2e;  --err-soft: #f7e5e2;
  --info: #2c4a66; --info-soft: #e9eef3;

  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(11,33,56,.05), 0 4px 16px rgba(11,33,56,.05);
  --shadow-lg: 0 8px 30px rgba(11,33,56,.14);
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #0b131c;
    --brand: #6fa8d6;
    --brand-strong: #8dbde5;
    --brand-soft: #142534;
    --accent: #c6a86f;
    --accent-soft: #2a2415;
    --gold: #c6a868;
    --gold-lt: #e4ce98;
    --bg: #0b1119;
    --surface: #141c26;
    --surface-2: #1c2733;
    --text: #e9eef4;
    --text-2: #96a5b5;
    --text-3: #6b7a8a;
    --line: #232f3c;
    --line-strong: #2d3b4a;
    --ok: #6ece8b;   --ok-soft: #10301c;
    --warn: #e3b569; --warn-soft: #322511;
    --err: #ef9a94;  --err-soft: #391513;
    --info: #85b3ec; --info-soft: #132638;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 22px rgba(0,0,0,.4);
    --shadow-lg: 0 12px 34px rgba(0,0,0,.55);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Nunca scroll horizontal de la página. `clip` (no `hidden`) para NO crear un
   contenedor de scroll — si no, rompe el `position: sticky` del topbar. */
html, body { margin: 0; padding: 0; width: 100%; max-width: 100%; }
html { overflow-x: clip; }
body { overflow-x: clip; }
body {
  font-family: "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }   /* sin retardo de doble-tap-zoom en botones */
img, svg, video, table { max-width: 100%; }
/* Evita que una cadena larga (UUID, correo) empuje el ancho y cause side-scroll. */
.title, .meta, .kv dd { overflow-wrap: anywhere; }
.ellip { overflow-wrap: normal; }
h1, h2, h3 { letter-spacing: -0.02em; }

/* ---------- layout ---------- */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--ink);
  color: #fff;
  padding: 15px 18px 14px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 -1px 0 var(--accent);   /* hairline oro sutil */
}
.topbar h1 { font-family: var(--serif); font-size: 18px; margin: 0; font-weight: 600; flex: 1; letter-spacing: .1px; }
.topbar .sub { font-size: 10.5px; opacity: .62; display: block; font-weight: 500; font-family: "Manrope", sans-serif; letter-spacing: .06em; text-transform: uppercase; margin-top: 2px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  border: 1px solid rgba(255,255,255,.18); cursor: pointer;
  transition: background .15s ease;
}
.avatar:hover { background: rgba(255,255,255,.2); }
/* Escritorio: cabecera clara tipo "papel", título serif + hairline oro (diseño Recepción). */
@media (min-width: 960px) {
  .topbar { background: var(--surface); color: var(--text); padding: 24px 34px 22px; align-items: flex-end; border-bottom: 1px solid var(--line); box-shadow: inset 0 -1px 0 var(--gold); }
  .topbar h1 { font-size: 30px; line-height: 1; }
  .topbar h1 .title-rule { display: inline-block; width: 26px; height: 1px; background: var(--gold); vertical-align: middle; margin-left: 14px; }
  .topbar .sub { display: block; opacity: 1; color: var(--text-2); font-size: 11px; letter-spacing: .12em; margin-top: 10px; }
  .avatar { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
  .avatar:hover { background: color-mix(in srgb, var(--gold) 22%, var(--surface)); }
}

.main { flex: 1; padding: 18px 16px calc(var(--nav-h) + var(--safe-b) + 24px); max-width: 760px; width: 100%; margin: 0 auto; }
@media (min-width: 960px) { .main { padding: 26px 30px 48px; max-width: 1040px; } }

/* bottom nav (mobile) / side nav (desktop) */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
  padding: 7px 4px calc(7px + var(--safe-b));
}
.nav button {
  position: relative;
  flex: 1; max-width: 120px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: 0; cursor: pointer;
  color: var(--text-3); font-size: 10px; font-weight: 600; letter-spacing: .01em;
  padding: 6px 2px; border-radius: 10px;
  transition: color .15s ease;
}
.nav button .ico { display: grid; place-items: center; line-height: 0; transition: transform .15s ease; }
.nav button .ico svg { width: 22px; height: 22px; display: block; }
.nav button.active { color: var(--brand); }
.nav button.active .ico { transform: translateY(-1px); }
.nav button.active::before {
  content: ""; position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand);
}
@media (min-width: 960px) {
  .nav { top: 0; bottom: auto; left: auto; right: 0; width: auto; position: static; border: 0; background: none; backdrop-filter: none; padding: 0; }
  /* La barra izquierda y el contenido derecho scrollean de forma INDEPENDIENTE:
     el shell fija la altura de la ventana y cada columna tiene su propio overflow. */
  .shell { flex-direction: row; height: 100dvh; overflow: hidden; }
  .side {
    width: 248px; flex: none; padding: 0 16px 16px;
    background: linear-gradient(180deg, #0c2236 0%, var(--ink) 55%, #081521 100%);
    height: 100dvh; overflow-y: auto; position: relative;
    display: flex; flex-direction: column;
  }
  /* hairline oro en el borde izquierdo del sidebar */
  .side::before {
    content: ""; position: absolute; top: 0; left: 0; bottom: 0; width: 2px; pointer-events: none;
    background: linear-gradient(180deg, transparent, var(--gold) 30%, var(--gold-lt) 45%, var(--gold) 60%, transparent);
  }
  .side::-webkit-scrollbar { width: 8px; }
  .side::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 8px; }
  .side > div:first-child { font-family: var(--serif) !important; font-weight: 600 !important; font-size: 20px !important; color: #f4efe6; letter-spacing: .1px; padding: 26px 10px 22px !important; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 14px; }
  .side .nav { flex: 1; flex-direction: column; gap: 3px; }
  .side .nav button { position: relative; flex-direction: row; max-width: none; justify-content: flex-start; gap: 13px; font-size: 14px; padding: 12px 14px; font-weight: 500; color: #9fb0be; border-radius: 8px; }
  .side .nav button .ico { color: #8496a4; }
  .side .nav button .ico svg { width: 19px; height: 19px; }
  .side .nav button:hover { color: #f4efe6; background: rgba(255,255,255,.04); }
  .side .nav button.active { background: rgba(198,168,104,.12); color: #f4efe6; font-weight: 600; box-shadow: none; }
  .side .nav button.active .ico { color: var(--gold); }
  .side .nav button.active::before { display: block; content: ""; position: absolute; top: 50%; left: 0; transform: translateY(-50%); width: 3px; height: 20px; border-radius: 2px; background: var(--gold); }
  /* tarjeta de usuario al pie del sidebar */
  .side-user { display: flex; align-items: center; gap: 11px; padding: 16px 12px 6px; margin-top: 8px; border-top: 1px solid rgba(255,255,255,.07); }
  .side-user .su-av { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: rgba(198,168,104,.16); border: 1px solid rgba(198,168,104,.4); color: var(--gold-lt); font-size: 13px; font-weight: 600; cursor: pointer; }
  .side-user .su-name { color: #dce4ec; font-size: 13px; font-weight: 600; }
  .side-user .su-role { color: #6e808e; font-size: 11px; margin-top: 1px; }
  .content { flex: 1; min-width: 0; height: 100dvh; overflow-y: auto; }
}

/* ---------- iconos ---------- */
.ic { flex: none; }
.ic-inline { vertical-align: -.16em; margin-right: 6px; opacity: .9; }
.ic-inline.warn { color: var(--warn); opacity: 1; }
.brand-side { display: flex; align-items: center; gap: 10px; }
.brand-side svg { flex: none; color: var(--brand); }
.side-mark { width: 42px !important; height: 42px !important; font-size: 22px !important; flex: none; border-radius: 7px; }
.bs-txt { display: flex; flex-direction: column; }
.bs-name { display: block; line-height: 1; }
.bs-sub { font-family: "Manrope", sans-serif !important; font-size: 10px !important; font-weight: 500 !important; letter-spacing: .22em; color: #7e90a0; margin-top: 5px; }
.empty .big { line-height: 0; }
.empty .big svg { width: 40px; height: 40px; }
/* badge de icono para las tarjetas de menú (estilo fintech) */
.mico {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.mico svg { width: 20px; height: 20px; }
.card.tap:hover .mico { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.chev { color: var(--text-3); font-size: 20px; line-height: 1; flex: none; }

/* ---------- componentes ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 16px;
  margin-bottom: 12px;
  transition: border-color .15s ease, box-shadow .15s ease, transform .06s ease;
}
.card.tap { cursor: pointer; }
.card.tap:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lg); }
.card.tap:active { transform: scale(.99); }

.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; min-width: 0; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.title { font-weight: 650; font-size: 14.5px; letter-spacing: -.01em; }
.meta { color: var(--text-2); font-size: 12.5px; }
.amount { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; letter-spacing: -.01em; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 5px; white-space: nowrap;
  border: 1px solid transparent;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 20%, transparent); }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 20%, transparent); }
.chip.err { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 20%, transparent); }
.chip.info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 20%, transparent); }
.chip.mute { background: var(--surface-2); color: var(--text-2); border-color: var(--line); }

.filters { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .f {
  display: inline-flex; align-items: center; min-height: 38px;
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 999px; padding: 6px 15px; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); cursor: pointer; white-space: nowrap;
  transition: all .15s ease;
}
.filters .f:hover { border-color: var(--brand); color: var(--text); }
.filters .f.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.search {
  width: 100%; padding: 12px 15px; margin-bottom: 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--accent-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; cursor: pointer;
  padding: 12px 18px; font-weight: 650; font-size: 14px; letter-spacing: -.01em;
  background: var(--brand); color: #fff;
  transition: filter .12s ease, box-shadow .12s ease, transform .06s ease;
}
.btn:hover { filter: brightness(1.06); box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; box-shadow: none; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--brand); box-shadow: none; }
.btn.danger { background: var(--err); }
.btn.ok { background: var(--ok); }
.btn { min-height: 46px; }
.btn.sm { padding: 9px 15px; font-size: 13px; border-radius: 8px; min-height: 40px; }
.btn.block { width: 100%; }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + var(--safe-b) + 18px); z-index: 25;
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--ink); color: #fff; border: 1px solid rgba(255,255,255,.12);
  font-size: 26px; cursor: pointer; box-shadow: var(--shadow-lg);
  transition: transform .1s ease;
}
.fab:active { transform: scale(.94); }
@media (min-width: 960px) { .fab { bottom: 28px; } }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 11px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; min-height: 46px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.5; resize: vertical; }
.hint { font-size: 12px; color: var(--text-2); margin-top: 5px; }

/* editor de líneas del documento SAP: una tarjeta por línea, campos a lo ancho.
   La descripción crece con el contenido (ver grow() en openDocumento). */
.doc-line { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 10px; }
.doc-line .field textarea { font-family: inherit; font-size: 14px; resize: none; overflow: hidden; }

/* matriz de permisos por usuario (editor) */
.perm-group { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; background: var(--surface); }
.perm-group-h { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); background: var(--surface-2); padding: 8px 12px; border-bottom: 1px solid var(--line); }
.perm-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.perm-row:last-child { border-bottom: 0; }
.perm-name { flex: 1; font-size: 13px; line-height: 1.35; }
.perm-def { color: var(--text-2); font-size: 11px; }
.perm-sel { width: auto !important; min-width: 118px; min-height: 38px !important; padding: 7px 10px !important; font-size: 13px; flex: 0 0 auto; }

/* bottom sheet / modal */
.sheet-back {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(7, 16, 26, .55);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadein .16s ease;
}
.sheet {
  background: var(--surface); width: 100%; max-width: 640px;
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: 20px 20px 0 0;
  max-height: 90dvh; overflow-y: auto;
  padding: 10px 20px calc(22px + var(--safe-b));
  box-shadow: var(--shadow-lg);
  animation: sheetup .2s cubic-bezier(.2,.7,.3,1);
}
@media (min-width: 960px) {
  .sheet-back { align-items: center; }
  .sheet { border: 1px solid var(--line); border-radius: 16px; max-height: 84dvh; }
}
.sheet .grab { width: 38px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 6px auto 16px; }
.sheet h2 { font-family: var(--serif); font-weight: 600; font-size: 19px; margin: 0 0 16px; }
@keyframes sheetup { from { transform: translateY(28px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* dropdown de facturas FEL */
.match-list { border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; margin-top: 8px; }
.match-item {
  width: 100%; text-align: left; background: var(--surface); border: 0;
  border-bottom: 1px solid var(--line); padding: 12px 14px; cursor: pointer;
  display: flex; gap: 10px; align-items: center; transition: background .12s ease;
}
.match-item:last-child { border-bottom: 0; }
.match-item:hover, .match-item.sel { background: var(--brand-soft); }
.match-item.sel { cursor: default; }
.match-item .amount { margin-left: auto; }
.match-radio { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; }
.match-item:hover .match-radio { border-color: var(--brand); }
.match-item.sel .match-radio { background: var(--ok); border-color: var(--ok); }
.match-date { font-weight: 700; color: var(--text); }
.match-chosen-h { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ok); background: var(--ok-soft); padding: 8px 14px; border-bottom: 1px solid var(--line); }
.match-pick-h { font-size: 12px; color: var(--text-2); background: var(--surface-2); padding: 9px 14px; border-bottom: 1px solid var(--line); }

/* listas de líneas */
.lines { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 6px; }
.line-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line-item:last-child { border-bottom: 0; }

.totalbar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--ink); color: #fff; border-radius: 10px; padding: 14px 16px; margin-top: 14px;
  font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em;
  box-shadow: inset 0 -1px 0 var(--accent);
}

.empty { text-align: center; color: var(--text-2); padding: 52px 20px; }
.empty .big { font-size: 40px; margin-bottom: 10px; opacity: .8; }

.skel { border-radius: var(--radius); height: 76px; margin-bottom: 12px; border: 1px solid var(--line);
  background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* toasts */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.toast {
  background: var(--ink); color: #fff;
  padding: 13px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: var(--shadow-lg); animation: sheetup .2s ease;
}
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

/* ---------- login: línea gráfica Fox Finance ----------
   Marca institucional: navy profundo + oro, serif Cormorant + Manrope.
   Colores fijos (no dependen del tema) para respetar la identidad exacta. */
:root {
  --ff-navy: #0b1e30;
  --ff-navy-2: #0a1b2c;
  --ff-navy-3: #081521;
  --ff-gold: #c6a868;
  --ff-gold-lt: #e4ce98;
  --ff-cream: #f6f3ec;
  --ff-ink: #132534;
}

.login-page {
  min-height: 100dvh; display: grid; place-items: center;
  background:
    radial-gradient(circle at 80% 12%, rgba(198,168,104,.12), transparent 42%),
    linear-gradient(170deg, #0c2236 0%, var(--ff-navy-2) 55%, #07131e 100%);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
}

/* móvil: pantalla completa a sangre. escritorio: tarjeta partida centrada. */
.login-card {
  width: 100%; min-height: 100dvh;
  display: flex; overflow: hidden;
  background: transparent;
  position: relative;
}
/* hairline oro superior en móvil (a sangre) */
.login-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; z-index: 2;
  background: linear-gradient(90deg, transparent, var(--ff-gold) 40%, var(--ff-gold-lt) 55%, transparent);
}

/* panel de marca (izquierda) — sólo escritorio */
.login-brand {
  display: none;
  width: 56%; position: relative;
  padding: 56px 60px;
  flex-direction: column; justify-content: space-between;
  background: linear-gradient(160deg, #0c2236 0%, var(--ff-navy-2) 60%, var(--ff-navy-3) 100%);
  overflow: hidden;
}
.login-brand::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(circle at 78% 18%, rgba(198,168,104,.10), transparent 45%);
}
.login-brand::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--ff-gold) 40%, var(--ff-gold-lt) 55%, transparent);
}
.login-brand > * { position: relative; }
.lb-logo { display: flex; align-items: center; gap: 14px; }
.lb-word { color: #dce4ec; font-size: 13px; font-weight: 600; letter-spacing: .24em; }
.lb-hero { max-width: 440px; }
.lb-rule { width: 38px; height: 1px; background: var(--ff-gold); margin-bottom: 28px; }
.lb-hero h1 {
  font-family: var(--serif); color: #f4efe6; font-weight: 500;
  font-size: 52px; line-height: 1.08; margin: 0 0 22px; letter-spacing: -.005em;
}
.lb-hero p { color: #9fb0be; font-size: 15.5px; line-height: 1.7; margin: 0; font-weight: 400; }
.lb-foot { display: flex; align-items: center; gap: 10px; color: #6e808e; font-size: 12px; letter-spacing: .14em; font-weight: 500; }
.lb-foot span { color: var(--ff-gold); }

/* monograma FF (caja con borde oro + serif) */
.ff-mark {
  border: 1px solid var(--ff-gold); border-radius: 7px;
  display: grid; place-items: center;
  font-family: var(--serif); color: var(--ff-gold-lt); font-weight: 600;
  width: 46px; height: 46px; font-size: 24px;
}

/* formulario (derecha en escritorio, único en móvil) */
.login-form {
  width: 100%;
  padding: 56px 34px calc(40px + var(--safe-b));
  display: flex; flex-direction: column; justify-content: center;
}
.login-form > * { width: 100%; max-width: 340px; margin-inline: auto; }

/* cabecera de marca del formulario — visible en móvil */
.lf-head { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 40px; }
.lf-head .ff-mark { width: 56px; height: 56px; font-size: 30px; border-radius: 9px; margin-bottom: 24px; }
.lf-title { font-family: var(--serif); color: #f4efe6; font-weight: 600; font-size: 34px; margin: 0 0 8px; letter-spacing: -.01em; }
.lf-sub { color: #9fb0be; font-size: 13.5px; margin: 0; font-weight: 400; }
.lf-head .lf-rule { width: 30px; height: 1px; background: var(--ff-gold); margin-top: 20px; }

.login-form label {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: .18em;
  color: #7e90a0; margin-bottom: 11px; text-transform: uppercase;
}
.login-form input {
  width: 100%; border: none; border-bottom: 1.5px solid rgba(255,255,255,.16);
  background: transparent; padding: 6px 2px 12px; font-size: 16px;
  color: #f4efe6; font-family: "Manrope", sans-serif; margin-bottom: 26px;
  transition: border-color .2s ease;
}
.login-form input::placeholder { color: #6e808e; }
.login-form input:focus { outline: none; border-bottom-color: var(--ff-gold); }

.lf-forgot { text-align: right; margin: -8px 0 28px; }
.lf-forgot a { color: #b8985a; font-size: 12.5px; text-decoration: none; }
.lf-forgot a:hover { color: #cbab6d; }

.lf-submit {
  width: 100%; border: none; cursor: pointer;
  background: linear-gradient(180deg, #d8bd82, var(--ff-gold));
  color: var(--ff-navy); padding: 17px; border-radius: 8px;
  font-family: "Manrope", sans-serif; font-size: 13px; font-weight: 700; letter-spacing: .16em;
  min-height: 52px; transition: filter .15s ease, transform .06s ease;
}
.lf-submit:hover { filter: brightness(1.05); }
.lf-submit:active { transform: translateY(1px); }
.lf-submit:disabled { opacity: .6; cursor: not-allowed; filter: none; }
.lf-ms:not([hidden]) { display: block; box-sizing: border-box; text-align: center; text-decoration: none; line-height: 18px; }
.lf-emergencia { display: block; margin: 18px auto 0; background: none; border: none; cursor: pointer; color: #b8985a; font-size: 12.5px; text-decoration: underline; }
.lf-emergencia:hover { color: #cbab6d; }
#l-pass-box:not([hidden]) { margin-top: 18px; }

.lf-err { color: #ef9a94; font-size: 13px; min-height: 18px; margin: 14px 0 0; text-align: center; }
.lf-secure {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 26px; color: #7e90a0; font-size: 11px; letter-spacing: .05em;
}
.lf-secure svg { width: 12px; height: 12px; opacity: .8; }
.lf-welcome { display: none; }   /* en móvil se usa .lf-head; en escritorio se muestra */

/* ----- escritorio: tarjeta partida centrada ----- */
@media (min-width: 900px) {
  .login-page { padding: 24px; }
  .login-card {
    max-width: 1120px; min-height: 0;
    border-radius: 16px;
    box-shadow: 0 40px 90px -30px rgba(11,30,48,.6);
    background: var(--ff-navy);
  }
  .login-card::before { display: none; }   /* el hairline vuelve al panel de marca */
  .login-brand { display: flex; }
  .login-form { width: 44%; background: var(--ff-cream); padding: 60px 56px; }
  .login-form .lf-head { display: none; }          /* la marca vive en el panel izquierdo */
  .login-form label { color: #8a97a2; }
  .login-form input { color: var(--ff-ink); border-bottom-color: #d3ccbb; }
  .login-form input::placeholder { color: #9aa6b0; }
  /* encabezado "Bienvenido" del formulario, sólo escritorio */
  .lf-welcome { display: block; }
  .lf-welcome h2 { font-family: var(--serif); font-size: 34px; font-weight: 600; color: var(--ff-ink); margin: 0 0 6px; letter-spacing: -.01em; }
  .lf-welcome p { color: #7a8894; font-size: 14px; margin: 0; font-weight: 400; }
  .lf-welcome .lf-rule { width: 34px; height: 1px; background: var(--ff-gold); margin: 22px 0 34px; }
  .lf-submit {
    background: var(--ff-navy); color: #f4efe6; border: 1px solid var(--ff-navy);
    transition: background .25s ease, color .25s ease, border-color .25s ease;
  }
  .lf-submit:hover { filter: none; background: #102a42; border-color: var(--ff-gold); color: var(--ff-gold-lt); }
  .lf-secure { color: #96a2ac; }
}

.section-h { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 12px; }
.section-h h2 { font-family: var(--serif); font-weight: 600; font-size: 16px; margin: 0; }

.kv { display: grid; grid-template-columns: 132px 1fr; gap: 6px 14px; font-size: 13.5px; margin: 12px 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; font-variant-numeric: tabular-nums; }

.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin-bottom: 16px; gap: 2px; }
.seg button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 7px; font-weight: 650; font-size: 13px; color: var(--text-2); cursor: pointer; transition: all .15s ease; }
.seg button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }

/* panel confidencial */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; margin-bottom: 16px; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 20px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
/* barra de acento superior (diseño Recepción); su color sigue al del número */
.kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--gold); }
.kpi:nth-child(1)::before { background: var(--gold); }
.kpi.k-ok::before { background: var(--ok); } .kpi.k-warn::before { background: var(--warn); } .kpi.k-err::before { background: var(--err); } .kpi.k-info::before { background: var(--info); } .kpi.k-ink::before { background: var(--ink); }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.kpi .n { font-family: var(--serif); font-size: 38px; font-weight: 600; line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; color: var(--text); }
.kpi .k { color: var(--text-2); font-size: 11px; margin-bottom: 12px; text-transform: uppercase; letter-spacing: .14em; font-weight: 600; }
.kpi.tap { cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .06s ease; }
.kpi.tap:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lg); }
.kpi.tap:active { transform: scale(.98); }
.kpi.on { border-color: var(--accent); }
.kpi.on::after { background: var(--accent); }
.kpi .n.ok { color: var(--ok); } .kpi .n.warn { color: var(--warn); } .kpi .n.err { color: var(--err); } .kpi .n.info { color: var(--info); }

.dtab { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dtab th, .dtab td { padding: 9px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dtab th:first-child, .dtab td:first-child { text-align: left; font-variant-numeric: normal; }
.dtab th { color: var(--text-3); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; position: sticky; top: 0; background: var(--surface); }
.dtab tbody tr { transition: background .1s ease; }
.dtab tbody tr.tap { cursor: pointer; }
.dtab tbody tr.tap:hover { background: var(--surface-2); }
.dtab tbody tr:last-child td { border-bottom: 0; }
.dscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2px 14px 6px; }
.bar { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 7px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-strong)); }

/* ---------- ergonomía móvil ---------- */
/* iOS hace auto-zoom al enfocar un campo con fuente < 16px: forzamos 16px en móvil. */
@media (max-width: 640px) {
  .field input, .field select, .field textarea, .search { font-size: 16px; }
}
/* Objetivos de toque cómodos (≥44px) en controles interactivos. */
.nav button { min-height: 50px; }
.seg button { min-height: 44px; }
.avatar { width: 40px; height: 40px; }
.match-item { min-height: 54px; }
.dtab tbody tr.tap td { padding-top: 12px; padding-bottom: 12px; }
/* La barra superior y la barra inferior no se solapan con el notch/gesture bar. */
.topbar { padding-top: max(15px, env(safe-area-inset-top)); }
/* Header pegajoso más nítido: hairline visible al hacer scroll bajo el contenido. */
@media (min-width: 960px) { .topbar { padding-left: max(18px, env(safe-area-inset-left)); } }

/* ---------- recurrentes: tablero "Programadas" ---------- */
/* Mini-gráfica de 12 meses por recurrente (barras SVG, sin dependencias). */
.spark { display: block; }
.spark rect.on { fill: color-mix(in srgb, var(--brand) 60%, transparent); }
.spark rect.off { fill: var(--line-strong); }
.rec-card .rec-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.rec-card .rec-chips { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 480px) { .rec-card .spark { width: 96px; } }

/* Encabezado de grupo (cola "Por aprobar" agrupada por proveedor). */
.group-h { display: flex; align-items: center; gap: 8px; margin: 16px 2px 8px; }
.group-h .group-name { font-weight: 700; font-size: 13.5px; letter-spacing: .01em; }

/* Semáforo del agente on-prem (Posteos). */
.dot { flex: 0 0 auto; width: 11px; height: 11px; border-radius: 50%; margin-right: 4px; }
.dot.ok { background: var(--ok); }
.dot.err { background: var(--err); }
.dot.mute { background: var(--text-3); }
.dot.pulse { animation: dot-pulse 2.2s ease-out infinite; }
@keyframes dot-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 40%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .dot.pulse { animation: none; } }

/* ═══════════════════════════════════════════════════════════════════════════
   CAPA CORPORATIVA "SAP" — densidad de escritorio + tablas tipo Excel.
   Filosofía: en móvil manda la tarjeta (dedo, una columna). En escritorio el
   trabajo contable es una hoja: rejilla fina, numerales tabulares, encabezados
   diminutos en versal, y aprovechar TODO el ancho. Nada de aire desperdiciado.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Ancho de trabajo: en pantallas grandes usamos la hoja completa, no una
   columnita de 1040px con dos desiertos a los lados. */
@media (min-width: 960px) {
  .main { max-width: 1320px; padding: 22px 32px 44px; }
  /* En vistas de "hoja" (posteos, facturas) el contenido va a sangre ancha. */
  .main.wide { max-width: 1600px; }
}
@media (min-width: 1500px) { .main { max-width: 1440px; } }

/* helpers de responsividad: una sola marca de "solo escritorio / solo móvil". */
.only-desk { display: none; }
@media (min-width: 960px) { .only-desk { display: block; } .only-mob { display: none; } }

/* Encabezado de sección de trabajo: título + acciones a la derecha, hairline. */
.work-h {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid var(--line-strong);
}
.work-h h2 { font-family: var(--serif); font-weight: 600; font-size: 21px; margin: 0; letter-spacing: -.01em; }
.work-h .sub { color: var(--text-2); font-size: 12px; font-weight: 500; }
.work-h .spacer { flex: 1; }

/* ---------- Tabla tipo hoja (Excel/SAP) ---------- */
/* Rejilla fina en TODAS las celdas, encabezado sticky en versal, zebra suave,
   numerales tabulares a la derecha. Es el caballo de batalla del rediseño. */
.xls-wrap {
  border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow);
}
.xls-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.xls { width: 100%; border-collapse: collapse; font-size: 13px; }
.xls thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--text-2);
  font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  text-align: left; padding: 9px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--line-strong);
}
.xls th.num, .xls td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.xls th.ctr, .xls td.ctr { text-align: center; }
.xls tbody td {
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line); vertical-align: middle;
}
.xls tbody td:last-child { border-right: 0; }
.xls thead th:not(:last-child) { border-right: 1px solid var(--line); }
.xls tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.xls tbody tr:last-child td { border-bottom: 0; }
.xls tbody tr.tap { cursor: pointer; }
.xls tbody tr.tap:hover td { background: var(--brand-soft); }
.xls td .sub { color: var(--text-2); font-size: 11px; margin-top: 1px; }
.xls td .strong { font-weight: 650; }
.xls td.rownum { color: var(--text-3); font-variant-numeric: tabular-nums; width: 34px; text-align: center; background: var(--surface-2); font-size: 12px; }
/* fila de totales (pie) */
.xls tfoot td {
  padding: 10px 12px; border-top: 2px solid var(--line-strong);
  font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface-2);
}
.xls tfoot td.num { text-align: right; }
/* celda editable: tinte permanente + cursor de texto, para que se note SIN pasar el
   mouse ni hacer clic (antes era invisible hasta enfocar y no se entendía que se
   podía editar). Al enfocar, se resalta más fuerte. */
.xls td.edit { padding: 0; background: color-mix(in srgb, var(--brand-soft) 55%, transparent); }
.xls td.edit textarea, .xls td.edit input, .xls td.edit select {
  width: 100%; border: 0; background: transparent; padding: 9px 12px;
  font: inherit; color: inherit; outline: none; resize: none; min-height: 40px; cursor: text;
}
.xls td.edit textarea { line-height: 1.4; overflow: hidden; }
.xls td.edit:hover { background: color-mix(in srgb, var(--brand-soft) 85%, transparent); }
.xls td.edit:focus-within { box-shadow: inset 0 0 0 2px var(--brand); background: var(--surface); border-radius: 4px; }
.xls td.edit .combo input { min-height: 40px; cursor: pointer; }
/* marquita de lápiz en el encabezado de las columnas editables */
.xls th .edit-flag { color: var(--brand); opacity: .85; font-size: 10px; margin-left: 3px; text-transform: none; letter-spacing: 0; }

/* ---------- Combobox de cuentas (type-ahead) ---------- */
/* "tipear madero y van saliendo las opciones": input + lista filtrada. */
.combo { position: relative; }
.combo > input {
  width: 100%; padding: 10px 34px 10px 12px; min-height: 42px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); outline: none; font: inherit; color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.combo > input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--accent-soft); }
.combo-caret {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: 12px; line-height: 1; pointer-events: auto; cursor: pointer;
  padding: 6px; user-select: none;
}
.combo-caret:hover { color: var(--text); }
/* En una celda de la hoja el caret se pega al borde derecho. */
.xls td.edit .combo-caret { right: 8px; }
/* Popup en position:fixed y montado en <body> (JS le fija left/top/width): así NO
   lo recorta el overflow de la hoja (.xls-scroll) ni ningún ancestro con scroll. */
.combo-pop {
  position: fixed; z-index: 60;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: var(--shadow-lg); max-height: 264px; overflow-y: auto; padding: 4px;
}
.combo-opt {
  display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  padding: 9px 11px; border-radius: 7px; font: inherit; color: var(--text); line-height: 1.3;
}
.combo-opt .code { color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; margin-top: 1px; display: block; }
.combo-opt:hover, .combo-opt.hi { background: var(--brand-soft); }
.combo-opt mark { background: color-mix(in srgb, var(--gold) 40%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.combo-empty { padding: 11px; color: var(--text-2); font-size: 12.5px; }

/* En una celda de la hoja el input del combo va sin caja (estilo Excel). */
.xls td.edit .combo > input { border: 0; border-radius: 0; background: transparent; padding: 9px 12px; }
.xls td.edit .combo > input:focus { box-shadow: none; }

/* ---------- Editor de documento a dos columnas (comparar FEL ↔ SAP) ---------- */
.doc-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .doc-grid { grid-template-columns: minmax(0,1fr) minmax(0,1.25fr); gap: 22px; align-items: start; } }
.doc-col > .panel-h { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.doc-col .panel-h .tag { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.doc-col h3 { font-family: var(--serif); font-weight: 600; font-size: 16px; margin: 0; }

/* Ficha de campos SAP (llave→valor) compacta, tipo formulario de SAP. */
.sap-fields { border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.sap-fields .r { display: grid; grid-template-columns: 148px 1fr; border-bottom: 1px solid var(--line); }
.sap-fields .r:last-child { border-bottom: 0; }
.sap-fields dt { padding: 8px 12px; background: var(--surface-2); color: var(--text-2); font-size: 11.5px; font-weight: 600; border-right: 1px solid var(--line); }
.sap-fields dd { padding: 8px 12px; margin: 0; font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
/* campo editable dentro de la ficha (ej. comentario de la recurrente) */
.sap-fields dd input {
  width: 100%; padding: 7px 10px; min-height: 34px;
  border: 1px solid var(--line-strong); border-radius: 7px;
  background: var(--surface); outline: none; font: inherit; font-weight: 600; color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.sap-fields dd input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--accent-soft); }
.sap-fields dd .meta { font-size: 11px; font-weight: 400; color: var(--text-2); margin-top: 4px; }

/* Barra de totales compacta para la hoja (sustituye a la barra grande en desktop). */
.tot-strip { display: flex; gap: 22px; justify-content: flex-end; align-items: baseline;
  background: var(--ink); color: #fff; border-radius: 10px; padding: 11px 16px; margin-top: 10px;
  box-shadow: inset 0 -1px 0 var(--accent); }
.tot-strip .t { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; opacity: .72; margin-right: 7px; }
.tot-strip .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.tot-strip .big .v { font-size: 17px; }

/* La hoja de documento es ANCHA en escritorio (comparación cómoda). */
.sheet--wide { max-width: 640px; }
@media (min-width: 900px) { .sheet--wide { max-width: 1120px; } }
@media (min-width: 1320px) { .sheet--wide { max-width: 1220px; } }

/* ---------- Lista densa (posteos / facturas) en escritorio ---------- */
/* La tabla vive dentro de .xls-wrap; acá solo el ancho de columnas y el chip. */
.list-table .xls td { padding-top: 10px; padding-bottom: 10px; }
.list-table .prov { font-weight: 650; }
.list-table .muted { color: var(--text-2); }


/* ---------- Seguimiento (timeline de una liquidación) ---------- */
/* Historia vertical: el solicitante ve por dónde va y qué pasó en cada paso. */
.timeline { list-style: none; margin: 4px 0 2px; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
/* Riel vertical que une los hitos (se corta en el último). */
.timeline li::before {
  content: ''; position: absolute; left: 6px; top: 14px; bottom: -2px;
  width: 2px; background: var(--line-strong);
}
.timeline li:last-child { padding-bottom: 2px; }
.timeline li:last-child::before { display: none; }
/* Punto del hito, coloreado por tono. */
.tl-dot {
  position: absolute; left: 0; top: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--text-3); box-sizing: border-box;
}
.tl-dot.ok { border-color: var(--ok); background: var(--ok-soft); }
.tl-dot.warn { border-color: var(--err); background: var(--err-soft); }
.tl-dot.ink { border-color: var(--brand); background: var(--brand-soft); }
.tl-dot.mute { border-color: var(--text-3); }
.tl-label { font-weight: 650; font-size: 13.5px; color: var(--text); line-height: 1.35; }
.tl-label.warn { color: var(--err); }
.tl-detail { font-size: 12.5px; color: var(--text-2); margin-top: 1px; }
.tl-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ── Liquidaciones recurrentes (BAC/NeoNet → asiento) + filtro por empresa ── */
.li-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.li-toolbar .pills { display: flex; gap: 6px; flex-wrap: wrap; }
.li-list { display: flex; flex-direction: column; gap: 12px; }
.li-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--text-3); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.li-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.li-head b { color: var(--text); }
.li-sub { font-size: 12px; margin-top: 3px; }
.li-amounts { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.li-amounts b { color: var(--text); }
.li-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.li-table th { text-align: left; color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; border-bottom: 1px solid var(--line); padding: 3px 6px; }
.li-table td { padding: 3px 6px; border-bottom: 1px solid var(--line); }
.li-table .num, .li-table th.num { text-align: right; }
.li-table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-2); }
.li-table tr.grp td { background: var(--surface-2); border-top: 2px solid var(--line-strong); padding-top: 8px; font-size: 13px; }
.li-table tr.sub td { border-bottom: 1px solid var(--line-strong); padding-top: 6px; }
.warn-box { margin-top: 8px; padding: 6px 10px; background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-sm); font-size: 12px; }
.li-acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* Insignia y filtro de empresa — el color lo inyecta el JS por empresa
   (Kasperle rojito, Rebecana cafesito) desde /api/settlements → empresas[]. */
.emp-badge { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; vertical-align: middle; }
.emp-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.emp-filter { font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--text-2); cursor: pointer; transition: all .12s ease; }
.emp-filter:hover { border-color: var(--text-3); }
.emp-filter.on { color: #fff; }

/* Facturas recurrentes por centro de costo */
.sec-h { font-size: 13px; font-weight: 750; color: var(--text-2); margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .05em; }
.rec-fel { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.rec-fel .inp { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 5px 9px; font-size: 12.5px; background: var(--surface); color: var(--text); min-width: 190px; }
.rec-fel .inp.sm { min-width: 88px; }
.rec-tpls { overflow-x: auto; }

/* Cuentas contables legibles: nombre (+ nº) en vez del código interno de SAP. */
.cta-name { font-weight: 600; }
.cta-unknown { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-2); font-weight: 500; }

/* ---------- navegación por secciones (Cobrar / Pagar / Caja chica / Más) ---------- */
/* Con scroll horizontal VISIBLE: una barra fina y un degradado a la derecha avisan que hay más pestañas (antes la barra estaba oculta y la última quedaba cortada sin pista). */
.subnav { display: flex; gap: 6px; overflow-x: auto; padding: 10px 28px 6px 14px; scrollbar-width: thin; scroll-snap-type: x proximity; background: var(--bg); -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
.subnav::-webkit-scrollbar { height: 4px; }
@media (min-width: 960px) { .subnav { -webkit-mask-image: none; mask-image: none; } }
.subnav button {
  flex: none; font-size: 12.5px; font-weight: 650; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.subnav button.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.topbar h1 .t-sub { font-weight: 500; opacity: .75; }
@media (min-width: 960px) {
  .side .side-subs { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 8px 22px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.1); }
  .side .side-subs button { background: none; border: 0; text-align: left; color: #8fa2b2; font-size: 13px; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
  .side .side-subs button:hover { color: #f4efe6; background: rgba(255,255,255,.04); }
  .side .side-subs button.active { color: var(--gold-lt); font-weight: 600; background: rgba(198,168,104,.08); }
}

/* Semáforo de una celda entera (tablas tipo planilla). */
.xls td.cell-ok { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); color: var(--ok); font-weight: 700; }
.xls td.cell-warn { background: color-mix(in srgb, var(--warn) 18%, var(--surface)); color: var(--warn); font-weight: 700; }
.xls td.cell-err { background: color-mix(in srgb, var(--err) 16%, var(--surface)); color: var(--err); font-weight: 700; }
.xls td.cell-mute { background: color-mix(in srgb, var(--text-3) 12%, var(--surface)); color: var(--text-2); }
.xls td.cell-info { background: color-mix(in srgb, var(--info) 14%, var(--surface)); color: var(--info); font-weight: 700; }
.xls tr.tap { cursor: pointer; }
.xls tr.tap:hover td { filter: brightness(.97); }

/* Tarjetas por mes (huérfanas). */
.meses { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.mes { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; box-shadow: var(--shadow); }
.mes.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.mes .m-k { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-2); font-weight: 700; }
.mes .m-n { font-family: var(--serif); font-size: 26px; font-weight: 600; margin-top: 4px; line-height: 1; }
.mes .m-n.warn { color: var(--warn); } .mes .m-n.ok { color: var(--ok); }
.mes .m-s { font-size: 12px; color: var(--text-2); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Calendario de cortes: tienda × día. */
.cal-wrap { overflow-x: auto; }
.cal { border-collapse: collapse; font-size: 12px; min-width: 100%; }
.cal th { position: sticky; top: 0; background: var(--surface); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.cal th.tienda, .cal td.tienda { text-align: left; position: sticky; left: 0; background: var(--surface); min-width: 130px; font-weight: 600; padding: 6px 8px; border-right: 1px solid var(--line); }
.cal td { border: 1px solid var(--line); text-align: center; padding: 0; }
.cal td .d { display: block; width: 100%; min-width: 34px; height: 34px; line-height: 34px; cursor: pointer; font-weight: 700; }
.cal .d.c-ok { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); color: var(--ok); }
.cal .d.c-warn { background: color-mix(in srgb, var(--warn) 22%, var(--surface)); color: var(--warn); }
.cal .d.c-err { background: color-mix(in srgb, var(--err) 18%, var(--surface)); color: var(--err); }
.cal .d.c-info { background: color-mix(in srgb, var(--info) 16%, var(--surface)); color: var(--info); }
.cal .d.c-mute { background: color-mix(in srgb, var(--text-3) 10%, var(--surface)); color: var(--text-3); font-weight: 500; }
.cal .d.c-none { color: var(--text-3); font-weight: 400; }
.cal .d.on { outline: 2px solid var(--accent); outline-offset: -2px; }
.leyenda { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-2); margin: 8px 0 12px; }
.leyenda span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.leyenda .l-ok::before { background: var(--ok); } .leyenda .l-warn::before { background: var(--warn); } .leyenda .l-err::before { background: var(--err); } .leyenda .l-info::before { background: var(--info); } .leyenda .l-mute::before { background: var(--text-3); }
.cuadre { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin: 12px 0; }
.cuadre .fuente { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.cuadre .fuente .f-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-2); font-weight: 700; }
.cuadre .fuente .f-n { font-family: var(--serif); font-size: 22px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.cuadre .fuente .f-s { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }
.cuadre .fuente.na .f-n { color: var(--text-3); font-size: 15px; }

/* Discrepancias: indicador en el calendario de cortes, badge del menú y la hoja lado a lado. */
.cal .d { position: relative; }
.cal .d .al { position: absolute; top: -5px; right: -5px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--err); color: #fff; font-size: 10px; line-height: 15px; text-align: center; font-weight: 700; }
.badge-disc { margin-left: 6px; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--err); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; display: inline-block; }
.dc-filtros { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.dc-filtros select, .dc-filtros input { max-width: 190px; }
.dc-fuentes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dc-lados { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 10px 0; }
@media (min-width: 720px) { .dc-lados { grid-template-columns: 1fr 1fr; } }
.dc-lados .lado { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; background: var(--surface-2); }
.dc-lados .lado h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.dc-lados .lado dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12.5px; }
.dc-lados .lado dt { color: var(--text-2); }
.dc-lados .lado dd { margin: 0; word-break: break-word; }

/* ---------- Cortes: tienda → calendario → día (resumen, página de la tienda, página del día) ---------- */
.ct-migas { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; }
.ct-migas a { color: var(--brand); text-decoration: none; font-weight: 650; }
.ct-migas a:hover { text-decoration: underline; }
.ct-migas .sep { color: var(--text-3); }
.ct-h { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ct-err { margin: 8px 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--err) 30%, transparent); background: var(--err-soft); color: var(--err); border-radius: var(--radius-sm); font-size: 13px; }
.ct-motivos { margin: 0 0 10px; padding-left: 18px; font-size: 12.5px; color: var(--text-2); }
.ok-t { color: var(--ok); } .warn-t { color: var(--warn); } .err-t { color: var(--err); }
.kpi .n.sm { font-size: 26px; }
.ct-res td.tienda, .ct-res th.tienda { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 150px; }
.ct-res td.tienda a { color: inherit; text-decoration: none; }
.ct-matriz { margin-top: 16px; }
.ct-matriz summary { cursor: pointer; font-weight: 650; font-size: 13px; color: var(--text-2); padding: 6px 0; }
.mes-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; max-width: 680px; margin: 6px 0 4px; }
.mg-h { text-align: center; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 2px 0; }
.mg-d { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 54px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: inherit; background: var(--surface); }
.mg-d .n { position: absolute; top: 3px; left: 6px; font-size: 10.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.mg-d .g { font-size: 18px; font-weight: 700; line-height: 1; }
.mg-d .q { font-size: 10px; font-weight: 650; margin-top: 2px; }
.mds { display: flex; gap: 2px; justify-content: center; margin-top: 3px; }
.cal .d .mds { position: absolute; left: 0; right: 0; bottom: 2px; margin: 0; line-height: 0; }
.md { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.md.m-ok { background: var(--ok); }
.md.m-err { background: var(--err); }
.md.m-warn { background: var(--warn); }
.md.m-mute { background: var(--text-2); opacity: .45; }
.mg-d .al { position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--err); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }
a.mg-d:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.mg-d.c-ok { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); color: var(--ok); }
.mg-d.c-warn { background: color-mix(in srgb, var(--warn) 22%, var(--surface)); color: var(--warn); }
.mg-d.c-err { background: color-mix(in srgb, var(--err) 18%, var(--surface)); color: var(--err); }
.mg-d.c-info { background: color-mix(in srgb, var(--info) 16%, var(--surface)); color: var(--info); }
.mg-d.c-mute { background: color-mix(in srgb, var(--text-3) 10%, var(--surface)); color: var(--text-3); }
.mg-d.c-none { color: var(--text-3); }
.mg-fut { opacity: .45; border-style: dashed; }
.xls td.acc { white-space: nowrap; }
.xls td.acc .btn { margin: 2px 4px 2px 0; }
.ct-acciones { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.ct-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; margin: 8px 0; }
.ct-dl dt { color: var(--text-2); } .ct-dl dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .ct-h { font-size: 17px; }
  .mes-grid { gap: 3px; }
  .mg-d { min-height: 46px; }
  .mg-d .q { display: none; }
  .xls td.acc { white-space: normal; }
}
/* Cuentas al día (control diario de cuentas por cobrar) */
.cx-salidas { margin: 6px 0 12px 18px; padding: 0; }
.cx-salidas li { margin-bottom: 8px; }

/* ---------- Cortes y bandeja: lo ACTIVO primero, lo resuelto como historia (2026-10-19) ---------- */
/* Resumen de tiendas: compacto para que quepan las 10 columnas a 1440 px (antes «Asientos» quedaba cortada por letter-spacing y nowrap en los encabezados). */
.ct-res thead th { white-space: normal; letter-spacing: .04em; padding: 8px 8px; vertical-align: bottom; line-height: 1.25; }
.ct-res tbody td { padding: 8px 7px; }
.ct-res td.tienda, .ct-res th.tienda { min-width: 200px; }
.ct-res tr.sem-rojo td.tienda { box-shadow: inset 3px 0 0 var(--err); }
.ct-res tr.sem-ambar td.tienda { box-shadow: inset 3px 0 0 var(--warn); }
.ct-res tr.sem-verde td.tienda { box-shadow: inset 3px 0 0 var(--ok); }
.ct-res td.num .sub { white-space: normal; }
ul.hoy { list-style: none; margin: 6px 0 0; padding: 0; font-size: 11.5px; color: var(--text-2); line-height: 1.35; }
ul.hoy li { margin: 1px 0; }
ul.hoy .quien { font-weight: 700; color: var(--text); margin-right: 2px; }
ul.hoy .quien::after { content: " ·"; font-weight: 400; color: var(--text-3); }
.kpis-sem .kpi .n { font-size: 30px; }
.kpis-t { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); margin: 4px 0 6px; }
.kpis-t .meta { text-transform: none; letter-spacing: 0; font-weight: 400; }
.kpis-3 { grid-template-columns: repeat(3, 1fr); }
.kpis-2 { grid-template-columns: repeat(2, 1fr); max-width: 520px; }
.kpis.hist .kpi { padding: 12px 16px; box-shadow: none; background: var(--surface-2); }
.kpis.hist .kpi .n { font-size: 24px; color: var(--text-2); }
.kpis.hist .kpi::before { background: var(--line-strong); }
.kpis-t.hist { margin-top: 2px; }
.kpis-3 .kpi .hint, .kpis-sem .kpi .hint { margin-top: 6px; font-size: 11.5px; }
.dc-rango { display: inline-flex; gap: 6px; }
.dc-rango[hidden] { display: none; }
h4.sec-h2 { margin: 14px 0 6px; font-size: 12.5px; font-weight: 750; color: var(--text); }
/* Tarjetas por tienda: sólo en el teléfono (la tabla de 10 columnas ahí dejaba ver «Tienda» y «Cuadrados»). */
.ct-cards { display: none; }
.ct-card { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: var(--radius-sm); padding: 11px 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
.ct-card.sem-rojo { border-left-color: var(--err); } .ct-card.sem-ambar { border-left-color: var(--warn); } .ct-card.sem-verde { border-left-color: var(--ok); } .ct-card.sem-gris { border-left-color: var(--text-3); }
.ct-card-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.ct-card-f { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.ct-hist { margin-top: 14px; }
.ct-hist summary { cursor: pointer; font-weight: 650; font-size: 13px; color: var(--text-2); padding: 6px 0; }
/* Día resuelto: marca discreta (no compite con los rojos). */
.mg-d .rs { position: absolute; bottom: 3px; left: 0; right: 0; text-align: center; font-size: 9px; font-weight: 600; color: var(--text-2); line-height: 1; }
.cal .d .rs { position: absolute; top: 1px; left: 3px; font-size: 10px; font-weight: 600; line-height: 1; color: var(--text-2); }
.rs-box { margin: 8px 0; padding: 9px 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.rs-box b { color: var(--text); }
/* Carpeta del día: pagos sin liquidar como tabla plegada; la tarjeta que la trae ocupa todo el ancho. */
.cuadre .fuente.ancha { grid-column: 1 / -1; }
.ps { margin-top: 8px; }
.ps-h { font-size: 12.5px; margin-bottom: 4px; color: var(--text); }
.ps-t { width: 100%; font-size: 12px; }
.ps-t th, .ps-t td { padding: 3px 8px 3px 0; }
.ps-mas summary { cursor: pointer; font-size: 12.5px; font-weight: 650; color: var(--brand); padding: 6px 0; }
.ps-mas[open] { max-height: 360px; overflow: auto; }
.xls td.acc .ac-why { white-space: normal; max-width: 300px; line-height: 1.3; margin-top: 3px; }
.warn-box.coh { font-size: 12.5px; }
/* Pestañas de sección (subnav): con indicador de que hay más a los lados (antes la barra de scroll estaba oculta y «Huérfanas» quedaba cortada sin pista). */
.subnav::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }
.subnav button { scroll-snap-align: start; }
@media (max-width: 719px) {
  .ct-res-tabla { display: none; }
  .ct-cards { display: block; }
  .kpis { gap: 8px; margin-bottom: 12px; }
  .kpi { padding: 10px 12px; }
  .kpi .n { font-size: 26px; }
  .kpi .k { font-size: 9.5px; letter-spacing: .07em; margin-bottom: 6px; }
  .kpis-sem { grid-template-columns: repeat(4, 1fr); }
  .kpis-sem .kpi { padding: 8px 8px; }
  .kpis-sem .kpi .n { font-size: 24px; }
  .kpis-sem .kpi .k { font-size: 9px; letter-spacing: .03em; min-height: 22px; }
  .kpis-3 { grid-template-columns: 1fr 1fr 1fr; }
  .kpis-3 .kpi .hint { font-size: 10.5px; }
  .kpis-2 { max-width: none; }
  .li-toolbar { gap: 8px; }
  .dc-filtros select, .dc-filtros input { max-width: none; min-width: 0; width: 100%; flex: 1 1 140px; }
  .ps-mas[open] { max-height: 300px; }
}
