/* =====================================================================
   Reportes de gastos AMF · tema CLARO único (sin modo oscuro automático)
   Contrastes (WCAG AA) sobre blanco: --texto 15:1, --tenue 6.3:1, --pri 6.9:1,
   --ok 6.1:1, --alerta 5.9:1, --error 6.5:1 (también sobre sus fondos suaves).
   Rojo de marca AMF (#e71830) SOLO como acento de marca (logo, filete superior,
   ítem activo). Acciones = azul; errores = rojo oscuro + ícono "!" + fondo rosado,
   para que el rojo de marca nunca se lea como "error".
   ===================================================================== */
:root {
  color-scheme: light;
  --fondo: #f3f5f9;
  --sup: #ffffff;
  --sup-2: #f6f8fb;
  --sup-hover: #eef2f8;
  --borde: #dfe4ec;
  --borde-f: #c5cedb;
  --texto: #1b2533;
  --tenue: #566173;
  --pri: #1d5ba6;
  --pri-hover: #174b8a;
  --pri-suave: #e7eefa;
  --foco: rgba(29, 91, 166, .38);
  --marca: #e71830;
  --ok: #16723f;      --ok-suave: #e2f4e9;      --ok-vivo: #22a35a;
  --alerta: #8a5200;  --alerta-suave: #fcefd6;  --alerta-vivo: #cc8400;
  --error: #b3261e;   --error-suave: #fde8e7;
  --info: #1d5ba6;    --info-suave: #e7eefa;
  --radio: 12px;
  --radio-ch: 8px;
  --sombra: 0 1px 2px rgba(20, 32, 54, .05), 0 1px 3px rgba(20, 32, 54, .06);
  --sombra-alta: 0 10px 30px rgba(20, 32, 54, .16);
  --barra-cel: 64px;
  --seg-abajo: env(safe-area-inset-bottom, 0px);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: anywhere;
}
a { color: var(--pri); text-underline-offset: 2px; }
a:hover { color: var(--pri-hover); }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; }
h1 { font-size: 1.45rem; line-height: 1.25; margin: .2rem 0 .3rem; letter-spacing: -.01em; }
h2 { font-size: 1.08rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.saltar { position: absolute; left: -999px; top: 8px; background: var(--sup); padding: 8px 12px; z-index: 50; border-radius: 8px; }
.saltar:focus { left: 8px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tenue, .muted { color: var(--tenue); }
small { font-size: .84rem; }

main { max-width: 1160px; margin: 0 auto; padding: 20px 16px 40px; outline: none; }

/* ---------- encabezado ---------- */
.top { background: var(--sup); border-top: 3px solid var(--marca); border-bottom: 1px solid var(--borde); position: sticky; top: 0; z-index: 20; }
.top-in { max-width: 1160px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 12px; min-height: 58px; }
.marca { display: flex; align-items: center; gap: 10px; color: var(--texto); text-decoration: none; font-weight: 650; white-space: nowrap; }
.marca img { height: 28px; width: auto; display: block; }
.marca span { font-size: .98rem; padding-left: 10px; border-left: 1px solid var(--borde); }
.nav-pc { display: flex; gap: 2px; margin-left: 12px; flex: 1; }
.nav-pc a { color: var(--tenue); text-decoration: none; padding: 8px 11px; border-radius: 8px; font-weight: 550; white-space: nowrap; position: relative; }
.nav-pc a:hover { background: var(--sup-hover); color: var(--texto); }
.nav-pc a.on { color: var(--texto); }
.nav-pc a.on::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: -9px; height: 3px; border-radius: 3px 3px 0 0; background: var(--marca); }
.cuenta { position: relative; }
.cuenta summary { list-style: none; display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 8px 10px; border-radius: 8px; min-height: 44px; color: var(--tenue); font-weight: 550; }
.cuenta summary::-webkit-details-marker { display: none; }
.cuenta summary:hover { background: var(--sup-hover); }
.cuenta .menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--sup); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra-alta); min-width: 220px; padding: 6px; z-index: 30; }
.cuenta .menu a, .menu-btn { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 8px; color: var(--texto); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.cuenta .menu a:hover, .menu-btn:hover { background: var(--sup-hover); }
.menu-btn { color: var(--error); }

/* barra inferior (celular) */
.nav-cel { display: none; }
.hoja { display: none; }

@media (max-width: 899px) {
  .nav-pc, .subir-pc, .cuenta { display: none; }
  .top-in { min-height: 52px; padding: 6px 16px; }
  .marca img { height: 26px; }
  .marca span { font-size: .92rem; }
  .instalar { margin-left: auto; }
  body.con-app main { padding-bottom: calc(var(--barra-cel) + var(--seg-abajo) + 28px); }
  .nav-cel {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    background: var(--sup); border-top: 1px solid var(--borde); box-shadow: 0 -2px 10px rgba(20, 32, 54, .06);
    padding: 4px 4px calc(4px + var(--seg-abajo));
  }
  .nav-cel a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; color: var(--tenue); text-decoration: none; font-size: .74rem; font-weight: 600; border-radius: 10px; }
  .nav-cel a .ico { width: 24px; height: 24px; }
  .nav-cel a.on { color: var(--pri); }
  .nav-cel a.on:not(.central) .ico { color: var(--marca); }
  .nav-cel .central { color: var(--texto); }
  .nav-cel .burbuja { display: grid; place-items: center; width: 50px; height: 50px; margin-top: -22px; border-radius: 50%; background: var(--pri); color: #fff; box-shadow: 0 4px 12px rgba(29, 91, 166, .35); border: 3px solid var(--sup); }
  .nav-cel .burbuja .ico { width: 24px; height: 24px; }
  .hoja:target { display: block; position: fixed; inset: 0; z-index: 40; }
  .hoja-fondo { position: absolute; inset: 0; background: rgba(15, 23, 36, .38); }
  .hoja-in { position: absolute; left: 0; right: 0; bottom: 0; background: var(--sup); border-radius: 16px 16px 0 0; padding: 8px 12px calc(16px + var(--seg-abajo)); box-shadow: var(--sombra-alta); max-height: 85vh; overflow-y: auto; }
  .hoja-cab { display: flex; justify-content: space-between; align-items: center; padding: 8px 6px 10px; border-bottom: 1px solid var(--borde); margin-bottom: 6px; }
  .hoja-in > a, .hoja-in button.salir, .hoja-in .instalar-hoja { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 8px 10px; color: var(--texto); text-decoration: none; font: inherit; font-weight: 550; background: none; border: 0; border-radius: 10px; text-align: left; cursor: pointer; }
  .hoja-in > a:hover { background: var(--sup-hover); }
  .hoja-in .instalar-hoja { color: var(--pri); }
  .hoja-in button.salir { color: var(--error); border-top: 1px solid var(--borde); border-radius: 0; margin-top: 6px; }
}
@media (max-width: 380px) { .marca span { display: none; } }

/* ---------- títulos de página ---------- */
.cab { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 0 0 18px; }
.cab > div:first-child { min-width: 0; }
.cab .sub { color: var(--tenue); margin: 0; }
.miga { font-size: .88rem; margin: 0 0 4px; }
.miga a { text-decoration: none; }
.acciones-cab { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- tarjetas ---------- */
.card { background: var(--sup); border: 1px solid var(--borde); border-radius: var(--radio); padding: 18px; margin: 0 0 16px; box-shadow: var(--sombra); }
.card > h2:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.card-cab { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; margin: 0 0 12px; }
.card-cab h2 { margin: 0; }
.narrow { max-width: 440px; margin: 32px auto; }
.cols { display: grid; gap: 16px; }
@media (min-width: 900px) { .cols.dos { grid-template-columns: 1fr 1fr; } .cols.ancha { grid-template-columns: 2fr 1fr; } }

/* ---------- KPIs ---------- */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin: 0 0 16px; }
.kpi { display: block; background: var(--sup); border: 1px solid var(--borde); border-left: 4px solid var(--borde-f); border-radius: var(--radio); padding: 12px 14px; color: var(--texto); text-decoration: none; box-shadow: var(--sombra); }
a.kpi:hover { border-color: var(--borde-f); background: var(--sup-2); color: var(--texto); }
.kpi.alerta { border-left-color: var(--alerta-vivo); }
.kpi.ok { border-left-color: var(--ok-vivo); }
.kpi.info { border-left-color: var(--pri); }
.kpi .etq { font-size: .82rem; color: var(--tenue); font-weight: 550; }
.kpi .grande { font-size: 1.6rem; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.kpi .sub { font-size: .8rem; color: var(--tenue); }
@media (max-width: 560px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi .grande { font-size: 1.35rem; } }

.total-dest { display: inline-flex; align-items: baseline; gap: 8px; background: var(--pri-suave); color: var(--texto); border-radius: 10px; padding: 8px 14px; font-weight: 600; }
.total-dest strong { font-size: 1.25rem; color: var(--pri); }

/* ---------- llamado principal ---------- */
.cta { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, #1d5ba6, #2a6fc0); color: #fff; border-radius: 14px; padding: 18px 20px; margin: 0 0 16px; text-decoration: none; box-shadow: 0 6px 18px rgba(29, 91, 166, .25); }
.cta:hover { color: #fff; filter: brightness(1.04); }
.cta .ico { width: 34px; height: 34px; padding: 6px; box-sizing: content-box; background: rgba(255, 255, 255, .16); border-radius: 12px; }
.cta strong { display: block; font-size: 1.12rem; }
.cta span { opacity: .92; font-size: .9rem; }
.atajos { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 16px;
  border-radius: 10px; border: 1px solid var(--borde-f); background: var(--sup); color: var(--texto);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; line-height: 1.2;
}
.btn:hover { background: var(--sup-hover); color: var(--texto); }
.btn.primary { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.primary:hover { background: var(--pri-hover); border-color: var(--pri-hover); color: #fff; }
.btn.danger { color: var(--error); border-color: #e6b4b0; background: var(--sup); }
.btn.danger:hover { background: var(--error-suave); color: var(--error); }
.btn.danger.lleno { background: var(--error); color: #fff; border-color: var(--error); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--pri); }
.btn.ghost:hover { background: var(--pri-suave); }
.btn.sm, .btn.small { min-height: 38px; padding: 6px 12px; font-size: .9rem; }
.btn.grande { min-height: 52px; font-size: 1.05rem; padding: 12px 22px; }
.btn.bloque { width: 100%; }
.btn .ico { width: 18px; height: 18px; }
@media (pointer: coarse) { .btn.sm, .btn.small { min-height: 44px; } }
button.link { background: none; border: 0; color: var(--pri); cursor: pointer; font: inherit; padding: 0; }
.actions, .acciones { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; align-items: center; }
form.inline { display: inline; }
@media (max-width: 560px) {
  .acciones.apiladas { flex-direction: column-reverse; align-items: stretch; }
  .acciones.apiladas .btn { width: 100%; }
}

/* ---------- formularios ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.ancho { grid-column: 1 / -1; }
.field > label, .etiqueta { font-weight: 600; font-size: .92rem; }
.field .ayuda, .field small.muted { color: var(--tenue); font-size: .82rem; }
.field.check { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; }
.field.check label { order: 2; font-weight: 550; }
.field.check input { order: 1; }
.err { color: var(--error); display: flex; gap: 6px; align-items: flex-start; font-size: .86rem; font-weight: 550; }
.err::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 17px; height: 17px; margin-top: 1px; border-radius: 50%; background: var(--error); color: #fff; font-size: .72rem; font-weight: 800; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--error); background: #fffafa; }
input, select, textarea {
  font: inherit; font-size: 16px; /* evita el zoom de iOS */
  min-height: 44px; padding: 9px 12px; border: 1px solid var(--borde-f); border-radius: var(--radio-ch);
  background: var(--sup); color: var(--texto); width: 100%; max-width: 100%;
}
textarea { min-height: 88px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px var(--foco); }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--pri); flex: none; }
input[type=file] { padding: 8px; background: var(--sup-2); }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; border: 1px solid var(--borde-f); background: var(--sup); color: var(--texto); border-radius: 8px; padding: 6px 12px; margin-right: 10px; cursor: pointer; }
label { display: block; }
input.wide { width: 100%; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.grupo { border-top: 1px solid var(--borde); padding-top: 16px; margin-top: 16px; }
.grupo:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.grupo > legend, .grupo-t { font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--tenue); margin-bottom: 10px; padding: 0; }
.resumen-err { border: 1px solid #f1c1bd; }

/* login */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.login-logo { height: 54px; width: auto; margin: 0 0 18px; }
.login { width: 100%; max-width: 400px; margin: 0; padding: 26px 24px; }
.login h1 { margin-bottom: 4px; }
.login .field { margin-bottom: 14px; }
.login .pie { margin-top: 16px; font-size: .86rem; color: var(--tenue); text-align: center; }
.login-nota { max-width: 400px; text-align: center; color: var(--tenue); font-size: .82rem; margin-top: 18px; }
body.publica main { max-width: none; padding: 0; }

/* ---------- mensajes ---------- */
.mensajes { display: grid; gap: 8px; margin-bottom: 16px; }
/* Bloque normal + ícono absoluto. Con flex/grid, un aviso con texto + <a>/<strong>
   se partía en columnas ("Comple ta tu / per fil"): cada trozo era un ítem aparte. */
.msg { display: block; position: relative; padding: 11px 14px 11px 44px; border-radius: 10px; margin: 0 0 12px; background: var(--info-suave); color: #173f73; border: 1px solid #c9d8f2; font-weight: 500; }
.mensajes .msg { margin: 0; }
.msg::before { content: "i"; position: absolute; left: 14px; top: 12px; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--info); color: #fff; font-weight: 800; font-size: .78rem; margin-top: 1px; font-style: italic; font-family: Georgia, serif; }
.msg.success { background: var(--ok-suave); color: #0f5530; border-color: #bfe3cc; }
.msg.success::before { content: "✓"; background: var(--ok); font-style: normal; font-family: inherit; }
.msg.warning { background: var(--alerta-suave); color: #6b3f00; border-color: #f0d6a6; }
.msg.warning::before { content: "!"; background: var(--alerta-vivo); color: #1b1300; font-style: normal; font-family: inherit; }
.msg.error { background: var(--error-suave); color: #8c1d17; border-color: #f1c1bd; }
.msg.error::before { content: "!"; background: var(--error); font-style: normal; font-family: inherit; }
.msg a { color: inherit; font-weight: 700; }
.errorlist { list-style: none; margin: 0 0 12px; padding: 11px 14px; border-radius: 10px; background: var(--error-suave); color: #8c1d17; border: 1px solid #f1c1bd; font-weight: 550; }

/* ---------- badges ---------- */
.badge, .tag { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 650; line-height: 1.3; padding: 2px 9px; border-radius: 99px; background: #edf0f4; color: #3e4757; white-space: nowrap; vertical-align: 1px; }
.badge.borrador { background: var(--alerta-suave); color: var(--alerta); }
.badge.ok { background: var(--ok-suave); color: var(--ok); }
.badge.info, .tag { background: var(--info-suave); color: var(--info); }
.badge.error { background: var(--error-suave); color: var(--error); }
.badge.neutro { background: #edf0f4; color: #3e4757; }

/* ---------- pasos ---------- */
.pasos { display: flex; list-style: none; padding: 0; margin: 0 0 18px; gap: 0; counter-reset: paso; }
.pasos li { flex: 1; display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--tenue); font-weight: 600; position: relative; min-width: 0; }
.pasos li:not(:last-child)::after { content: ""; flex: 1; height: 2px; background: var(--borde); margin: 0 8px; min-width: 10px; }
.pasos li::before { counter-increment: paso; content: counter(paso); flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--borde-f); background: var(--sup); color: var(--tenue); font-size: .82rem; }
.pasos li.hecho::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: #fff; }
.pasos li.hecho:not(:last-child)::after { background: var(--ok-vivo); }
.pasos li.actual { color: var(--texto); }
.pasos li.actual::before { background: var(--pri); border-color: var(--pri); color: #fff; }
@media (max-width: 420px) { .pasos li { font-size: .8rem; gap: 6px; } .pasos li:not(:last-child)::after { margin: 0 4px; } }

/* ---------- tablas ---------- */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; background: var(--sup); }
th, td { padding: 10px 10px; border-bottom: 1px solid var(--borde); text-align: left; vertical-align: middle; }
thead th, th { font-weight: 650; font-size: .8rem; color: var(--tenue); text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover td { background: var(--sup-2); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
tr.total td { font-weight: 750; border-top: 2px solid var(--texto); border-bottom: 0; font-size: 1.05rem; }
tr.total td.num { color: var(--pri); font-size: 1.2rem; }
.tabla-card { margin: 0 -18px; }
.tabla-card table th:first-child, .tabla-card table td:first-child { padding-left: 18px; }
.tabla-card table th:last-child, .tabla-card table td:last-child { padding-right: 18px; }
.td-sub { display: block; color: var(--tenue); font-size: .84rem; }
.fila-link { font-weight: 600; text-decoration: none; }
.fila-link:hover { text-decoration: underline; }

/* tablas que se vuelven tarjetas en celular */
@media (max-width: 719px) {
  .tabla-card { margin: 0; }
  table.resp, table.resp tbody, table.resp tr, table.resp td { display: block; width: 100%; }
  table.resp thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.resp tr { border: 1px solid var(--borde); border-radius: 10px; padding: 8px 12px; margin: 0 0 10px; background: var(--sup); }
  table.resp tbody tr:hover td { background: transparent; }
  table.resp td { border: 0; padding: 5px 0 !important; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.resp td::before { content: attr(data-label); color: var(--tenue); font-size: .82rem; font-weight: 600; text-align: left; flex: none; max-width: 45%; }
  table.resp td[data-label=""]::before { content: none; }
  table.resp td.prin { display: block; text-align: left; font-size: 1rem; }
  table.resp td.prin::before { content: none; }
  table.resp tr.total { border-color: var(--pri); background: var(--pri-suave); }
}

/* lista de gastos (tarjetas en celular, filas en PC) */
.gastos { list-style: none; margin: 0; padding: 0; }
.gasto { display: grid; grid-template-columns: 82px minmax(0, 1fr) minmax(0, .8fr) 120px 96px 44px; gap: 4px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--borde); }
.gasto:last-child { border-bottom: 0; }
.gasto.cab { font-size: .78rem; font-weight: 650; color: var(--tenue); text-transform: uppercase; letter-spacing: .03em; padding-top: 0; }
.gasto .fecha { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--tenue); font-size: .92rem; }
.gasto .que { min-width: 0; }
.gasto .que a { font-weight: 650; text-decoration: none; color: var(--texto); }
.gasto .que a:hover { color: var(--pri); text-decoration: underline; }
.gasto .det { color: var(--tenue); font-size: .88rem; }
.gasto .marcas { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.gasto .proy { font-size: .9rem; color: var(--tenue); min-width: 0; }
.gasto .loc { text-align: right; font-size: .88rem; color: var(--tenue); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gasto .usd { text-align: right; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gasto .usd .falta { color: var(--alerta); font-weight: 650; font-size: .86rem; }
.gasto .ir { justify-self: end; }
.gasto.borrador { background: linear-gradient(90deg, var(--alerta-suave), transparent 60%); border-left: 3px solid var(--alerta-vivo); padding-left: 8px; }
.ir-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; color: var(--pri); text-decoration: none; font-size: 1.3rem; }
.ir-btn:hover { background: var(--pri-suave); }
@media (max-width: 719px) {
  .gasto.cab { display: none; }
  .gasto { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "que usd" "meta loc" ; gap: 2px 12px; padding: 12px 4px; position: relative; }
  .gasto.borrador { padding-left: 10px; }
  .gasto .que { grid-area: que; }
  .gasto .usd { grid-area: usd; font-size: 1.05rem; }
  .gasto .loc { grid-area: loc; }
  .gasto .fecha, .gasto .proy { grid-area: meta; font-size: .84rem; }
  .gasto .fecha::after { content: " · " attr(data-proy); }
  .gasto .proy { display: none; }
  .gasto .ir { display: none; }
  .gasto .que a::after { content: ""; position: absolute; inset: 0; } /* toda la tarjeta es tocable */
}

/* ---------- estados vacíos ---------- */
.vacio { text-align: center; padding: 28px 16px; color: var(--tenue); }
.vacio .ico { width: 40px; height: 40px; color: var(--borde-f); margin-bottom: 6px; }
.vacio strong { display: block; color: var(--texto); font-size: 1.02rem; margin-bottom: 4px; }
.vacio p { max-width: 420px; margin: 0 auto 14px; }

/* ---------- filtros ---------- */
.filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px; align-items: end; }
.filtros .check-inline { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 550; }
details.filtros-cel > summary { display: none; }
@media (max-width: 719px) {
  details.filtros-cel > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-weight: 650; min-height: 44px; list-style: none; }
  details.filtros-cel > summary::-webkit-details-marker { display: none; }
  details.filtros-cel > summary::after { content: "▾"; color: var(--tenue); }
  details.filtros-cel[open] > summary { margin-bottom: 10px; }
  details.filtros-cel[open] > summary::after { content: "▴"; }
  details.filtros-cel:not([open]) > :not(summary) { display: none; }
}

/* ---------- subir facturas ---------- */
.zona { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; border: 2px dashed var(--borde-f); border-radius: 14px; padding: 22px 16px; background: var(--sup-2); cursor: pointer; position: relative; }
.zona:hover, .zona.arrastre { border-color: var(--pri); background: var(--pri-suave); }
.zona .ico { width: 36px; height: 36px; color: var(--pri); }
.zona strong { font-size: 1.05rem; }
.zona input[type=file] { margin-top: 8px; max-width: 320px; }
.zona-par { display: grid; gap: 12px; }
@media (min-width: 720px) { .zona-par { grid-template-columns: 1fr 1fr; } }
.zona.camara { background: var(--sup); }
.elegidos { list-style: none; padding: 0; margin: 8px 0 0; font-size: .88rem; color: var(--tenue); }
.elegidos li { padding: 2px 0; }

/* ---------- revisión de gasto ---------- */
.revision { display: grid; gap: 16px; align-items: start; }
@media (min-width: 960px) {
  .revision.con-factura { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
  .revision .visor { position: sticky; top: 80px; }
  .revision .visor details > summary { pointer-events: none; }
  .revision .visor details > summary::after { content: none; }
}
.visor { padding: 0; overflow: hidden; }
.visor details > summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; cursor: pointer; font-weight: 650; list-style: none; min-height: 48px; border-bottom: 1px solid var(--borde); }
.visor details > summary::-webkit-details-marker { display: none; }
.visor details > summary::after { content: "Ocultar ▴"; font-weight: 600; font-size: .86rem; color: var(--pri); }
.visor details:not([open]) > summary::after { content: "Ver factura ▾"; }
.visor details:not([open]) > summary { border-bottom: 0; }
.visor .lienzo { background: #e9edf3; display: flex; justify-content: center; align-items: flex-start; max-height: 78vh; overflow: auto; }
.visor .lienzo img { display: block; max-width: 100%; height: auto; }
.visor iframe { width: 100%; height: 76vh; border: 0; display: block; background: #e9edf3; }
.visor .pie-visor { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--borde); }
@media (max-width: 959px) {
  .visor .lienzo { max-height: 55vh; }
  .visor iframe { height: 60vh; }
}
.pdf-aviso { padding: 22px 16px; text-align: center; background: var(--sup-2); }
.pdf-aviso .ico { width: 36px; height: 36px; color: var(--error); }
.monto-usd input { font-size: 1.15rem; font-weight: 700; }
.monto-usd input::placeholder { font-weight: 400; color: var(--tenue); opacity: .7; }
.vinculo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: var(--sup-2); border: 1px solid var(--borde); border-radius: 10px; padding: 10px 12px; }
.pie-form { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--sup) 30%); padding-top: 10px; margin: 16px -18px -18px; padding: 14px 18px 18px; border-radius: 0 0 var(--radio) var(--radio); }
@media (max-width: 899px) { .pie-form { bottom: calc(var(--barra-cel) + var(--seg-abajo)); } }
.zona-peligro { margin-top: 8px; display: flex; justify-content: flex-end; }

/* ---------- proyecto ---------- */
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--tenue); font-size: .92rem; margin: 2px 0 0; }
.viaje { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--borde); }
.viaje:first-of-type { padding-top: 0; }
.viaje .tramo { font-weight: 650; text-decoration: none; color: var(--texto); }
.viaje .tramo:hover { color: var(--pri); text-decoration: underline; }
.viaje .tramo small { display: block; font-weight: 500; color: var(--tenue); }
.viaje .ops { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
@media (max-width: 600px) { .viaje { grid-template-columns: 1fr; } .viaje .ops { justify-content: flex-start; } }
.notas-dia { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px 12px; align-items: center; }
.notas-dia label { font-weight: 600; font-size: .9rem; white-space: nowrap; }
@media (max-width: 560px) { .notas-dia { grid-template-columns: 1fr; gap: 2px; } .notas-dia input { margin-bottom: 8px; } }

/* ---------- horas ---------- */
.semana-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 14px; }
.semana-nav .rango { font-weight: 700; text-align: center; }
.horas { display: grid; gap: 0; }
.horas .h-fila { display: grid; grid-template-columns: minmax(150px, 1.4fr) repeat(7, minmax(56px, 1fr)) 70px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--borde); }
.horas .h-cab { font-size: .8rem; font-weight: 650; color: var(--tenue); text-transform: uppercase; padding-top: 0; }
.horas .h-cab .finde { color: var(--pri); }
.horas .h-cab span { text-align: center; }
.horas .h-nom { font-weight: 650; }
.horas .h-nom small { display: block; color: var(--tenue); font-weight: 500; }
.horas .h-dia label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.horas .h-dia input { text-align: center; padding: 8px 4px; }
.horas .h-tot { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.horas .h-tot small { display: none; }
@media (max-width: 760px) {
  .horas .h-cab { display: none; }
  .horas .h-fila { grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--borde); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--sup); }
  .horas .h-nom { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; }
  .horas .h-dia label { position: static; width: auto; height: auto; clip: auto; font-size: .78rem; font-weight: 650; color: var(--tenue); text-align: center; display: block; margin-bottom: 2px; }
  .horas .h-tot { text-align: center; align-self: end; background: var(--sup-2); border-radius: 8px; min-height: 44px; display: grid; place-items: center; }
  .horas .h-tot small { display: block; font-size: .72rem; color: var(--tenue); font-weight: 600; line-height: 1; }
}
.resumen-horas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 0; }
.resumen-horas div { background: var(--sup-2); border-radius: 10px; padding: 10px 12px; text-align: center; }
.resumen-horas b { display: block; font-size: 1.3rem; }
.resumen-horas .ot { background: var(--pri-suave); }
.resumen-horas .ot b { color: var(--pri); }

/* ---------- listas de archivos ---------- */
.archivos { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.archivos a { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border: 1px solid var(--borde); border-radius: 10px; text-decoration: none; color: var(--texto); font-weight: 550; font-size: .92rem; }
.archivos a:hover { border-color: var(--pri); background: var(--pri-suave); }
.archivos .ico { color: var(--pri); }

/* lista simple de enlaces (proyectos en inicio) */
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { border-bottom: 1px solid var(--borde); }
.lista li:last-child { border-bottom: 0; }
.lista a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 2px; min-height: 52px; text-decoration: none; color: var(--texto); }
.lista a:hover { color: var(--pri); }
.lista .t { font-weight: 650; }
.lista .s { display: block; font-size: .86rem; color: var(--tenue); }
.lista .flecha { color: var(--tenue); font-size: 1.2rem; }

/* PWA / offline */
.instalar[hidden], [data-instalar][hidden] { display: none !important; }
.offline { max-width: 460px; margin: 10vh auto; text-align: center; }
.offline img { height: 48px; margin-bottom: 18px; }
.check-inline { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 550; }
@media (max-width: 959px) { .solo-pc { display: none !important; } }
/* modo app instalada: la barra inferior respeta el área segura (ya incluida con env()) */
html.standalone .top { padding-top: env(safe-area-inset-top, 0px); }
/* ajustes tras revisión visual */
@media (max-width: 899px) { .top .subir-pc, .top .nav-pc, .top .cuenta { display: none; } }
.gasto { padding-left: 10px; padding-right: 4px; }
.gasto.cab > span { font-size: inherit; color: inherit; font-weight: inherit; }
.gasto.borrador { background: #fffaf0; border-left: 0; box-shadow: inset 3px 0 0 var(--alerta-vivo); padding-left: 10px; }
@media (max-width: 719px) { .gasto, .gasto.borrador { padding-left: 12px; } }
.pie-form { position: static; background: var(--sup); border-top: 1px solid var(--borde); margin: 18px -18px -18px; padding: 14px 18px 18px; }
@media (max-width: 899px) {
  .pie-form { position: sticky; bottom: calc(var(--barra-cel) + var(--seg-abajo)); box-shadow: 0 -6px 14px rgba(20, 32, 54, .08); z-index: 5; }
}
.offline { width: calc(100% - 32px); margin: 10vh auto; padding: 28px 20px; }
@media (max-width: 560px) {
  .pie-form { padding: 10px 14px 12px; margin: 16px -18px -18px; }
  .pie-form .acciones.apiladas { flex-direction: row-reverse; }
  .pie-form .acciones.apiladas .btn { width: auto; flex: 1; min-height: 48px; font-size: 1rem; padding: 10px 12px; white-space: normal; }
  .pie-form .acciones.apiladas .btn.primary { flex: 1.4; }
}
