/* DUMA | Tesorería Inteligente — estilos */
:root {
  --bg: #fdf7f2;
  --panel: #ffffff;
  --panel-2: #fffaf6;
  --ink: #33241b;
  --ink-2: #6a5345;
  --ink-3: #9b8576;
  --line: #f1e3d7;
  --line-2: #f8eee5;
  --brand: #c4622d;
  --brand-2: #d97a45;
  --side: #fbe3cf;
  --side-ink: #4a2c1a;
  --brand-ink: #ffffff;
  --accent: #e0915b;
  --accent-soft: #fdeadb;
  --rojo: #b3261e; --rojo-bg: #fbeae8;
  --naranja: #c8630f; --naranja-bg: #fdf0e3;
  --amarillo: #a57f0a; --amarillo-bg: #fbf4dc;
  --verde: #2e7d4f; --verde-bg: #e6f3eb;
  --gris: #7c877f; --gris-bg: #efefea;
  --morado: #6a4c93; --morado-bg: #efe9f6;
  --azul: #2b5c8a; --azul-bg: #e7eff7;
  --shadow: 0 1px 2px rgba(20, 30, 22, .06), 0 4px 16px rgba(20, 30, 22, .05);
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1612; --panel: #251d18; --panel-2: #2b221c; --ink: #f3e9e1; --ink-2: #cdb9aa; --ink-3: #9d8a7c; --side: #2a1f18; --side-ink: #f6e4d6; --brand-ink: #2a1608;
    --line: #3a2e26; --line-2: #31271f; --brand: #e38a55; --brand-2: #f0a273; --accent: #f0a273; --accent-soft: #3d2a1e;
    --rojo: #ef7d72; --rojo-bg: #3a1f1c; --naranja: #f0a35c; --naranja-bg: #3a2a1a; --amarillo: #e3c25a; --amarillo-bg: #352f18;
    --verde: #6cc492; --verde-bg: #1b3325; --gris: #9aa59c; --gris-bg: #262d28; --morado: #b79ae0; --morado-bg: #2b2438; --azul: #84b3e0; --azul-bg: #1c2a38;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1612; --panel: #251d18; --panel-2: #2b221c; --ink: #f3e9e1; --ink-2: #cdb9aa; --ink-3: #9d8a7c; --side: #2a1f18; --side-ink: #f6e4d6; --brand-ink: #2a1608;
  --line: #3a2e26; --line-2: #31271f; --brand: #e38a55; --brand-2: #f0a273; --accent: #f0a273; --accent-soft: #3d2a1e;
  --rojo: #ef7d72; --rojo-bg: #3a1f1c; --naranja: #f0a35c; --naranja-bg: #3a2a1a; --amarillo: #e3c25a; --amarillo-bg: #352f18;
  --verde: #6cc492; --verde-bg: #1b3325; --gris: #9aa59c; --gris-bg: #262d28; --morado: #b79ae0; --morado-bg: #2b2438; --azul: #84b3e0; --azul-bg: #1c2a38;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-2); }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td.num, .money { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; }

/* ---------- estructura ---------- */
.app { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--side) 228px, transparent 228px); }
.side { background: var(--side); color: var(--side-ink); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 18px 18px 14px; border-bottom: 1px solid color-mix(in srgb, var(--side-ink) 12%, transparent); }
.brand .logo-img { display: block; background: #fff; border-radius: 10px; padding: 8px 12px; width: 100%; box-shadow: var(--shadow); }
.brand .logo-img img { display: block; height: 34px; width: auto; }
.brand .t2 { margin-top: 8px; text-align: center; }
.brand .logo { display: flex; align-items: center; gap: 10px; }
.brand .mark { width: 34px; height: 34px; border-radius: 8px; background: #f2e3c2; color: #1f3d2b; display: grid; place-items: center; font-weight: 800; font-size: 15px; letter-spacing: -.04em; }
.brand .t1 { font-weight: 700; font-size: 15px; letter-spacing: .06em; }
.brand .t2 { font-size: 10.5px; letter-spacing: .14em; opacity: .75; text-transform: uppercase; }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { color: var(--side-ink); text-decoration: none; padding: 9px 12px; border-radius: 7px; display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.nav a:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.nav a.on { background: var(--panel); color: var(--brand); font-weight: 600; box-shadow: var(--shadow); }
.nav .badge { margin-left: auto; background: var(--brand); color: var(--brand-ink); border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 700; }
.nav .sep { height: 1px; background: color-mix(in srgb, var(--side-ink) 12%, transparent); margin: 8px 6px; }
.nav svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.side .me { padding: 12px 16px; border-top: 1px solid color-mix(in srgb, var(--side-ink) 12%, transparent); font-size: 12px; }
.side .me b { display: block; font-size: 13px; }
.side .me button { margin-top: 8px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); padding: 10px 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.clock { display: flex; flex-direction: column; line-height: 1.15; min-width: 170px; }
.clock .h { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.clock .d { font-size: 11.5px; color: var(--ink-3); text-transform: capitalize; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; flex: 1; }
.filters label { display: flex; flex-direction: column; font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; gap: 3px; }
.filters select, .filters input { min-width: 0; }
.filters.colapsado { display: none; }
#btn-filtros { margin-left: auto; }
#btn-filtros.filtros-activos { border-color: var(--naranja); color: var(--naranja); background: var(--naranja-bg); }
.btn.menu-btn, .menu-btn { display: none; }
.content { padding: 20px 22px 60px; max-width: 1500px; width: 100%; }
.pagehead { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 16px; }
.pagehead h1 { flex: 1; min-width: 200px; }
.pagehead .sub { color: var(--ink-3); font-size: 12.5px; display: block; font-weight: 400; margin-top: 2px; }

/* ---------- controles ---------- */
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 18%, transparent); }
textarea { resize: vertical; min-height: 64px; width: 100%; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--rojo); border-color: color-mix(in srgb, var(--rojo) 40%, var(--line)); }
.btn.ok { color: var(--verde); border-color: color-mix(in srgb, var(--verde) 40%, var(--line)); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.side .btn { background: var(--panel); color: var(--side-ink); border-color: var(--line); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
.seg button.on { background: var(--brand); color: var(--brand-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 20px; padding: 4px 11px; font-size: 12px; cursor: pointer; color: var(--ink-2); }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip .n { opacity: .7; margin-left: 4px; }

/* ---------- tarjetas / KPIs ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .hd { padding: 12px 16px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card > .hd h2 { flex: 1; font-size: 14px; }
.card > .bd { padding: 14px 16px; }
.card > .bd.flush { padding: 0; }
.grid { display: grid; gap: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px 12px; position: relative; overflow: hidden; cursor: pointer; box-shadow: var(--shadow); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--k, var(--brand)); }
.kpi .l { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; }
.kpi .v { font-size: 21px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .s { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.kpi.rojo { --k: var(--rojo); } .kpi.naranja { --k: var(--naranja); } .kpi.amarillo { --k: var(--amarillo); } .kpi.verde { --k: var(--verde); } .kpi.morado { --k: var(--morado); } .kpi.azul { --k: var(--azul); } .kpi.accent { --k: var(--accent); }
.kpi .v.neg { color: var(--rojo); }
.alert { border-radius: 9px; padding: 10px 14px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; font-weight: 600; }
.alert.rojo { background: var(--rojo-bg); color: var(--rojo); border: 1px solid color-mix(in srgb, var(--rojo) 30%, transparent); }
.op-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.op-item { border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; cursor: pointer; }
.op-item:hover { border-color: var(--brand-2); }
.op-item .l { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.op-item .v { font-size: 18px; font-weight: 700; margin: 2px 0; font-variant-numeric: tabular-nums; }
.op-item .s { font-size: 12px; color: var(--ink-2); }
.op-item.aviso { border-color: var(--naranja); }
.op-item.mal { border-color: var(--rojo); background: var(--rojo-bg); }
.op-alertas { list-style: none; margin: 10px 0 0; padding: 0; }
.op-alertas li { padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.op-alertas li:hover { background: var(--panel-2); }
.op-alertas li.n1 { color: var(--rojo); font-weight: 600; }
.aviso-alertas { background: var(--rojo); color: #fff; padding: 8px 16px; font-size: 13px; line-height: 1.4; }
.aviso-alertas a { color: #fff; text-decoration: underline; font-weight: 700; margin-left: 6px; }
.alert.info { background: var(--azul-bg); color: var(--azul); border: 1px solid color-mix(in srgb, var(--azul) 25%, transparent); font-weight: 500; }
.alert.amarillo { background: var(--amarillo-bg); color: var(--amarillo); border: 1px solid color-mix(in srgb, var(--amarillo) 30%, transparent); font-weight: 500; }
.cols-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ---------- semáforo y etiquetas ---------- */
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--gris); }
.dot.rojo { background: var(--rojo); } .dot.naranja { background: var(--naranja); } .dot.amarillo { background: #d6aa1c; } .dot.verde { background: var(--verde); } .dot.bloqueada { background: var(--morado); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--gris-bg); color: var(--ink-2); }
.tag.e-recibida { background: var(--azul-bg); color: var(--azul); }
.tag.e-en-revision { background: var(--amarillo-bg); color: var(--amarillo); }
.tag.e-pendiente-de-aprobacion { background: var(--naranja-bg); color: var(--naranja); }
.tag.e-aprobada { background: var(--verde-bg); color: var(--verde); }
.tag.e-para-pago { background: var(--brand); color: var(--brand-ink); }
.alert.verde { background: var(--verde-bg); color: var(--verde); border: 1px solid color-mix(in srgb, var(--verde) 30%, transparent); font-weight: 500; flex-wrap: wrap; }
/* Obligaciones: filtros rápidos por fecha de pago */
.ob-rapidos { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ob-rapidos .chip .v { margin-left: 6px; font-size: 11px; opacity: .8; font-variant-numeric: tabular-nums; }
.ob-rapidos .chip.chip-alerta:not(.on) { border-color: var(--rojo); color: var(--rojo); }
/* Proveedores */
.btn.pv-copy { padding: 1px 6px; font-size: 12px; line-height: 1.4; vertical-align: middle; }
/* Créditos agrupados por banco */
table.t tr.cr-banco td { background: var(--accent-soft); border-top: 2px solid var(--line); }
/* Créditos: cuadrícula mes a mes */
table.cr-grid th, table.cr-grid td { white-space: nowrap; }
table.cr-grid tr.cr-tot td { background: var(--accent-soft); font-weight: 700; }
/* Cuadre de caja */
.cu-res { display: grid; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.cu-res > div { display: flex; justify-content: space-between; gap: 10px; font-variant-numeric: tabular-nums; }
.cu-res .tot { border-top: 1px solid var(--line); padding-top: 8px; font-size: 16px; }
table.cu-den { margin-bottom: 10px; }
table.cu-den td, table.cu-den th { padding-top: 4px; padding-bottom: 4px; }
input.cu-bad { border-color: var(--rojo); background: var(--rojo-bg); }
.cu-total { display: grid; gap: 6px; border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.cu-total > div { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.cu-total b { font-size: 16px; }
.cu-dif { justify-content: center !important; font-weight: 700; font-size: 16px; border-radius: 8px; padding: 8px; }
.cu-dif.bien { background: var(--verde-bg); color: var(--verde); }
.cu-dif.mal { background: var(--rojo-bg); color: var(--rojo); }
.cu-siigo { margin-top: 12px; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; }
tr.cj-anulado td { color: var(--ink-3); text-decoration: line-through; }
tr.cj-anulado td.cj-acc { text-decoration: none; }
tr.cj-saldo-ant td { background: var(--accent-soft); }
td.cj-acc, td.cj-nw { white-space: nowrap; }
td.cj-acc { text-align: right; }
/* Pagos mes a mes: fila resaltada en naranja suave con borde a la izquierda (claro y oscuro). */
table.t tr.fila-mensual > td { background: color-mix(in srgb, var(--naranja) 12%, transparent); }
table.t tr.fila-mensual > td:first-child { box-shadow: inset 4px 0 0 var(--naranja); }
table.t tr.fila-mensual:hover > td { background: color-mix(in srgb, var(--naranja) 20%, transparent); }
.tag.mensual { background: var(--azul-bg); color: var(--azul); border: 1px solid color-mix(in srgb, var(--azul) 35%, transparent); font-weight: 600; }
.tag.diaria { background: var(--naranja-bg); color: var(--naranja); border: 1px solid var(--naranja); font-weight: 600; }
.tag.e-reprogramada { background: var(--accent-soft); color: var(--accent); }
.tag.e-pago-parcial { background: var(--morado-bg); color: var(--morado); }
.tag.e-pagada { background: var(--gris-bg); color: var(--verde); }
.tag.e-bloqueada { background: var(--morado); color: #fff; }
.tag.e-anulada { background: var(--gris-bg); color: var(--ink-3); text-decoration: line-through; }
.tag.ok { background: var(--verde-bg); color: var(--verde); } .tag.bad { background: var(--rojo-bg); color: var(--rojo); } .tag.warn { background: var(--amarillo-bg); color: var(--amarillo); }

/* ---------- tablas ---------- */
.tablewrap { overflow: auto; max-width: 100%; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.t th { position: sticky; top: 0; background: var(--panel-2); text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tbody tr:hover td { background: var(--panel-2); }
table.t tr.click { cursor: pointer; }
table.t tr.sel td { background: var(--accent-soft) !important; }
table.t tfoot td { font-weight: 700; background: var(--panel-2); border-top: 1px solid var(--line); position: sticky; bottom: 0; }
table.t td.wrap { white-space: normal; min-width: 180px; }
table.t th.num { text-align: right; }
.t-tercero { font-weight: 600; }
.t-sub { font-size: 11.5px; color: var(--ink-3); }
.rojo-txt { color: var(--rojo); font-weight: 600; } .verde-txt { color: var(--verde); font-weight: 600; } .naranja-txt { color: var(--naranja); font-weight: 600; }
.empty { padding: 30px; text-align: center; color: var(--ink-3); }

/* ---------- detalle ---------- */
.drawer-bg { position: fixed; inset: 0; background: rgba(15, 22, 17, .35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(880px, 100%); background: var(--bg); z-index: 41; overflow-y: auto; box-shadow: -10px 0 40px rgba(0,0,0,.15); animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer .dh { position: sticky; top: 0; z-index: 2; background: var(--panel); border-bottom: 1px solid var(--line); padding: 14px 20px; }
.drawer .dh .row1 { display: flex; align-items: center; gap: 10px; }
.drawer .dh h2 { font-size: 18px; flex: 1; }
.drawer .db { padding: 16px 20px 40px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1px; background: var(--line-2); border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.fields > div { background: var(--panel); padding: 8px 11px; }
.fields .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; }
.fields .v { margin-top: 2px; font-weight: 600; word-break: break-word; }
.fields .v.big { font-size: 17px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 16px 0 12px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 8px 12px; cursor: pointer; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--brand-2); border-bottom-color: var(--brand-2); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-2); }
.timeline .when { font-size: 11.5px; color: var(--ink-3); }

/* ---------- modal / formularios ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 22, 17, .45); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 12px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(860px, 100%); }
.modal .mh { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; }
.modal .mh h2 { flex: 1; }
.modal .mb { padding: 16px 18px; }
.modal .mf { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: var(--panel); }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form .f { display: flex; flex-direction: column; gap: 4px; }
.form .f.full { grid-column: 1 / -1; }
.form label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.form label .req { color: var(--rojo); }
.form .help { font-size: 11.5px; color: var(--ink-3); }
.form input, .form select, .form textarea { width: 100%; }
.form fieldset { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px 12px; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.form legend { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 0 6px; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.check input { width: auto; }
.err { background: var(--rojo-bg); color: var(--rojo); border-radius: 7px; padding: 8px 11px; font-size: 13px; margin-bottom: 10px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow); font-size: 13px; animation: slidein .15s; }
.toast.bad { background: var(--rojo); color: #fff; }
.toast.good { background: var(--verde); color: #fff; }

/* ---------- gráficos ---------- */
.chart { width: 100%; display: block; }
.chart text { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.chart .lbl { fill: var(--ink-2); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.bars-h .row { display: grid; grid-template-columns: minmax(110px, 1.2fr) 2fr auto; align-items: center; gap: 10px; padding: 5px 0; font-size: 12.5px; }
.bars-h .bar { height: 10px; border-radius: 5px; background: var(--line-2); overflow: hidden; }
.bars-h .bar > i { display: block; height: 100%; background: var(--brand-2); border-radius: 5px; }
.bars-h .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sema { display: flex; gap: 14px; flex-wrap: wrap; }
.sema .s { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.sema .s b { font-size: 18px; font-variant-numeric: tabular-nums; }

/* ---------- calendario ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cal .dow { background: var(--panel-2); padding: 6px 8px; font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; }
.cal .day { background: var(--panel); min-height: 104px; padding: 6px 7px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; }
.cal .day.out { background: var(--panel-2); opacity: .6; }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal .day.deficit { background: var(--rojo-bg); }
.cal .day .n { font-size: 12px; font-weight: 700; color: var(--ink-2); display: flex; justify-content: space-between; }
.cal .day .tot { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal .it { font-size: 11px; padding: 2px 5px; border-radius: 4px; background: var(--line-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--gris); }
.cal .it.rojo { border-left-color: var(--rojo); } .cal .it.naranja { border-left-color: var(--naranja); } .cal .it.amarillo { border-left-color: #d6aa1c; } .cal .it.verde { border-left-color: var(--verde); } .cal .it.pagada { opacity: .55; text-decoration: line-through; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .art { background: linear-gradient(160deg, #fde6d3 0%, #f8c9a5 100%); color: #4a2c1a; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login .art::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(255, 255, 255, .25); }
.login .art h1 { font-size: 40px; line-height: 1.05; letter-spacing: -.02em; max-width: 460px; }
.login .art p { max-width: 420px; opacity: .8; line-height: 1.5; }
.login .box { display: grid; place-items: center; padding: 32px; }
.login form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login form input { padding: 11px 12px; }
.login form .btn { justify-content: center; padding: 11px; }

/* ---------- markdown ---------- */
.md { line-height: 1.6; max-width: 860px; }
.md h1 { font-size: 22px; margin: 6px 0 12px; } .md h2 { font-size: 17px; margin: 22px 0 8px; } .md h3 { font-size: 14px; margin: 16px 0 6px; }
.md code { font-family: var(--mono); background: var(--line-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.md pre { background: var(--panel-2); border: 1px solid var(--line); padding: 10px 12px; border-radius: 8px; overflow-x: auto; }
.md table { border-collapse: collapse; margin: 8px 0; } .md td, .md th { border: 1px solid var(--line); padding: 5px 9px; text-align: left; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; background: none; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 10px 0 40px rgba(0,0,0,.3); }
  .btn.menu-btn, .menu-btn { display: inline-flex; }
  .topbar { padding: 8px 16px; }
  .content { padding: 14px 16px 60px; }
  .clock { min-width: 0; }
  .filters label.opt { display: none; }
  .filters.open label.opt { display: flex; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px 11px; } .kpi .v { font-size: 17px; }
  .form { grid-template-columns: 1fr; }
  .form fieldset { grid-template-columns: 1fr 1fr; }
  .login { grid-template-columns: 1fr; } .login .art { padding: 28px; min-height: 220px; } .login .art h1 { font-size: 28px; }
  .cal .day { min-height: 64px; } .cal .it { display: none; }
  table.t .hide-m { display: none; }
}
@media print {
  .side, .topbar, .btn, .actions { display: none !important; }
  .app { display: block; } .card { box-shadow: none; }
}
.cols-2 > *, .cols-3 > *, .grid > *, .main, .content { min-width: 0; }
@media (max-width: 860px) { .pagehead h1 { min-width: 0; flex-basis: 100%; } .topbar .clock .d { font-size: 10.5px; } }
@media (max-width: 860px) { .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .drawer .db { padding: 12px 14px 40px; } .drawer .dh { padding: 12px 14px; } }
.menu-btn svg { width: 22px; height: 22px; flex: none; }

/* Panel de selección de obligaciones: suma lo marcado frente al efectivo y bancos disponibles */
.selpanel { position: sticky; bottom: 0; z-index: 5; margin-top: 12px; background: var(--panel); border: 2px solid var(--brand); border-radius: var(--radius); box-shadow: 0 -4px 16px rgba(0,0,0,.12); }
.selpanel summary { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; padding: 10px 14px; cursor: pointer; list-style: none; }
.selpanel summary::-webkit-details-marker { display: none; }
.selpanel summary::before { content: '▸'; color: var(--brand); }
.selpanel details[open] summary::before { content: '▾'; }
.selpanel summary .btn { margin-left: auto; }
.selpanel-bd { padding: 0 14px 12px; max-height: 45vh; overflow: auto; }
.sellist { list-style: none; margin: 0 0 10px; padding: 0; }
.sellist li { display: flex; gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); }
.sellist li > span:first-child { flex: 1; min-width: 0; }
.selcuentas { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.selcuentas > div { background: var(--bg); border-radius: 8px; padding: 8px 11px; }
.selcuentas .k { font-size: 11px; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.selcuentas .v { font-size: 17px; font-weight: 700; }
.selcuentas .s { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
/* Saldo tentativo: saldo registrado menos lo mandado a pagar sin comprobante */
.tent-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.tent-lado { background: var(--bg); border-radius: 8px; padding: 10px 12px; }
.tent-lado .k { font-size: 11px; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-bottom: 4px; }
.tent-calc { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 2px 0; }
.tent-calc span { color: var(--ink-2); }
.tent-total { border-top: 1px solid var(--line, #ddd); margin-top: 4px; padding-top: 6px; font-size: 16px; }
.tent-lado details { margin-top: 6px; }
td[data-stop] input[type=checkbox], th input[data-selall] { width: 20px; height: 20px; cursor: pointer; }

/* Obligaciones: secciones 'por revisar' y 'mandadas a pagar' */
.ob-seccion { margin-bottom: 12px; }
.ob-seccion .hd h2 .small { font-weight: 400; margin-left: 6px; }
.ob-mandadas { border-left: 4px solid var(--verde, #2e7d32); }

