html, body { margin: 0; padding: 0; }

body {
  font-family: 'Schibsted Grotesk', sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  --bg: oklch(0.972 0.01 140);
  --card: oklch(0.997 0.002 140);
  --ink: oklch(0.25 0.02 250);
  --muted: oklch(0.5 0.025 230);
  --line: oklch(0.9 0.015 150);
  --soft: oklch(0.955 0.012 150);
  --pos: oklch(0.58 0.15 160);
  --neg: oklch(0.56 0.19 27);
  --amb: oklch(0.68 0.14 70);
  --pos-bg: oklch(0.93 0.06 160);
  --neg-bg: oklch(0.93 0.05 27);
  --amb-bg: oklch(0.94 0.07 85);
  --bar-gas: oklch(0.72 0.035 240);
  --blanco: oklch(0.99 0 0);
  --shadow: 0 1px 2px oklch(0.3 0.01 90 / 0.05), 0 4px 14px oklch(0.3 0.01 90 / 0.05);
  background: var(--bg);
  color: var(--ink);
  color-scheme: light;
}
body[data-tema="oscuro"] {
  --bg: oklch(0.165 0.015 230);
  --card: oklch(0.215 0.018 230);
  --ink: oklch(0.93 0.008 220);
  --muted: oklch(0.67 0.02 225);
  --line: oklch(0.32 0.02 230);
  --soft: oklch(0.265 0.02 230);
  --pos: oklch(0.75 0.14 160);
  --neg: oklch(0.72 0.15 27);
  --amb: oklch(0.8 0.13 80);
  --pos-bg: oklch(0.33 0.07 160);
  --neg-bg: oklch(0.32 0.06 27);
  --amb-bg: oklch(0.34 0.06 85);
  --bar-gas: oklch(0.5 0.04 240);
  --shadow: 0 1px 2px oklch(0 0 0 / 0.25), 0 4px 14px oklch(0 0 0 / 0.2);
  color-scheme: dark;
}

a { color: var(--pos); text-decoration: none; }
a:hover { color: var(--ink); text-decoration: underline; }

.mono { font-family: 'Spline Sans Mono', monospace; }

.wrap { min-height: 100vh; background: var(--bg); color: var(--ink); padding: 28px clamp(16px, 4vw, 44px) 48px; }
.container { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

/* ── Encabezado ─────────────────────────────────────────── */
.hdr { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 4px 2px 8px; }
.hdr-txt { display: flex; flex-direction: column; gap: 3px; }
.hdr-txt h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.hdr-sub { font-size: 13.5px; color: var(--muted); }

.seg { display: flex; align-items: center; gap: 4px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg.nav-desk { margin-right: auto; }
.seg button { border: none; border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; background: transparent; color: var(--muted); }
.seg.meses button { padding: 6px 13px; text-transform: capitalize; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.avatars { display: flex; align-items: center; }
.avatar { border-radius: 50%; color: var(--blanco); display: flex; align-items: center; justify-content: center; font-weight: 600; flex: 0 0 auto; }
.avatars .avatar { width: 32px; height: 32px; font-size: 13px; border: 2px solid var(--bg); margin-left: -6px; }

.btn-outline { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; }
.btn-outline:hover { border-color: var(--muted); }
.btn-ghost { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 10px; padding: 9px 13px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; }
.btn-ghost:hover { color: var(--ink); border-color: var(--muted); }
.btn-primary { border: none; background: var(--pos); color: var(--blanco); border-radius: 10px; padding: 9px 16px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; }
.btn-primary:hover { filter: brightness(1.07); }

/* ── Tarjetas / paneles ─────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(225px, 1fr)); gap: 14px; }
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat-value { font-family: 'Spline Sans Mono', monospace; font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.stat-foot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.stat-foot .vs { color: var(--muted); }

.chip { border-radius: 999px; padding: 3px 9px; font-weight: 600; font-family: 'Spline Sans Mono', monospace; font-size: 12px; }
.chip-sm { border-radius: 999px; padding: 3px 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap; font-family: inherit; }
.chip-pos { background: var(--pos-bg); color: var(--pos); }
.chip-neg { background: var(--neg-bg); color: var(--neg); }
.chip-amb { background: var(--amb-bg); color: var(--amb); }

.row { display: flex; flex-wrap: wrap; gap: 14px; }
.row.stretch { align-items: stretch; }
.panel { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.panel-title { font-size: 15px; font-weight: 600; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.panel-head .panel-title { margin-right: auto; }

.legend { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.sw-dash { background: var(--soft); border: 1px dashed var(--muted); box-sizing: border-box; }

/* ── Gráfico de barras ──────────────────────────────────── */
.bars { display: flex; align-items: stretch; gap: 8px; height: 210px; border-bottom: 1px solid var(--line); }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.bar-pair { display: flex; align-items: flex-end; justify-content: center; gap: 5px; height: 100%; }
.bar { width: 22%; max-width: 26px; border-radius: 4px 4px 0 0; }
.bar-ing { background: var(--pos); }
.bar-gas { background: var(--bar-gas); }
.bar-labels { display: flex; gap: 8px; margin-top: -8px; }
.bar-labels div { flex: 1; text-align: center; font-size: 12px; color: var(--muted); text-transform: capitalize; }

/* ── Donut ──────────────────────────────────────────────── */
.donut-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.donut { position: relative; width: 172px; height: 172px; flex: 0 0 auto; }
.donut svg { width: 100%; height: 100%; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.donut-center .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.donut-center .val { font-family: 'Spline Sans Mono', monospace; font-size: 17px; font-weight: 600; }
.cat-list { flex: 1 1 170px; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.cat-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.cat-row .nombre { color: var(--ink); margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-row .pct { font-family: 'Spline Sans Mono', monospace; color: var(--muted); }
.cat-row .monto { font-family: 'Spline Sans Mono', monospace; font-weight: 500; min-width: 76px; text-align: right; }

/* ── Transacciones (lista resumen / historial) ──────────── */
.tx-row { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-top: 1px solid var(--line); }
.tx-row .avatar { width: 34px; height: 34px; font-size: 13px; }
.tx-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; margin-right: auto; }
.tx-desc { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 12px; color: var(--muted); }
.tx-fecha { font-size: 12px; color: var(--muted); flex: 0 0 auto; }
.tx-monto { font-family: 'Spline Sans Mono', monospace; font-size: 13.5px; font-weight: 600; min-width: 104px; text-align: right; flex: 0 0 auto; }
.rec-mark { color: var(--muted); font-size: 13px; flex: 0 0 auto; }

/* ── Barras de progreso ─────────────────────────────────── */
.track { height: 12px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); overflow: hidden; }
.track > div { height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.track-sm { position: relative; height: 9px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); overflow: hidden; }
.track-sm > .fill { height: 100%; border-radius: 999px; }
.track-sm > .umbral { position: absolute; top: 0; bottom: 0; left: 80%; width: 2px; background: var(--line); }
.track-xs { height: 7px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); overflow: hidden; }
.track-xs > div { height: 100%; border-radius: 999px; }

/* ── Franja de totales ──────────────────────────────────── */
.strip { padding: 16px 22px; display: flex; flex-wrap: wrap; gap: 28px; align-items: center; }
.strip-item { display: flex; flex-direction: column; gap: 3px; }
.strip-item .lbl { font-size: 12px; color: var(--muted); font-weight: 500; }
.strip-item .val { font-family: 'Spline Sans Mono', monospace; font-size: 18px; font-weight: 600; }

/* ── Presupuestos ───────────────────────────────────────── */
.presup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 14px; }
.presup-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.sw-lg { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.comp-rows { display: flex; flex-direction: column; gap: 13px; }
.comp-track { position: relative; height: 18px; }
.comp-pres { position: absolute; top: 0; left: 0; height: 18px; background: var(--soft); border: 1px dashed var(--line); border-radius: 5px; box-sizing: border-box; }
.comp-real { position: absolute; top: 4px; left: 0; height: 10px; border-radius: 4px; }

/* ── Miembros ───────────────────────────────────────────── */
.miem-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 14px; }
.miem-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; cursor: pointer; }
.miem-card:hover { border-color: var(--muted); }
.miem-card .avatar { width: 42px; height: 42px; font-size: 17px; }
.miem-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.miem-stats > div { display: flex; flex-direction: column; gap: 2px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.miem-stats .lbl { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.miem-stats .val { font-family: 'Spline Sans Mono', monospace; font-size: 16.5px; font-weight: 600; }
.miem-bal { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; border-top: 1px solid var(--line); padding-top: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; font-size: 11.5px; }
.pill .sw-xs { width: 8px; height: 8px; border-radius: 2px; }
.link-back { border: none; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; padding: 0; }
.link-back:hover { color: var(--ink); }

/* ── Metas ──────────────────────────────────────────────── */
.metas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.meta-card { padding: 18px 20px; display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 116px; height: 116px; flex: 0 0 auto; }
.ring svg { width: 100%; height: 100%; }
.ring-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: 'Spline Sans Mono', monospace; font-size: 16px; font-weight: 600; }

/* ── Filtros y tabla ────────────────────────────────────── */
.filtros { padding: 16px 18px; display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.input, .select { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; padding: 8px 11px; font-family: inherit; font-size: 13px; outline: none; width: 100%; box-sizing: border-box; }
.select { cursor: pointer; }
.input:focus, .select:focus { border-color: var(--pos); }

/* ── Selector de fecha ──────────────────────────────────── */
.dp-field { position: relative; }
.dp-btn { display: flex; align-items: center; gap: 8px; cursor: pointer; text-align: left; }
.dp-btn svg { color: var(--muted); flex: 0 0 auto; }
.dp-btn .dp-val { margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-btn .dp-val.ph { color: var(--muted); }
.dp-clear { color: var(--muted); font-size: 11px; padding: 2px 5px; border-radius: 6px; flex: 0 0 auto; }
.dp-clear:hover { color: var(--ink); background: var(--soft); }
.dp-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 70; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; width: 252px; box-sizing: border-box; }
.dp-pop.der { left: auto; right: 0; }
.dp-head { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; }
.dp-mes { flex: 1; text-align: center; font-size: 13px; font-weight: 600; text-transform: capitalize; }
.dp-nav { width: 26px; height: 26px; border: none; background: var(--soft); color: var(--muted); border-radius: 8px; cursor: pointer; font-size: 13px; font-family: inherit; display: flex; align-items: center; justify-content: center; padding: 0; }
.dp-nav:hover { color: var(--ink); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { text-align: center; font-size: 10.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 4px 0; }
.dp-dia { border: none; background: transparent; color: var(--ink); font-family: 'Spline Sans Mono', monospace; font-size: 12px; height: 30px; border-radius: 8px; cursor: pointer; padding: 0; }
.dp-dia:hover { background: var(--soft); }
.dp-dia.fuera { color: var(--muted); opacity: 0.55; }
.dp-dia.enrango { background: var(--pos-bg); border-radius: 0; }
.dp-dia.hoy { box-shadow: inset 0 0 0 1px var(--pos); }
.dp-dia.sel { background: var(--pos); color: var(--blanco); font-weight: 600; border-radius: 8px; }
.dp-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 8px; }
.dp-link { border: none; background: transparent; color: var(--pos); font-size: 12.5px; font-weight: 600; font-family: inherit; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.dp-link:hover { background: var(--soft); }
.dp-link.muted { color: var(--muted); }
.dp-link.muted:hover { color: var(--ink); }

.tbl-scroll { overflow: auto; max-height: 62vh; }
.tbl-head { position: sticky; top: 0; background: var(--card); z-index: 2; }

/* Listados largos con scroll propio */
.tbl-scroll, .tx-cards, .lista-scroll, .adm-lista { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.tx-cards { max-height: 62vh; overflow-y: auto; }
.lista-scroll { max-height: 56vh; overflow-y: auto; }
.adm-lista { max-height: 430px; overflow-y: auto; overscroll-behavior: contain; }
.tbl { min-width: 760px; }
.tbl-head, .tbl-row { display: grid; grid-template-columns: 86px minmax(170px, 1.6fr) 130px 140px 150px 110px 62px; gap: 12px; padding: 8px 2px; }
.tbl-head { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.tbl-row { padding: 10px 2px; border-top: 1px solid var(--line); align-items: center; font-size: 13px; }
.tbl-row .fecha, .tbl-row .cuenta { color: var(--muted); font-size: 12.5px; }
.tbl-row .desc-cell { display: flex; align-items: center; gap: 7px; min-width: 0; }
.tbl-row .desc-cell span:first-child { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; font-size: 11.5px; color: var(--muted); }
.tbl-row .quien { display: flex; align-items: center; gap: 7px; }
.tbl-row .quien .avatar { width: 22px; height: 22px; font-size: 10.5px; }
.tbl-row .quien span:last-child { font-size: 12.5px; }
.tbl-row .monto { text-align: right; font-family: 'Spline Sans Mono', monospace; font-weight: 600; }

/* ── Tarjetas móviles de transacciones ──────────────────── */
.tx-cards { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.tx-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; background: var(--bg); }
.tx-card .top { display: flex; align-items: center; gap: 10px; }
.tx-card .avatar { width: 32px; height: 32px; font-size: 12.5px; }
.tx-card .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-rec { background: var(--pos-bg); border: 1px solid transparent; border-radius: 999px; padding: 3px 9px; font-size: 11.5px; color: var(--pos); font-weight: 600; }

/* ── Estado vacío ───────────────────────────────────────── */
.vacio { padding: 44px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.vacio-sm { padding: 36px 16px; gap: 8px; }
.vacio-icono { width: 46px; height: 46px; border-radius: 50%; background: var(--soft); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); font-family: 'Spline Sans Mono', monospace; font-size: 18px; font-weight: 600; }
.vacio .t { font-size: 14px; font-weight: 600; }
.vacio .s { font-size: 12.5px; color: var(--muted); max-width: 300px; }

/* ── Modal ──────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; background: oklch(0.12 0.01 90 / 0.55); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; width: min(500px, 94vw); max-height: 92vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); box-sizing: border-box; }
.modal h2 { margin: 0 auto 0 0; font-size: 17px; font-weight: 700; }
.modal-head { display: flex; align-items: center; gap: 10px; }
.btn-x { border: none; background: var(--soft); color: var(--muted); border-radius: 8px; width: 30px; height: 30px; font-size: 14px; cursor: pointer; font-family: inherit; }
.btn-x:hover { color: var(--ink); }
.tipo-seg { display: flex; gap: 4px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tipo-seg button { flex: 1; border: none; border-radius: 8px; padding: 8px 0; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; background: transparent; color: var(--muted); }
.tipo-seg button.on { background: var(--card); box-shadow: var(--shadow); }
.tipo-seg button.on.gasto { color: var(--neg); }
.tipo-seg button.on.ingreso { color: var(--pos); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .input, .form-grid .select { padding: 9px 11px; font-size: 13.5px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 13.5px; cursor: pointer; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.check input { width: 16px; height: 16px; accent-color: var(--pos); margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 2px; }
.btn-cancel { border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 10px; padding: 10px 16px; font-size: 13.5px; font-weight: 600; font-family: inherit; cursor: pointer; }
.btn-guardar { background: var(--pos); color: var(--blanco); border: none; border-radius: 10px; padding: 10px 18px; font-weight: 600; font-family: inherit; font-size: 13.5px; cursor: pointer; }
.btn-guardar.off { cursor: not-allowed; opacity: 0.55; }

/* ── Mantenedores ───────────────────────────────────────── */
.btn-icon { border: none; background: transparent; color: var(--muted); width: 26px; height: 26px; border-radius: 7px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; padding: 0; font-family: inherit; flex: 0 0 auto; }
.btn-icon:hover { background: var(--soft); color: var(--ink); }
.btn-icon.peligro:hover { background: var(--neg-bg); color: var(--neg); }
.acciones { display: flex; gap: 2px; justify-content: flex-end; }
.meta-acciones { display: flex; gap: 2px; flex: 0 0 auto; margin: -4px -6px 0 0; }

.adm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(430px, 100%), 1fr)); gap: 14px; }
.adm-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.adm-row.fila-miembro { grid-template-columns: 34px minmax(0, 1fr) 108px auto; }
.adm-row.fila-miembro-nueva { grid-template-columns: minmax(0, 1fr) 108px auto; }
.adm-row.fila-cat { grid-template-columns: minmax(0, 1fr) 122px auto; }
.adm-row.fila-fijo { grid-template-columns: 34px minmax(0, 1fr) auto auto; }
.sueldo-bloque { display: flex; flex-direction: column; }
.sueldo-fila { display: flex; align-items: center; gap: 12px; padding: 12px 0 6px; border-top: 1px solid var(--line); }
.sueldo-fila .avatar { flex: 0 0 auto; }
.sueldo-monto { font-size: 20px; font-weight: 600; flex: 0 0 auto; }
.sueldo-editar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 6px 0; }
.sueldo-editar .field { flex: 1 1 150px; }
.sueldo-editar .input, .sueldo-editar .select { width: 100%; box-sizing: border-box; }
.sueldo-hist { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 4px; border-top: 1px dashed var(--line); margin-top: 4px; }
.sueldo-hist .btn-icon { width: 20px; height: 20px; font-size: 10px; }
.sel-mes { max-width: 160px; }
.sueldo-detalle { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 12px 44px; padding-left: 12px; border-left: 2px solid var(--line); }
.det-linea { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 3px 0; }
.det-linea .det-desc { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: auto; }
.det-linea .det-monto { font-weight: 600; }
.det-total { border-top: 1px dashed var(--line); margin-top: 3px; padding-top: 7px; font-weight: 600; }
.chip-extra { background: var(--soft); border: 1px solid var(--line); color: var(--muted); }
.sueldo-resumen { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
@media (max-width: 700px) { .sueldo-detalle { margin-left: 10px; } }
@media (max-width: 700px) {
  .sueldo-fila { flex-wrap: wrap; }
  .sueldo-fila .acciones { flex-basis: 100%; justify-content: flex-start; }
}
.adm-row .swatches { grid-column: 1 / -1; }
.adm-row .input, .adm-row .select { width: 100%; min-width: 0; box-sizing: border-box; }
.adm-row .input.num { font-family: 'Spline Sans Mono', monospace; }
.adm-row .acciones { justify-content: flex-end; flex-wrap: nowrap; }
.adm-nuevo { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 12px; }
.adm-nota { font-size: 12px; color: var(--muted); }

.swatches { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.sw-btn { width: 18px; height: 18px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; padding: 0; flex: 0 0 auto; }
.sw-btn.on { border-color: var(--ink); }

.btn-sm { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 9px; padding: 7px 11px; font-size: 12.5px; font-weight: 600; font-family: inherit; cursor: pointer; flex: 0 0 auto; }
.btn-sm:hover { border-color: var(--muted); }
.btn-sm.primario { border: none; background: var(--pos); color: var(--blanco); }
.btn-sm.primario:hover { filter: brightness(1.07); }

/* ── Notificaciones (toasts) ────────────────────────────── */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--pos); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); font-size: 13.5px; font-weight: 500; max-width: 330px; animation: toast-in 0.25s ease; pointer-events: auto; }
.toast.error { border-left-color: var(--neg); }
.toast-icono { width: 22px; height: 22px; border-radius: 50%; background: var(--pos-bg); color: var(--pos); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex: 0 0 auto; }
.toast.error .toast-icono { background: var(--neg-bg); color: var(--neg); }
.toast.salir { opacity: 0; transform: translateX(14px); transition: opacity 0.3s, transform 0.3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

/* ── Diálogo de confirmación ────────────────────────────── */
.alerta-overlay { position: fixed; inset: 0; background: oklch(0.12 0.01 90 / 0.55); display: flex; align-items: center; justify-content: center; z-index: 95; padding: 16px; animation: toast-in 0.15s ease; }
.alerta { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 26px 26px 22px; width: min(380px, 92vw); text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; box-shadow: var(--shadow); box-sizing: border-box; animation: alerta-pop 0.2s ease; }
.alerta-icono { width: 62px; height: 62px; border-radius: 50%; background: var(--amb-bg); color: var(--amb); font-size: 30px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.alerta-titulo { font-size: 17px; font-weight: 700; }
.alerta-texto { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.alerta-botones { display: flex; gap: 10px; padding-top: 8px; }
.btn-alerta-ok { background: var(--neg); color: var(--blanco); border: none; border-radius: 10px; padding: 10px 18px; font-weight: 600; font-family: inherit; font-size: 13.5px; cursor: pointer; }
.btn-alerta-ok:hover { filter: brightness(1.08); }
@keyframes alerta-pop { from { transform: scale(0.92); opacity: 0; } }

/* ── Navegación móvil ───────────────────────────────────── */
.mnav-spacer { height: 60px; }
.mnav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); display: flex; z-index: 50; padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 12px oklch(0.3 0.01 90 / 0.08); }
.mnav button { flex: 1; border: none; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 0 11px; font-size: 10.5px; font-weight: 600; font-family: inherit; cursor: pointer; min-width: 0; color: var(--muted); }
.mnav button.on { color: var(--ink); }
.mnav .dot { width: 18px; height: 3px; border-radius: 999px; background: transparent; }
.mnav button.on .dot { background: var(--pos); }

/* ── Impresión del informe ──────────────────────────────── */
@media print {
  .hdr, .mnav, .mnav-spacer, .no-print, .toasts { display: none !important; }
  body { background: #fff !important; }
  .wrap { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
}

/* ── Servicios y marcas frecuentes ──────────────────────── */
.serv-det { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: var(--soft); }
.serv-det summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); user-select: none; }
.serv-det summary:hover { color: var(--ink); }
.serv-cuerpo { max-height: 224px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; padding-top: 8px; }
.serv-rubro { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding-top: 4px; }
.serv-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.serv-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card); border-radius: 9px; padding: 4px 9px 4px 4px; cursor: pointer; font-family: inherit; transition: border-color 0.12s ease; }
.serv-chip:hover { border-color: var(--muted); }
.serv-chip.on { border-color: var(--pos); box-shadow: 0 0 0 1px var(--pos); }
.serv-ico { width: 26px; height: 26px; border-radius: 7px; color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; letter-spacing: -0.02em; }
.serv-txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.serv-txt > span:first-child { font-size: 12px; font-weight: 600; color: var(--ink); }
.serv-cat { font-size: 10.5px; color: var(--muted); }

/* Logo de marca dentro de filas de texto (listas de movimientos) */
.serv-ico { display: inline-flex; vertical-align: -5px; }
.tx-desc .serv-ico, .desc-cell .serv-ico, .det-desc .serv-ico, .pill .serv-ico { margin-right: 6px; }
.serv-ico svg text { dominant-baseline: auto; }

/* ── Formularios: errores, "Más opciones" y responsive ──── */
.field-err { color: var(--neg); font-size: 11.5px; line-height: 1.35; }
.input.err, .select.err { border-color: var(--neg); }
.mas-det { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: var(--soft); }
.mas-det summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); user-select: none; }
.mas-det summary:hover { color: var(--ink); }
.mas-cuerpo { display: flex; flex-direction: column; gap: 12px; padding-top: 10px; }
.serv-chip { max-width: 100%; }
.serv-txt { min-width: 0; }
/* Nitidez: el SVG del logo se dibuja como bloque alineado a la caja */
.serv-ico svg { display: block; }
.serv-ico svg text { text-rendering: geometricPrecision; }

/* Móvil angosto (≤480px): una columna, botón principal a lo ancho */
@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; gap: 11px; }
  .modal { padding: 18px 15px; border-radius: 14px; }
  .modal-foot { flex-direction: column-reverse; gap: 8px; }
  .modal-foot .btn-guardar, .modal-foot .btn-cancel { width: 100%; text-align: center; box-sizing: border-box; padding: 12px; }
}
