/* Finanzas personales — sistema visual "fintech limpio" */
:root {
  --bg: #F5F6F8;
  --panel: #FFFFFF;
  --text: #0E1525;
  --text-2: #3B4352;
  --muted: #5E6675;
  --border: #E5E7EB;
  --border-soft: #EEF0F3;
  --border-strong: #D5D9E0;
  --accent: #0B7A5F;
  --accent-hover: #086650;
  --accent-soft: #E7F4EF;
  --accent-ink: #075A46;
  --ink: #0E1525;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --ok: #0B6B53;
  --ok-soft: #E7F4EF;
  --warn: #8A4B08;
  --warn-soft: #FDF3E4;
  --child: #FAFBFC;
  --sel: #EEF6F3;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(14, 21, 37, .04);
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); background: var(--bg); color: var(--text); font-feature-settings: 'tnum' 1, 'cv11' 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
.ic { flex: none; vertical-align: -3px; pointer-events: none; }
button svg, a svg { pointer-events: none; }

/* ---------- layout ---------- */
.layout { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar {
  flex: 1 1 248px; max-width: 100%; background: var(--panel); border-right: 1px solid var(--border);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 18px;
}
@media (min-width: 900px) {
  .sidebar { flex: 0 0 248px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.content { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
main { padding: 4px 32px 48px; width: 100%; max-width: 1440px; }
@media (max-width: 640px) { main { padding: 4px 16px 40px; } }

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { width: 36px; height: 36px; flex: none; display: block; }
.brand-mark svg { display: block; filter: drop-shadow(0 1px 2px rgba(7, 90, 70, .25)); }
.brand b { display: block; font-size: 15px; letter-spacing: -0.01em; }
.brand .wordmark { font-size: 16.5px; font-weight: 500; letter-spacing: -0.025em; color: var(--text-2); line-height: 1.15; }
.brand .wordmark span { font-weight: 700; color: var(--accent); }
.brand small { display: block; font-size: 12px; color: var(--muted); line-height: 1.2; }

nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); padding: 14px 12px 6px; }
.nav-section:first-child { padding-top: 0; }
/* Sección que es en sí misma un acceso (Configuración): título verde con el ícono a la derecha. */
nav button.nav-section-link {
  min-height: 0; margin-top: 8px; padding: 10px 12px; justify-content: space-between; font-size: 11px; font-weight: 700;
  letter-spacing: .07em; color: var(--accent);
}
nav button.nav-section-link:hover { color: var(--accent-hover); background: var(--accent-soft); }
nav button.nav-section-link.active { color: var(--accent-ink); font-weight: 700; }
nav button.nav-section-link svg { width: 16px; height: 16px; }
nav button {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; text-align: left; min-height: 40px;
  padding: 8px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-weight: 500;
}
nav button svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav button:hover { background: #F3F4F6; color: var(--text); }
nav button.active, nav button.active:hover { background: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 2px 6px rgba(11, 122, 95, .25); }
nav button.active .badge { background: #fff; color: var(--danger); }
/* Secciones desplegables del menú lateral */
.nav-group + .nav-group { margin-top: 2px; }
nav button.nav-toggle { min-height: 0; padding: 10px 12px; justify-content: space-between; font-size: 11px; font-weight: 700; letter-spacing: .07em; color: var(--accent); }
.nav-group > .nav-toggle.nav-section { padding-top: 10px; }
nav button.nav-toggle:hover { background: var(--accent-soft); color: var(--accent-hover); }
nav button.nav-toggle .nav-chev { width: 16px; height: 16px; stroke-width: 2.2; transition: transform .2s; }
.nav-group.open > .nav-toggle .nav-chev { transform: rotate(180deg); }
.nav-group.current > .nav-toggle { color: var(--accent-ink); background: var(--accent-soft); }
/* Aviso de solicitudes pendientes aunque la sección esté cerrada */
.nav-group:not(.open):has(.badge:not(.hidden)) > .nav-toggle::after { content: ''; width: 8px; height: 8px; margin-left: auto; margin-right: 8px; border-radius: 50%; background: var(--danger); order: 1; }
.nav-group:not(.open):has(.badge:not(.hidden)) > .nav-toggle .nav-chev { order: 2; }
.nav-items { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.nav-items > div { overflow: hidden; display: flex; flex-direction: column; gap: 2px; }
.nav-group.open > .nav-items { grid-template-rows: 1fr; }
.nav-group.open > .nav-items > div { padding: 2px 0 6px; }
.nav-group:not(.open) .nav-items button { visibility: hidden; transition: visibility 0s .22s; }
@media (prefers-reduced-motion: reduce) { .nav-items, nav button.nav-toggle .nav-chev { transition: none; } }
.badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--border-soft); }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; flex: none; }
.side-user-text { flex: 1; min-width: 0; }
.side-user-text b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text small { display: block; font-size: 12px; color: var(--muted); }

/* Switch de datos de prueba: cuadro verde como el ícono de la app */
.demo-box { display: flex; flex-direction: row; align-items: center; gap: 12px; margin: 0 -2px; padding: 12px 14px; border-radius: 12px;
  background: var(--accent); color: #fff; cursor: pointer; font-size: 13px; font-weight: 400; }
.demo-box:hover { background: var(--accent-hover); }
.demo-text { flex: 1; min-width: 0; }
.demo-text b { display: block; font-size: 13.5px; }
.demo-text small { display: block; font-size: 11.5px; color: #CDEBE1; line-height: 1.3; }
.demo-box input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.demo-switch { position: relative; flex: none; width: 40px; height: 22px; border-radius: 999px; background: rgba(255,255,255,.28); transition: background .15s; }
.demo-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.demo-box input:checked + .demo-switch { background: #F5B400; }
.demo-box input:checked + .demo-switch::after { transform: translateX(18px); }
.demo-box input:focus-visible + .demo-switch { outline: 3px solid #7EE2C0; outline-offset: 2px; }
.demo-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 9px 32px; background: #FDF3E4;
  border-bottom: 1px solid #F5D9A8; color: #6B3E05; font-size: 13px; }
.demo-banner button.ghost { min-height: 30px; padding: 0 10px; background: transparent; border: 1px solid #E8C48A; color: #6B3E05; font-size: 12.5px; font-weight: 600; }
.demo-banner button.ghost:hover { background: #FBE6C4; }
@media (max-width: 640px) { .demo-banner { padding: 8px 12px; } }

.topbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 28px 32px 18px; max-width: 1440px; }
@media (max-width: 640px) { .topbar { padding: 20px 16px 14px; } }
.eyebrow { display: block; font-size: 13px; color: var(--muted); }
.page-head h1 { margin: 6px 0 0; font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
.search { display: flex; flex-direction: row; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 12px; height: 44px; width: 340px; max-width: 100%; color: var(--muted); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: 0; outline: 0; flex: 1; min-width: 0; padding: 0; background: transparent; font-size: 14px; color: var(--text); }
kbd { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }

.tab { display: none; }
.tab.active { display: block; }

/* ---------- superficies ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow-x: auto; }
.card h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.005em; }
.card h3 { font-size: 13px; font-weight: 600; margin: 14px 0 8px; color: var(--text-2); }
.hint { color: var(--muted); margin: 0 0 12px; font-size: 13px; }
.hint.ok { color: var(--ok); }
.hint.warn { color: var(--warn); }
.muted { color: var(--muted); }
.note { font-size: 12px; color: var(--muted); }
.note.orig { font-family: var(--mono); font-size: 11px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row.end { justify-content: flex-end; margin-top: 14px; }
.row.between { justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.row .grow { flex: 1 1 260px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 + .grid2 { margin-top: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- formularios ---------- */
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 500; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; min-height: 36px; color: var(--text); font-size: 13px; font-weight: 400; cursor: pointer; }
input, select, button, textarea { font: inherit; }
input, select, textarea {
  min-height: 38px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 9px; background: #fff; color: var(--text); font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 16px; height: 16px; padding: 0; accent-color: var(--accent); box-shadow: none; }
input[type=color] { padding: 3px; width: 44px; height: 38px; }
input[type=file] { min-height: 0; }
textarea { resize: vertical; }

button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px;
  padding: 0 14px; border-radius: 9px; border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
}
button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
/* Enlaces con forma de botón (ej. "Abrir Telegram") y botones con forma de enlace */
a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap;
}
a.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
a.button.secondary { background: #fff; color: var(--text); border-color: var(--border-strong); }
a.button.secondary:hover { background: #F7F8FA; }
button.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600; font-size: inherit; text-decoration: underline; }
button.link:hover { background: none; color: var(--accent-hover); }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 1px; }
button.secondary { background: #fff; color: var(--text); border-color: var(--border-strong); }
button.secondary:hover { background: #F7F8FA; }
button.danger { background: #fff; color: var(--danger); border-color: #F3C6C1; }
button.danger:hover { background: var(--danger-soft); }
button.icon { min-height: 32px; padding: 0 8px; background: transparent; border: 1px solid transparent; color: var(--muted); font-weight: 500; }
button.icon:hover { border-color: var(--border); background: #fff; color: var(--text); }
button.block { width: 100%; min-height: 44px; }
button:disabled { opacity: .5; cursor: default; }

.dropzone {
  display: flex; flex-direction: column; position: relative; margin-top: 16px; align-items: center; justify-content: center; text-align: center; gap: 6px;
  min-height: 150px; padding: 22px; border: 1.5px dashed #C9CED6; border-radius: 14px; background: #FAFBFC; cursor: pointer;
  color: var(--text); font-size: 14px;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.dropzone b { font-size: 15px; }
.dropzone .dz-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* ---------- tablas ---------- */
.scroll { overflow: auto; max-height: 440px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: middle; }
th { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; background: #FAFBFC; position: sticky; top: 0; z-index: 1; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--ok); }
table.raw td { white-space: nowrap; font-size: 12px; }
table.raw tr.header-row td { background: var(--accent-soft); font-weight: 600; }
table.raw tr:hover td { background: #F3F4F6; cursor: pointer; }

table.tx { min-width: 1080px; }
table.tx th:first-child, table.tx td:first-child { padding-left: 18px; }
table.tx th:last-child, table.tx td:last-child { padding-right: 14px; }
table.tx td { padding-top: 10px; padding-bottom: 10px; }
table.tx select { min-height: 32px; padding: 3px 8px; font-size: 13px; max-width: 170px; }
table.tx tr.child td { background: var(--child); }
table.tx tr.child td.desc { padding-left: 34px; color: var(--text-2); }
table.tx tr.child td.desc::before { content: "↳ "; color: var(--muted); }
table.tx tr.pending td:first-child { box-shadow: inset 3px 0 0 #D97706; }
table.tx tr.linkable:hover td { background: var(--accent-soft); cursor: pointer; }
table.tx tr.selected td { background: var(--sel); }
table.tx td:nth-child(2) { white-space: nowrap; color: var(--muted); font-size: 13px; }
/* Acciones de cada movimiento: 4 por fila para que la tabla no se salga de la tarjeta */
.tx-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px; width: 128px; margin-left: auto; }
.tx-acts button.icon { min-height: 30px; padding: 0 6px; }
.tx-acts button.icon[data-act="del"] { color: var(--danger); }
.tx-acts button.icon[data-act="del"]:hover { background: var(--danger-soft); border-color: #F3C6C1; }
#modal-ok.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
#modal-ok.danger:hover { background: #912018; border-color: #912018; }
td.desc { max-width: 400px; }
td.desc > a { font-weight: 600; }
.more-row td { text-align: center; padding: 14px; }
table.rp-items select { min-height: 32px; padding: 3px 8px; font-size: 13px; max-width: 170px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--accent-soft); }
td.desc a, td a[data-detail] { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--muted); }
td.desc a:hover, td a[data-detail]:hover { color: var(--accent); border-bottom-color: var(--accent); }
td.desc a.pill { border-bottom: 0; }
.summary-table td:first-child { font-weight: 600; }
.summary-table tr.total td { font-weight: 700; border-top: 2px solid var(--text); }

/* ---------- pills y estados ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: #F1F2F5; color: var(--text-2); vertical-align: 1px; }
.pill .ic { width: 13px; height: 13px; vertical-align: 0; }
.pill.pkg { background: #EFEBFF; color: #4C2DB8; text-decoration: none; }
.pill.helpp { background: #E8EEFB; color: #1F4BB8; text-decoration: none; }
.pill.helpp.answered { background: var(--accent-soft); color: var(--accent-ink); }
.pill.dispute { background: #FDECEA; color: #8F1D14; }
.pill.dispute.a_favor { background: var(--ok-soft); color: var(--ok); }
.pill.dispute.en_contra { background: #F1F2F5; color: var(--text-2); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.warn { background: var(--warn-soft); color: var(--warn); }
.status.bad { background: var(--danger-soft); color: var(--danger); }
.status.neutral { background: #F1F2F5; color: var(--text-2); }
/* Estatus de las conexiones (Configuración): más grandes para leerse de un vistazo */
#tab-conexiones .person-head .status { padding: 8px 16px; font-size: 14px; gap: 8px; }
#tab-conexiones .person-head .status::before { width: 9px; height: 9px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
mark { background: #FDE68A; color: inherit; padding: 0 1px; border-radius: 2px; }

.stats { display: flex; gap: 6px 22px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--muted); }
.stats b { font-size: 15px; color: var(--text); }
.stats .results { flex-basis: 100%; color: var(--text); }

.banner { position: sticky; top: 8px; z-index: 5; background: var(--warn-soft); border: 1px solid #F5D9A8; border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.bulk { background: var(--ink); border-color: var(--ink); color: #fff; }
.banner.bulk #bulk-count { font-weight: 600; margin-right: 4px; }
.banner.bulk select { background: #1A2232; color: #fff; border-color: #2A3345; }
.banner.bulk button.ghost { background: transparent; border-color: transparent; color: #D5D9E0; }
.banner.bulk button.ghost:hover { color: #fff; background: #1A2232; }
.banner.bulk button.light { background: #7EE2C0; border-color: #7EE2C0; color: var(--ink); margin-left: auto; }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.kpi:first-child { background: var(--ink); border-color: var(--ink); color: #fff; }
.kpi:first-child .kpi-label, .kpi:first-child .note { color: #B8BFCC; }
.kpi:first-child a { color: #7EE2C0; }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { font-size: clamp(22px, 2.1vw, 30px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .note.up { color: var(--danger); }
.kpi .note.down { color: var(--ok); }
.hbars { display: flex; flex-direction: column; gap: 2px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 200px) 1fr minmax(140px, auto); gap: 14px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.hbar:hover { background: #F5F6F8; }
.hbar-label { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 8px; background: #F1F2F5; border-radius: 999px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 999px; min-width: 2px; }
.hbar-value { font-size: 14px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-value .muted { font-weight: 400; font-size: 12px; margin-left: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; margin-bottom: 10px; color: var(--text-2); }
.legend i, .chart-tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-wrap { position: relative; }
.month-chart { width: 100%; height: auto; display: block; }
.month-chart .grid { stroke: #E5E7EB; stroke-width: 1; stroke-dasharray: 3 3; }
.month-chart .axis { fill: var(--muted); font-size: 11px; }
.month-chart .seg { stroke: var(--panel); stroke-width: 2; }
.month-chart .hit { fill: transparent; }
.month-chart .col:hover .hit { fill: #F3F4F6; }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; line-height: 1.6; padding: 8px 10px; border-radius: 10px; white-space: nowrap; z-index: 3; box-shadow: 0 8px 24px rgba(14,21,37,.18); }
@media (max-width: 640px) {
  .hbar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label value" "track track"; gap: 4px 10px; padding: 7px 4px; }
  .hbar-label { grid-area: label; } .hbar-value { grid-area: value; } .hbar-track { grid-area: track; }
}

/* ---------- reporte ---------- */
.person { border-left: 4px solid var(--accent); }
.person.unassigned { border-left-color: #D97706; }
.person-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.person-head h2 { margin: 0; }
.person-head .amount { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.breakdowns { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 10px; }
.breakdowns table td { padding: 5px 6px; font-size: 13px; }
.disputes-card { border-left: 4px solid var(--danger); }
tr.dispute-row td { background: #FEF6F5; color: #8F1D14; }
tr.dispute-row td.num { text-decoration: line-through; text-decoration-color: rgba(143, 29, 20, .5); }
tr.dispute-row td:last-child.num { text-decoration: none; }
details summary { cursor: pointer; color: var(--accent); margin-top: 10px; font-weight: 500; }

/* ---------- listas de catálogo ---------- */
.list-item { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border-soft); }
.list-item input[type=text] { flex: 1; }

/* ---------- modal y avisos ---------- */
dialog { border: 0; border-radius: 18px; padding: 22px 24px; width: min(580px, 94vw); box-shadow: 0 24px 60px rgba(14,21,37,.25); color: var(--text); }
dialog::backdrop { background: rgba(14,21,37,.45); }
dialog h2 { margin: 0 0 14px; font-size: 18px; letter-spacing: -0.01em; }
#modal-body { display: flex; flex-direction: column; gap: 12px; max-height: 70vh; overflow-y: auto; }
#modal-body label { font-size: 13px; }
#modal-body h3 { font-size: 13px; margin: 6px 0 0; }
.detail-amount { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
table.detail td { padding: 5px 6px; font-size: 13px; vertical-align: top; }
table.detail td.muted { width: 38%; }
.raw-val { white-space: pre-line; word-break: break-word; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; display: flex; gap: 12px; align-items: center; z-index: 50; max-width: min(520px, calc(100vw - 32px)); box-shadow: 0 10px 30px rgba(14,21,37,.25); }
.toast.error { background: var(--danger); }
.toast button { min-height: 32px; padding: 0 12px; background: #fff; color: var(--ink); border-color: #fff; }

/* ---------- inicio de sesión ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 12px 40px rgba(14,21,37,.06); }
.auth-card .brand { padding: 0; margin-bottom: 6px; }
.auth-card h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.auth-card .hint { margin: -6px 0 0; }
.auth-card input { min-height: 44px; }
.auth-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 13px; }

/* ---------- módulos nuevos ---------- */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #F1F2F5; color: var(--text-2); }
.chip.inv { background: #E8EEFB; color: #1F4BB8; }
.chip.rev { background: var(--accent-soft); color: var(--accent-ink); }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.members { display: flex; flex-direction: column; }
.member { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.member:last-child { border-bottom: 0; }
.member .avatar { width: 30px; height: 30px; font-size: 12px; border-radius: 8px; }
.member-name { flex: 1; min-width: 0; }
.member-name small { display: block; color: var(--muted); font-size: 12px; }

.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.inv-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; text-align: left; color: var(--text); box-shadow: var(--shadow); font-weight: 400; white-space: normal; align-items: stretch; min-height: 0; }
.inv-card:hover { border-color: var(--accent); background: var(--panel); }
.inv-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inv-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.inv-name { font-size: 15px; font-weight: 600; }
.inv-sub { font-size: 12px; color: var(--muted); }
.inv-value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.inv-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.gain { color: var(--ok); font-weight: 600; }
.loss { color: var(--danger); font-weight: 600; }
.spark { width: 100%; height: 36px; display: block; }
.inst-group { margin-bottom: 22px; }

/* Bancos / instituciones con lector: insignia con nombre y color de marca (o su logo si existe en public/logos/) */
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 12px; }
.card-top h2 { margin: 6px 0 0; }
.lectores { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lectores-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.lector { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px;
  background: #fff; color: var(--c); font-weight: 800; font-size: 13px; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.lector i { width: 11px; height: 11px; border-radius: 2px; background: var(--c); transform: skewX(-14deg); flex: none; }
.lector small { font-size: 10.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }
.lector img { height: 20px; width: auto; display: block; }
.lector.neutral { color: var(--text-2); font-weight: 600; text-transform: none; letter-spacing: 0; }
.lector.neutral i { background: #A3A29D; }
@media (max-width: 640px) { .card-top { margin-bottom: 8px; } .lector { height: 30px; padding: 0 10px; font-size: 12px; } }
.inst-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; padding-bottom: 8px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.inst-head h3 { margin: 0; font-size: 15px; letter-spacing: -0.005em; }
.inst-head b { color: var(--text); }

/* Grupos: propósitos en la introducción y partes del ejemplo */
.group-purposes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.group-purpose { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid #D3EBE1; color: var(--text-2); font-size: 13.5px; }
.group-purpose.inv { border-color: #D3DEF6; }
@media (max-width: 640px) { .group-purposes { grid-template-columns: 1fr; } }
.mock-check { display: flex; align-items: center; gap: 8px; }
.mock-check::before { content: '✓'; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.mock-member { display: flex; align-items: center; gap: 8px; }
.mock .avatar { width: 26px; height: 26px; border-radius: 7px; font-size: 10.5px; }
.mock-avatars { display: flex; flex: none; }
.mock-avatars .avatar { box-shadow: 0 0 0 2px var(--panel); }
.mock-avatars .avatar + .avatar { margin-left: -6px; }
.mock-share { display: flex; height: 22px; border-radius: 6px; overflow: hidden; font-size: 11px; font-weight: 700; color: #fff; }
.mock-share span { display: grid; place-items: center; background: var(--accent); }
.mock-share span:nth-child(2) { background: #1F4BB8; }
.mock-share span:nth-child(3) { background: #B45309; }

/* Ayuda: explicación en pasos + ejemplo ilustrado */
.help-intro { display: flex; gap: 18px; align-items: flex-start; padding: 20px 22px; margin-bottom: 20px; border-radius: var(--radius); background: linear-gradient(135deg, #E7F4EF, #F3FAF7 60%, #fff); border: 1px solid #D3EBE1; }
.help-intro-ico { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--accent); color: #fff; }
.help-intro-ico svg { width: 24px; height: 24px; }
.help-intro-text { flex: 1; min-width: 0; }
.help-intro h2 { margin: 0; font-size: 17px; }
.help-intro-text > p { margin: 2px 0 0; color: var(--text-2); }
.help-flow { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; padding: 0; }
.help-flow li { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px; background: var(--panel); border: 1px solid #D3EBE1; font-weight: 500; }
.help-intro .n, .help-demo .n { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.help-key { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; }
.help-key svg { width: 16px; height: 16px; }
.help-private { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; font-size: 13px; color: var(--accent-ink); font-weight: 500; }
.help-private svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.help-demo { margin-top: 20px; }
.help-demo-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.help-demo figure { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.help-demo figcaption { display: flex; gap: 10px; font-size: 13px; color: var(--muted); }
.help-demo figcaption b { display: block; color: var(--text); font-size: 14px; }
.help-demo figcaption svg { width: 14px; height: 14px; vertical-align: -2px; color: var(--accent); }
.mock { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 8px; min-height: 176px; padding: 16px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border-soft); font-size: 12.5px; }
.mock-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border-soft); }
.mock-row.muted { opacity: .55; }
.mock-row.hl { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mock-row small { display: block; color: var(--muted); font-size: 11px; }
.mock-row > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mock-amt { font-weight: 700; }
.mock-btn { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: #fff; animation: help-pulse 2s infinite; }
.mock-btn svg { width: 15px; height: 15px; }
@keyframes help-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(11, 122, 95, .45); } 50% { box-shadow: 0 0 0 6px rgba(11, 122, 95, 0); } }
@media (prefers-reduced-motion: reduce) { .mock-btn { animation: none; } }
.mock-title { font-weight: 700; font-size: 13px; }
.mock-field { display: flex; flex-direction: column; gap: 3px; }
.mock-field small { color: var(--muted); font-size: 11px; }
.mock-field > span { display: flex; justify-content: space-between; padding: 6px 9px; border-radius: 7px; background: var(--panel); border: 1px solid var(--border-strong); }
.mock-field i { font-style: normal; color: var(--muted); }
.mock-send, .mock-done { align-self: flex-end; padding: 5px 12px; border-radius: 7px; background: var(--accent); color: #fff; font-weight: 600; }
.mock-done { align-self: center; margin-top: 4px; }
.mock-bubble { max-width: 85%; padding: 7px 11px; border-radius: 12px 12px 12px 4px; background: var(--panel); border: 1px solid var(--border-soft); }
.mock-bubble.mine { align-self: flex-end; border-radius: 12px 12px 4px 12px; background: var(--accent-soft); border-color: #D3EBE1; color: var(--accent-ink); }
@media (max-width: 900px) { .help-demo-steps { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .help-intro { flex-direction: column; gap: 12px; padding: 18px 16px; } .help-flow li { width: 100%; } }

.help-list { display: flex; flex-direction: column; gap: 14px; }
.help-item { border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; background: var(--panel); }
.help-item.closed { opacity: .75; }
.help-tx { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 12px 14px; background: #F8F9FA; border-radius: 10px; margin: 10px 0; }
.help-tx b { display: block; }
.help-tx .amt { font-size: 18px; font-weight: 700; white-space: nowrap; }
.thread { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.msg { padding: 8px 12px; border-radius: 10px; background: #F1F2F5; font-size: 13px; max-width: 85%; }
.msg.mine { background: var(--accent-soft); align-self: flex-end; }
.msg small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.reply { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.reply input { flex: 1 1 220px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick button { min-height: 32px; font-size: 13px; font-weight: 500; }
tr.list-item { display: table-row; }
main .card { overflow-x: auto; }

/* ---------- celular y tablet (< 900px) ---------- */
.bottom-nav, .menu-backdrop, .mobile-only { display: none; }
@media (max-width: 899px) {
  /* Menú lateral → panel que se desliza desde la izquierda */
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(300px, 86vw); max-width: none; height: 100%;
    overflow-y: auto; transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(14,21,37,.18);
    padding: max(20px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  }
  body.menu-open { overflow: hidden; }
  body.menu-open .sidebar { transform: none; }
  .menu-backdrop { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(14,21,37,.4); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.menu-open .menu-backdrop { opacity: 1; pointer-events: auto; }
  nav button { min-height: 44px; }

  /* Barra inferior */
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--border);
    padding: 4px 4px max(4px, env(safe-area-inset-bottom)); gap: 0;
  }
  .bottom-nav button {
    flex-direction: column; justify-content: center; gap: 2px; width: auto; min-height: 54px; padding: 4px 2px; border-radius: 10px;
    font-size: 11px; font-weight: 500; text-align: center; color: var(--muted); background: transparent;
  }
  .bottom-nav button svg { width: 22px; height: 22px; }
  .bottom-nav button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .bottom-nav button.active { background: transparent; color: var(--accent); font-weight: 600; }
  .bottom-nav button:hover { background: transparent; }
  .layout { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .toast { left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); max-width: none; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  main { padding: 0 12px 28px; }
  .topbar { padding: max(16px, env(safe-area-inset-top)) 12px 12px; gap: 12px; }
  .page-head h1 { font-size: 24px; }
  .search { width: 100%; height: 46px; }
  .search kbd { display: none; }

  /* iOS no hace zoom al enfocar campos de 16px; áreas táctiles de 44px */
  input, select, textarea { font-size: 16px; min-height: 44px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; }
  button { min-height: 44px; }
  button.icon { min-height: 40px; min-width: 40px; }

  .card { padding: 16px; border-radius: 14px; margin-bottom: 12px; }
  .card h2 { font-size: 16px; }
  .section-head h2 { font-size: 17px; }

  /* Filtros: dos por renglón, la búsqueda a todo lo ancho */
  .filters, .row { gap: 10px; }
  .filters > label, .card > .row > label { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .filters select, .row > label > select, .row > label:not(.check) > input { width: 100%; }
  label.check { font-size: 15px; }

  /* Filtros de Movimientos plegados */
  .mobile-only { display: inline-flex; }
  .tx-filters > .row:first-child { flex-wrap: nowrap; align-items: flex-end; }
  .tx-filters > .row:first-child > .grow { flex: 1 1 auto; }
  .tx-filters:not(.open) > .row:first-child > label:not(.grow), .tx-filters:not(.open) .row.between > .row:first-child { display: none; }
  .tx-filters.open > .row:first-child { flex-wrap: wrap; }
  .tx-filters.open #tx-filters-btn { order: -1; flex-basis: 100%; }
  .tx-filters:not(.open) .row.between { border-top: 0; padding-top: 0; }
  .row .grow { flex-basis: 100%; }
  .row.between > .row { width: 100%; }
  .row.between > .row:last-child { flex-wrap: nowrap; }
  .row.between > .row:last-child > button { flex: 1 1 0; min-width: 0; padding: 0 10px; white-space: normal; line-height: 1.2; }

  /* Indicadores: dos columnas; el principal a todo lo ancho */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
  .kpi { padding: 14px; gap: 4px; border-radius: 14px; }
  .kpi:first-child { grid-column: 1 / -1; }
  .kpi-value { font-size: 19px; overflow-wrap: anywhere; }
  .kpi:first-child .kpi-value { font-size: 28px; }
  .kpi-label { font-size: 12px; }

  .month-chart .axis { font-size: 12px; }
  .legend { font-size: 12px; gap: 4px 12px; }

  /* Resumen de inversiones del dashboard: sin columnas secundarias */
  table.inv-dash th:nth-child(5), table.inv-dash td:nth-child(5),
  table.inv-dash th:nth-child(6), table.inv-dash td:nth-child(6) { display: none; }
  .inv-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Movimientos: cada renglón se vuelve una tarjeta */
  .card.flush:has(> table.tx) { overflow: visible; background: transparent; border: 0; box-shadow: none; }
  table.tx { min-width: 0; }
  table.tx thead { display: none; }
  table.tx tbody { display: flex; flex-direction: column; gap: 8px; }
  table.tx tr {
    display: grid; grid-template-columns: 28px 1fr 1fr; column-gap: 8px; row-gap: 6px; align-items: center;
    background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 12px;
  }
  table.tx td { display: block; padding: 0 !important; border: 0; min-width: 0; }
  table.tx td:empty { display: none; }
  table.tx td:nth-child(1) { grid-column: 1; grid-row: 1 / span 2; align-self: start; padding-top: 2px !important; }
  table.tx td:nth-child(3) { grid-column: 2 / 4; grid-row: 1; max-width: none; }
  table.tx td:nth-child(2) { grid-column: 2; grid-row: 2; }
  table.tx td:nth-child(4) { grid-column: 3; grid-row: 2; font-size: 16px; font-weight: 700; }
  table.tx td:nth-child(5) { grid-column: 2 / 4; grid-row: 3; font-size: 13px; color: var(--muted); }
  table.tx td:nth-child(5)::before { content: "Total con sub-cargos "; }
  table.tx td:nth-child(6) { grid-column: 2 / 4; grid-row: 4; }
  table.tx td:nth-child(7) { grid-column: 2; grid-row: 5; }
  table.tx td:nth-child(8) { grid-column: 3; grid-row: 5; }
  .tx-acts { display: contents; }
  /* Celular: los íconos se reparten parejo a lo ancho de la tarjeta */
  .tx-acts button.icon { flex: 1 1 0; min-width: 0; min-height: 40px; padding: 0 4px; }
  .tx-acts button.icon[data-act="unlink"] { flex: 2 1 auto; }
  table.tx td:nth-child(9) { grid-column: 1 / 4; grid-row: 6; display: flex; flex-wrap: wrap; gap: 2px; border-top: 1px solid var(--border-soft); padding-top: 6px !important; margin-top: 2px; }
  table.tx select { max-width: none; width: 100%; min-height: 40px; font-size: 16px; }
  table.tx td.desc { font-size: 15px; }
  table.tx tr.child { margin-left: 18px; background: var(--child); }
  table.tx tr.child td.desc { padding-left: 0 !important; }
  table.tx tr.child td:nth-child(7) { grid-column: 2 / 4; grid-row: 5; }
  table.tx tr.child td:nth-child(8) { grid-column: 1 / 4; grid-row: 6; display: flex; flex-wrap: wrap; gap: 2px; border-top: 1px solid var(--border-soft); padding-top: 6px !important; }
  table.tx tr.pending { box-shadow: inset 4px 0 0 #D97706; }
  table.tx tr.pending td:first-child { box-shadow: none; }
  table.tx tr.selected { border-color: var(--accent); }
  table.tx tr.more-row, table.tx tr:has(> td[colspan="9"]) { display: block; text-align: center; }
  table.tx tr.more-row td { display: flex; flex-direction: column; align-items: center; gap: 8px; }

  /* Ventanas: hoja desde abajo */
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; padding: 20px 16px max(16px, env(safe-area-inset-bottom)); }
  #modal-body { max-height: 68vh; }
  dialog .row.end > button { flex: 1 1 0; }

  .banner { border-radius: 12px; }
  .banner.bulk select { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .banner.bulk button.light { margin-left: 0; flex: 1 1 100%; }
  .person-head .amount { font-size: 20px; }
  .help-tx { flex-direction: column; }
  .msg { max-width: 100%; }
  .auth-card { padding: 22px; }
}

/* Telegram: QR para abrir el chat desde el celular + pasos */
.tg-setup { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; margin: 8px 0 12px; }
.qr-box { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 168px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: var(--muted); font-size: 12px; text-decoration: none; }
.qr-box svg { width: 146px; height: 146px; display: block; }
.tg-steps { flex: 1 1 260px; margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--text-2); }
.tg-steps .note { display: block; }
.copy-chip { min-height: 28px; padding: 0 8px 0 10px; margin-left: 4px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-ink); border: 1px solid transparent; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 600; }
.copy-chip:hover { background: var(--accent-soft); border-color: var(--accent); }
.copy-chip svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

/* Telegram: funciones del bot con casillas */
.tg-fn-title { margin: 6px 0 8px; font-size: 15px; }
.tg-fns { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.tg-fn { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.tg-fn:hover { background: #F7F8FA; }
.tg-fn.sub { margin-left: 30px; }
.tg-fn > input[type=checkbox] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.tg-fn > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tg-fn b { font-size: 14px; font-weight: 600; color: var(--text); }
.tg-fn small { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-check { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 13px; background: #fff; cursor: pointer; }
.chip-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.chip-check input { accent-color: var(--accent); margin: 0; }
.chip-check:has(input:disabled), .tg-fn:has(> input:disabled) { opacity: .55; cursor: default; }
.pct-input { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.pct-input input { width: 76px; min-height: 32px; }
.tg-fn label[for] { display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
/* Las etiquetas de formulario van en columna; aquí la casilla va a la izquierda del texto */
label.tg-fn, .tg-fn label[for] { color: var(--text-2); font-size: inherit; font-weight: 400; }
label.tg-fn { flex-direction: row; gap: 12px; }
.chip-check, .pct-input { flex-direction: row; color: var(--text-2); font-weight: 500; }
.tg-fn-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 6px 0 8px; }
.tg-fn-head .tg-fn-title { margin: 0; }
.autosave { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 600; }
.autosave svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* Descripción breve de cada sección, bajo el título */
.page-desc { margin: 10px 0 0; font-size: 15px; color: var(--text-2); max-width: 70ch; line-height: 1.45; }

/* Ayuda: tutorial en tarjetas agrupadas por área; al abrir una ocupa todo el ancho */
.guide { display: flex; flex-direction: column; gap: 28px; max-width: 1100px; container-type: inline-size; }
.g-general { --c: #4F46E5; --c-soft: #EEF0FD; }
.g-gastos { --c: var(--accent); --c-soft: var(--accent-soft); }
.g-inversiones { --c: #1F4BB8; --c-soft: #E8EEFB; }
.g-usuarios { --c: #B45309; --c-soft: #FDF1E3; }
.g-config { --c: #7C3AED; --c-soft: #F2ECFE; }
.g-extra { --c: #BE185D; --c-soft: #FCEBF3; }
.guide-ico { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--c-soft, var(--accent-soft)); color: var(--c, var(--accent)); }
.guide-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.guide-group-title, .guide-start-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 12px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--c, var(--accent-ink)); }
.guide-group-title small, .guide-start-title small { font-size: 13px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }

/* ¿Por dónde empiezo?: cuatro pasos numerados */
.guide-start { padding: 18px; border-radius: var(--radius); background: linear-gradient(135deg, #E7F4EF, #F3FAF7 60%, #fff); border: 1px solid #D3EBE1; }
.guide-start-title { font-size: 15px; text-transform: none; letter-spacing: 0; }
.guide-steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 12px; }
@container (min-width: 900px) { .guide-steps { grid-template-columns: repeat(4, 1fr); } }
.guide-step { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ico title" "ico sub"; gap: 2px 12px; align-items: center; justify-content: stretch; text-align: left; white-space: normal; height: auto; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); color: var(--text); cursor: pointer; font: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
.guide-step:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 18px rgba(7, 90, 70, .1); }
.guide-step .guide-ico { grid-area: ico; }
.guide-step b { grid-area: title; font-size: 14px; }
.guide-step small { grid-area: sub; font-size: 12.5px; color: var(--muted); }
.guide-step:hover b { color: #fff; }
.guide-step:hover small { color: rgba(255, 255, 255, .88); }
.guide-step-n { position: absolute; top: -8px; left: -8px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 0 0 3px #fff; }

/* Tarjetas de cada tema */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.guide-item { border: 1px solid var(--border); border-radius: 14px; background: var(--panel); overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s; }
.guide-item:not([open]):hover { transform: translateY(-2px); border-color: var(--c); box-shadow: 0 6px 18px rgba(14, 21, 37, .08); }
.guide-item[open] { grid-column: 1 / -1; border-color: var(--c); box-shadow: 0 4px 16px rgba(14, 21, 37, .08); }
.guide-item summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ico chev" "title title" "sub sub"; row-gap: 4px; padding: 16px; height: 100%; }
.guide-item summary::-webkit-details-marker { display: none; }
.guide-item summary .guide-ico { grid-area: ico; margin-bottom: 8px; }
.guide-item summary::after { content: ""; grid-area: chev; justify-self: end; align-self: start; width: 8px; height: 8px; margin: 8px 6px 0 0; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.guide-item summary b { grid-area: title; font-size: 15px; color: var(--text); }
.guide-item summary small { grid-area: sub; font-size: 13px; color: var(--muted); line-height: 1.4; }
.guide-item[open] summary { grid-template-columns: auto 1fr auto; grid-template-areas: "ico title chev" "ico sub chev"; column-gap: 14px; align-items: center; height: auto; background: var(--c-soft); }
.guide-item[open] summary .guide-ico { margin: 0; background: var(--panel); }
.guide-item[open] summary::after { transform: rotate(-135deg); border-color: var(--c); align-self: center; margin-top: 4px; }
.guide-body { padding: 16px 18px 18px; font-size: 14px; color: var(--text-2); line-height: 1.55; max-width: 820px; }
.guide-body p { margin: 0 0 10px; }
.guide-body ol, .guide-body ul { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.guide-body ol li::marker { color: var(--c); font-weight: 700; }
.guide-ex { padding: 10px 12px; border-left: 3px solid var(--c, var(--accent)); background: #F7F8FA; border-radius: 0 8px 8px 0; }
.guide-tip { font-size: 13px; color: var(--muted); }
@media (max-width: 600px) {
  .guide-steps, .guide-grid { grid-template-columns: 1fr; }
  .guide-item summary { grid-template-columns: auto 1fr auto; grid-template-areas: "ico title chev" "ico sub chev"; column-gap: 14px; align-items: center; }
  .guide-item summary .guide-ico { margin: 0; }
  .guide-item summary::after { align-self: center; margin-top: 0; }
}
