/* ============================================================================
   Valoris Financiero — TESORERÍA DE FONDOS · CSS
   RC29.1 — paquete de diseño aprobado (tokens + app + tesorería)
   Aislado: no modifica css globales existentes.
   ============================================================================ */

/* ===== TOKENS ===== */
:root {
  --font-disp: "Space Grotesk", system-ui, sans-serif;
  --font-ui: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --signal: oklch(0.82 0.15 168);
  --signal-strong: oklch(0.86 0.16 168);
  --signal-ink: oklch(0.22 0.05 168);
  --real: oklch(0.80 0.14 168);
  --proj: oklch(0.72 0.10 274);
  --pend: oklch(0.82 0.12 92);
  --restr: oklch(0.62 0.012 250);
  --used: oklch(0.70 0.11 230);
  --risk: oklch(0.68 0.17 28);
  --pos: oklch(0.80 0.14 168);
  --neg: oklch(0.68 0.17 28);
  --warn: oklch(0.82 0.12 92);
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(0,0,0,0.22);
  --shadow-2: 0 6px 18px -8px rgba(0,0,0,0.38);
  --shadow-pop: 0 20px 50px -18px rgba(0,0,0,0.6);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --density: 1;
  --pad: calc(16px * var(--density));
  --gap: calc(16px * var(--density));
}

:root, [data-mode="dark"] {
  --bg: oklch(0.165 0.018 250);
  --bg-2: oklch(0.195 0.020 250);
  --surface: oklch(0.225 0.022 250);
  --surface-2: oklch(0.265 0.024 250);
  --surface-3: oklch(0.305 0.025 250);
  --line: oklch(0.33 0.020 250);
  --line-soft: oklch(0.27 0.018 250);
  --ink: oklch(0.96 0.010 240);
  --ink-2: oklch(0.78 0.014 240);
  --ink-3: oklch(0.62 0.016 244);
  --ink-4: oklch(0.48 0.016 246);
  --signal-wash: color-mix(in oklch, var(--signal) 16%, transparent);
  --real-wash: color-mix(in oklch, var(--real) 16%, transparent);
  --proj-wash: color-mix(in oklch, var(--proj) 18%, transparent);
  --pend-wash: color-mix(in oklch, var(--pend) 18%, transparent);
  --risk-wash: color-mix(in oklch, var(--risk) 16%, transparent);
  --used-wash: color-mix(in oklch, var(--used) 18%, transparent);
  --edge-ink: rgba(0,0,0,0.30);
  color-scheme: dark;
}

[data-mode="light"] {
  --bg: oklch(0.955 0.008 240);
  --bg-2: oklch(0.925 0.010 240);
  --surface: oklch(0.995 0.004 240);
  --surface-2: oklch(0.965 0.006 240);
  --surface-3: oklch(0.94 0.008 240);
  --line: oklch(0.87 0.010 244);
  --line-soft: oklch(0.91 0.008 244);
  --ink: oklch(0.22 0.020 250);
  --ink-2: oklch(0.40 0.020 248);
  --ink-3: oklch(0.52 0.018 246);
  --ink-4: oklch(0.62 0.014 244);
  --signal: oklch(0.60 0.13 168);
  --signal-strong: oklch(0.54 0.14 168);
  --signal-ink: oklch(0.99 0 0);
  --real: oklch(0.55 0.13 168);
  --proj: oklch(0.54 0.11 274);
  --pend: oklch(0.62 0.12 88);
  --restr: oklch(0.64 0.012 250);
  --used: oklch(0.52 0.11 230);
  --risk: oklch(0.55 0.18 28);
  --pos: oklch(0.52 0.13 168);
  --neg: oklch(0.55 0.18 28);
  --warn: oklch(0.62 0.12 88);
  --signal-wash: color-mix(in oklch, var(--signal) 12%, transparent);
  --real-wash: color-mix(in oklch, var(--real) 14%, transparent);
  --proj-wash: color-mix(in oklch, var(--proj) 14%, transparent);
  --pend-wash: color-mix(in oklch, var(--pend) 16%, transparent);
  --risk-wash: color-mix(in oklch, var(--risk) 13%, transparent);
  --used-wash: color-mix(in oklch, var(--used) 14%, transparent);
  --edge-ink: rgba(0,0,0,0.16);
  --shadow-1: 0 1px 2px rgba(16,24,40,0.05);
  --shadow-2: 0 6px 18px -10px rgba(16,24,40,0.18);
  --shadow-pop: 0 20px 50px -18px rgba(16,24,40,0.24);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-ui); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.disp { font-family: var(--font-disp); letter-spacing: -0.01em; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.eyebrow { font-size: 10.5px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--line); background-clip: padding-box; border: 3px solid transparent; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 4px; }

.tx-proj { background-image: repeating-linear-gradient(45deg, transparent 0 6px, var(--edge-ink) 6px 7px); }
.tx-pend { background-image: radial-gradient(var(--edge-ink) 1.1px, transparent 1.2px); background-size: 7px 7px; }
.tx-restr { background-image: repeating-linear-gradient(-45deg, transparent 0 5px, var(--edge-ink) 5px 6px); }
.tx-used { background-image: repeating-linear-gradient(90deg, transparent 0 5px, var(--edge-ink) 5px 6px), repeating-linear-gradient(0deg, transparent 0 5px, var(--edge-ink) 5px 6px); }

@keyframes vfPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.38; } }
@keyframes vfFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes vfRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes vfFlow { to { stroke-dashoffset: -16; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.001ms !important; } }

/* ===== SHELL ===== */
.app { display: grid; grid-template-columns: auto 1fr; min-height: 100vh; min-height: 100dvh; }
.side { width: 230px; background: var(--bg-2); border-right: 1px solid var(--line-soft); display: flex; flex-direction: column;
  padding: 14px 12px; gap: 1px; position: sticky; top: 0; height: 100vh; height: 100dvh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; }
.brand-mk { width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; background: var(--signal); position: relative; display: grid; place-items: center; }
.brand-mk::before { content: ""; width: 14px; height: 14px; border: 2.5px solid var(--signal-ink); border-radius: 99px; }
.brand-mk::after { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 99px; background: var(--signal-ink); }
.brand-tx .n { font-family: var(--font-disp); font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.brand-tx .s { font-size: 9.5px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; }
.navgroup { font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-4); font-weight: 700; padding: 14px 10px 6px; white-space: nowrap; }
.navitem { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 6px; color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  border: none; background: none; width: 100%; text-align: left; transition: background .14s, color .14s; text-decoration: none; }
.navitem:hover { background: var(--surface-2); color: var(--ink); }
.navitem.on { background: var(--surface-2); color: var(--ink); font-weight: 600; box-shadow: inset 2px 0 0 var(--signal); }
.navitem .lbl { white-space: nowrap; overflow: hidden; flex: 1; }
.navitem .nbadge { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); background: var(--surface-3); padding: 1px 6px; border-radius: 99px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-top: 1px solid var(--line-soft); margin-top: 2px; }
.me-ava { width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--signal-ink); background: var(--signal); }

/* ===== HEADER VIVO ===== */
.main { min-width: 0; display: flex; flex-direction: column; }
.live { position: sticky; top: 0; z-index: 30; display: flex; align-items: stretch;
  background: color-mix(in oklch, var(--bg-2) 92%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line-soft); }
.live-co { padding: 10px 14px; display: flex; align-items: center; border-right: 1px solid var(--line-soft); }
.live-cell { padding: 10px 20px; border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 3px; justify-content: center; }
.live-cell .k { font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; }
.live-cell .v { font-size: 14.5px; font-weight: 600; }
.live-cell .v.mono { font-family: var(--font-mono); }
.live-right { margin-left: auto; display: flex; align-items: center; gap: 9px; padding: 0 14px; }
.cs-mk { width: 26px; height: 26px; border-radius: 6px; flex-shrink: 0; display: grid; place-items: center; font-weight: 700; font-size: 12px; font-family: var(--font-disp); color: var(--signal-ink); background: var(--signal); }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 6px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: transform .08s, background .14s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn.signal { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.btn.signal:hover:not(:disabled) { background: var(--signal-strong); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.icobtn { width: 36px; height: 36px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: grid; place-items: center; position: relative; }
.icobtn:hover { background: var(--surface-2); color: var(--ink); }
.dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 99px; background: var(--risk); border: 2px solid var(--surface); }

/* ===== CONTENT / LAYOUTS ===== */
.content { padding: 20px 24px 64px; }
.cd { display: flex; flex-direction: column; gap: var(--gap); }
.panel { border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface); }
.panel-h { display: flex; align-items: center; gap: 9px; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); }
.panel-h .t { font-size: 13.5px; font-weight: 600; font-family: var(--font-disp); }
.panel-h .s { font-size: 11.5px; color: var(--ink-4); }
.panel-h .sp { flex: 1; }
.panel-h .badge { font-family: var(--font-mono); font-size: 10.5px; color: var(--signal); background: var(--signal-wash); padding: 2px 7px; border-radius: 4px; font-weight: 600; }
.live-status { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.pulse { width: 7px; height: 7px; border-radius: 99px; background: var(--signal); animation: vfPulse 2s infinite; flex-shrink: 0; }

.headline { padding: 4px 2px 2px; }
.hl-q { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4); font-weight: 700; }
.hl-a { font-family: var(--font-disp); font-size: 23px; font-weight: 500; letter-spacing: -0.02em; margin-top: 6px; color: var(--ink-2); }
.hl-a b { color: var(--ink); font-weight: 700; }

.states-wrap { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; }
.states-strip { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); background: var(--surface); }
.ss-total, .ss-cell { padding: 13px 16px; border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 5px; }
.ss-cell:last-child { border-right: none; }
.ss-total { background: linear-gradient(180deg, var(--signal-wash), transparent 70%); }
.ss-k { font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ss-sw { width: 14px; height: 8px; border-radius: 2px; flex-shrink: 0; border: 1px solid color-mix(in oklch, var(--ink) 12%, transparent); }
.ss-v { font-size: 17px; font-weight: 600; }
.ss-total .ss-v { font-size: 21px; }
.ss-sub { font-size: 10px; color: var(--ink-4); letter-spacing: 0.02em; }

.cd-grid { display: grid; grid-template-columns: 1fr 392px; gap: var(--gap); align-items: start; }
.cd-main { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.cd-side { position: sticky; top: 76px; }
.cd-row { display: grid; grid-template-columns: 1fr 360px; gap: var(--gap); align-items: start; }

/* ===== FLOW MAP ===== */
.flowmap { padding: 16px 14px 14px; }
.flow-cols { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 clamp(28px, 3.5vw, 64px); align-items: center; }
.flow-svg { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: visible; }
.flow-col { display: flex; flex-direction: column; gap: 11px; position: relative; z-index: 2; min-width: 0; }
.flow-colhead { font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-4); font-weight: 700; text-align: center; margin-bottom: 2px; }
.flow-arrow { display: none; }
.flow-node { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; position: relative; transition: opacity .2s, transform .12s, box-shadow .12s; }
.flow-node:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.flow-node::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; }
.flow-node.st-real::before { background: var(--real); } .flow-node.st-proj::before { background: var(--proj); }
.flow-node.st-pend::before { background: var(--pend); } .flow-node.st-restr::before { background: var(--restr); } .flow-node.st-risk::before { background: var(--risk); }
.flow-node.st-risk { border-color: color-mix(in oklch, var(--risk) 42%, var(--line)); }
.fn-ic { width: 30px; height: 30px; border-radius: 6px; flex-shrink: 0; display: grid; place-items: center; color: var(--ink-2); background: var(--surface-2); }
.fn-body { flex: 1; min-width: 0; }
.fn-label { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fn-value { font-size: 14px; font-weight: 600; margin-top: 2px; font-family: var(--font-mono); }
.fn-sub { font-size: 9.5px; font-weight: 600; margin-top: 3px; color: var(--ink-4); }
.fn-sub.st-proj { color: var(--proj); } .fn-sub.st-restr { color: var(--ink-3); } .fn-sub.st-risk { color: var(--risk); } .fn-sub.st-used { color: var(--used); }
.flow-key { display: flex; flex-wrap: wrap; gap: 9px 16px; margin-top: 18px; padding-top: 13px; border-top: 1px solid var(--line-soft); }
.fk { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-2); }
.fk-sw { width: 18px; height: 7px; border-radius: 3px; display: inline-block; }
.fk-sw.st-real { background: var(--real); } .fk-sw.st-proj { background: var(--proj); } .fk-sw.st-pend { background: var(--pend); } .fk-sw.st-restr { background: var(--restr); } .fk-sw.st-risk { background: var(--risk); } .fk-sw.st-used { background: var(--used); }
.flow-node.st-used::before { background: var(--used); }

/* ===== DECISION CARDS ===== */
.dqueue { display: flex; flex-direction: column; gap: 12px; }
.dcard { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.dcard:hover { box-shadow: var(--shadow-2); }
.dcard.sev-risk { border-left: 3px solid var(--risk); }
.dcard.sev-pend { border-left: 3px solid var(--pend); }
.dcard-top { display: flex; gap: 11px; align-items: flex-start; }
.dcard-head { flex: 1; min-width: 0; }
.dcard-head h4 { margin: 0; font-size: 15px; font-weight: 600; }
.dmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; margin-top: 7px; }
.dm-item { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-4); }
.mtag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; }
.mtag-sw { width: 16px; height: 9px; border-radius: 2px; flex-shrink: 0; border: 1px solid color-mix(in oklch, var(--ink) 14%, transparent); }
.dcard-foot { display: flex; align-items: center; gap: 8px; }
.dcard-foot .sp { flex: 1; }

/* ===== PANELS / COMPONENTS ===== */
.scrim { display: none; position: fixed; inset: 0; z-index: 49; background: rgba(0,0,0,0.5); backdrop-filter: blur(2px); }
.scrim.show { display: block; animation: vfFade .18s; }
.dpanel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(444px, 100%); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; animation: vfSlide .24s var(--ease); }
@keyframes vfSlide { from { transform: translateX(100%); } to { transform: none; } }

/* ===== TOASTS ===== */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 36px); }
.toast { display: flex; align-items: center; gap: 11px; background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--signal); border-radius: 6px; padding: 12px 14px; box-shadow: var(--shadow-pop); min-width: 250px; animation: vfRise .25s var(--ease); }

/* ===== MOBILE chrome ===== */
.mobtop, .mseg, .tabbar, .drawer { display: none; }

/* ===== PAGE HEADER ===== */
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.ph-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ph-eyebrow { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-4); font-weight: 700; }
.ph-title { font-family: var(--font-disp); font-size: 23px; font-weight: 600; letter-spacing: -0.025em; margin: 4px 0 0; }
.ph-sub { font-size: 13px; color: var(--ink-3); margin: 3px 0 0; }
.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== KPI STRIP ===== */
.kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.statcell { padding: 13px 16px; border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 4px; }
.statcell:last-child { border-right: none; }
.sc-k { font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; }
.sc-v { font-size: 17px; font-weight: 600; }
.sc-sub { font-size: 11px; color: var(--ink-4); }

/* ===== TOOLBAR ===== */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tb-search { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); color: var(--ink-3); min-width: 0; }
.tb-search input { border: none; background: none; color: var(--ink); font: inherit; font-size: 13px; outline: none; width: 140px; max-width: 40vw; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 7px; padding: 2px; }
.seg button { border: none; background: none; color: var(--ink-3); font: inherit; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 5px; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.toolbar .sp { flex: 1; }

/* ===== DATA TABLE ===== */
.dtable { width: 100%; border-collapse: collapse; }
.dtable th { text-align: left; font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.dtable th.r { text-align: right; }
.dtable td { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13px; vertical-align: middle; }
.dtable td.r { text-align: right; }
.dtable tbody tr:last-child td { border-bottom: none; }
.dtable tr.rrow { cursor: pointer; transition: background .12s; }
.dtable tr.rrow:hover { background: var(--surface-2); }
.ico-tile { width: 30px; height: 30px; border-radius: 6px; flex-shrink: 0; display: grid; place-items: center; color: var(--ink-2); background: var(--surface-2); }

/* ===== BADGES ===== */
.badge2 { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 5px; white-space: nowrap; }
.minibar { display: inline-block; width: 54px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; vertical-align: middle; }
.minibar i { display: block; height: 100%; border-radius: 3px; }

/* ===== SKELETON ===== */
.skel-wrap { display: flex; flex-direction: column; gap: 12px; }
.skel-card { border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 16px; display: flex; flex-direction: column; gap: 9px; }
.skel-line { height: 11px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: skel 1.3s linear infinite; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ===== STATE BLOCKS ===== */
.stateblock { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 24px; }
.sb-ic2 { width: 60px; height: 60px; border-radius: 99px; display: grid; place-items: center; margin-bottom: 14px; }
.sb-t2 { font-family: var(--font-disp); font-size: 16px; font-weight: 600; }
.sb-s2 { font-size: 13px; color: var(--ink-3); margin: 7px 0 0; max-width: 40ch; line-height: 1.5; }
.sbanner { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.sbanner.sev-risk { border-color: color-mix(in oklch, var(--risk) 38%, var(--line)); background: color-mix(in oklch, var(--risk) 6%, var(--surface)); }
.sbanner.sev-go { background: color-mix(in oklch, var(--signal) 5%, var(--surface)); }
.sb-ic { width: 36px; height: 36px; border-radius: 7px; flex-shrink: 0; display: grid; place-items: center; }
.sb-tx { flex: 1; min-width: 0; } .sb-tx b { font-size: 13.5px; font-weight: 600; display: block; } .sb-tx span { font-size: 12px; color: var(--ink-3); }

/* ===== DETAIL GRID ===== */
.detail-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--gap); align-items: start; }

/* ===== RECONCILIATION ===== */
.recon-box { background: var(--surface-2); border-radius: 6px; padding: 14px; }
.recon-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--ink-2); padding: 6px 0; }
.recon-row.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; font-weight: 700; color: var(--ink); }

/* ===== TESORERÍA — FONDOS ===== */
.funds-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--gap); }
.fundcard { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); padding: 14px; display: flex; flex-direction: column; gap: 9px; border-top: 3px solid var(--fund); min-width: 0; }
.fc-top { display: flex; align-items: center; gap: 10px; }
.fc-ic { width: 34px; height: 34px; border-radius: 7px; flex-shrink: 0; display: grid; place-items: center; }
.fc-name { font-size: 14px; font-weight: 600; font-family: var(--font-disp); }
.fc-pct { font-size: 10.5px; color: var(--ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-chip { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--fund); background: color-mix(in oklch, var(--fund) 16%, transparent); padding: 2px 7px; border-radius: 4px; flex-shrink: 0; }
.fc-total { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.fc-disp { font-size: 11.5px; color: var(--ink-3); margin-top: -4px; }
.fc-disp b { color: var(--real); }
.fc-meta { display: flex; align-items: center; gap: 8px; }
.fc-metabar { flex: 1; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.fc-metabar i { display: block; height: 100%; border-radius: 3px; }
.fc-actions { display: flex; gap: 7px; margin-top: 2px; }

/* ===== MONEY BAR + LEGEND ===== */
.moneybar { display: flex; width: 100%; border-radius: 4px; overflow: hidden; border: 1px solid var(--line-soft); background: var(--surface-3); }
.mb-seg { display: block; height: 100%; }
.money-legend { display: flex; flex-direction: column; gap: 1px; }
.money-legend.compact { gap: 0; }
.ml-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line-soft); }
.money-legend .ml-row:first-child { border-top: none; }
.ml-l { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--ink-2); }
.ml-sw { width: 16px; height: 10px; border-radius: 3px; flex-shrink: 0; border: 1px solid color-mix(in oklch, var(--ink) 14%, transparent); }
.ml-v { font-size: 13px; font-weight: 600; }

/* ===== APROBACIONES ===== */
.apr-list { display: flex; flex-direction: column; }
.apr-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.apr-item:last-child { border-bottom: none; }
.apr-item.lg { padding: 14px 16px; }
.apr-ic { width: 34px; height: 34px; border-radius: 7px; flex-shrink: 0; display: grid; place-items: center; }
.apr-actions { display: flex; gap: 7px; flex-shrink: 0; }

/* ===== TRAZABILIDAD ===== */
.traza-list { display: flex; flex-direction: column; }
.traza-row { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 10px; }
.traza-row:last-child { border-bottom: none; }
.traza-chain { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tz-node { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 5px 9px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-soft); white-space: nowrap; }
.tz-node.fondo { color: var(--ink); font-weight: 600; }
.tz-node.activo.link { cursor: pointer; color: var(--used); border-color: color-mix(in oklch, var(--used) 35%, var(--line)); }
.tz-arrow { color: var(--ink-4); flex-shrink: 0; }
.traza-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ===== NOTAS ===== */
.note-info { display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; border-radius: 6px; background: var(--surface-2); color: var(--ink-3); font-size: 12px; line-height: 1.5; }
.note-info b { color: var(--ink-2); }
.pending-tag { font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--pend); background: var(--pend-wash); padding: 2px 6px; border-radius: 4px; }

/* ===== MODAL ===== */
.modal { width: min(440px, 100%); max-height: 94vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-pop); }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.modal-title { font-family: var(--font-disp); font-size: 18px; font-weight: 700; margin: 5px 0 0; letter-spacing: -0.02em; }
.modal-body { padding: 16px 20px; }
.modal-foot { display: flex; gap: 10px; padding: 0 20px 20px; }
.modal-badge { width: 64px; height: 64px; border-radius: 99px; display: grid; place-items: center; margin: 0 auto; }
.vf-spinner { width: 38px; height: 38px; border-radius: 99px; border: 3px solid var(--surface-3); border-top-color: var(--signal); margin: 0 auto; animation: vfSpin .8s linear infinite; }
@keyframes vfSpin { to { transform: rotate(360deg); } }

/* ===== STEPPER / MODALES ===== */
.stepper { display: flex; gap: 6px; margin-bottom: 16px; }
.st-seg { flex: 1; }
.st-bar { height: 4px; border-radius: 99px; transition: background .3s; }
.st-lbl { font-size: 11px; margin-top: 6px; display: block; }
.fundpick { display: flex; flex-direction: column; gap: 7px; }
.fp-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px; border: 1.5px solid var(--line-soft); background: var(--surface-2); color: var(--ink); }
.fp-item.on { border-color: var(--fund); background: color-mix(in oklch, var(--fund) 10%, transparent); }
.fp-ic { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-3); flex-shrink: 0; }
.chip-q { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 99px; }
.destino-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dest-item { display: flex; flex-direction: column; gap: 3px; padding: 11px; border-radius: 7px; border: 1.5px solid var(--line-soft); background: var(--surface-2); color: var(--ink); text-align: left; }
.dest-item.on { border-color: var(--signal); background: var(--signal-wash); }
.dest-ic { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); margin-bottom: 3px; }
.review-box { background: var(--surface-2); border-radius: 7px; padding: 14px; margin-bottom: 14px; }
.rv-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13px; color: var(--ink-3); border-top: 1px solid var(--line-soft); }
.rv-row:first-child { border-top: none; }
.rv-row b { color: var(--ink); font-weight: 600; }
.rv-row.total { border-top: 1.5px solid var(--line); }
.ba-wrap { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.ba-row { display: grid; grid-template-columns: 1fr; gap: 6px; }
.ba-name { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.ba-bars { display: flex; flex-direction: column; gap: 4px; }
.ba-track { height: 10px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.ba-track i { display: block; height: 100%; border-radius: 3px; transition: width .35s var(--ease); }
.ba-vals { font-size: 12px; text-align: right; }
.safebox { border: 1px solid var(--line); border-radius: 7px; padding: 13px; background: var(--surface-2); }
.safebox.hi { border-color: color-mix(in oklch, var(--risk) 40%, var(--line)); background: color-mix(in oklch, var(--risk) 5%, var(--surface)); }
.safe-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.safebox.hi .safe-head { color: var(--risk); }
.confirm-input { width: 100%; padding: 10px 12px; border-radius: 6px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; letter-spacing: 0.1em; text-align: center; outline: none; }
.loan-fromto { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: start; margin-bottom: 6px; }
.loan-arrow { color: var(--ink-4); align-self: center; margin-top: 18px; }
.sim-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.sim-cell { display: flex; flex-direction: column; gap: 7px; }
.sim-input { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 11px; background: var(--surface-2); }
.sim-input input { border: none; background: none; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; width: 100%; outline: none; }
.sim-input span { color: var(--ink-4); font-size: 12px; }
.sim-result { background: var(--surface-2); border-radius: 7px; padding: 14px; }
.sr-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13px; color: var(--ink-3); }
.sr-row.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; font-weight: 700; color: var(--ink); }
.repago-plan { border: 1px solid var(--line-soft); border-radius: 7px; padding: 12px 13px; margin: 12px 0; background: var(--surface-2); }
.rp-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); padding: 3px 0; }
.rp-row b { color: var(--ink); }
.reclass { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: var(--bg-2); }
.reclass-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.reclass-bar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line-soft); }
.reclass-bar i { display: block; height: 100%; }
.reclass-split { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.rc-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.rc-chip b { color: var(--ink); }
.rc-eq { font-size: 13px; font-weight: 700; color: var(--ink); margin-left: auto; }
.dist-row { display: grid; grid-template-columns: 1.1fr 1.6fr auto; gap: 12px; align-items: center; margin-bottom: 12px; }
.dist-name { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.dist-pct { font-size: 13px; font-weight: 600; min-width: 42px; text-align: right; }
.dist-summary { background: var(--surface-2); border-radius: 7px; padding: 12px 14px; margin-top: 4px; }
.ds-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13px; color: var(--ink-3); }
.ds-warn { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--risk); margin-top: 6px; }
.safe-reasons { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.safe-reasons li { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--risk); }

/* ===== OVERFLOW SAFETY ===== */
.main { min-width: 0; max-width: 100vw; }
.cd-grid, .cd-row, .cd-main, .cd-side, .detail-grid { min-width: 0; }
.cd-grid > *, .cd-row > *, .detail-grid > * { min-width: 0; }
.dcard, .dcard-head, .panel, .dqueue { min-width: 0; }

/* ============================================================ RESPONSIVE */
@media (max-width: 1180px) {
  .cd-grid { grid-template-columns: 1fr 340px; }
  .live-cell.opt2 { display: none; }
}
@media (max-width: 1080px) {
  .side { width: 64px; }
  .side .hide-mini { display: none; }
  .side .navitem { justify-content: center; padding: 9px; }
  .side .navgroup { text-align: center; font-size: 0; padding: 12px 0 4px; }
  .side .navgroup::after { content: "·"; font-size: 13px; color: var(--ink-4); }
  .cd-grid, .cd-row { grid-template-columns: 1fr; }
  .cd-side { position: static; }
  .states-strip { grid-template-columns: repeat(3, 1fr) !important; }
  .states-strip .ss-total { grid-column: 1 / -1; }
  .live-cell.opt { display: none; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .kpi-strip .statcell:nth-child(2) { border-right: none; }
  .funds-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side, .live { display: none; }
  .mobtop { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 30;
    padding: 11px 14px; background: color-mix(in oklch, var(--bg-2) 90%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line-soft); }
  .content { padding: 12px 14px 88px; overflow-x: clip; }
  .hl-a { font-size: 18px; }
  .states-strip { grid-template-columns: repeat(2, 1fr) !important; }
  .states-strip .ss-total { grid-column: 1 / -1; }
  .flow-cols { grid-template-columns: 1fr; gap: 8px; }
  .flow-svg { display: none; }
  .flow-colhead { text-align: left; }
  .flow-arrow { display: grid; place-items: center; color: var(--ink-4); padding: 2px 0; }
  .dpanel { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: color-mix(in oklch, var(--bg-2) 95%, transparent); backdrop-filter: blur(18px); border-top: 1px solid var(--line);
    padding: 7px 6px calc(7px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 10px; border: none; background: none; color: var(--ink-4); font-size: 10px; font-weight: 600; text-decoration: none; }
  .tab.on { color: var(--signal); }
  .tabbar .fab { width: 46px; height: 46px; border-radius: 12px; background: var(--signal); color: var(--signal-ink); display: grid; place-items: center; margin-top: -18px; box-shadow: var(--shadow-pop); }
  .drawer { display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; width: 270px; max-width: 84vw;
    background: var(--bg-2); border-right: 1px solid var(--line); padding: 14px 12px; box-shadow: var(--shadow-pop); animation: vfDrawer .22s var(--ease); }
  @keyframes vfDrawer { from { transform: translateX(-100%); } to { transform: none; } }
  .apr-item { flex-wrap: wrap; }
  .apr-actions { width: 100%; }
  .apr-actions .btn { flex: 1; justify-content: center; }
  .traza-meta { gap: 8px 12px; }
  .funds-row { grid-template-columns: 1fr; }
  .loan-fromto { grid-template-columns: 1fr; }
  .loan-arrow { transform: rotate(90deg); margin: 0 auto; }
  .ph-title { font-size: 20px; }
  .kpi-strip { grid-template-columns: 1fr 1fr; }
  .dtable th.col-sec, .dtable td.col-sec { display: none; }
}
@media (max-width: 400px) {
  .content { padding: 10px 12px 88px; }
  .states-strip { grid-template-columns: repeat(2, 1fr) !important; }
}
/* RC29.1 operational movement forms */
.field{display:grid;gap:7px;margin:12px 0}
.field label{font-size:11px;font-weight:650;text-transform:uppercase;letter-spacing:.06em;color:var(--ink-4)}
.field select,.field textarea,.safebox input{width:100%;box-sizing:border-box;border:1px solid var(--line);border-radius:8px;background:var(--surface-2);color:var(--ink);padding:10px 11px;font:inherit}
.field textarea{min-height:72px;resize:vertical}
.field select:focus,.field textarea:focus,.safebox input:focus{outline:2px solid color-mix(in oklch,var(--signal) 40%,transparent);border-color:var(--signal)}
.note-warn{margin:0 0 12px;padding:10px 12px;border:1px solid color-mix(in oklch,var(--risk) 45%,var(--line));border-radius:8px;background:color-mix(in oklch,var(--risk) 10%,transparent);color:var(--risk);font-size:12px}
