/* ============================================================
   pages/pages.css — layouts for the 2.0 net-new pages
   (Ficha · Family · Centro de Mensajes · Configuración).
   AI4N-authored, built ON the Claude Design system (design/kit.css
   tokens + components). Replace/merge when Claude Design ships these.
   ============================================================ */

/* shared page chrome */
.pg{ padding:18px 24px 60px; overflow-y:auto; }
.pg-back{ background:transparent; border:0; color:var(--accent); font:inherit; font-size:12.5px; font-weight:600;
  cursor:pointer; padding:4px 0; display:inline-flex; align-items:center; gap:6px; margin-bottom:8px; }
.pg-back:hover{ color:var(--accent-dark); text-decoration:underline; }
.pg-grid2{ display:grid; grid-template-columns:1.4fr 1fr; gap:16px; align-items:start; }
@media (max-width:980px){ .pg-grid2{ grid-template-columns:1fr; } }
.card{ background:var(--paper); border:1px solid var(--grid); border-radius:var(--radius-card); padding:16px 18px; margin-bottom:16px; }
.card h3{ font-family:var(--font-serif); font-size:15px; margin:0 0 12px; color:var(--text); }
.kv{ display:flex; justify-content:space-between; gap:12px; padding:6px 0; border-bottom:1px solid var(--grid); font-size:13px; }
.kv:last-child{ border-bottom:0; }
.kv .k{ color:var(--text-muted); font-size:11px; text-transform:uppercase; letter-spacing:.06em; font-weight:700; }
.kv .v{ color:var(--text); font-weight:600; }
.kv .v.mono{ font-family:var(--font-mono); }

/* ---- FICHA ---- */
.ficha-hd{ display:flex; align-items:center; gap:16px; }
.ficha-av{ width:60px; height:60px; border-radius:14px; display:grid; place-items:center; color:#fff;
  font-weight:700; font-size:22px; font-family:var(--font-serif); flex:none; }
.ficha-hd .nm{ font-family:var(--font-serif); font-size:22px; color:var(--text); margin:0; }
.ficha-hd .sub{ font-size:13px; color:var(--text-muted); margin-top:2px; }
.sib{ display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--grid); cursor:pointer; }
.sib:last-child{ border-bottom:0; }
.sib:hover .sib-nm{ color:var(--accent); }
.sib-av{ width:30px; height:30px; border-radius:8px; display:grid; place-items:center; color:#fff; font-weight:700; font-size:12px; flex:none; }
.sib-nm{ font-weight:600; font-size:13px; flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.months{ display:flex; flex-wrap:wrap; gap:6px; margin-top:4px; }
.mo{ display:flex; flex-direction:column; align-items:center; gap:3px; width:54px; padding:7px 4px; border:1px solid var(--grid); border-radius:8px; font-size:10.5px; }
.mo .mo-l{ text-transform:uppercase; letter-spacing:.04em; color:var(--text-muted); font-weight:700; }
.mo .mo-s{ font-weight:800; font-size:14px; }
.mo.paid{ background:var(--money-cell-paid); } .mo.paid .mo-s{ color:var(--status-good); }
.mo.mora{ background:var(--money-cell-mora); } .mo.mora .mo-s{ color:var(--status-mora2); }
.mo.future{ background:var(--warm-2); } .mo.future .mo-s{ color:var(--text-muted); }
.mo.cur{ outline:2px solid #F59E0B; outline-offset:-2px; }
.consent-line{ display:flex; align-items:center; justify-content:space-between; padding:7px 0; font-size:12.5px; border-bottom:1px solid var(--grid); }
.consent-line:last-child{ border-bottom:0; }
.cbadge{ font-size:10.5px; font-weight:800; text-transform:uppercase; letter-spacing:.04em; padding:2px 9px; border-radius:999px; }
.cbadge.ok{ background:var(--status-good-bg); color:var(--status-good); }
.cbadge.no{ background:var(--warm-2); color:var(--text-muted); }
.pg-actions{ display:flex; gap:10px; flex-wrap:wrap; margin-top:4px; }

/* ---- FAMILY ---- */
.fam-total{ display:flex; align-items:baseline; gap:10px; }
.fam-total .amt{ font-family:var(--font-mono); font-size:26px; font-weight:700; color:var(--status-mora2); }
.fam-total .amt.ok{ color:var(--status-good); }
.fam-tbl{ width:100%; border-collapse:collapse; font-size:13px; margin-top:6px; }
.fam-tbl th,.fam-tbl td{ text-align:left; padding:8px 10px; border-bottom:1px solid var(--grid); }
.fam-tbl th{ font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--text-muted); }
.fam-tbl td.money,.fam-tbl th.money{ text-align:right; font-family:var(--font-mono); }
.fam-tbl tr.tot td{ font-weight:700; border-top:2px solid var(--grid-strong); border-bottom:0; }

/* ---- CONFIGURACIÓN ---- */
.cfg-tabs{ display:flex; gap:4px; border-bottom:1px solid var(--grid-strong); margin-bottom:16px; }
.cfg-tab{ background:transparent; border:0; border-bottom:2px solid transparent; padding:10px 14px; font:inherit;
  font-size:13px; font-weight:600; color:var(--text-muted); cursor:pointer; }
.cfg-tab:hover{ color:var(--text); }
.cfg-tab.active{ color:var(--accent); border-bottom-color:var(--accent); }
.cfg-row{ display:flex; align-items:center; justify-content:space-between; padding:10px 0; border-bottom:1px solid var(--grid); font-size:13px; gap:12px; }
.cfg-row:last-child{ border-bottom:0; }
.cfg-row .lbl{ color:var(--text-soft); } .cfg-row .lbl small{ display:block; color:var(--text-muted); font-size:11px; }
.cfg-input{ border:1px solid var(--grid-strong); border-radius:var(--radius-input); padding:7px 10px; font:inherit; font-size:13px;
  background:var(--paper); color:var(--text); min-width:140px; text-align:right; font-family:var(--font-mono); }

/* ---- CENTRO DE MENSAJES (3-pane) ---- */
.mc{ display:grid; grid-template-columns:300px 1fr 300px; height:calc(100vh - 59px); min-height:0; }
@media (max-width:1100px){ .mc{ grid-template-columns:260px 1fr; } .mc .mc-rail{ display:none; } }
.mc-col{ min-height:0; display:flex; flex-direction:column; border-right:1px solid var(--grid); background:var(--paper); }
.mc-col:last-child{ border-right:0; }
.mc-colhd{ padding:12px 14px; border-bottom:1px solid var(--grid); }
.mc-colhd h2{ font-family:var(--font-serif); font-size:16px; margin:0; }
.mc-colhd .sub{ font-size:11.5px; color:var(--text-muted); margin-top:2px; }
.mc-list{ overflow-y:auto; flex:1; }
.mc-conv{ display:flex; gap:10px; padding:11px 14px; border-bottom:1px solid var(--grid); cursor:pointer; align-items:flex-start; }
.mc-conv:hover{ background:var(--warm-2); } .mc-conv.active{ background:var(--warm-2); box-shadow:inset 3px 0 0 var(--accent); }
.mc-conv .av{ width:34px; height:34px; border-radius:9px; display:grid; place-items:center; color:#fff; font-weight:700; font-size:12px; flex:none; }
.mc-conv .body{ flex:1; min-width:0; }
.mc-conv .nm{ font-weight:600; font-size:12.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mc-conv .pre{ font-size:11.5px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mc-conv .meta{ display:flex; flex-direction:column; align-items:flex-end; gap:4px; flex:none; }
.mc-conv .dot{ width:8px; height:8px; border-radius:50%; }
.mc-thread{ flex:1; overflow-y:auto; padding:16px 18px; background:var(--warm); display:flex; flex-direction:column; gap:10px; }
.bub{ max-width:74%; padding:9px 12px; border-radius:12px; font-size:12.5px; line-height:1.4; }
.bub.in{ align-self:flex-start; background:var(--paper); border:1px solid var(--grid); }
.bub.out{ align-self:flex-end; background:#DCF8C6; color:#0B3B1E; }
:root[data-theme="dark"] .bub.out{ background:#1F3D2A; color:#CFF5D8; }
.bub .tm{ display:block; font-size:9.5px; color:var(--text-muted); margin-top:4px; text-align:right; }
.mc-compose{ border-top:1px solid var(--grid); padding:12px 14px; background:var(--paper); }
.mc-compose select,.mc-compose textarea{ width:100%; border:1px solid var(--grid-strong); border-radius:8px; padding:8px;
  font:inherit; font-size:12.5px; background:var(--paper); color:var(--text); }
.mc-compose textarea{ min-height:64px; margin-top:8px; resize:vertical; }
.mc-gate{ font-size:11px; margin:8px 0; padding:7px 9px; border-radius:7px; }
.mc-gate.ok{ background:var(--status-good-bg); color:var(--status-good); }
.mc-gate.no{ background:var(--status-mora2-bg); color:var(--status-mora2); }
.mc-send{ width:100%; appearance:none; border:0; border-radius:9px; background:#25D366; color:#08210F; font:inherit;
  font-size:13.5px; font-weight:800; padding:10px; cursor:pointer; margin-top:8px; }
.mc-send[disabled]{ opacity:.5; cursor:not-allowed; }

/* ---- sin-matrícula pill (distinct from mora) ---- */
.pill.sinmat{ background:var(--status-remate-bg); color:var(--status-remate); }
:root[data-theme="dark"] .pill.sinmat{ color:#C4B5FD; }

/* ---- Vista (saved views) dropdown ---- */
.vista-wrap{ position:relative; }
.vista-panel{ position:absolute; right:0; top:calc(100% + 6px); z-index:50; width:228px; background:var(--paper);
  border:1px solid var(--grid-strong); border-radius:10px; box-shadow:0 12px 32px rgba(0,0,0,.18); padding:8px; }
.vista-h{ font-size:10px; text-transform:uppercase; letter-spacing:.08em; color:var(--text-muted); font-weight:700; padding:8px 8px 4px; }
.vista-preset{ display:block; width:100%; text-align:left; background:transparent; border:0; font:inherit; font-size:12.5px;
  color:var(--text); padding:7px 8px; border-radius:6px; cursor:pointer; }
.vista-preset:hover{ background:var(--warm-2); color:var(--accent); }
.vista-col{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--text-soft); padding:6px 8px; cursor:pointer; }
.vista-col:hover{ background:var(--warm-2); border-radius:6px; }

/* ---- POE nav item: short label + long subtitle ---- */
.leftnav .nav-item .lbl{ flex-wrap:wrap; }
.leftnav .nav-sub{ flex-basis:100%; font-size:10px; color:#7B8AB8; font-weight:400; line-height:1.2; margin-top:1px; white-space:normal; }
/* ---- quick-view count badge ---- */
.qv-n{ display:inline-block; min-width:16px; text-align:center; font-size:10.5px; font-weight:800; background:var(--warm-2);
  color:var(--text-muted); border-radius:999px; padding:0 5px; margin-left:2px; }
.qv-chip.active .qv-n{ background:rgba(255,255,255,.22); color:#fff; }

/* ============================================================
   FROZEN HEADER: the chrome (title · toolbar · legend) stays put and only the
   table BODY scrolls; thead + sticky-left cols freeze (Excel freeze-panes).
   main-col becomes a flex column that doesn't itself scroll.
   ============================================================ */
.main-col{ display:flex; flex-direction:column; min-width:0; overflow:hidden; }
.pg{ flex:1 1 auto; min-height:0; overflow:auto; }
.mc{ flex:1 1 auto; min-height:0; }
.main-col > .sheet{ flex:1 1 auto; min-height:0; overflow:auto; margin:0 16px 0; border:1px solid var(--grid-strong); }
/* keep the band + column-header rows pinned while the body scrolls */
table.libro thead tr.band-row th{ position:sticky; top:0; z-index:6; }
table.libro thead tr.head-row th{ position:sticky; z-index:5; }
table.libro thead th.sticky-0, table.libro thead th.sticky-1,
table.libro thead th.sticky-2, table.libro thead th.sticky-3{ z-index:7; }

/* ============================================================
   DATA WIZARD (Import / Export on one screen)
   ============================================================ */
.dw-backdrop{ position:fixed; inset:0; background:rgba(10,14,26,.42); backdrop-filter:blur(2px); z-index:10000; display:grid; place-items:center; padding:24px; }
.dw-modal{ width:560px; max-width:96vw; background:var(--paper); border-radius:16px; box-shadow:0 24px 60px rgba(0,0,0,.32); overflow:hidden; }
.dw-head{ display:flex; justify-content:space-between; align-items:flex-start; padding:18px 22px 12px; border-bottom:1px solid var(--grid); }
.dw-head h2{ font-family:var(--font-serif); font-size:19px; margin:0; }
.dw-head .sub{ font-size:12.5px; color:var(--text-muted); margin-top:2px; }
.dw-x{ background:transparent; border:0; font-size:26px; line-height:1; color:var(--text-muted); cursor:pointer; }
.dw-body{ display:grid; grid-template-columns:1fr 1fr; gap:14px; padding:18px 22px 22px; }
@media (max-width:560px){ .dw-body{ grid-template-columns:1fr; } }
.dw-card{ border:1px solid var(--grid-strong); border-radius:12px; padding:18px 16px; text-align:center; display:flex; flex-direction:column; }
.dw-card .ico{ font-size:26px; color:var(--accent); display:flex; justify-content:center; margin-bottom:10px; }
.dw-card h3{ font-size:14px; margin:0 0 4px; }
.dw-card p{ font-size:12px; color:var(--text-muted); margin:0 0 14px; line-height:1.45; flex:1; }
.dw-card .btn-primary, .dw-card .btn-secondary{ width:100%; justify-content:center; }
.dw-note{ font-size:11px; color:var(--text-muted); text-align:center; padding:0 22px 18px; }

/* ---- WhatsApp rail: simple eligibility line + thin health footer ---- */
.mr-elig{ font-size:12px; margin-top:6px; line-height:1.5; }
.mr-elig .ok{ color:var(--status-good); font-weight:700; }
.mr-elig .mut{ color:var(--text-muted); }
.mr-health-foot{ width:100%; display:flex; align-items:center; gap:7px; justify-content:center; background:transparent; border:0; border-top:1px solid var(--grid); margin-top:10px; padding:9px 0 2px; font:inherit; font-size:11px; color:var(--text-muted); cursor:pointer; }
.mr-health-foot .hdot{ width:8px; height:8px; border-radius:50%; background:var(--status-good); }
.mr-health-foot .more{ color:var(--accent-dark); font-weight:600; margin-left:auto; }

/* ---- month cell = subtle "register payment" button ---- */
table.libro td.cell.payable{ cursor:pointer; font-weight:700; color:var(--accent-dark);
  background:rgba(44,140,153,.07); box-shadow:inset 0 0 0 1px rgba(44,140,153,.20); border-radius:4px; transition:background-color .1s, box-shadow .1s; }
table.libro td.cell.payable:hover{ background:rgba(44,140,153,.18); box-shadow:inset 0 0 0 1.5px var(--accent); }
table.libro td.cell.payable.mora{ color:var(--status-mora2); background:rgba(185,28,28,.06); box-shadow:inset 0 0 0 1px rgba(185,28,28,.20); }
table.libro td.cell.payable.mora:hover{ background:rgba(185,28,28,.16); box-shadow:inset 0 0 0 1.5px var(--status-mora2); }
:root[data-theme="dark"] table.libro td.cell.payable{ background:rgba(91,182,194,.10); }

/* ---- sortable column headers ---- */
table.libro thead th.sortable{ cursor:pointer; user-select:none; }
table.libro thead th.sortable:hover{ color:var(--accent); }

/* ---- household group-header row (when "Households" is on) ---- */
table.libro tr.group-head td{ position:sticky; left:0; background:var(--warm-2); color:var(--text-soft);
  font-size:12px; font-weight:600; padding:7px 12px; border-top:2px solid var(--grid-strong); border-bottom:1px solid var(--grid-strong); }
table.libro tr.group-head td b{ font-family:var(--font-mono); color:var(--status-mora2); }

/* ---- Columns panel (column manager) ---- */
.cols-panel{ width:264px; max-height:72vh; overflow-y:auto; }
.preset-row{ display:flex; flex-wrap:wrap; gap:5px; padding:2px 8px 8px; }
.preset-pill{ background:var(--warm-2); border:1px solid var(--grid-strong); border-radius:999px; font:inherit; font-size:11.5px; padding:4px 10px; cursor:pointer; color:var(--text-soft); }
.preset-pill:hover{ border-color:var(--accent); color:var(--accent); }
.col-group{ border-top:1px solid var(--grid); margin-top:2px; }
