﻿:root {
  --bg: #F4F7FB; --grid: #E1E8F2; --surface: #FFFFFF; --ink: #16223D; --muted: #5A6781; --line: #D3DCE9;
  --blue: #2743C9; --blue-soft: #E7ECFF; --marker: #FFE45C; --green: #1B8456; --green-soft: #DCF2E6;
  --red: #C4372C; --red-soft: #FBE3E0; --on-blue: #FFFFFF;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1628; --grid: #1A2440; --surface: #172039; --ink: #E7EDF8; --muted: #9AA7C2; --line: #2A3657;
    --blue: #7D93FF; --blue-soft: #222F5C; --marker: #F2D544; --green: #4CC48C; --green-soft: #16362A;
    --red: #FF7B6E; --red-soft: #3E1D1D; --on-blue: #0F1628;
  }
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--body); color: var(--ink); line-height: 1.5; font-size: 16px;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 26px 26px;
}
a { color: var(--blue); }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; }
h1 { font-size: clamp(26px, 4.5vw, 40px); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 21px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 22px 20px 60px; }

/* Encabezado y navegación */
.top { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; }
.top .sub { color: var(--muted); margin-top: 4px; }
.nav { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; overflow-x: auto; margin-bottom: 18px; }
.nav a { text-decoration: none; padding: 9px 15px; border-radius: 9px; font-weight: 700; white-space: nowrap; color: var(--muted); }
.nav a.activo { background: var(--blue); color: var(--on-blue); }

/* Paneles y formularios */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 18px; }
.stack > * + * { margin-top: 16px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.f { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 700; }
.f .h { font-weight: 400; color: var(--muted); font-size: 13px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=month], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; min-width: 0;
}
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters > * { flex: 1 1 180px; }
.filters .btn { flex: 0 0 auto; }

.btn, input[type=submit].btn { display: inline-block; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 16px;
  border-radius: 9px; cursor: pointer; font: inherit; font-weight: 700; text-decoration: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
.btn.danger { color: var(--red); }
.btn.chico { padding: 5px 10px; font-size: 14px; }
.btn[disabled], .btn.aspNetDisabled { opacity: .5; cursor: not-allowed; }

/* Avisos */
.aviso { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 700; border: 1px solid var(--green); background: var(--green-soft); color: var(--green); }
.aviso.error { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.val { color: var(--red); font-size: 13px; font-weight: 700; }

/* Indicadores */
.ledger { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 18px; }
.ledger > div { padding: 16px 20px; border-left: 1px solid var(--line); }
.ledger > div:first-child { border-left: 0; }
.ledger .v { font-family: var(--display); font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ledger .l { color: var(--muted); font-size: 14px; }

/* Tablas */
.scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 15px; }
table.grid th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tfoot td, table.grid tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ctr { text-align: center; }
.who b { display: block; }
.who span { font-size: 13px; color: var(--muted); }
.vacio { padding: 26px; text-align: center; color: var(--muted); }
.debt { color: var(--red); font-weight: 700; }
.favor { color: var(--green); font-weight: 700; }
.ok { color: var(--green); font-weight: 700; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 20px; background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.tag.off { background: var(--red-soft); color: var(--red); }
tr.cargo td.c { color: var(--red); }
tr.pago td.a { color: var(--green); }

/* Sellos de mes */
.strip { display: flex; gap: 5px; flex-wrap: wrap; }
.st { width: 44px; height: 46px; border-radius: 7px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; line-height: 1.1; font-weight: 700; border: 1.5px solid var(--line); background: var(--surface); }
.st small { font-weight: 400; font-size: 10px; opacity: .8; }
.st.pagado { background: var(--green); border-color: var(--green); color: var(--on-blue); }
.st.parcial { background: linear-gradient(to top, var(--green-soft) 50%, var(--surface) 50%); border-color: var(--green); color: var(--green); }
.st.pendiente { background: var(--marker); border-color: var(--marker); color: #16223D; }
.st.vencido { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.st.sincargo { border-style: dotted; color: var(--muted); }
.st.futuro { border-style: dashed; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; border: 1.5px solid var(--line); }
.legend i.pagado { background: var(--green); border-color: var(--green); }
.legend i.parcial { background: linear-gradient(to top, var(--green-soft) 50%, var(--surface) 50%); border-color: var(--green); }
.legend i.pendiente { background: var(--marker); border-color: var(--marker); }
.legend i.vencido { background: var(--red-soft); border-color: var(--red); }
.legend i.sincargo { border-style: dotted; }
.legend i.futuro { border-style: dashed; }

/* Acceso */
.acceso { max-width: 440px; margin: 7vh auto 0; }
.acceso .modos { display: flex; gap: 4px; margin-bottom: 16px; }
.acceso .modos a { flex: 1; text-align: center; }
.hero { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: end; }
.hero .monto { font-family: var(--display); font-size: clamp(32px, 6vw, 52px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; }
  .ledger > div { border-left: 0; border-top: 1px solid var(--line); }
  .ledger > div:first-child { border-top: 0; }
}

/* Estado del mes como etiqueta de texto */
.st-texto { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 9px; border-radius: 20px; border: 1.5px solid var(--line); }
.st-texto.pagado { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.st-texto.parcial { border-color: var(--green); color: var(--green); }
.st-texto.pendiente { background: var(--marker); border-color: var(--marker); color: #16223D; }
.st-texto.vencido { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.st-texto.sincargo, .st-texto.futuro { color: var(--muted); border-style: dashed; }
a.st { text-decoration: none; }
table.grid td input[type=text] { min-width: 110px; text-align: right; }

/* App instalada: respeta las zonas seguras del celular */
body { padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.instalar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 20;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 8px 28px rgba(10, 16, 32, .18); max-width: 560px; margin: 0 auto; }
.instalar[hidden] { display: none; }
.instalar span { flex: 1 1 220px; font-size: 14px; }
.instalar img { width: 36px; height: 36px; border-radius: 9px; }
@media (max-width: 640px) {
  .wrap { padding: 16px 12px 90px; }
  .nav a { padding: 8px 12px; }
  table.grid { font-size: 14px; }
}

/* Fase 2: fotos, documentos, torneos y reportes */
.av { width: 38px; height: 38px; border-radius: 50%; flex: none; object-fit: cover; background: var(--blue-soft); color: var(--blue);
  display: inline-grid; place-items: center; font-weight: 700; font-size: 14px; font-family: var(--display); vertical-align: middle; }
.av.grande { width: 84px; height: 84px; font-size: 28px; }
.persona { display: flex; gap: 10px; align-items: center; }
.barra { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; min-width: 90px; margin-top: 4px; }
.barra > i { display: block; height: 100%; background: var(--green); }
.tag.aviso-tag { background: var(--marker); color: #16223D; }
.tag.ok { background: var(--green-soft); color: var(--green); }
.lista-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.lista-checks label { font-weight: 400; }
.lista-checks input { margin-right: 6px; }
table.cbl td { padding: 4px 14px 4px 0; }
.concepto-fila { display: grid; grid-template-columns: 1fr 140px 220px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
@media (max-width: 640px) { .concepto-fila { grid-template-columns: 1fr 1fr; } }
.calculo { padding: 12px 16px; border-radius: 12px; background: var(--blue-soft); }
.calculo b { font-family: var(--display); font-size: 20px; }
table.rep th, table.rep td { white-space: nowrap; }
table.rep td:first-child, table.rep th:first-child { position: sticky; left: 0; background: var(--surface); }
table.rep tr.sec td { font-family: var(--display); font-weight: 700; padding-top: 16px; }
table.rep tr.tot td { font-weight: 700; border-top: 2px solid var(--ink); }
table.rep tr.res td { font-family: var(--display); font-weight: 800; border-top: 2px solid var(--ink); }
table.rep td.b { font-weight: 700; }
.doc-acciones { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.doc-acciones input[type=file] { max-width: 220px; font-size: 13px; }
.signo-g { color: var(--red); }
.signo-i { color: var(--green); }
ul.lista-checks { list-style: none; padding: 0; margin: 0; }
ul.lista-checks li { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }

/* ===== Tipografía más compacta (fase 6) ===== */
body { font-size: 14px; line-height: 1.4; }
h1 { font-size: clamp(22px, 3.5vw, 32px); }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
.wrap { padding: 16px 16px 50px; }
.panel { padding: 14px 16px; margin-bottom: 14px; }
.stack > * + * { margin-top: 12px; }
.nav a { padding: 7px 11px; font-size: 13px; }
.f { font-size: 13px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=month],
input[type=search], input[type=tel], input[type=email], select, textarea { padding: 6px 9px; font-size: 13px; }
.btn, input[type=submit].btn { padding: 6px 12px; font-size: 13px; }
.btn.chico { padding: 3px 8px; font-size: 12px; }
table.grid { font-size: 13px; }
table.grid th { font-size: 12px; padding: 5px 8px; }
table.grid td { padding: 5px 8px; }
.who span, .small { font-size: 12px; }
.av { width: 28px; height: 28px; font-size: 11px; }
.ledger .v { font-size: 21px; }
.ledger .l { font-size: 12px; }
.ledger > div { padding: 10px 14px; }
.st { width: 36px; height: 38px; font-size: 10px; }
.st small { font-size: 9px; }
.hero .monto { font-size: clamp(26px, 5vw, 40px); }

/* ---------- Fase 8: multiclub y permisos ---------- */
.top-acciones { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.club-sel { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; font-size: 13px; color: var(--muted); }
.club-sel select { max-width: 260px; }
.aviso.consulta { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.lista-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.lista-checks label { margin-left: 4px; font-weight: 400; }
@media (max-width: 600px) { .club-sel select { max-width: 100%; } .top-acciones { width: 100%; } }

/* ---------- Fase 9: logo, secciones plegables y tablas compactas ---------- */
.marca { display: flex; align-items: center; gap: 12px; }
.logo-club { height: 48px; width: auto; max-width: 120px; object-fit: contain; border-radius: 8px; }
.logo-club.grande { height: 96px; max-width: 220px; }
.logo-ajustes { min-height: 40px; display: flex; align-items: center; }
details.plegable > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
details.plegable > summary::-webkit-details-marker { display: none; }
details.plegable > summary h2 { display: inline; }
details.plegable > summary h2::before { content: "▸ "; color: var(--muted); }
details.plegable[open] > summary h2::before { content: "▾ "; }
.grid.compacta { font-size: 12px; }
.grid.compacta th, .grid.compacta td { padding-top: 4px; padding-bottom: 4px; }
.grid.compacta .btn.chico { padding: 2px 8px; font-size: 11px; }
.aviso-peligro { border: 2px solid var(--red); }
@media (max-width: 600px) { .logo-club { height: 36px; } }

/* ---------- Fase 10: licencia, acerca de ---------- */
.aviso.por-vencer { border-color: #B7791F; background: #FFF6E0; color: #7A4E00; }
.aviso a { color: inherit; text-decoration: underline; margin-left: 8px; }
.aviso-texto { color: #B7791F; }
.llave { font-family: ui-monospace, Consolas, monospace; font-size: 12px; width: 100%; word-break: break-all; }
.pie { margin: 24px 0 8px; text-align: center; font-size: 12px; color: var(--muted); }
.pie a { color: inherit; }

/* Encabezados de columnas numéricas alineados a la derecha, igual que sus valores */
table.grid th.num, table.grid td.num { text-align: right; }
/* Tabla al ancho de su contenido: columnas angostas para leer encabezado y valor juntos */
table.grid.ajustada { width: auto; max-width: 100%; }
table.grid.ajustada th, table.grid.ajustada td { padding-left: 14px; padding-right: 14px; }
table.grid.ajustada th.num { white-space: normal; max-width: 110px; vertical-align: bottom; }
table.grid.ajustada td.acciones { padding-left: 28px; }

/* Fase 12: cobro único */
h3.subtitulo { font-size: 14px; margin: 6px 0 0; }
.repartir { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; padding: 10px 12px;
            border: 1px dashed var(--line); border-radius: 10px; }
.repartir .f { flex: 0 1 180px; }
.repartir span { flex: 1 1 260px; }
table.grid.pagar td.importe { width: 150px; }
table.grid.pagar td.importe input[type=text] { width: 130px; min-width: 0; }
.total-pago { text-align: right; font-size: 15px; margin: 4px 0 0; }
.panel.comprobante { border: 2px solid var(--green); }
.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; letter-spacing: .04em; }

/* Fase 15: Finanzas */
.nav.subnav { background: transparent; border-style: dashed; margin-top: -8px; }
.nav.subnav a { padding: 6px 12px; font-size: 14px; }
.nav.subnav a.activo { background: var(--blue-soft); color: var(--blue); }
ol.pasos { margin: 0; padding-left: 22px; }
ol.pasos li + li { margin-top: 8px; }
table.poliza td { padding: 6px 6px; vertical-align: top; }
table.poliza td input[type=text] { min-width: 110px; }
table.poliza td input.num { min-width: 100px; text-align: right; }
table.poliza tr.extra td { border-bottom: 1px solid var(--line); padding-top: 0; }
table.poliza tr:not(.extra) td { border-bottom: 0; }
table.poliza tfoot td { font-weight: 700; border-top: 2px solid var(--ink); }
table.poliza select.cuenta { min-width: 240px; }
table.poliza select.dc { min-width: 56px; }
table.poliza select.codigo { min-width: 140px; }
table.poliza input.adicional { min-width: 120px; }
table.poliza th.agrupador { color: var(--blue); }
