/* COVISAL — sistema visual
   Concreto claro de placa huella como fondo, verde de monte como color principal,
   ocre de guayacán para lo gastado, y el medidor de dos huellas como único elemento llamativo. */

@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/static/fonts/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2'), url('/static/fonts/atkinson-hyperlegible-latin-400-normal.woff') format('woff'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/static/fonts/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2'), url('/static/fonts/atkinson-hyperlegible-latin-700-normal.woff') format('woff'); }

:root {
  --paper: #eceFeb;
  --surface: #ffffff;
  --surface-2: #f5f7f4;
  --ink: #18261f;
  --ink-2: #4d5b54;
  --line: #d2d8d3;
  --line-strong: #aab3ad;
  --forest: #1f4d3a;
  --forest-2: #2a6a50;
  --forest-ink: #e8f1ec;
  --leaf: #1b7547;
  --brick: #ad3427;
  --ochre: #c98e12;
  --river: #1d6a86;
  --track: #c7cec9;
  --ok-bg: #e2f1e8; --ok-ink: #17573a;
  --warn-bg: #fcefd2; --warn-ink: #6c4300;
  --danger-bg: #f9e5e1; --danger-ink: #8a2419;
  --info-bg: #e1eff4; --info-ink: #155269;
  --neutral-bg: #e9ece9; --neutral-ink: #3f4b45;
  --progress-bg: #e5ede8; --progress-ink: #1f4d3a;
  --focus: #1d6a86;
  --r-s: 4px; --r-m: 7px;
  --font: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;
  --side: 252px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121a16; --surface: #18221d; --surface-2: #1d2923; --ink: #e5ece7; --ink-2: #a9b6ae; --line: #2c3a33; --line-strong: #44544b;
    --forest: #2f7556; --forest-2: #3b8a66; --forest-ink: #e8f1ec; --leaf: #5cc28c; --brick: #f08a7c; --ochre: #e6b246; --river: #6fb9d6; --track: #34433b;
    --ok-bg: #173527; --ok-ink: #a3dcbb; --warn-bg: #3a2c0d; --warn-ink: #f2cf86; --danger-bg: #3b1a16; --danger-ink: #f5b1a7;
    --info-bg: #13303b; --info-ink: #a5d6e8; --neutral-bg: #26312b; --neutral-ink: #c4cec8; --progress-bg: #1d3329; --progress-ink: #b9dcc9; --focus: #6fb9d6;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--paper); }
a { color: var(--forest-2); text-underline-offset: 2px; }
@media (prefers-color-scheme: dark) { a { color: var(--leaf); } }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -0.005em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .75em; }
small, .small { font-size: .875rem; }
.muted { color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
code.pw { font-size: 1.1rem; background: var(--surface); padding: 2px 8px; border-radius: var(--r-s); border: 1px solid var(--line); user-select: all; }
.icon { flex: none; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface-2); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand strong { display: block; font-size: 1.15rem; letter-spacing: .02em; color: var(--forest); }
.brand small { display: block; color: var(--ink-2); font-size: .8rem; }
.brand-mark { display: inline-flex; gap: 3px; padding: 6px; background: var(--forest); border-radius: 6px; }
.brand-mark i { display: block; width: 6px; height: 22px; border-radius: 2px; background: #d9dfda; }
.sidebar nav ul, .menu-drawer ul { list-style: none; margin: 0; padding: 0; }
.sidebar nav a, .menu-drawer nav a, .navlike { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-s); color: var(--ink); text-decoration: none; font-size: .97rem; border-left: 3px solid transparent; }
.sidebar nav a:hover, .menu-drawer nav a:hover { background: var(--surface); }
.sidebar nav a[aria-current="page"], .menu-drawer nav a[aria-current="page"] { background: var(--surface); border-left-color: var(--forest); font-weight: 700; color: var(--forest); }
@media (prefers-color-scheme: dark) { .sidebar nav a[aria-current="page"] { color: var(--leaf); border-left-color: var(--leaf); } }
.who { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; font-size: .9rem; }
.who-name { display: block; font-weight: 700; }
.who-role { display: block; color: var(--ink-2); }
.who-links { display: flex; gap: 14px; margin-top: 6px; }
.linklike { background: none; border: 0; padding: 0; color: var(--forest-2); text-decoration: underline; text-underline-offset: 2px; font: inherit; cursor: pointer; }
.navlike { width: 100%; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
main { padding: 26px 32px 40px; max-width: 1240px; width: 100%; }
main:focus { outline: none; }
.foot { margin-top: auto; padding: 14px 32px 24px; color: var(--ink-2); font-size: .8rem; }
.topbar { display: none; }
.bottom-nav { display: none; }
.demo-banner { background: var(--warn-bg); color: var(--warn-ink); padding: 8px 32px; font-size: .9rem; border-bottom: 1px solid var(--line); }
.demo-banner a { color: inherit; font-weight: 700; }
.is-public .shell { grid-template-columns: var(--side) minmax(0, 1fr); }

/* ---------- Encabezado de página ---------- */
.page-head { margin-bottom: 20px; }
.page-head .back { display: inline-block; margin-bottom: 6px; font-size: .92rem; text-decoration: none; }
.page-head-row { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-2); max-width: 70ch; margin: 4px 0 0; }
.head-badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Bloques ---------- */
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px 20px; margin-bottom: 18px; }
.block .block { border: 0; padding: 0; margin: 14px 0 0; }
.block-tight { padding: 14px 16px; }
.block-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.block-head h2 { margin: 0; }
.block-head .sub { color: var(--ink-2); font-size: .9rem; margin: 2px 0 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-2 > .block, .grid-2 > div > .block { margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; }
.grid-2 .grid-2 { gap: 0 14px; }
form .grid-2 { gap: 0 14px; }
.span-2 { grid-column: span 2; }

/* ---------- La plata (inicio y portal) ---------- */
.cashboard { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; margin-bottom: 18px; background: var(--surface); }
.cashboard h2, .cashboard h3 { font-size: .95rem; font-weight: 700; margin: 0 0 8px; }
.cash-main { background: var(--forest); color: var(--forest-ink); padding: 20px 22px; }
.cash-main h2 { color: #cfe3d8; font-weight: 400; font-size: 1rem; }
.cash-total { font-size: 2.9rem; font-weight: 700; line-height: 1.05; margin: 0 0 10px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cash-main .muted, .cash-main .small { color: #c4d9cd; }
.accounts { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid rgba(255, 255, 255, .2); font-size: .92rem; }
.accounts li { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.accounts .money { color: #fff; }
.cash-funds { padding: 18px 20px; border-right: 1px solid var(--line); }
.cash-promised { padding: 18px 20px; background: repeating-linear-gradient(135deg, var(--surface-2) 0 7px, var(--surface) 7px 14px); }
.cash-promised .money { color: var(--ink-2); }
.fund-list { list-style: none; margin: 0; padding: 0; }
.fund-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.fund-list li:last-child { border-bottom: 0; }
.fund-list li > span { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.fund-list li > .money { flex: none; }
.fund-list small { display: block; color: var(--ink-2); font-size: .82rem; line-height: 1.35; }
.fund-list .money { white-space: nowrap; font-weight: 700; }
.fund-list .restricted strong::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border: 2px solid var(--river); border-radius: 2px; vertical-align: 1px; }
.fund-list .sub-row { padding-left: 12px; font-size: .92rem; }
.fund-list .sub-row .money { font-weight: 400; }

.month-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); margin-bottom: 18px; overflow: hidden; }
.month-strip > div { padding: 12px 16px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.month-strip > div:first-child { border-left: 0; }
.month-strip span { color: var(--ink-2); font-size: .85rem; }
.month-strip strong, .month-strip .money { font-size: 1.2rem; font-weight: 700; }
.month-strip small { font-size: .8rem; }
.block .month-strip { margin: 10px 0; }

.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money-in { color: var(--leaf); }
.money-out { color: var(--brick); }
.money-neutral { color: var(--ink-2); }

/* ---------- Medidor de dos huellas ---------- */
.huella { margin: 8px 0 4px; }
.huella svg { display: block; width: 100%; height: 34px; overflow: visible; }
.huella-compact svg { height: 26px; }
.huella .t { fill: var(--track); }
.huella .in { fill: var(--leaf); }
.huella .out { fill: var(--ochre); }
.huella .out.is-over { fill: var(--brick); }
.huella .mark { fill: var(--ink); }
.huella-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .88rem; margin-top: 4px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.dot-in { background: var(--leaf); }
.dot-out { background: var(--ochre); }

.project-list { list-style: none; margin: 0; padding: 0; }
.project-list > li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.project-list > li:first-child { padding-top: 2px; }
.project-list > li:last-child { border-bottom: 0; }
.pl-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.pl-head a { color: var(--ink); text-decoration: none; }
.pl-head a:hover { text-decoration: underline; }

/* ---------- Ciclo del proyecto ---------- */
.steps { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0 0 16px; font-size: .84rem; }
.steps li { padding: 4px 10px; border-radius: var(--r-s); color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); }
.steps li.done { color: var(--forest); border-color: var(--forest); }
.steps li.done::before { content: '✓ '; }
.steps li.current { background: var(--forest); border-color: var(--forest); color: #fff; font-weight: 700; }
@media (prefers-color-scheme: dark) { .steps li.done { color: var(--leaf); border-color: var(--leaf); } }

.timeline { list-style: none; margin: 0 0 8px; padding: 0 0 0 16px; border-left: 2px solid var(--track); }
.timeline > li { position: relative; padding: 0 0 16px 10px; }
.timeline > li::before { content: ''; position: absolute; left: -23px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--forest); }
.tl-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }

.decisions { margin: 0; padding-left: 22px; }
.decisions > li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.decisions > li:last-child { border-bottom: 0; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 10px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tbl caption { text-align: left; font-weight: 700; padding: 6px 0; }
.tbl th, .tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl thead th { font-size: .84rem; color: var(--ink-2); font-weight: 700; border-bottom: 2px solid var(--line-strong); white-space: nowrap; }
.tbl tfoot th, .tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl input, .tbl select { min-width: 120px; }
.tbl.attendance td { vertical-align: middle; }
.empty { color: var(--ink-2); padding: 8px 0; }
.empty-state { text-align: left; padding: 18px; border: 1px dashed var(--line-strong); border-radius: var(--r-m); background: var(--surface); }
.empty-state p { color: var(--ink-2); }
.kv { margin: 0; display: grid; gap: 8px; }
.kv > div { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 12px; }
.kv dt { color: var(--ink-2); font-size: .9rem; }
.kv dd { margin: 0; }
.mini-totals { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .92rem; color: var(--ink-2); margin-bottom: 6px; }
.mini-totals .money { color: var(--ink); font-weight: 700; }
.link-list { margin: 0; padding-left: 18px; }
.link-list li { padding: 3px 0; }
.simple-list { list-style: none; padding: 0; margin: 0; }
.simple-list li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.simple-list li:last-child { border-bottom: 0; }
.prose { max-width: 75ch; }

/* ---------- Insignias y avisos ---------- */
.badge { display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: var(--r-s); line-height: 1.5; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge-danger { background: var(--danger-bg); color: var(--danger-ink); }
.badge-info { background: var(--info-bg); color: var(--info-ink); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral-ink); }
.badge-progress { background: var(--progress-bg); color: var(--progress-ink); box-shadow: inset 0 0 0 1px currentColor; }
.notice { padding: 12px 14px; border-radius: var(--r-s); border-left: 4px solid; margin: 0 0 16px; }
.notice ul { margin: 6px 0; padding-left: 20px; }
.notice-ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--leaf); }
.notice-info { background: var(--info-bg); color: var(--info-ink); border-color: var(--river); }
.notice-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--ochre); }
.notice-danger { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--brick); }
.notice .field label, .notice .field-check span { color: inherit; }
.alerts { list-style: none; margin: 0; padding: 0; }
.alert { padding: 8px 12px; border-left: 3px solid; margin-bottom: 6px; border-radius: 0 var(--r-s) var(--r-s) 0; font-size: .95rem; }
.alert a { color: inherit; }
.alert-info { background: var(--info-bg); color: var(--info-ink); border-color: var(--river); }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--ochre); }
.alert-danger { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--brick); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 8px 15px; border-radius: 6px; border: 1px solid transparent; font: inherit; font-weight: 700; font-size: .95rem; text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn-primary { background: var(--forest); color: #fff; }
.btn-primary:hover { background: var(--forest-2); }
.btn-secondary { background: var(--surface); color: var(--forest); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--forest); }
.btn-ghost { background: transparent; color: var(--forest-2); padding-left: 8px; padding-right: 8px; min-height: 36px; font-weight: 400; text-decoration: underline; text-underline-offset: 2px; }
.btn-danger { background: var(--surface); color: var(--brick); border-color: var(--brick); }
.btn-danger:hover { background: var(--danger-bg); }
@media (prefers-color-scheme: dark) { .btn-secondary { color: var(--leaf); } .btn-primary { color: #fff; } }
.btn[disabled] { opacity: .6; cursor: progress; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline-form .field { margin: 0; }
.inline-form select { min-height: 34px; padding: 4px 8px; font-size: .9rem; }

/* ---------- Formularios ---------- */
.field { margin-bottom: 14px; min-width: 0; }
.field label, .field legend, fieldset.radios legend { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 5px; color: var(--ink); }
.field .req { color: var(--brick); }
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=month], input[type=number], input:not([type]), select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; padding: 9px 11px; min-height: 44px; }
textarea { min-height: 0; resize: vertical; line-height: 1.45; }
input[type=file] { font: inherit; font-size: .95rem; max-width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--brick); border-width: 2px; }
.field-error { color: var(--danger-ink); font-size: .9rem; margin: 4px 0 0; font-weight: 700; }
.help { color: var(--ink-2); font-size: .87rem; margin: 5px 0 0; line-height: 1.4; }
p.help { max-width: 80ch; }
.money-input { position: relative; }
.money-input > span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.money-input input { padding-left: 24px; font-variant-numeric: tabular-nums; }
.tbl .money-input input { text-align: right; min-width: 130px; }
.field-check label { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: .95rem; cursor: pointer; }
.field-check input, .inline-check input, .check-grid input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--forest); }
.inline-check { display: inline-flex; gap: 6px; align-items: center; font-size: .92rem; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.fs { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.fs > legend { font-weight: 700; font-size: 1.02rem; padding: 0 8px 0 0; color: var(--forest); }
@media (prefers-color-scheme: dark) { .fs > legend { color: var(--leaf); } }
.radios .radio { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; cursor: pointer; }
.radios .radio:has(input:checked) { border-color: var(--forest); background: var(--surface-2); }
.radios .radio input { margin-top: 4px; accent-color: var(--forest); width: 18px; height: 18px; flex: none; }
.radios .radio small { display: block; color: var(--ink-2); font-size: .87rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.check-grid label { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.filters { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; margin-bottom: 14px; }
.filters .field { flex: 1 1 160px; max-width: 280px; margin-bottom: 10px; }
.filters .field-check { flex: 0 0 auto; padding-bottom: 10px; }
.filters > .btn { margin-bottom: 10px; }
details.more { margin: 10px 0; border: 1px solid var(--line); border-radius: 6px; padding: 0 12px; background: var(--surface); }
details.more > summary { cursor: pointer; padding: 10px 0; font-weight: 700; color: var(--forest-2); }
details.more[open] { padding-bottom: 12px; }
details.row-menu { display: inline-block; position: relative; }
details.row-menu > summary { cursor: pointer; color: var(--forest-2); text-decoration: underline; list-style: none; font-size: .92rem; }
details.row-menu > summary::-webkit-details-marker { display: none; }
details.row-menu[open] > form { position: absolute; right: 0; z-index: 10; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; padding: 12px; width: 300px; box-shadow: 0 8px 24px rgba(20, 40, 30, .14); text-align: left; }
.who-pick { max-width: 520px; }
.who-card { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--forest); border-radius: 6px; margin-bottom: 16px; }
.who-card .muted { flex-basis: 100%; }
.alloc-tbl td { vertical-align: middle; }
.alloc-extra select { min-width: 220px; }
.budget-row { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px 0; margin-bottom: 10px; background: var(--surface-2); }
.budget-row legend { font-weight: 700; font-size: .9rem; padding: 0 6px; color: var(--ink-2); }
.rules { display: grid; gap: 4px; }
.rule { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 12px; align-items: start; border-bottom: 1px solid var(--line); padding-top: 8px; }
.rule-meta { display: flex; flex-direction: column; gap: 4px; padding-top: 26px; }
.rule-meta select { min-height: 36px; padding: 5px 8px; font-size: .9rem; }
.hp { position: absolute; left: -5000px; }

/* ---------- WhatsApp ---------- */
.wa-box { border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px; background: var(--surface-2); }
.wa-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.wa-text { font-family: var(--font); font-size: .93rem; background: var(--surface); width: 100%; white-space: pre-wrap; }
.wa-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.js-only[hidden] { display: none; }

.docs { list-style: none; padding: 0; margin: 0 0 10px; }
.docs li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.uploader { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
.announcements { list-style: none; margin: 0; padding: 0; }
.announcements li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.announcements li p { margin: 4px 0 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--forest); border-bottom-color: var(--forest); font-weight: 700; }
@media (prefers-color-scheme: dark) { .tabs a[aria-current="page"] { color: var(--leaf); border-bottom-color: var(--leaf); } }

/* ---------- Ingreso ---------- */
.auth-card { max-width: 440px; margin: 6vh auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 24px 26px; }
.auth-card h1 { font-size: 1.5rem; }
.auth-card .sub { color: var(--ink-2); }

/* ---------- Portal ---------- */
.portal-hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 26px; margin-bottom: 20px; align-items: start; }
.portal-hero h1 { font-size: 2rem; max-width: 22ch; }
.portal-hero .lede { font-size: 1.08rem; max-width: 60ch; }
.objectives { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 16px 18px; border-top: 4px solid var(--forest); }
.objectives h2 { font-size: 1rem; }
.objectives ul { margin: 0; padding-left: 18px; }
.objectives li { margin-bottom: 5px; }

/* ---------- Móvil ---------- */
@media (max-width: 1000px) {
  .cashboard { grid-template-columns: 1fr 1fr; }
  .cash-main { grid-column: 1 / -1; }
  .cash-funds { border-right: 1px solid var(--line); }
  .portal-hero { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell, .is-public .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .brand-top { gap: 8px; }
  .brand-top .brand-mark { padding: 5px; }
  .brand-top .brand-mark i { height: 16px; width: 5px; }
  .menu-drawer > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; cursor: pointer; background: var(--surface); font-weight: 700; }
  .menu-drawer > summary::-webkit-details-marker { display: none; }
  .menu-drawer[open] > nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line-strong); padding: 8px 12px 14px; box-shadow: 0 12px 24px rgba(20, 40, 30, .14); max-height: 80vh; overflow-y: auto; }
  main { padding: 18px 16px 96px; }
  .foot { padding: 12px 16px 90px; }
  .is-public main { padding-bottom: 32px; }
  .is-public .foot { padding-bottom: 24px; }
  .demo-banner { padding: 8px 16px; }
  .bottom-nav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line-strong); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 9px; font-size: .78rem; color: var(--ink-2); text-decoration: none; }
  .bottom-nav a[aria-current="page"] { color: var(--forest); font-weight: 700; }
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
  h1 { font-size: 1.5rem; }
  .cash-total { font-size: 2.4rem; }
}
@media (max-width: 640px) {
  .cashboard { grid-template-columns: 1fr; }
  .cash-funds { border-right: 0; border-bottom: 1px solid var(--line); }
  .block { padding: 14px; border-radius: var(--r-s); }
  .hide-sm { display: none; }
  .month-strip { grid-template-columns: 1fr 1fr; }
  .month-strip > div { border-left: 0; border-top: 1px solid var(--line); }
  .month-strip > div:nth-child(-n+2) { border-top: 0; }
  .month-strip > div:nth-child(even) { border-left: 1px solid var(--line); }
  .kv > div { grid-template-columns: 1fr; gap: 0; }
  .span-2 { grid-column: auto; }
  .rule { grid-template-columns: 1fr; }
  .rule-meta { padding-top: 0; padding-bottom: 8px; flex-direction: row; flex-wrap: wrap; align-items: center; }
  /* Tablas como lista en pantallas pequeñas */
  .table-wrap { overflow: visible; }
  .tbl:not(.alloc-tbl):not(.attendance) thead { display: none; }
  .tbl:not(.alloc-tbl):not(.attendance), .tbl:not(.alloc-tbl):not(.attendance) tbody, .tbl:not(.alloc-tbl):not(.attendance) tr, .tbl:not(.alloc-tbl):not(.attendance) td { display: block; width: 100%; }
  .tbl:not(.alloc-tbl):not(.attendance) tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .tbl:not(.alloc-tbl):not(.attendance) td { border: 0; padding: 3px 0 3px 38%; text-align: left; position: relative; min-height: 1.6em; }
  .tbl:not(.alloc-tbl):not(.attendance) td::before { content: attr(data-label); position: absolute; left: 0; top: 4px; width: 35%; color: var(--ink-2); font-size: .82rem; line-height: 1.3; }
  .tbl:not(.alloc-tbl):not(.attendance) td.num { padding-left: 0; }
  .tbl:not(.alloc-tbl):not(.attendance) td.num::before { position: static; width: auto; }
  .tbl:not(.alloc-tbl):not(.attendance) td:first-child, .tbl:not(.alloc-tbl):not(.attendance) td[data-label=""] { padding-left: 0; }
  .tbl:not(.alloc-tbl):not(.attendance) td.num { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; text-align: right; }
  .tbl:not(.alloc-tbl):not(.attendance) td.num::before { display: inline; font-size: .85rem; }
  .tbl:not(.alloc-tbl):not(.attendance) td:first-child::before { display: none; }
  .tbl:not(.alloc-tbl):not(.attendance) td:first-child { font-weight: 700; }
  .tbl:not(.alloc-tbl):not(.attendance) td[data-label=""]::before { content: none; }
  .tbl:not(.alloc-tbl):not(.attendance) td.hide-sm { display: none; }
  .tbl tfoot { display: block; }
  .tbl tfoot tr { display: flex; justify-content: space-between; }
  .tbl tfoot th, .tbl tfoot td { border: 0; padding: 6px 0; }
  .tbl:not(.alloc-tbl):not(.attendance) td .money { text-align: right; }
  .alloc-tbl, .alloc-tbl tbody, .alloc-tbl tfoot { display: block; }
  .alloc-tbl thead { display: none; }
  .alloc-tbl tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .alloc-tbl td, .alloc-tbl th { display: block; border: 0; padding: 0; }
  .alloc-tbl td:last-child { grid-column: 1 / -1; }
  .alloc-tbl .money-input input { text-align: left; min-width: 0; }
  .alloc-extra select { min-width: 0; }
  .alloc-tbl tfoot tr { grid-template-columns: 1fr auto; }
  .attendance { min-width: 640px; }
  .table-wrap:has(.attendance) { overflow-x: auto; }
  .btn { width: auto; }
  .quick .btn { flex: 1 1 45%; }
  .wa-actions .btn { flex: 1 1 100%; }
  details.row-menu[open] > form { position: static; width: 100%; box-shadow: none; margin-top: 6px; }
}
@media print {
  .sidebar, .topbar, .bottom-nav, .quick, .actions, .demo-banner, form, .wa-box { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .block { border: 0; padding: 0; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
