/* CR Finanzas — estilo Bento: tarjetas de varios tamaños, verde de marca (#38E54D) para acciones,
   modo claro y oscuro (sigue a Windows; el botón de tema lo fija en localStorage → data-theme). */
@font-face { font-family: 'DM Sans'; font-weight: 400; src: url('/assets/fonts/DMSans-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'DM Sans'; font-weight: 500; src: url('/assets/fonts/DMSans-500-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'DM Sans'; font-weight: 600; src: url('/assets/fonts/DMSans-600-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'DM Sans'; font-weight: 700; src: url('/assets/fonts/DMSans-700-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Work Sans'; font-weight: 400; src: url('/assets/fonts/WorkSans-regular.ttf'); }
@font-face { font-family: 'Work Sans'; font-weight: 700; src: url('/assets/fonts/WorkSans-bold.ttf'); }
@font-face { font-family: 'Work Sans'; font-weight: 400; font-style: italic; src: url('/assets/fonts/WorkSans-italic.ttf'); }

/* ---------- colores ---------- */
/* Claro (base). --accent es el verde de marca para rellenos; --accent-fg es el verde cuando va como texto. */
:root {
  --bg: #eef1ef;
  --surface: #ffffff;
  --surface-2: #f5f7f6;
  --surface-3: #e8ece9;
  --border: #dde3df;
  --border-strong: #c2cbc5;
  --text: #101512;
  --text-2: #36403a;
  --muted: #5c6761;
  --hover: rgba(16, 21, 18, .05);
  --scrim: rgba(16, 21, 18, .45);
  --shadow: 0 1px 2px rgba(16, 21, 18, .04), 0 6px 20px rgba(16, 21, 18, .06);
  --shadow-pop: 0 12px 40px rgba(16, 21, 18, .18);
  --accent: #38e54d; --accent-hover: #2fd444; --accent-text: #06120a; --accent-fg: #15803d; --accent-soft: #dcfce4;
  --ok: #15803d; --ok-soft: #dcfce4;
  --info: #1d5fb8; --info-soft: #e3eefc;
  --warn: #a15c00; --warn-soft: #fdf0d9;
  --err: #c62828; --err-soft: #fde7e6;
  --chart-in: #1fa336; --chart-out: #e5534b; --chart-2: #1d5fb8;
  --wa-bg: #e3f9ea; --wa-border: #25d366; --wa-text: #0b5d2a;
  --raw-on: rgba(56, 229, 77, .10);
  --scroll: #c2cbc5;
  color-scheme: light;
}
/* Oscuro: por preferencia de Windows (si no se fijó claro) o fijado con el botón. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0c0b; --surface: #131715; --surface-2: #1a1f1c; --surface-3: #232925;
    --border: #252c28; --border-strong: #39433d;
    --text: #eef2ef; --text-2: #c5cdc8; --muted: #949f99;
    --hover: rgba(255, 255, 255, .05); --scrim: rgba(0, 0, 0, .6);
    --shadow: none; --shadow-pop: 0 16px 48px rgba(0, 0, 0, .55);
    --accent-hover: #5cf06e; --accent-fg: #4ade80; --accent-soft: #12281a;
    --ok: #4ade80; --ok-soft: #12281a; --info: #6cb4ff; --info-soft: #132235;
    --warn: #f0b04a; --warn-soft: #2d2412; --err: #ff7a75; --err-soft: #331817;
    --chart-in: #38e54d; --chart-out: #ff7a75; --chart-2: #6cb4ff;
    --wa-bg: #1d3b27; --wa-text: #d9ffe4; --raw-on: rgba(56, 229, 77, .06); --scroll: #2f3833;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0c0b; --surface: #131715; --surface-2: #1a1f1c; --surface-3: #232925;
  --border: #252c28; --border-strong: #39433d;
  --text: #eef2ef; --text-2: #c5cdc8; --muted: #949f99;
  --hover: rgba(255, 255, 255, .05); --scrim: rgba(0, 0, 0, .6);
  --shadow: none; --shadow-pop: 0 16px 48px rgba(0, 0, 0, .55);
  --accent-hover: #5cf06e; --accent-fg: #4ade80; --accent-soft: #12281a;
  --ok: #4ade80; --ok-soft: #12281a; --info: #6cb4ff; --info-soft: #132235;
  --warn: #f0b04a; --warn-soft: #2d2412; --err: #ff7a75; --err-soft: #331817;
  --chart-in: #38e54d; --chart-out: #ff7a75; --chart-2: #6cb4ff;
  --wa-bg: #1d3b27; --wa-text: #d9ffe4; --raw-on: rgba(56, 229, 77, .06); --scroll: #2f3833;
  color-scheme: dark;
}

/* ---------- medidas ---------- */
:root {
  --radius: 18px;       /* tarjetas */
  --radius-sm: 12px;    /* botones, campos */
  --radius-xs: 8px;
  --gap: 14px;
  --font: 'DM Sans', 'Work Sans', system-ui, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* El logo blanco en oscuro, el negro en claro. */
.on-light { display: none !important; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .on-dark { display: none !important; } :root:not([data-theme="dark"]) .on-light { display: inline-block !important; } }
:root[data-theme="light"] .on-dark { display: none !important; }
:root[data-theme="light"] .on-light { display: inline-block !important; }

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { display: flex; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-fg); }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-text); }
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 300; background: var(--accent); color: var(--accent-text); padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 600; }
.skip:focus { top: 12px; }
main:focus { outline: none; }
/* Cifras alineadas en columnas y tarjetas. */
.val, .num, .acc-saldo, .tasas-mini b, .goal-amt b, .conv b, .bar-row b, input.big, .total-row input { font-variant-numeric: tabular-nums; }

/* ---------- barra lateral ---------- */
.topbar { display: none; }
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 90; }
.sidebar { width: 236px; flex: none; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; }
.brand img.iso { width: 36px; height: 36px; }
.brand b { display: block; font-size: 16px; letter-spacing: .01em; }
.brand small { color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 12px 4px; font-weight: 600; }
.nav a, .side-theme { display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none; border: 0; background: none; cursor: pointer; text-align: left; width: 100%; transition: background .15s var(--ease), color .15s var(--ease); }
.nav a:hover, .side-theme:hover { background: var(--hover); color: var(--text); }
.nav a.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.nav a i, .side-theme i { font-size: 16px; }
.nav a .soon { margin-left: auto; font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 20px; padding: 0 8px; }
.nav a.disabled { opacity: .5; pointer-events: none; }
.side-foot { border-top: 1px solid var(--border); padding-top: 8px; flex: none; }
.side-foot button { width: 100%; }

/* ---------- contenido ---------- */
main { flex: 1; min-width: 0; overflow: auto; }
.page { padding: 28px 32px 64px; max-width: 1320px; margin: 0 auto; }
.page.wide { max-width: none; }
.head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.head h1 { font-size: 26px; line-height: 1.2; margin: 0; flex: 1; font-weight: 700; letter-spacing: -.01em; }
.head h1 small { display: block; font-size: 14px; color: var(--muted); font-weight: 400; margin-top: 4px; letter-spacing: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: var(--gap); }
.card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card h3 > i { color: var(--muted); }
.card h3 .grow { flex: 1; }
.grid { display: grid; gap: var(--gap); }
.kpis { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: var(--gap); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s var(--ease), transform .15s var(--ease); display: flex; flex-direction: column; }
.kpi:hover { border-color: var(--border-strong); }
.kpi:active { transform: scale(.99); }
.kpi .lbl { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.kpi .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Bento de Inicio: patrimonio grande en verde, los demás alrededor. */
.kpis.bento { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.bento .hero { grid-column: span 2; grid-row: span 2; background: var(--accent); border-color: var(--accent); color: var(--accent-text); justify-content: space-between; padding: 24px; }
.kpis.bento .hero .lbl, .kpis.bento .hero .sub { color: color-mix(in srgb, var(--accent-text) 72%, transparent); }
.kpis.bento .hero .val { font-size: 44px; margin-top: 18px; }
.kpis.bento .hero:hover { background: var(--accent-hover); }
.kpis.bento .wide2 { grid-column: span 2; }
.bento-mid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr); align-items: stretch; margin-bottom: var(--gap); }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--text); font-weight: 500; transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease); }
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: none; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--err); }
.btn.primary.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.primary.danger:hover { filter: brightness(1.08); background: var(--err); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { min-height: 34px; padding: 5px 12px; font-size: 14px; border-radius: 10px; }
.btn.wa { background: var(--wa-bg); border-color: var(--wa-border); color: var(--wa-text); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn kbd { margin-left: 2px; }
.icon-btn { display: inline-grid; place-items: center; min-width: 36px; min-height: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 10px; transition: background .15s var(--ease), color .15s var(--ease); }
.icon-btn:hover { color: var(--text); background: var(--hover); }

/* ---------- formularios ---------- */
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
label.f > span { display: flex; gap: 6px; align-items: center; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-size: 15px; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent-fg); }
input[type=color] { padding: 4px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.row + .row, .row + label.f, label.f + .row, label.f + label.f { margin-top: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.hint { color: var(--muted); font-size: 13px; }
.hint code { background: var(--surface-3); padding: 1px 5px; border-radius: 5px; color: var(--accent-fg); }

/* ---------- tablas ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--hover); }
.table .num { text-align: right; white-space: nowrap; }
.table .mono { font-variant-numeric: tabular-nums; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.empty i { font-size: 30px; display: block; margin-bottom: 10px; }

/* ---------- estados ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge.borrador { background: var(--surface-3); color: var(--text-2); }
.badge.enviado { background: var(--info-soft); color: var(--info); }
.badge.aprobado { background: var(--ok-soft); color: var(--ok); }
.badge.rechazado { background: var(--err-soft); color: var(--err); }
.badge.vencido { background: var(--warn-soft); color: var(--warn); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 14px; color: var(--text-2); transition: background .15s var(--ease), border-color .15s var(--ease); }
.chip:hover { border-color: var(--border-strong); }
.chip.on { background: var(--accent-soft); border-color: var(--accent-fg); color: var(--accent-fg); font-weight: 600; }
.search { position: relative; }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 36px; min-width: 240px; }

/* ---------- editor de contrato ---------- */
.editor { display: grid; grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr); gap: 18px; align-items: start; }
.editor .form { display: flex; flex-direction: column; gap: var(--gap); }
.preview { position: sticky; top: 0; height: calc(100vh - 110px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.preview .bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--muted); }
.preview iframe { flex: 1; border: 0; background: #525659; width: 100%; }
.items .it { display: grid; grid-template-columns: 1fr 150px 36px; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.items .it + .it { margin-top: 8px; }
.items .it input, .items .it textarea { background: var(--surface); }
.items .it textarea { min-height: 42px; grid-column: 1 / 3; }
.items .it input.valor { text-align: right; }
.items .it .icon-btn { grid-row: 1; grid-column: 3; }
.total-row { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.total-row input:not([type=checkbox]) { width: 170px; text-align: right; font-weight: 700; }
.list-edit .le { display: grid; grid-template-columns: 80px 1fr 36px; gap: 8px; align-items: start; }
.list-edit .le + .le { margin-top: 8px; }
.list-edit.claus .le { grid-template-columns: 110px 1fr 36px; }
.list-edit.pagos .le { grid-template-columns: 170px 1fr 36px; }
details.sec > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; min-height: 32px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::before { content: '\F285'; font-family: 'bootstrap-icons'; font-size: 12px; color: var(--muted); transition: transform .15s var(--ease); }
details.sec[open] > summary::before { transform: rotate(90deg); }
details.sec > summary .hint { font-weight: 400; margin-left: auto; }
details.sec[open] > summary { margin-bottom: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.timeline li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.timeline li time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.estado-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.estado-bar button { flex: 1; }
.estado-bar button.on.borrador { border-color: var(--text-2); }
.estado-bar button.on.enviado { border-color: var(--info); color: var(--info); background: var(--info-soft); }
.estado-bar button.on.aprobado { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.estado-bar button.on.rechazado { border-color: var(--err); color: var(--err); background: var(--err-soft); }

/* ---------- ventanas y avisos ---------- */
.modal-bg { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .15s var(--ease); }
.modal { width: min(620px, 100%); max-height: 92vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 24px; box-shadow: var(--shadow-pop); animation: pop .18s var(--ease); }
.modal h2 { margin: 0 0 16px; font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 14px 0 0; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.steps li::before { content: counter(s); width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 13px; font-weight: 700; }
.steps li .grow { flex: 1; font-size: 14px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast div { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: var(--radius-sm); max-width: 380px; box-shadow: var(--shadow-pop); animation: pop .18s var(--ease); }
.toast div.err { border-left-color: var(--err); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; min-height: 40px; padding: 9px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent-fg); }
.cli-head { display: flex; gap: 16px; align-items: center; }
.avatar { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-fg); font-weight: 700; font-size: 17px; flex: none; }
/* telegram */
.tg-pasos { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.tg-paso { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; }
.tg-paso p { margin: 4px 0 10px; }
.tg-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-weight: 700; font-size: 14px; }
.tg-paso.ok .tg-n { background: var(--accent); color: var(--accent-text); }
.tg-code { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tg-code code { font-size: 20px; padding: 8px 14px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--text); letter-spacing: .04em; }
.comp-thumb { display: flex; gap: 12px; align-items: center; margin-top: 12px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); text-decoration: none; color: var(--text-2); }
.comp-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: var(--surface-3); }
.comp-thumb:hover { border-color: var(--border-strong); }

/* recurrentes */
.nav-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--err); color: #fff; }
.nav a.on .nav-count { background: var(--accent-text); color: var(--accent); }
.rec-aviso { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.rec-aviso:hover { border-color: var(--info); }
.pend-list { display: flex; flex-direction: column; }
.pend { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 4px; border-top: 1px solid var(--border); }
.pend:first-child { border-top: 0; }
.pend-info b { display: block; }
.pend-info .badge { margin-top: 4px; font-size: 12px; padding: 2px 8px; }
.pend-monto { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pend-acc { display: flex; gap: 6px; }
.t-rec tr.off td { opacity: .55; }
.pend-fecha { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.pend-fecha .badge { margin-top: 0; }
.pend-fecha .btn.sm { min-height: 28px; padding: 2px 8px; font-size: 12px; }
.pend-abono { margin-top: 8px; max-width: 360px; }
.pend-abono .bar { height: 6px; margin-bottom: 4px; }
.pend-abono .bar i { background: var(--chart-in); }

/* reportes */
.rep-split { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin-top: 14px; font-size: 14px; color: color-mix(in srgb, var(--accent-text) 78%, transparent); }
.rep-split b { color: var(--accent-text); font-variant-numeric: tabular-nums; text-align: right; }
.kpi .delta { margin: 0 0 0 4px; padding: 1px 8px; font-size: 12px; }
.rep-cols { height: 170px; gap: 4px; }
.rep-cols .col { min-width: 0; }
.rep-cols .pair { gap: 2px; }
.rep-meses td, .rep-meses th { white-space: nowrap; }
.rep-meses tr.rep-tot td { font-weight: 700; border-top: 1px solid var(--border-strong); }

/* recibos */
.tag.tag-rec { margin: 4px 0 0; background: var(--ok-soft); color: var(--ok); }
.tag.tag-nota { margin: 4px 0 0; background: var(--info-soft); color: var(--info); }
.t-recibos td .tag { display: inline-block; }

/* clientes como tarjetas */
.cli-search { max-width: 360px; margin-bottom: var(--gap); }
.cli-search input { width: 100%; min-width: 0; }
.cli-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap); }
.cli-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; gap: 14px; transition: border-color .15s var(--ease), transform .15s var(--ease); }
.cli-card:hover { border-color: var(--border-strong); }
.cli-card:active { transform: scale(.99); }
.cli-card.off { opacity: .6; }
.cli-top { display: flex; gap: 12px; align-items: center; }
.cli-name { min-width: 0; }
.cli-name b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cli-name small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cli-stats { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--text-2); }
.cli-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.cli-links .more { margin-left: auto; }
.cli-detail { grid-template-columns: 320px minmax(0, 1fr); align-items: start; }
.chip .cnt { margin-left: 6px; font-size: 12px; font-weight: 600; padding: 0 7px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); }
.chip.on .cnt { background: var(--accent); color: var(--accent-text); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } .preview { position: static; height: 80vh; } }
.row > label.f + label.f, .row + label.f.nomt { margin-top: 0; }
.grid > .card + .card { margin-top: 0; }

/* ---------- finanzas ---------- */
.nav .quick { margin: 14px 0 0; width: 100%; }
.sec-title { font-size: 17px; font-weight: 700; margin: 30px 0 14px; display: flex; gap: 8px; align-items: center; color: var(--text); }
.sec-title i { color: var(--muted); }
.pos { color: var(--ok); } .neg { color: var(--err); } .warn { color: var(--warn); }
.up { color: var(--ok); } .down { color: var(--err); }
kbd { font: 600 11px/1 var(--font); padding: 3px 6px; border-radius: 5px; border: 1px solid color-mix(in srgb, currentColor 30%, transparent); background: color-mix(in srgb, currentColor 8%, transparent); }
.tag { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); margin-left: 6px; white-space: nowrap; }
.month-nav { display: flex; align-items: center; gap: 4px; }
.month-nav b { min-width: 140px; text-align: center; text-transform: capitalize; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: var(--gap); padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.filters select { width: auto; min-height: 38px; background-color: var(--surface-2); }
.filters .month-nav { padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--border); }
.filters .search { flex: 1; }
.filters .search input { width: 100%; min-height: 38px; }

/* movimientos agrupados por día */
.t-movs tr.day td { padding: 18px 12px 6px; border-bottom: 1px solid var(--border); background: none; }
.t-movs tr.day:first-child td, .t-movs tr:first-child + tr.day td { padding-top: 10px; }
.t-movs tr.day td { font-size: 13px; color: var(--muted); font-weight: 600; }
.t-movs tr.day td { display: table-cell; }
.t-movs tr.day b { float: right; font-size: 13px; font-variant-numeric: tabular-nums; text-transform: none; }
.t-movs tr.click:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: -2px; }

/* monto con la moneda de la cuenta */
.money-in { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.money-in:focus-within { border-color: var(--accent-fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.money-in span { display: grid; place-items: center; padding: 0 4px 0 14px; font-weight: 700; color: var(--muted); font-size: 15px; }
.money-in input { border: 0; background: none; box-shadow: none !important; padding-left: 6px; }
/* moneda del precio dentro del campo de monto (movimientos) */
.money-in .mon-sel { width: auto; min-height: 0; border: 0; background-color: transparent; box-shadow: none !important; padding: 0 2px 0 12px; font-weight: 700; color: var(--muted); font-size: 15px; cursor: pointer; }
.money-in .mon-sel.otra { color: var(--info); }
.money-in .mon-sel[hidden] { display: none; }
.filters .search input { min-width: 180px; }

/* formulario de movimiento */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 16px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; }
.seg button { min-height: 44px; padding: 8px; border-radius: 10px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--muted); font-weight: 500; transition: background .15s var(--ease), color .15s var(--ease); }
.seg button:hover { color: var(--text); }
.seg button.on.gasto { border-color: var(--err); color: var(--err); background: var(--err-soft); }
.seg button.on.ingreso { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.seg button.on.transferencia { border-color: var(--info); color: var(--info); background: var(--info-soft); }
input.big { font-size: 26px; font-weight: 700; padding: 8px 14px; min-height: 56px; }
.tasa-box { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--border-strong); }
.tasa-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.tasa-row .chip { min-height: 32px; padding: 4px 12px; }
#mEquiv b { color: var(--text); }

/* listas */
.mov-t { display: flex; gap: 12px; align-items: center; }
.mov-ic { width: 36px; height: 36px; flex: none; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); }
.mov-ic.ingreso { background: var(--ok-soft); color: var(--ok); }
.mov-ic.gasto { background: var(--err-soft); color: var(--err); }
.mov-ic.transferencia { background: var(--info-soft); color: var(--info); }
.acc-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }

/* cuentas */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: var(--gap); }
.acc-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; position: relative; overflow: hidden; }
.acc-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: var(--c); }
.acc-top { display: flex; gap: 12px; align-items: center; }
.acc-top > div { flex: 1; min-width: 0; }
.acc-top small { display: block; color: var(--muted); font-size: 13px; }
.acc-ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); font-size: 18px; flex: none; }
.acc-saldo { font-size: 28px; font-weight: 700; margin-top: 16px; letter-spacing: -.02em; }
.acc-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 14px; flex-wrap: wrap; }
.acc-top .icon-btn { flex: none; }
.acc-flow2 { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.acc-flow2 span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.acc-flow2 .in { background: var(--ok-soft); color: var(--ok); }
.acc-flow2 .out { background: var(--err-soft); color: var(--err); }
.ok-pill { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; color: var(--ok); font-weight: 600; }
.acc-more { margin-top: 10px; font-size: 13px; }
.acc-more summary { cursor: pointer; color: var(--muted); list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 28px; }
.acc-more summary::-webkit-details-marker { display: none; }
.acc-more summary::before { content: '\F285'; font-family: 'bootstrap-icons'; font-size: 11px; transition: transform .15s var(--ease); }
.acc-more[open] summary::before { transform: rotate(90deg); }
.acc-more summary:hover { color: var(--text); }
.acc-more .kv { grid-template-columns: 1fr auto; margin-top: 6px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; font-size: 13px; }
.acc-more .kv dd { text-align: right; font-variant-numeric: tabular-nums; }
.acc-check { display: flex; gap: 8px; align-items: flex-start; }
.acc-actions .more { margin-left: auto; }

/* cabecera de Cuentas: patrimonio + reparto */
.acc-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--gap); margin-bottom: var(--gap); }
.acc-hero .hero { background: var(--accent); border-color: var(--accent); color: var(--accent-text); justify-content: space-between; padding: 24px; min-height: 180px; }
.acc-hero .hero .lbl, .acc-hero .hero .sub { color: color-mix(in srgb, var(--accent-text) 72%, transparent); }
.acc-hero .hero .val { font-size: 40px; }
.acc-mix h3 { margin-bottom: 12px; }
.mix-bar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; gap: 2px; background: var(--surface-3); }
.mix-bar i { display: block; height: 100%; min-width: 3px; }
.mix-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 16px; font-size: 14px; }
.mix-list li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mix-list .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mix-list .acc-dot { margin-right: 2px; }
.mix-list b { font-variant-numeric: tabular-nums; font-size: 13px; }
.mix-list .hint { font-variant-numeric: tabular-nums; min-width: 92px; text-align: right; }
.mix-mon { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.mix-mon .tag { margin: 0; font-size: 13px; padding: 3px 10px; font-variant-numeric: tabular-nums; }
.mix-mon .tag.neg { color: var(--err); background: var(--err-soft); }
@media (max-width: 900px) { .acc-hero { grid-template-columns: 1fr; } .acc-hero .hero { min-height: 0; } .acc-hero .hero .val { font-size: 32px; } .mix-list .hint { display: none; } }
.sug { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.arch { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.warn-card { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); margin-bottom: var(--gap); padding: 12px 16px; }

/* inicio */
.tasas-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tasas-mini div { display: flex; flex-direction: column; gap: 2px; }
.tasas-mini span { color: var(--muted); font-size: 13px; }
.tasas-mini b { font-size: 22px; letter-spacing: -.01em; }
.tasas-mini small { color: var(--muted); font-size: 12px; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.bar-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row b { font-size: 13px; }
.bar { height: 8px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 6px; background: var(--chart-in); }
.bar i.personal { background: var(--warn); }
.cols { display: flex; gap: 10px; align-items: flex-end; height: 160px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.pair { flex: 1; width: 100%; display: flex; gap: 4px; align-items: flex-end; justify-content: center; }
.pair i { width: 42%; max-width: 20px; border-radius: 6px 6px 2px 2px; min-height: 3px; }
.pair i.in, .legend i.in { background: var(--chart-in); }
.pair i.out, .legend i.out { background: var(--chart-out); }
.col small { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 10px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* tasas */
.chart { width: 100%; height: 240px; display: block; }
.chart text { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.chart .grid-l { stroke: var(--border); stroke-dasharray: 3 4; }
.conv { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.conv div { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }

/* tasas: bento, variación diaria, brecha y calculadora */
.tasas-bento .hero .val { font-size: 52px; }
.hero-foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.hero .delta { background: color-mix(in srgb, var(--accent-text) 10%, transparent); color: var(--accent-text); }
.manana { display: inline-flex; gap: 5px; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 13px; background: color-mix(in srgb, var(--accent-text) 10%, transparent); }
.delta { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; align-self: flex-start; padding: 3px 10px; border-radius: 20px; font-size: 13px; font-weight: 600; background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums; }
.hero-foot .delta { margin-top: 0; }
.delta.sube { background: var(--warn-soft); color: var(--warn); }
.delta.baja { background: var(--ok-soft); color: var(--ok); }
.hero .delta.sube, .hero .delta.baja { background: color-mix(in srgb, var(--accent-text) 10%, transparent); color: var(--accent-text); }
.brecha-bar { height: 8px; border-radius: 6px; background: var(--surface-3); margin: 10px 0 6px; overflow: hidden; }
.brecha-bar i { display: block; height: 100%; border-radius: 6px; background: var(--warn); }
.tasas-mid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: stretch; margin-bottom: var(--gap); }
.calc-in { display: flex; gap: 8px; align-items: flex-end; }
.calc-in label { flex: 1; }
.calc-in .money-in input { font-size: 22px; font-weight: 700; min-height: 50px; }
.calc-swap { min-height: 52px; min-width: 52px; padding: 0; font-size: 18px; }
.calc-quick { margin-top: 10px; }
.calc-quick .chip { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.conv div b { font-size: 15px; }
@media (max-width: 1100px) { .tasas-mid { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .tasas-bento .hero .val { font-size: 38px; }
  /* historial: fecha, BCV, USDT prom., brecha y manual */
  .t-tasas th:nth-child(3), .t-tasas td:nth-child(3), .t-tasas th:nth-child(4), .t-tasas td:nth-child(4), .t-tasas th:nth-child(5), .t-tasas td:nth-child(5) { display: none; }
  .t-tasas th, .t-tasas td { padding: 10px 4px; font-size: 13px; }
  .t-tasas th { font-size: 11px; letter-spacing: .02em; white-space: normal; vertical-align: bottom; }
  .t-tasas .icon-btn { min-width: 28px; min-height: 28px; padding: 0; }
  .card h3 { flex-wrap: wrap; }
  .card h3 .chips { flex-basis: 100%; }
  .t-tasas .tag { display: block; margin: 2px 0 0; width: max-content; }
}

/* contrato: cobros */
.cobro { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.cobro .btn { align-self: flex-start; }

/* configuración: categorías */
.cat-group h4 { margin: 4px 0 8px; font-size: 14px; color: var(--muted); }
.cat-row { display: grid; grid-template-columns: 20px 1fr 120px 100px 36px auto 36px; gap: 6px; align-items: center; margin-bottom: 6px; font-size: 14px; }
.cat-row input, .cat-row select { min-height: 36px; padding: 6px 8px; font-size: 14px; }
.cat-row.off { opacity: .55; }
@media (max-width: 1100px) { .grid[style*="grid-template-columns"], .bento-mid { grid-template-columns: 1fr !important; } }

/* ---------- importar ---------- */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stepper { list-style: none; margin: 0 0 var(--gap); padding: 0; display: flex; gap: 8px; }
.stepper li { flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-weight: 500; font-size: 14px; }
.stepper li span { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 13px; font-weight: 700; color: var(--text-2); }
.stepper li.on { color: var(--text); }
.stepper li.on span { background: var(--accent-soft); color: var(--accent-fg); }
.stepper li.now { border-color: var(--accent-fg); }
.stepper li.now span { background: var(--accent); color: var(--accent-text); }
.drop.has { border-style: solid; border-color: var(--accent-fg); }
.drop.has b { color: var(--text); }
.drop:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
.info-card { border-color: var(--info); background: var(--info-soft); color: var(--text); margin-bottom: var(--gap); padding: 12px 16px; }
.info-card > i { color: var(--info); }
.sticky-actions { position: sticky; bottom: 12px; z-index: 5; justify-content: flex-end; align-items: center; margin: 14px 0; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); }
.drop { margin-top: 12px; border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; text-align: center; transition: background .15s var(--ease), border-color .15s var(--ease); }
.drop i { font-size: 30px; color: var(--accent-fg); }
.drop.over, .drop:hover { border-color: var(--accent-fg); background: var(--accent-soft); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.raw { margin-top: 12px; overflow: auto; max-height: 300px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.raw table { border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.raw td { padding: 6px 9px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); color: var(--muted); }
.raw td.on { color: var(--text); background: var(--raw-on); }
.raw tr.h td { font-weight: 700; color: var(--text); background: var(--surface-3); }
.imp-bar, .imp-bulk { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 4px 10px 8px; }
.imp-scroll { max-height: 62vh; overflow: auto; }
.imp-scroll thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
table.imp td { padding: 8px 10px; }
table.imp select { min-height: 36px; padding: 5px 8px; font-size: 14px; min-width: 190px; }
table.imp tr.dup td { opacity: .55; }

/* ---------- presupuestos y metas ---------- */
.bar.budget { position: relative; overflow: visible; }
.bar.budget i { background: var(--ok); }
.bar.budget.near i { background: var(--warn); }
.bar.budget.over i { background: var(--err); }
.bar.budget b { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--text-2); border-radius: 1px; }
.budget-t .pres { width: 120px; text-align: right; padding: 6px 10px; min-height: 38px; }
.budget-t tr.grp td { background: var(--surface-2); font-weight: 700; font-size: 14px; }
.budget-t tr.off { opacity: .6; }
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--gap); }
.goal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.goal::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: var(--c); }
.goal-amt { margin: 14px 0 8px; }
.goal-amt b { font-size: 26px; letter-spacing: -.02em; }
.goal-bar { height: 10px; }
.goal-bar i, .mini-goal .bar i { background: var(--c, var(--chart-in)); }
.goal-meta { display: flex; justify-content: space-between; font-size: 14px; margin-top: 6px; }
.goal-plan { margin-top: 8px; }
.icon-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-pick label { cursor: pointer; }
.icon-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.icon-pick i { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border); font-size: 16px; color: var(--muted); }
.icon-pick input:focus-visible + i { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
.icon-pick input:checked + i { border-color: var(--accent-fg); color: var(--accent-fg); background: var(--accent-soft); }
.mini-goal { display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 10px; align-items: center; font-size: 14px; margin-bottom: 10px; }

/* bloque principal: barra de avance y versión "te pasaste" */
.hero-bar { position: relative; height: 10px; border-radius: 6px; background: color-mix(in srgb, var(--accent-text) 14%, transparent); margin: 14px 0 8px; }
.hero-bar i { display: block; height: 100%; border-radius: 6px; background: var(--accent-text); }
.hero-bar b { position: absolute; top: -4px; width: 2px; height: 18px; border-radius: 1px; background: var(--accent-text); opacity: .55; }
.kpis.bento .hero.bad { background: var(--err); border-color: var(--err); --accent-text: #fff; }
.kpis.bento .hero.bad:hover { background: var(--err); }

/* metas: anillo de avance */
.goal-body { display: flex; align-items: center; gap: 16px; margin: 16px 0 6px; }
.goal-body .goal-amt { margin: 0 0 2px; }
.ring { --p: 0; flex: none; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c, var(--chart-in)) calc(var(--p) * 1%), var(--surface-3) 0); }
.ring span { width: 58px; height: 58px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; grid-auto-flow: column; align-content: center; }
.ring small { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 1px; }
.goal-falta { font-size: 14px; color: var(--text-2); }

/* cuentas: flujo y verificación con el banco */
.acc-flow { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-top: 10px; color: var(--muted); }
.acc-flow b { color: var(--text); font-weight: 600; }
.acc-flow-d { font-size: 12px; margin-top: 2px; }
.acc-check { font-size: 13px; margin-top: 10px; padding: 8px 10px; border-radius: 10px; }
.acc-check.ok { background: var(--ok-soft); color: var(--ok); }
.acc-check.bad { background: var(--warn-soft); color: var(--warn); }

/* ---------- pantallas chicas: menú como cajón ---------- */
@media (max-width: 900px) {
  body { flex-direction: column; }
  .topbar { display: flex; align-items: center; gap: 8px; flex: none; height: 56px; padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 80; }
  .topbar .icon-btn { min-width: 44px; min-height: 44px; font-size: 22px; color: var(--text); }
  .brand-mini { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 16px; }
  .brand-mini img { width: 28px; height: 28px; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(290px, 84vw); z-index: 95; transform: translateX(-100%); transition: transform .22s var(--ease); box-shadow: var(--shadow-pop); visibility: hidden; }
  body.drawer-open .sidebar { transform: none; visibility: visible; }
  .page { padding: 18px 16px 72px; }
  .head { gap: 8px; margin-bottom: 16px; }
  .head h1 { flex-basis: 100%; font-size: 23px; }
  .btn { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
  .btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
  .chip { min-height: 32px; padding: 4px 12px; font-size: 13px; }
  input, select, textarea { min-height: 40px; }
  .kpis.bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.bento .hero .val { font-size: 34px; }
  .kpi { padding: 16px; }
  .kpi .val { font-size: 22px; }
  .filters > * { flex: 1 1 140px; }
  .filters select, .search input { width: 100%; min-width: 0; }
  .month-nav { flex-basis: 100%; }
  .month-nav b { flex: 1; }
  .card:has(> .table), #lista { overflow-x: auto; }
  .editor { grid-template-columns: 1fr; }
  .modal-bg { padding: 0; place-items: end center; }
  .modal { border-radius: 22px 22px 0 0; max-height: 94vh; padding: 20px 16px; }
  .toast { left: 16px; right: 16px; bottom: 16px; }
  .search input { min-width: 0; }
  .search { flex: 1 1 100%; }
  .chips { flex: 1 1 100%; }
  .chips + .search { margin-left: 0 !important; }
  /* Totales chicos: varios por fila en vez de uno por pantalla. */
  .kpis:not(.bento) { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; }
  .kpis:not(.bento) .kpi { padding: 12px; border-radius: 14px; }
  .kpis:not(.bento) .kpi .val { font-size: 17px; }
  .kpis:not(.bento) .kpi .lbl, .kpis:not(.bento) .kpi .sub { font-size: 12px; }

  /* Tablas de contratos y movimientos como tarjetas: todo en el ancho de la pantalla. */
  .t-contratos, .t-recientes, .t-movs { display: block; }
  .t-contratos tbody, .t-recientes tbody, .t-movs tbody { display: block; }
  .t-contratos tr:has(th), .t-recientes tr:has(th), .t-movs tr:has(th) { display: none; }
  .t-contratos tr, .t-recientes tr, .t-movs tr { display: grid; gap: 4px 10px; padding: 12px 6px; border-bottom: 1px solid var(--border); align-items: center; }
  .t-contratos tr:last-child, .t-recientes tr:last-child, .t-movs tr:last-child { border-bottom: 0; }
  .t-contratos td, .t-recientes td, .t-movs td { display: block; padding: 0; border: 0; min-width: 0; }
  .t-contratos tr.click:hover td, .t-recientes tr.click:hover td, .t-movs tr.click:hover td { background: none; }
  .t-contratos tr.click:active, .t-recientes tr.click:active, .t-movs tr.click:active { background: var(--hover); }

  /* contratos: cliente | total / servicio | estado / N.º · fecha | PDF */
  .t-contratos tr { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "cli cli tot" "srv srv est" "num fec pdf"; }
  .t-contratos td:nth-child(1) { grid-area: num; font-size: 13px; }
  .t-contratos td:nth-child(2) { grid-area: cli; }
  .t-contratos td:nth-child(3) { grid-area: srv; font-size: 14px; color: var(--text-2); }
  .t-contratos td:nth-child(4) { grid-area: fec; font-size: 13px; color: var(--muted); }
  .t-contratos td:nth-child(4)::before { content: '· '; }
  .t-contratos td:nth-child(5) { display: none; }
  .t-contratos td:nth-child(6) { grid-area: est; justify-self: end; }
  .t-contratos td:nth-child(7) { grid-area: tot; font-weight: 700; }
  .t-contratos td:nth-child(8) { grid-area: pdf; justify-self: end; }
  .t-contratos td:nth-child(8) .icon-btn { min-height: 30px; min-width: 30px; padding: 2px 6px; }

  /* recientes en Inicio: cliente | total / N.º · servicio | estado */
  .t-recientes tr { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "cli cli tot" "num srv est"; }
  .t-recientes td:nth-child(1) { grid-area: num; font-size: 13px; }
  .t-recientes td:nth-child(2) { grid-area: cli; font-weight: 600; }
  .t-recientes td:nth-child(3) { grid-area: srv; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .t-recientes td:nth-child(4) { grid-area: est; justify-self: end; }
  .t-recientes td:nth-child(5) { grid-area: tot; font-weight: 700; }

  /* movimientos: detalle | monto / cuenta | ≈ USD / · | tasa; el día va como título */
  .t-movs tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "det mon" "cta usd" ". tas"; }
  .t-movs tr.day { display: block; padding: 14px 6px 4px; }
  .t-movs tr.day td { display: block; padding: 0; border: 0; }
  .t-movs td:nth-child(1) { grid-area: det; }
  .t-movs td:nth-child(2) { grid-area: cta; font-size: 13px; color: var(--muted); padding-left: 48px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .t-movs td:nth-child(3) { grid-area: mon; font-weight: 700; }
  .t-movs td:nth-child(4) { grid-area: usd; font-size: 13px; }
  .t-movs td:nth-child(5) { grid-area: tas; font-size: 12px; }
  .t-movs td:nth-child(5) .hint { display: inline; margin-left: 4px; font-size: 12px; }
  .filters .month-nav { border-right: 0; padding-right: 0; margin-right: 0; }

  /* presupuestos: categoría | gastado / barra / presupuesto · promedio | queda */
  .t-pres, .t-pres tbody { display: block; }
  .t-pres tr:has(th) { display: none; }
  .t-pres tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "cat cat gas" "bar bar bar" "pre prom que"; gap: 6px 10px; align-items: center; padding: 12px 6px; border-bottom: 1px solid var(--border); }
  .t-pres tr.grp { display: block; padding: 10px; border-radius: 10px; }
  .t-pres tr.grp td { display: block; padding: 0; background: none; border: 0; }
  .t-pres td { display: block; padding: 0; border: 0; min-width: 0; }
  .t-pres td:nth-child(1) { grid-area: cat; font-weight: 600; }
  .t-pres td:nth-child(2) { grid-area: pre; text-align: left; }
  .t-pres td:nth-child(3) { grid-area: gas; }
  .t-pres td:nth-child(4) { grid-area: bar; width: auto !important; }
  .t-pres td:nth-child(4) .hint { display: none; }
  .t-pres td:nth-child(5) { grid-area: que; font-size: 13px; }
  .t-pres td:nth-child(6) { grid-area: prom; }
  .t-pres td:nth-child(6) .btn { min-height: 30px; padding: 2px 8px; font-size: 12px; }
  .t-pres td:nth-child(6) .btn::before { content: 'Prom. '; color: var(--muted); font-weight: 400; }
  .t-pres .pres { width: 110px; min-height: 36px; text-align: left; }
  .t-pres td:nth-child(3) .hint { display: inline; margin-left: 4px; }
  .goal-body .goal-amt .hint { display: block; }

  /* recurrentes: por registrar y lista como tarjetas */
  .pend { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "ic info" ". monto" "acc acc"; gap: 6px 10px; }
  .pend > .mov-ic { grid-area: ic; align-self: start; } .pend-info { grid-area: info; } .pend-monto { grid-area: monto; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
  .pend-monto .hint { order: 2; }
  .pend-abono { max-width: none; }
  .pend-acc { grid-area: acc; justify-content: flex-end; }
  .t-rec, .t-rec tbody { display: block; }
  .t-rec tr:has(th) { display: none; }
  .t-rec tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "det mon" "frec prox" "cta cta"; gap: 4px 10px; padding: 12px 6px; border-bottom: 1px solid var(--border); }
  .t-rec td { display: block; padding: 0; border: 0; min-width: 0; }
  .t-rec td:nth-child(1) { grid-area: det; } .t-rec td:nth-child(5) { grid-area: mon; font-weight: 700; }
  .t-rec td:nth-child(2) { grid-area: frec; font-size: 13px; color: var(--muted); padding-left: 48px; }
  .t-rec td:nth-child(3) { grid-area: prox; font-size: 13px; text-align: right; }
  .t-rec td:nth-child(3)::before { content: 'próx. '; color: var(--muted); }
  .t-rec td:nth-child(4) { grid-area: cta; font-size: 13px; color: var(--muted); padding-left: 48px; }

  /* reportes: cada mes como tarjeta (mes | ganancia / ingresos · gastos / reserva · IVA) */
  .rep-meses, .rep-meses tbody { display: block; }
  .rep-meses tr:has(th) { display: none; }
  .rep-meses tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
  .rep-meses td { display: flex; justify-content: space-between; gap: 6px; padding: 0; border: 0; font-size: 13px; min-width: 0; white-space: normal; }
  .rep-meses td:nth-child(1) { font-weight: 700; font-size: 15px; order: 0; }
  .rep-meses td:nth-child(4) { font-weight: 700; font-size: 15px; order: 1; }
  .rep-meses td:nth-child(2) { order: 2; } .rep-meses td:nth-child(3) { order: 3; }
  .rep-meses td:nth-child(5) { order: 4; } .rep-meses td:nth-child(6) { order: 5; }
  .rep-meses tr { gap: 2px 10px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rep-meses td:nth-child(4) { font-size: 14px; }
  .rep-meses td { font-size: 12.5px; overflow-wrap: anywhere; }
  div:has(> .rep-meses) { overflow-x: visible !important; }
  .rep-meses td:nth-child(4)::before { content: 'Ganancia'; }
  .rep-meses td:nth-child(2)::before { content: 'Ingresos'; color: var(--muted); }
  .rep-meses td:nth-child(3)::before { content: 'Gastos'; color: var(--muted); }
  .rep-meses td:nth-child(4)::before { content: 'Ganancia'; color: var(--muted); font-weight: 400; font-size: 13px; }
  .rep-meses td:nth-child(5)::before { content: 'Reserva'; color: var(--muted); }
  .rep-meses td:nth-child(6)::before { content: 'IVA'; color: var(--muted); }
  .rep-meses tr.rep-tot td { border-top: 0; }

  /* ficha de cliente: datos arriba y contratos como tarjetas (servicio | total / N.º · fecha | estado) */
  .cli-detail { grid-template-columns: 1fr; }
  .cli-search { max-width: none; }
  .t-cli-k, .t-cli-k tbody { display: block; }
  .t-cli-k tr:has(th) { display: none; }
  .t-cli-k tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "srv srv tot" "num fec est"; gap: 4px 10px; align-items: center; padding: 12px 6px; border-bottom: 1px solid var(--border); }
  .t-cli-k td { display: block; padding: 0; border: 0; min-width: 0; }
  .t-cli-k td:nth-child(1) { grid-area: num; font-size: 13px; }
  .t-cli-k td:nth-child(2) { grid-area: srv; font-weight: 600; }
  .t-cli-k td:nth-child(3) { grid-area: fec; font-size: 13px; color: var(--muted); }
  .t-cli-k td:nth-child(4) { grid-area: est; justify-self: end; }
  .t-cli-k td:nth-child(5) { grid-area: tot; font-weight: 700; }
  .t-cli-k td:nth-child(6) { display: none; }
  .cli-head .avatar { width: 40px; height: 40px; font-size: 15px; }

  /* recibos: cliente | monto / concepto | estado / N.º · fecha | PDF */
  .t-recibos, .t-recibos tbody { display: block; }
  .t-recibos tr:has(th) { display: none; }
  .t-recibos tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "cli cli mon" "con con est" "num fec pdf"; gap: 4px 10px; align-items: center; padding: 12px 6px; border-bottom: 1px solid var(--border); }
  .t-recibos td { display: block; padding: 0; border: 0; min-width: 0; }
  .t-recibos td:nth-child(1) { grid-area: num; font-size: 13px; display: flex; gap: 6px; align-items: center; }
  .t-recibos td:nth-child(1) .tag { margin: 0; }
  .t-recibos td:nth-child(2) { grid-area: cli; }
  .t-recibos td:nth-child(3) { grid-area: con; font-size: 14px; color: var(--text-2); }
  .t-recibos td:nth-child(4) { grid-area: fec; font-size: 13px; color: var(--muted); }
  .t-recibos td:nth-child(4) .hint { display: none; }
  .t-recibos td:nth-child(5) { grid-area: est; justify-self: end; }
  .t-recibos td:nth-child(6) { grid-area: mon; }
  .t-recibos td:nth-child(7) { grid-area: pdf; justify-self: end; }
  .t-recibos td:nth-child(7) .icon-btn { min-height: 30px; min-width: 30px; padding: 2px 6px; }

  /* editor de contrato: concepto a todo el ancho; valor y papelera debajo */
  .items .it { grid-template-columns: minmax(0, 1fr) 36px; }
  .items .it .concepto { grid-column: 1 / -1; }
  .items .it input.valor { grid-column: 1; grid-row: 2; }
  .items .it .icon-btn { grid-column: 2; grid-row: 2; }
  .items .it textarea { grid-column: 1 / -1; }
  .total-row { justify-content: flex-start; }
  .total-row .check { flex: 1 1 100%; }
  .total-row b { margin-left: auto; }
  .total-row input:not([type=checkbox]) { width: 150px; }
  .list-edit .le, .list-edit.claus .le, .list-edit.pagos .le { grid-template-columns: minmax(0, 1fr) 36px; }
  .list-edit .le > :first-child { grid-column: 1; }
  .list-edit .le > textarea, .list-edit .le > input:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .list-edit .le > .icon-btn { grid-column: 2; grid-row: 1; }

  /* importar y unificar: guía de pasos compacta y tablas de revisión como tarjetas */
  .stepper li { padding: 8px; gap: 6px; font-size: 12px; flex-direction: column; text-align: center; }
  .imp-scroll { max-height: none; overflow: visible; }
  table.imp, table.imp tbody { display: block; }
  table.imp thead { display: none; }
  table.imp tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
  table.imp td { display: block; padding: 0 !important; border: 0; min-width: 0; }
  table.imp td { order: 5; }
  table.imp td:first-child { flex: none; order: 0; }
  table.imp td:nth-child(2) { order: 1; color: var(--muted); font-size: 13px; }
  table.imp td.num { order: 2; margin-left: auto; text-align: right; font-weight: 600; }
  table.imp td:nth-child(3):not(.num) { order: 3; flex: 1 1 100%; font-weight: 500; overflow-wrap: anywhere; }
  table.imp select { min-width: 0; width: 100%; }
  table.imp td:has(select) { order: 4; flex: 1 1 100%; }
  table.imp td:nth-child(6):last-child:has(input[type=checkbox]) { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
  table.imp td:nth-child(6):last-child:has(input[type=checkbox])::after { content: 'Recordar esta categoría'; }
  .t-hist, .t-hist tbody { display: block; }
  .t-hist tr:has(th) { display: none; }
  .t-hist tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 12px 6px; border-bottom: 1px solid var(--border); }
  .t-hist td { display: block; padding: 0; border: 0; min-width: 0; font-size: 13px; }
  .t-hist td:nth-child(3) { grid-column: 1 / -1; grid-row: 1; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
  .t-hist td:nth-child(6) { grid-column: 2; grid-row: 2 / span 3; align-self: center; }
  .t-hist td.num { text-align: left; }
  .sticky-actions { bottom: 8px; }
  .goal-amt b { font-size: 22px; }
  .t-movs .mov-t { align-items: flex-start; }
  .t-movs .mov-t b { display: block; }
  .t-movs .mov-t .hint { overflow-wrap: anywhere; }
  .t-movs .tag { margin-left: 0; }
}
@media (max-width: 480px) {
  .kpis.bento .hero { grid-column: span 2; grid-row: auto; }
  .kpis.bento .wide2 { grid-column: span 2; }
  .tasas-mini b { font-size: 18px; }
  .acc-grid, .goal-grid { grid-template-columns: 1fr; }
}
@media (pointer: coarse) { .icon-btn { min-width: 40px; min-height: 40px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.ia-prov { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.ia-prov h4 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.ia-prov .btn.sm { margin-top: 8px; }
