/* Diseño para celular primero (CONTRATO.md §5). Misma línea visual que la maqueta. */
:root {
  --fondo: #F3F2EE;
  --tarjeta: #FFFFFF;
  --tinta: #16191D;
  --suave: #5B6168;
  --linea: #E2E0DA;
  --borde: #CFCCC4;
  --acento: #9E1B32;
  --acento-2: #7A1426;
  --azul: #1E4FD8; --azul-f: #E6EDFD;
  --naranja: #B4480C; --naranja-f: #FCEBDD;
  --gris: #3F444A; --gris-f: #ECEBE7;
  --morado: #5B2FA6; --morado-f: #EFE8FB;
  --verde: #1F6B3A; --verde-f: #E3F1E7;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fondo); color: var(--tinta); font-family: 'Figtree', system-ui, sans-serif; font-size: 16px; }
a { color: var(--acento); }
a:hover { color: var(--acento-2); }
button, input, select, textarea { font: inherit; color: inherit; }

.app { min-height: 100dvh; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; }
.vista { flex: 1; padding: 0 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.top { padding: 22px 4px 4px; }
.h1 { font-family: 'Bricolage Grotesque', sans-serif; font-size: 27px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.sub { font-size: 14px; color: var(--suave); margin: 4px 0 0; }
.lbl { font-size: 12px; color: var(--suave); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin: 0; }
.card { background: var(--tarjeta); border: 1px solid var(--linea); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.money, .num { font-variant-numeric: tabular-nums; font-weight: 700; }
.pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: var(--gris-f); color: var(--gris); }
.pill.azul { background: var(--azul-f); color: var(--azul); }
.pill.naranja { background: var(--naranja-f); color: var(--naranja); }
.pill.morado { background: var(--morado-f); color: var(--morado); }
.pill.verde { background: var(--verde-f); color: var(--verde); }
.pill.oscuro { background: var(--tinta); color: #fff; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 16px; border-radius: 12px;
  background: var(--acento); color: #fff; font-weight: 700; font-size: 16px; border: 0; text-decoration: none; cursor: pointer; width: 100%; }
.btn:hover { background: var(--acento-2); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sec { background: #fff; color: var(--tinta); border: 1px solid var(--borde); }
.btn.sec:hover { background: #F7F6F3; }
.btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.archivo { position: relative; }
.archivo input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: #E6E4DE; border-radius: 12px; padding: 4px; gap: 4px; }
.seg a { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--gris); text-decoration: none; }
.seg a.on { background: #fff; color: var(--tinta); font-weight: 700; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat { background: #F6F5F2; border-radius: 10px; padding: 10px 12px; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--suave); }

.lista { display: flex; flex-direction: column; }
.lista > div { padding: 9px 0; border-top: 1px solid #EFEDE8; font-size: 14px; }
.lista small { display: block; color: var(--suave); font-size: 12px; }

.tabla { overflow-x: auto; }
.tabla table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-size: 12px; color: var(--suave); font-weight: 700; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--linea); white-space: nowrap; }
.tabla td { padding: 8px 8px 8px 0; border-bottom: 1px solid #EFEDE8; vertical-align: top; }
.tabla td.r, .tabla th.r { text-align: right; font-variant-numeric: tabular-nums; }

.campo { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.campo select, .campo input { min-height: 46px; border: 1px solid var(--borde); border-radius: 12px; padding: 0 12px; background: #fff; font-weight: 400; }

.aviso { background: var(--naranja-f); border: 1px solid #F2CFB3; color: #6B2A06; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.ok { background: var(--verde-f); border: 1px solid #BFDCC8; color: #174F2B; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.vacio { color: var(--suave); font-size: 14px; text-align: center; padding: 20px 0; }

.usuario { display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 0 16px; background: #fff;
  border: 1px solid var(--linea); border-radius: 12px; font-weight: 700; cursor: pointer; width: 100%; text-align: left; }

.nav { position: sticky; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: #fff;
  border-top: 1px solid var(--linea); padding: 6px 4px calc(10px + env(safe-area-inset-bottom)); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--suave); text-decoration: none; min-height: 50px; }
.nav a.on { color: var(--acento); font-weight: 700; }
.nav svg { width: 22px; height: 22px; }

.barra-usuario { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--suave); padding: 10px 4px 0; }
.barra-usuario button { background: none; border: 0; color: var(--acento); font-weight: 700; cursor: pointer; padding: 8px 0; min-height: 44px; }

@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.chip { font-size: 13px; font-weight: 600; padding: 0 14px; min-height: 40px; border-radius: 999px; border: 1px solid var(--borde); background: #fff; color: var(--tinta); white-space: nowrap; cursor: pointer; }
.chip.on { background: var(--tinta); color: #fff; border-color: var(--tinta); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lista small { display: block; }
.venta .row > span:first-child { min-width: 0; overflow-wrap: anywhere; }

[hidden] { display: none !important; }
.btn svg { width: 20px; height: 20px; flex: none; }
.ib { width: 40px; height: 40px; flex: none; border-radius: 10px; border: 1px solid var(--linea); background: #fff; display: inline-flex; align-items: center; justify-content: center; color: var(--gris); padding: 0; cursor: pointer; }
.ib:hover { background: #F7F6F3; }
.link { background: none; border: 0; padding: 8px 0; min-height: 40px; color: var(--acento); font-weight: 700; cursor: pointer; text-align: left; }
.entrada { min-height: 46px; border: 1px solid var(--borde); border-radius: 12px; padding: 0 12px; background: #fff; width: 100%; }
.form-inline { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.renglon { padding: 9px 0; border-top: 1px solid #EFEDE8; font-size: 14px; }
.renglon .row { align-items: flex-start; }
.renglon small { display: block; color: var(--suave); font-size: 12px; }
.lista, .lbl, .card { overflow-wrap: anywhere; }
.lista .row > span:first-child { min-width: 0; }
.vista-pdf { width: 100%; height: 70vh; min-height: 420px; border: 1px solid var(--linea); border-radius: 12px; background: #fff; }
.money { white-space: nowrap; }
.mes-grupo small { display: block; color: var(--suave); font-size: 12px; margin-top: 4px; overflow-wrap: normal; word-break: normal; }
.montos-grupo { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-top: 4px; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.montos-grupo span { white-space: nowrap; }
.montos-grupo small { display: block; font-weight: 400; color: var(--suave); font-size: 11px; }
.link { white-space: nowrap; }
.hoja { background: #fff; border: 1px solid #D5D2CB; border-radius: 6px; padding: 14px 12px; box-shadow: 0 2px 8px rgba(0,0,0,.06); display: flex; flex-direction: column; gap: 8px; }
.hoja-titulo { text-align: center; font-weight: 700; font-size: 14px; }
.hoja table { width: 100%; border-collapse: collapse; font-size: 12px; }
.hoja th { text-align: left; background: #E9E7E2; padding: 4px; font-size: 11px; }
.hoja td { padding: 4px; border-bottom: 1px solid #EEE; vertical-align: top; }
.hoja td small { color: var(--suave); font-size: 11px; }
.hoja .r { text-align: right; white-space: nowrap; }
.hoja .sec td { font-weight: 700; background: #F6F5F2; }
.firmas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; font-size: 10px; font-weight: 700; text-align: center; }
.firmas span { border-top: 1px solid #333; padding-top: 4px; }
.firmas small { display: block; font-weight: 400; }

/* Bienvenida / acceso: fondo a pantalla completa con el panel encima. */
.bienvenida { position: fixed; inset: 0; z-index: 5; overflow-y: auto; display: flex; flex-direction: column; justify-content: space-between;
  gap: 24px; padding: max(28px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); color: #fff;
  background: linear-gradient(180deg, rgba(8,14,32,.55) 0%, rgba(8,14,32,.1) 38%, rgba(8,14,32,.15) 60%, rgba(8,14,32,.85) 100%),
    #0B1530 url('/img/bienvenida.jpg') center 65% / cover no-repeat; }
.bv-texto { max-width: 520px; }
.bv-marca { margin: 0 0 14px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.bv-titulo { margin: 0; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: clamp(34px, 9vw, 56px); line-height: 1.02; letter-spacing: -.02em; text-shadow: 0 2px 24px rgba(0,0,0,.35); }
.bv-lema { margin: 14px 0 0; font-size: 16px; line-height: 1.45; max-width: 400px; opacity: .92; text-shadow: 0 1px 12px rgba(0,0,0,.4); }
.bv-panel { background: rgba(255,255,255,.96); color: var(--tinta); border-radius: 20px; padding: 22px 18px 18px; display: flex; flex-direction: column; gap: 12px;
  width: 100%; max-width: 420px; align-self: center; box-shadow: 0 20px 60px rgba(0,0,0,.35); backdrop-filter: blur(10px); }
.bv-h2 { margin: 0; font-family: 'Bricolage Grotesque', sans-serif; font-size: 24px; font-weight: 700; }
.bv-panel .sub { margin: -6px 0 2px; }
.bv-nota { margin: 0; font-size: 13px; color: var(--suave); text-align: center; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 52px; padding: 0 16px; border-radius: 12px;
  background: #fff; color: #1F1F1F; border: 1px solid #C9CCD1; font-weight: 600; font-size: 16px; text-decoration: none; }
.btn-google:hover { background: #F4F6F8; color: #1F1F1F; border-color: #A9AEB5; }
.btn-google:focus-visible { outline: 3px solid var(--azul); outline-offset: 2px; }
@media (min-width: 900px) {
  .bienvenida { flex-direction: row; align-items: flex-end; padding: 56px 64px;
    background: linear-gradient(90deg, rgba(8,14,32,.7) 0%, rgba(8,14,32,.15) 55%, rgba(8,14,32,.35) 100%), #0B1530 url('/img/bienvenida.jpg') center 70% / cover no-repeat; }
  .bv-texto { align-self: flex-start; }
  .bv-panel { align-self: flex-end; padding: 28px 26px 22px; }
}
