/* Econogar — sistema de estilos (boceto 2 aprobado el 2026-08-27).
   Escritorio primero, usable en móvil. Fondo blanco, azul petróleo y verde bosque.
   Solo Google Fonts o fuentes del sistema; ningún otro recurso externo. */

:root {
  --bg: #FFFFFF; --surface: #F4F7F6; --surface-2: #EAF0EE; --line: #D8E0DD; --line-2: #C4CFCB;
  --ink: #10262F; --ink-2: #5B6E75; --ink-3: #8A9AA0;
  --primary: #0F4C5C; --primary-2: #16687D; --accent: #1B5E3B; --accent-2: #2E8B57;
  --c1: #0F4C5C; --c2: #1B5E3B; --c3: #2A9D8F; --c4: #4B6C8C; --c5: #7FB69B; --c6: #C9B27C; --c7: #9FB2B8; --c8: #6A8E9C;
  --ok: #2E7D32; --warn: #B26A00; --danger: #B3261E; --warn-bg: #FFF4E0; --danger-bg: #FBEAE8; --ok-bg: #E8F3E9;
  --shadow: 0 1px 2px rgba(16,38,47,.06), 0 8px 24px rgba(16,38,47,.06);
  --r: 14px;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.4; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.neg, .amount-neg { color: var(--danger); } .pos, .amount-pos { color: var(--ok); }
.muted { color: var(--ink-2); } .small { font-size: .85rem; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------- estructura ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 1.1rem 1rem; display: flex; flex-direction: column; gap: 1.25rem; background: var(--bg); position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.15rem; color: var(--primary); }
.brand i { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--primary), var(--accent)); display: inline-block; flex: none; }
.side nav { display: flex; flex-direction: column; gap: .15rem; }
.side nav a { display: flex; align-items: center; justify-content: space-between; padding: .5rem .7rem; border-radius: 10px; color: var(--ink-2); font-weight: 700; }
.side nav a:hover { background: var(--surface-2); text-decoration: none; }
.side nav a.is-active { background: var(--surface); color: var(--primary); }
.pill { font-family: var(--mono); font-size: .72rem; background: var(--warn); color: #fff; border-radius: 999px; padding: .05rem .45rem; }
.pill.danger { background: var(--danger); }
.side .who { margin-top: auto; border-top: 1px solid var(--line); padding-top: .9rem; display: flex; justify-content: space-between; align-items: center; color: var(--ink-2); font-size: .9rem; gap: .5rem; }
.side .who b { color: var(--accent); }
.side .who form { margin: 0; }
.main { padding: 1.4rem 1.75rem 3rem; min-width: 0; max-width: 1440px; }
.page-plain { max-width: 440px; margin: 8vh auto 0; padding: 0 1rem; }

/* ---------- cabecera de pantalla ---------- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.head .month { font-family: var(--display); font-weight: 500; font-size: 2.3rem; line-height: 1; letter-spacing: -.01em; text-wrap: balance; }
.head .month small { display: block; font-family: var(--body); font-size: .8rem; color: var(--ink-2); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: .35rem; }
.head .tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--bg); }
.seg a, .seg span, .seg b, .seg select { padding: .45rem .8rem; font-size: .9rem; color: var(--ink-2); border: 0; background: transparent; font: inherit; }
.seg a:hover { background: var(--surface); text-decoration: none; }
.seg b { background: var(--surface-2); color: var(--ink); font-weight: 800; }
.seg select { color: var(--ink); font-weight: 800; background: var(--surface-2); }
.seg form { display: contents; }

/* ---------- botones ---------- */
.btn { font: inherit; font-weight: 700; padding: .5rem .9rem; border-radius: 10px; border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-ghost { background: var(--bg); color: var(--primary); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { background: var(--bg); color: var(--danger); border-color: var(--line-2); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: .3rem .65rem; font-size: .85rem; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; margin-top: 1rem; }

/* ---------- rejilla y tarjetas ---------- */
.grid { display: grid; gap: 1rem; }
.kpis { grid-template-columns: repeat(5, 1fr); }
.kpis-4 { grid-template-columns: repeat(4, 1fr); }
.kpis-6 { grid-template-columns: repeat(6, 1fr); }
.kpis-6 .kpi .value { font-size: 1.32rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1rem .8rem; display: flex; flex-direction: column; gap: .2rem; min-height: 108px; position: relative; min-width: 0; }
.kpi .label { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); font-weight: 800; }
.kpi .value { font-family: var(--mono); font-weight: 700; font-size: 1.5rem; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi .value a { color: inherit; }
.kpi .hint { font-size: .8rem; color: var(--ink-2); }
.kpi.stripe-warn { border-left: 4px solid var(--warn); }
.kpi.stripe-danger { border-left: 4px solid var(--danger); }
.kpi.stripe-ok { border-left: 4px solid var(--accent); }
.kpi.ok-box { background: var(--ok-bg); border-color: transparent; }
.kpi.ok-box .value { font-size: 1rem; color: var(--ok); font-family: var(--body); white-space: normal; }
.kpi.bad-box { background: var(--danger-bg); border-color: transparent; }
.kpi.bad-box .value { font-size: 1rem; color: var(--danger); font-family: var(--body); white-space: normal; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; box-shadow: var(--shadow); min-width: 0; }
.card > h2, .card-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); font-weight: 800; margin-bottom: .7rem; display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.card > h2 a, .card > h2 .sub { font-size: .78rem; text-transform: none; letter-spacing: 0; font-weight: 700; }
.charts { grid-template-columns: 1.05fr 1.15fr 1.5fr; margin-top: 1rem; }
.bottom { grid-template-columns: 1.2fr 1fr 1fr; margin-top: 1rem; }
.two { grid-template-columns: 1fr 1fr; }
.two-wide { grid-template-columns: 1.4fr 1fr; }
.stats-top { grid-template-columns: 2fr 1fr; }
.empty { padding: 1.5rem 0; text-align: center; color: var(--ink-2); }
.note { border: 1px dashed var(--line-2); border-radius: 10px; padding: .6rem .8rem; color: var(--ink-2); font-size: .85rem; margin-top: 1rem; }

/* ---------- donut ---------- */
.donut-wrap { display: grid; grid-template-columns: 170px 1fr; gap: .8rem; align-items: center; }
.donut { width: 170px; height: 170px; }
.donut .center { font-family: var(--mono); font-weight: 700; font-size: 14px; fill: var(--ink); }
.donut .center-label { font-family: var(--body); font-size: 9px; fill: var(--ink-2); letter-spacing: .08em; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; font-size: .86rem; }
.legend li { display: grid; grid-template-columns: 12px 1fr auto; gap: .5rem; align-items: center; }
.legend li a { color: var(--ink); }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend .pct { color: var(--ink-2); margin-left: .35rem; font-size: .78rem; }

/* ---------- presupuesto vs real ---------- */
.bva { display: flex; flex-direction: column; gap: .55rem; }
.bva-row { display: grid; grid-template-columns: 120px 1fr 96px; gap: .6rem; align-items: center; font-size: .88rem; }
.bva-row a { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bva-track { position: relative; height: 18px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bva-track .budget { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(135deg, var(--line-2) 0 4px, transparent 4px 8px); opacity: .7; }
.bva-track .actual { position: absolute; left: 0; top: 4px; bottom: 4px; border-radius: 4px; background: var(--primary); }
.bva-track .actual.over { background: var(--danger); }
.bva-track .actual.warn { background: var(--warn); }
.bva-row .num { text-align: right; }
.bva-legend { display: flex; gap: 1rem; margin-top: .6rem; font-size: .78rem; color: var(--ink-2); flex-wrap: wrap; }
.bva-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: .3rem; }
.legend-stripes { background: repeating-linear-gradient(135deg, var(--line-2) 0 3px, transparent 3px 6px); }

/* ---------- gráficas SVG ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { font-family: var(--mono); font-size: 9.5px; fill: var(--ink-3); }
.chart .axis.strong { fill: var(--ink); font-weight: 700; }
.chart .area { fill: var(--primary); opacity: .14; }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2.2; stroke-linejoin: round; }
.chart .line2 { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 4; }
.chart .dot { fill: var(--bg); stroke: var(--primary); stroke-width: 2.2; }
.chart .dot.hi { fill: var(--primary); }
.chart .tag { font-family: var(--mono); font-size: 9.5px; font-weight: 700; fill: var(--primary); }
.chart-legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--ink-2); margin: .35rem 0 .6rem; flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; margin-right: .3rem; }
.fill-c1 { fill: var(--c1); } .fill-c2 { fill: var(--c2); } .fill-c3 { fill: var(--c3); } .fill-c4 { fill: var(--c4); } .fill-c5 { fill: var(--c5); } .fill-c6 { fill: var(--c6); } .fill-c7 { fill: var(--c7); } .fill-c8 { fill: var(--c8); }
.stroke-c1 { stroke: var(--c1); } .stroke-c2 { stroke: var(--c2); } .stroke-c3 { stroke: var(--c3); } .stroke-c4 { stroke: var(--c4); } .stroke-c5 { stroke: var(--c5); } .stroke-c6 { stroke: var(--c6); } .stroke-c7 { stroke: var(--c7); } .stroke-c8 { stroke: var(--c8); }
.bg-c1 { background: var(--c1); } .bg-c2 { background: var(--c2); } .bg-c3 { background: var(--c3); } .bg-c4 { background: var(--c4); } .bg-c5 { background: var(--c5); } .bg-c6 { background: var(--c6); } .bg-c7 { background: var(--c7); } .bg-c8 { background: var(--c8); }
.spark { position: absolute; right: .8rem; bottom: .7rem; width: 84px; height: 30px; }

/* ---------- tablas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); font-weight: 800; padding: .35rem .5rem; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.table td { padding: .5rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; white-space: nowrap; }
.table tfoot td { font-weight: 800; border-top: 2px solid var(--line-2); }
.table a.row-link { color: var(--ink); font-weight: 700; }
.table tr.dim td { opacity: .55; }
.table tr.clickable:hover td { background: var(--surface); }
.chip { display: inline-block; font-size: .72rem; font-weight: 800; padding: .12rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); } .chip.danger { background: var(--danger-bg); color: var(--danger); }
.chip.cat { background: var(--surface-2); color: var(--primary); }
.dot-cat { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .4rem; vertical-align: middle; background: var(--c7); }

/* ---------- listas de estado (avisos, recordatorios) ---------- */
.status-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.status-list li { display: grid; grid-template-columns: 4px 1fr auto; gap: .7rem; align-items: center; padding: .55rem .7rem; border-radius: 10px; background: var(--surface); }
.status-list li i { width: 4px; height: 100%; min-height: 28px; border-radius: 4px; background: var(--warn); }
.status-list li.danger i { background: var(--danger); } .status-list li.ok i { background: var(--accent); } .status-list li.info i { background: var(--c4); }
.status-list .t { font-weight: 700; font-size: .9rem; } .status-list .s { font-size: .8rem; color: var(--ink-2); }
.status-list .d { font-family: var(--mono); font-size: .82rem; color: var(--ink-2); white-space: nowrap; }
.status-list form { margin: 0; display: flex; gap: .3rem; }

/* ---------- filtros y formularios ---------- */
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .9rem; align-items: center; }
.filters select, .filters input { font: inherit; border: 1px solid var(--line-2); border-radius: 10px; padding: .45rem .7rem; font-size: .9rem; color: var(--ink); background: var(--bg); max-width: 100%; }
.filters .search { flex: 1; min-width: 180px; }
.check { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .9rem; }
.form { display: flex; flex-direction: column; gap: .35rem; }
.form label { font-weight: 700; font-size: .85rem; margin-top: .5rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.form input, .form select, .form textarea { font: inherit; padding: .6rem .7rem; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); color: var(--ink); }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.form input[readonly] { background: var(--surface-2); color: var(--ink-2); }
.form-card { max-width: 680px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.form-row > div { display: flex; flex-direction: column; gap: .35rem; }
.form-actions { margin-top: 1rem; display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
.form-danger { margin-top: 1rem; display: flex; justify-content: flex-end; }
.radio-row { display: flex; gap: 1rem; padding: .5rem 0; }
.alert { padding: .7rem .9rem; border-radius: 10px; margin: .5rem 0 1rem; font-weight: 600; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.5rem; }
.pin-input { letter-spacing: .4em; font-size: 1.3rem; text-align: center; }

/* ---------- subir extracto ---------- */
.drop { border: 2px dashed var(--line-2); border-radius: var(--r); padding: 1.6rem; text-align: center; color: var(--ink-2); background: var(--surface); }
.drop b { color: var(--ink); display: block; font-size: 1.05rem; margin-bottom: .3rem; }
.drop input[type="file"] { margin-top: .6rem; max-width: 100%; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin: 0 0 1rem; }
.step { background: var(--surface); border-radius: 10px; padding: .7rem .9rem; font-size: .88rem; color: var(--ink-2); }
.step b { display: block; color: var(--ink); }
.step.on { background: var(--ok-bg); } .step.on b { color: var(--ok); }
.verdict { display: grid; grid-template-columns: 1fr 1fr 1fr 2fr; gap: .8rem; margin-bottom: 1rem; }
.verdict .kpi { min-height: 88px; }

/* ---------- pendientes ---------- */
.pend { display: grid; grid-template-columns: 1fr 340px; gap: 1rem; }
.pend-card { border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; margin-bottom: .7rem; background: var(--bg); box-shadow: var(--shadow); }
.pend-card.first { border-color: var(--primary); }
.pend-card .row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.pend-card .concept { font-weight: 800; font-size: 1.05rem; }
.pend-card .meta { color: var(--ink-2); font-size: .85rem; margin: .2rem 0 .6rem; }
.pend-card select { width: 100%; font: inherit; border: 1px solid var(--line-2); border-radius: 10px; padding: .5rem .7rem; background: var(--bg); color: var(--ink); }
.pend-card .actions { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.suggest { font-size: .8rem; color: var(--accent); font-weight: 700; }

/* ---------- comercios / mapa de calor ---------- */
.merchants { list-style: none; margin: 0; padding: 0; }
.merchants li { display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: center; padding: .4rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.merchants li:last-child { border-bottom: 0; }
.merchants .bar { height: 6px; border-radius: 3px; background: var(--primary); margin-top: .3rem; }
.merchants small { color: var(--ink-2); }
.heat { display: grid; gap: 4px; font-size: .78rem; align-items: center; }
.heat .h { color: var(--ink-2); font-family: var(--mono); text-align: center; }
.heat .cell { height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: .74rem; color: var(--ink); background: var(--surface); }
.heat .cell a { color: inherit; display: block; width: 100%; text-align: center; }
.heat .rowname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- móvil: la misma web, apilada ---------- */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; gap: .8rem; padding: .6rem .9rem; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .side nav { flex-direction: row; gap: .15rem; } .side nav a { white-space: nowrap; padding: .4rem .6rem; }
  .side .who { margin-top: 0; border-top: 0; padding-top: 0; } .side .who span { display: none; } .side .brand span { display: none; }
  .main { padding: 1rem .9rem 3rem; }
  .kpis, .kpis-4, .kpis-6 { grid-template-columns: 1fr 1fr; }
  .kpis-6 .kpi .value { font-size: 1.4rem; }
  .charts, .bottom, .two, .two-wide, .stats-top, .pend { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .head .month { font-size: 1.8rem; }
  .verdict, .steps { grid-template-columns: 1fr 1fr; }
  .spark { display: none; }
  .bva-row { grid-template-columns: 90px 1fr 80px; }
  .heat .hide-m { display: none; }
}
@media (min-width: 961px) and (max-width: 1280px) {
  .kpis-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- Comision de transferencia y cola de una en una (28-ago-2026) ---------------- */
.pend-single { border-left: 4px solid var(--c4); }
.commission-ask { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; background: var(--warn-bg); border-radius: 10px; padding: .5rem .7rem; margin: .5rem 0; font-size: .86rem; color: var(--warn); }
.commission-ask.done { background: var(--ok-bg); color: var(--ok); }
.commission-ask span { flex: 1; min-width: 200px; }
.commission-ask .btn { flex: none; }
.quick-answer { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; background: var(--surface); border-radius: 10px; padding: .5rem .7rem; margin: .5rem 0; font-size: .86rem; color: var(--ink-2); }
.quick-answer span { flex: 1; min-width: 200px; }
