/* Panel de finanzas FTG · marca: anillo verde azulado #4E9AA6, gris #8C8C8C,
   Bodoni Moda (títulos) + Roboto (texto). */
:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface-1: #fcfcfb;
  --surface-2: #f0efec;
  --line: #e2e1dc;
  --grid: #ebeae6;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6f6e69;
  --brand: #4e9aa6;
  --brand-strong: #2f6f79;
  --brand-wash: #e3f0f2;
  --series-in: #2a78d6;
  --series-out: #eb6834;
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --warning-text: #8a5a00;
  --serious: #ec835a;
  --serious-text: #a2401b;
  --critical: #d03b3b;
  --critical-text: #b02727;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 4px 16px rgb(0 0 0 / .04);
  --radius: 14px;
  font-family: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121211;
    --surface-1: #1a1a19;
    --surface-2: #232321;
    --line: #2f2f2c;
    --grid: #2a2a28;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #9a998f;
    --brand: #6cb4bf;
    --brand-strong: #4e9aa6;
    --brand-wash: #1d3236;
    --series-in: #3987e5;
    --series-out: #d95926;
    --good-text: #5fd35f;
    --warning-text: #fab219;
    --serious-text: #f09a77;
    --critical-text: #f07a7a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text-primary); font-size: 15px; line-height: 1.45; }
h1, h2, h3 { font-family: "Bodoni Moda", Georgia, serif; font-weight: 600; margin: 0; letter-spacing: .01em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1.25rem; margin-bottom: 14px; }
.muted { color: var(--text-muted); }
.small { font-size: .82rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }

/* ---------- encabezado y filtros ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 28px; background: var(--surface-1); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand p { margin: 2px 0 0; }
.logo { width: 46px; height: 46px; object-fit: contain; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top-actions form { margin: 0; }
.vivo { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; color: var(--text-secondary); padding: 6px 10px; border-radius: 99px; background: var(--surface-2); }
.vivo .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.vivo.on .dot { background: var(--good); box-shadow: 0 0 0 0 rgb(12 163 12 / .5); animation: pulse 2s infinite; }
.vivo.off .dot { background: var(--critical); }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgb(12 163 12 / 0); } 100% { box-shadow: 0 0 0 0 rgb(12 163 12 / 0); } }
@media (prefers-reduced-motion: reduce) { .vivo.on .dot { animation: none; } }

.filtros { display: flex; align-items: center; gap: 16px; padding: 14px 28px 0; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface-1); color: var(--text-secondary); padding: 6px 13px; border-radius: 99px; font: inherit; font-size: .86rem; cursor: pointer; }
.chip:hover { border-color: var(--brand); }
.chip[aria-checked="true"] { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; font-weight: 500; }
.sel { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--text-secondary); }

select, input { font: inherit; color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; }
select:focus, input:focus, button:focus-visible, .chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.btn { font: inherit; font-size: .88rem; border-radius: 9px; padding: 8px 14px; cursor: pointer; border: 1px solid var(--line); background: var(--surface-1); color: var(--text-primary); }
.btn.primary { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; font-weight: 500; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.mini { padding: 4px 9px; font-size: .78rem; }
.btn:disabled { opacity: .55; cursor: progress; }

/* ---------- rejilla ---------- */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; padding: 16px 28px 40px; transition: opacity .2s; }
.grid.cargando { opacity: .6; }
.card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.span-5 { grid-column: span 5; } .span-7 { grid-column: span 7; } .span-12 { grid-column: span 12; }
@media (max-width: 1000px) { .span-5, .span-7 { grid-column: span 12; } }
@media (max-width: 640px) { .grid, .top, .filtros { padding-left: 14px; padding-right: 14px; } h1 { font-size: 1.4rem; } }

/* ---------- KPIs ---------- */
.kpis { grid-column: span 12; display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .lbl { font-size: .8rem; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 1.65rem; font-weight: 500; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.kpi .bar { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.kpi .bar.in { background: var(--series-in); } .kpi .bar.out { background: var(--series-out); }
.pos { color: var(--good-text); } .neg { color: var(--critical-text); }

/* ---------- estados (siempre icono + texto) ---------- */
.estado { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 500; padding: 2px 8px 2px 6px; border-radius: 99px; white-space: nowrap; border: 1px solid currentColor; }
.estado::before { font-size: .8rem; line-height: 1; }
.estado.critico { color: var(--critical-text); } .estado.critico::before { content: "⛔"; }
.estado.serio { color: var(--serious-text); } .estado.serio::before { content: "▲"; }
.estado.atencion { color: var(--warning-text); } .estado.atencion::before { content: "●"; }
.estado.bien { color: var(--good-text); } .estado.bien::before { content: "✓"; }

/* ---------- recomendaciones ---------- */
.recos { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.reco { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px 14px; border-radius: 11px; background: var(--surface-2); border-left: 4px solid var(--text-muted); }
.reco.critico { border-left-color: var(--critical); } .reco.serio { border-left-color: var(--serious); }
.reco.atencion { border-left-color: var(--warning); } .reco.bien { border-left-color: var(--good); }
.reco .tag { grid-row: span 2; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); padding-top: 3px; min-width: 64px; }
.reco strong { font-weight: 500; }
.reco p { margin: 0; color: var(--text-secondary); font-size: .87rem; }

/* ---------- calendario ---------- */
.cal { list-style: none; margin: 0; padding: 0; }
.cal li { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--grid); }
.cal li:last-child { border-bottom: 0; }
.cal .dia { text-align: center; line-height: 1.1; }
.cal .dia b { display: block; font-size: 1.15rem; font-weight: 500; }
.cal .dia span { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; }
.cal .concepto { min-width: 0; }
.cal .concepto div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .vacio { color: var(--text-muted); }

/* ---------- gráficos ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--text-muted); font-size: 11px; font-family: Roboto, sans-serif; }
.chart .lbl-val { fill: var(--text-secondary); font-size: 11px; }
.chart .lbl-cat { fill: var(--text-secondary); font-size: 12px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--line); stroke-width: 1; }
.chart .m-in { fill: var(--series-in); } .chart .m-out { fill: var(--series-out); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .m, .chart g.hov .m { filter: brightness(1.12); }
.chart .sel-band { fill: var(--brand-wash); }
.legend { font-size: .8rem; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.legend .key { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-left: 8px; }
.k-in { background: var(--series-in); } .k-out { background: var(--series-out); }
details { margin-top: 10px; font-size: .85rem; }
summary { cursor: pointer; color: var(--text-secondary); }

.tooltip { position: fixed; z-index: 30; pointer-events: none; background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; font-size: .82rem; box-shadow: 0 6px 24px rgb(0 0 0 / .14); min-width: 140px; }
.tooltip .tt-t { color: var(--text-muted); font-size: .76rem; margin-bottom: 3px; }
.tooltip .tt-r { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .tt-r b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tooltip .tt-k { width: 12px; height: 2px; display: inline-block; margin-right: 6px; vertical-align: middle; }

/* ---------- cuentas ---------- */
.cuentas { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cuenta { padding: 12px 14px; border-radius: 11px; background: var(--surface-2); }
.cuenta .n { font-size: .8rem; color: var(--text-secondary); }
.cuenta .s { font-size: 1.2rem; font-weight: 500; font-variant-numeric: tabular-nums; margin-top: 2px; }
.cuenta .u { font-size: .72rem; color: var(--text-muted); }

/* ---------- tablas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th { text-align: left; font-weight: 500; color: var(--text-secondary); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.num { text-align: right; }
td { padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td .nota { color: var(--text-muted); font-size: .78rem; margin-top: 3px; max-width: 520px; }
td.acciones { white-space: nowrap; text-align: right; }
tfoot td { font-weight: 500; border-top: 1px solid var(--line); }
.pill { font-size: .74rem; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--text-secondary); white-space: nowrap; }
.pill.pc { background: transparent; border: 1px dashed var(--text-muted); }
.margen { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.margen svg { width: 70px; height: 8px; }
.margen .track { fill: var(--surface-2); } .margen .fill { fill: var(--brand); }
.mov-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.mov-tools input { min-width: 240px; }
#mas, #recos-mas { margin-top: 12px; }
.logo { border-radius: 50%; }

/* ---------- diálogos ---------- */
.dlg { border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; background: var(--surface-1); color: var(--text-primary); width: min(560px, 94vw); box-shadow: 0 20px 60px rgb(0 0 0 / .25); }
.dlg::backdrop { background: rgb(0 0 0 / .35); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display: grid; gap: 5px; font-size: .82rem; color: var(--text-secondary); }
.form-grid .full { grid-column: span 2; }
.form-grid .check { display: flex; align-items: center; gap: 8px; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } .form-grid .full { grid-column: span 1; } }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.form-err { color: var(--critical-text); font-size: .85rem; margin: 12px 0 0; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text-primary); color: var(--surface-1); padding: 10px 16px; border-radius: 10px; font-size: .88rem; z-index: 40; }

/* ---------- login ---------- */
body.login { min-height: 100vh; display: grid; place-items: center; }
.login-card { background: var(--surface-1); border: 1px solid var(--line); border-radius: 18px; padding: 34px 32px; width: min(360px, 92vw); text-align: center; box-shadow: var(--shadow); }
.login-logo { width: 72px; height: 72px; object-fit: contain; }
.login-card h1 { margin-top: 8px; }
.login-card form { display: grid; gap: 8px; text-align: left; margin-top: 18px; }
.login-card label { font-size: .82rem; color: var(--text-secondary); }
.login-card button { margin-top: 8px; font: inherit; padding: 10px; border-radius: 9px; border: 0; background: var(--brand-strong); color: #fff; font-weight: 500; cursor: pointer; }
.login-error { color: var(--critical-text); font-size: .85rem; margin: 4px 0 0; }
@media (max-width: 640px) {
  .top { position: static; padding-top: 12px; padding-bottom: 12px; }
  .brand p { display: none; }
  .logo { width: 38px; height: 38px; }
}

/* =================== v2: pestañas, bandeja, plan, proyectos =================== */
:root { --series-3: #1baf7a; }
@media (prefers-color-scheme: dark) { :root { --series-3: #199e70; } }

.tabs { display: flex; gap: 2px; padding: 0 28px; background: var(--surface-1); border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: 83px; z-index: 4; }
.tabs button { font: inherit; font-size: .9rem; background: none; border: 0; border-bottom: 3px solid transparent; padding: 12px 14px 10px; color: var(--text-secondary); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--text-primary); }
.tabs button[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--brand); font-weight: 500; }
.badge { background: var(--critical); color: #fff; font-size: .7rem; font-weight: 600; border-radius: 99px; padding: 1px 7px; }
.vista[hidden] { display: none !important; }
.hint { margin: 6px 0 0; }
.clic { cursor: pointer; }
.kpi.clic:hover { border-color: var(--brand); }
tr.clic:hover td { background: var(--brand-wash); }
tr.apagado td { opacity: .55; }
.chart .hit.clic { cursor: pointer; }
kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface-1); color: var(--text-secondary); }
.atajos { margin: -6px 0 12px; }
.vacio-grande { text-align: center; padding: 36px 10px; }
.vacio-grande strong { font-size: 1.2rem; }
.nota-box { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: .88rem; margin: 10px 0 0; }

/* bandeja */
.bandeja { display: grid; gap: 12px; }
.tarjeta { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 10px; background: var(--surface-1); transition: opacity .25s, transform .25s; outline: none; }
.tarjeta.activa { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash); }
.tarjeta.guardando { opacity: .4; transform: translateX(12px); pointer-events: none; }
.t-top { display: flex; justify-content: space-between; gap: 12px; }
.t-desc { font-weight: 500; margin-top: 2px; }
.t-monto { font-size: 1.25rem; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sug { font-size: .78rem; color: var(--brand-strong); background: var(--brand-wash); border-radius: 6px; padding: 3px 8px; justify-self: start; }
@media (prefers-color-scheme: dark) { .sug { color: var(--brand); } }
.chip.suave { font-size: .8rem; padding: 4px 11px; }
.chip kbd { margin-right: 2px; }
.chip[aria-checked="true"] kbd { background: transparent; color: #fff; border-color: rgb(255 255 255 / .5); }
.chip-sel { font-size: .8rem; padding: 4px 8px; border-radius: 99px; }
.t-extra { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.t-extra input:not([type]) { flex: 1 1 220px; }
.t-acc { display: flex; justify-content: flex-end; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: .86rem; }

/* plan */
.salud { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1200px) { .salud { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .salud { grid-template-columns: repeat(2, 1fr); } }
.kpi .sub { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.sim { display: grid; grid-template-columns: 340px 1fr; gap: 24px; }
@media (max-width: 1000px) { .sim { grid-template-columns: 1fr; } }
.sim-ctrl { display: grid; gap: 14px; align-content: start; }
.slider { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: baseline; font-size: .86rem; color: var(--text-secondary); }
.slider output { font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.slider input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--brand-strong); padding: 0; border: 0; background: none; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; font-size: .84rem; border: 0; background: var(--surface-1); color: var(--text-secondary); padding: 8px 12px; cursor: pointer; flex: 1; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-checked="true"] { background: var(--brand-strong); color: #fff; font-weight: 500; }
.sim-res { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; }
.sim-res p { margin: 6px 0 0; font-size: .88rem; }
.sim-res .nota-box { background: var(--surface-1); }
.big { display: flex; flex-direction: column; }
.big strong { font-family: "Bodoni Moda", Georgia, serif; font-size: 1.9rem; font-weight: 600; }
.sim-orden { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; font-size: .86rem; }
.sim-orden li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--grid); padding: 5px 0; }
.mini-bar { width: 100px; height: 8px; display: block; }
.mini-bar .track, .hbar .track { fill: var(--surface-2); }
.mini-bar .fill, .hbar .fill { fill: var(--brand); }
.mini-bar .fill-out, .hbar .fill-out { fill: var(--series-out); }

/* líneas */
.chart .linea { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .linea.l1 { stroke: var(--series-in); } .chart .linea.l2 { stroke: var(--series-out); } .chart .linea.l3 { stroke: var(--series-3); }
.chart .punto { stroke: var(--surface-1); stroke-width: 2; }
.chart .punto.l1 { fill: var(--series-in); } .chart .punto.l2 { fill: var(--series-out); } .chart .punto.l3 { fill: var(--series-3); }
.chart .guia { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .base.cero { stroke: var(--text-muted); }
.legend .key.l1, .tt-k.k-l1 { background: var(--series-in); }
.legend .key.l2, .tt-k.k-l2 { background: var(--series-out); }
.legend .key.l3, .tt-k.k-l3 { background: var(--series-3); }
.tt-k.k-in { background: var(--series-in); } .tt-k.k-out { background: var(--series-out); }

/* proyectos */
.dlg-ancho { width: min(880px, 96vw); }
.proy-ed { display: grid; grid-template-columns: 1fr 260px; gap: 20px; }
@media (max-width: 760px) { .proy-ed { grid-template-columns: 1fr; } }
.proy-vivo { background: var(--surface-2); border-radius: 12px; padding: 16px; display: grid; gap: 10px; align-content: start; position: sticky; top: 0; }
.pv-score { display: flex; align-items: baseline; justify-content: space-between; }
.pv-score strong { font-family: "Bodoni Moda", Georgia, serif; font-size: 2.4rem; }
.proy-vivo dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: .86rem; }
.proy-vivo dt { color: var(--text-secondary); }
.proy-vivo dd { margin: 0; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.pill + .pill { margin-left: 4px; }
.hbar { display: grid; grid-template-columns: minmax(0, 150px) 1fr auto; gap: 10px; align-items: center; font-size: .84rem; margin-top: 10px; }
.hbar svg { width: 100%; height: 10px; }
.hbar-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* gasto rápido */
.fab { position: fixed; right: 22px; bottom: 22px; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--brand-strong); color: #fff; font-size: 1.9rem; line-height: 1; box-shadow: 0 6px 20px rgb(0 0 0 / .25); cursor: pointer; z-index: 20; }
.fab:hover { filter: brightness(1.1); }
.monto-grande { width: 100%; font-size: 2rem; text-align: center; padding: 12px; margin: 14px 0 4px; font-variant-numeric: tabular-nums; }
.lbl-mini { font-size: .78rem; color: var(--text-muted); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .05em; }
.full-w { width: 100%; margin-top: 14px; }
#form-rapido .seg { display: flex; }

@media (max-width: 640px) {
  .tabs { top: 0; padding: 0 8px; position: sticky; }
  .fab { right: 16px; bottom: 16px; }
  #btn-nuevo { display: none; }
}
#app.cargando .vista { opacity: .6; }

.filtros[hidden] { display: none; }
.chart .oculto { visibility: hidden; }
.t-desc .pill { margin-left: 8px; font-weight: 600; }
.regla-txt { max-width: 220px; }
.tarjeta { gap: 8px; padding: 12px 14px; }
#proy-kpis .kpi:first-child .val { font-size: 1.15rem; line-height: 1.3; }

/* =================== v3: trabajos directos =================== */
.trabajos { display: grid; gap: 14px; }
.trabajo { border: 1px solid var(--line); border-radius: 13px; padding: 14px 16px; background: var(--surface-1); }
.tr-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.tr-h h3 { margin: 0; font-size: 1.1rem; }
.tr-h p { margin: 3px 0 0; }
.tr-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tr-res { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 8px; align-items: stretch; }
.tr-big, .tr-fecha { display: grid; gap: 1px; padding: 9px 13px; border-radius: 10px; background: var(--surface-2); font-size: .8rem; color: var(--text-secondary); min-width: 150px; }
.tr-big b { font-size: 1.35rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.tr-fecha b { font-size: 1rem; font-weight: 500; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.tr-fecha.neg { box-shadow: inset 3px 0 0 var(--critical); }
.tr-fecha.neg b { color: var(--critical-text); }
.tr-res .nota-box { flex-basis: 100%; margin: 0; }
.tr-acciones { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 10px; }
.tr-tabla td, .tr-tabla th { padding: 6px 8px; }
.tr-plantillas { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tr-lineas td { padding: 4px 4px; vertical-align: top; }
.tr-lineas input { padding: 6px 7px; }
.tr-lineas .w-concepto { width: 100%; min-width: 150px; }
.tr-lineas .w-n { width: 64px; text-align: right; }
.tr-lineas .w-m { width: 90px; text-align: right; }
.tr-lineas td.num { padding-top: 10px; }
.tr-yapagado { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.tr-yapagado input { padding: 0; }
.tr-total { display: flex; gap: 18px; flex-wrap: wrap; justify-content: flex-end; padding: 10px 4px 14px; font-size: .9rem; color: var(--text-secondary); border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tr-total b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
#tr-mas-linea { margin-top: 6px; }
#tr-cerrados-box { margin-top: 18px; }
.form-grid label[hidden] { display: none; }
@media (max-width: 640px) { .tr-big, .tr-fecha { flex: 1 1 140px; min-width: 0; } }
.tr-docs { display: grid; gap: 6px; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.tr-doc { display: grid; grid-template-columns: 100px 1fr auto; gap: 10px; align-items: center; font-size: .85rem; }
.tr-doc-t { color: var(--text-secondary); font-weight: 500; }
.tr-doc.falta .tr-doc-t::after { content: " ●"; color: var(--warning); }
.tr-doc.falta .muted { color: var(--warning-text); }
.tr-doc-l { display: flex; gap: 10px; flex-wrap: wrap; }
.tr-doc a { color: var(--brand-strong); }
@media (max-width: 520px) { .tr-doc { grid-template-columns: 1fr auto; } .tr-doc-l, .tr-doc .muted { grid-column: 1 / -1; grid-row: 2; } }
