/* =====================================================================
   SOLVENCITY · Hoja de estilos
   Concepto: "libreta de cobros" — papel frío, tinta verde oscura,
   cifras tabulares grandes y una cinta semanal de cobros como elemento
   protagonista. Todo lo demás, sobrio.
   ===================================================================== */

:root {
  --paper: #F3F4F1;
  --surface: #FFFFFF;
  --ink: #1E2A28;
  --ink-2: #4A5653;
  --ink-3: #7B8582;
  --line: #DFE2DD;
  --line-2: #ECEEEA;
  --accent: #0F766E;
  --accent-ink: #FFFFFF;
  --accent-soft: color-mix(in srgb, var(--accent) 9%, white);
  --ok: #2F7D4F;      --ok-soft: #E7F2EA;
  --warn: #A9661A;    --warn-soft: #FBF0DF;
  --danger: #B4443A;  --danger-soft: #F8E6E3;
  --info: #3B6596;    --info-soft: #E6EDF6;
  --wa: #1F8F55;

  --r-lg: 12px;
  --r-md: 8px;
  --r-sm: 6px;
  --sidebar: 248px;
  --font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "tnum" 1, "cv11" 1;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--ink-3); }
.ic { flex: none; vertical-align: middle; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.hide { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------- Estructura */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--line);
  background: var(--paper);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--ink);
  display: grid; place-items: center; color: var(--paper); font-weight: 700; font-size: 15px;
}
.brand-mark img { width: 30px; height: 30px; object-fit: contain; border-radius: 8px; background: #fff; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; }
.brand-sub { display: block; font-size: .75rem; color: var(--ink-3); font-weight: 500; margin-top: -2px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-group { margin-bottom: 18px; }
.nav-title { font-size: .76rem; color: var(--ink-3); padding: 0 10px 6px; font-weight: 600; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--r-md);
  color: var(--ink-2); font-weight: 520; font-size: .94rem;
}
.nav a:hover { background: #E9EBE6; color: var(--ink); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.nav a.active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav .count { margin-left: auto; font-size: .75rem; background: var(--danger-soft); color: var(--danger); padding: 1px 7px; border-radius: 99px; font-weight: 650; }

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); color: var(--ink); }
.me:hover { background: #E9EBE6; text-decoration: none; }
.me b { display: block; font-size: .9rem; font-weight: 600; line-height: 1.2; }
.me small { font-size: .78rem; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: .78rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}
.avatar.lg { width: 52px; height: 52px; font-size: 1.05rem; }

.scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; grid-column: 2; }
.topbar { display: none; }
.content { padding: 30px 36px 60px; max-width: 1320px; width: 100%; }

.support-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 36px; background: var(--ink); color: #E8ECEA; font-size: .88rem;
}
.support-bar form { margin: 0; }
.support-bar button { background: transparent; color: #fff; border: 1px solid #5D6B68; padding: 4px 12px; border-radius: 99px; cursor: pointer; font: inherit; font-size: .84rem; }

/* ------------------------------------------------------------- Encabezado de página */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: .86rem; color: var(--ink-3); margin-bottom: 6px; display: inline-flex; align-items: center; gap: 4px; }
.crumb a { color: var(--ink-3); }
.crumb .ic { transform: rotate(180deg); }

/* ------------------------------------------------------------- Paneles */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel + .panel, .panel + .grid, .grid + .panel, .grid + .grid { margin-top: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.panel-head h2 { font-size: 1rem; }
.panel-head .muted { font-size: .86rem; }
.panel-body { padding: 20px; }
.panel-body.tight { padding: 0; }

.grid { display: grid; gap: 20px; }
.grid > .panel + .panel, .grid > .panel + form, .grid > form + .panel { margin-top: 0; }
.grid > div > .panel + .panel { margin-top: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }

/* ------------------------------------------------------------- Cifras clave
   Una tira continua con separadores, no tarjetas sueltas. */
.figures {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.figure { padding: 18px 20px; border-left: 1px solid var(--line-2); min-width: 0; }
.figure:first-child { border-left: 0; }
.figure .label { font-size: .86rem; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.figure .value { font-size: 1.65rem; font-weight: 650; letter-spacing: -0.025em; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.figure .value .cur { font-size: .9rem; color: var(--ink-3); font-weight: 550; margin-right: 3px; letter-spacing: 0; }
.figure .foot { font-size: .82rem; color: var(--ink-3); margin-top: 2px; }
.figure.danger .value { color: var(--danger); }
.figure.warn .value { color: var(--warn); }
.figure.good .value { color: var(--ok); }

/* ------------------------------------------------------------- Cinta semanal de cobros (elemento protagonista) */
.ribbon { display: grid; grid-template-columns: 1.15fr repeat(7, minmax(0, 1fr)); background: var(--ink); color: #E9EEEC; border-radius: var(--r-lg); overflow: hidden; margin-bottom: 20px; }
.ribbon-intro { padding: 18px 20px; border-right: 1px solid #33423F; }
.ribbon-intro h2 { color: #fff; font-size: 1.05rem; }
.ribbon-intro p { margin: 6px 0 0; color: #A9B7B3; font-size: .86rem; }
.ribbon-day { display: block; padding: 14px 14px 16px; border-right: 1px solid #2B3936; color: inherit; position: relative; min-width: 0; }
.ribbon-day:last-child { border-right: 0; }
.ribbon-day:hover { background: #26332F; text-decoration: none; }
.ribbon-day .d { font-size: .8rem; color: #A9B7B3; }
.ribbon-day .n { font-size: 1.5rem; font-weight: 650; color: #fff; line-height: 1.1; margin-top: 2px; }
.ribbon-day .amt { font-size: .84rem; margin-top: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ribbon-day .cnt { font-size: .76rem; color: #8FA19C; }
.ribbon-day .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: #5FC0B4; }
.ribbon-day.today { background: #2A3A36; }
.ribbon-day.today .d { color: #8FE0D5; }
.ribbon-day.is-empty .amt { color: #6F817C; }

/* ------------------------------------------------------------- Tablas */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th {
  text-align: left; font-weight: 600; color: var(--ink-3); font-size: .82rem;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FAFBF9; white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FAFBF9; }
.table .right, .table th.right { text-align: right; }
.table td.actions { white-space: nowrap; text-align: right; }
.table tfoot td { font-weight: 650; background: #FAFBF9; border-top: 1px solid var(--line); }
.table tr.is-off td { color: var(--ink-3); }
.cell-main { font-weight: 600; color: var(--ink); }
.cell-main:hover { color: var(--accent); }
.cell-sub { display: block; font-size: .82rem; color: var(--ink-3); }
.who { display: flex; align-items: center; gap: 10px; }
.who .avatar { width: 30px; height: 30px; font-size: .72rem; }

/* ------------------------------------------------------------- Insignias */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #EEF0EC; color: var(--ink-2); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

/* ------------------------------------------------------------- Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: var(--r-md);
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #F6F7F4; border-color: #CDD2CB; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); border-color: transparent; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #2C3B38; }
.btn-wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn-wa:hover { background: #1A7A49; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: #EBC7C2; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: #ECEEE9; border-color: transparent; }
.btn-sm { height: 32px; padding: 0 11px; font-size: .84rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
form.inline { display: inline; margin: 0; }

/* ------------------------------------------------------------- Formularios */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field label, .label-text { display: block; font-size: .86rem; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--ink-3); margin-top: 5px; }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r-md);
  border: 1px solid #D3D7D1; background: #fff; color: var(--ink); font: inherit; font-size: .94rem;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237B8582' stroke-width='2.2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.input.sm { height: 34px; font-size: .88rem; }
.input-group { display: flex; }
.input-group .addon { display: grid; place-items: center; padding: 0 11px; border: 1px solid #D3D7D1; border-right: 0; border-radius: var(--r-md) 0 0 var(--r-md); background: #F6F7F4; color: var(--ink-3); font-size: .88rem; }
.input-group .input { border-radius: 0 var(--r-md) var(--r-md) 0; }
.input-group .addon.end { border-right: 1px solid #D3D7D1; border-left: 0; border-radius: 0 var(--r-md) var(--r-md) 0; }
.input-group .addon.end ~ .input, .input-group .input:has(+ .addon.end) { border-radius: var(--r-md) 0 0 var(--r-md); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 20px; border-top: 1px solid var(--line-2); background: #FAFBF9; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.section-title { font-size: .95rem; font-weight: 650; margin: 6px 0 2px; grid-column: 1 / -1; padding-top: 6px; }
.section-title + p { grid-column: 1 / -1; margin: -10px 0 0; font-size: .86rem; color: var(--ink-3); }

/* Barra de filtros */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.filters .field { min-width: 150px; flex: 1 1 150px; max-width: 240px; }
.filters .field.grow { max-width: none; flex: 2 1 220px; }
.filters .field label { font-size: .8rem; margin-bottom: 4px; }
.filters .btns { display: flex; gap: 8px; }

/* Segmentos (pestañas rápidas) */
.segments { display: inline-flex; background: #E9EBE6; padding: 3px; border-radius: 10px; gap: 2px; flex-wrap: wrap; }
.segments a { padding: 6px 12px; border-radius: 8px; color: var(--ink-2); font-size: .86rem; font-weight: 600; }
.segments a:hover { text-decoration: none; color: var(--ink); }
.segments a.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(30, 42, 40, .08); }

/* ------------------------------------------------------------- Listas y detalles */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 9px 18px; margin: 0; font-size: .92rem; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; font-weight: 520; min-width: 0; overflow-wrap: anywhere; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); }
.rows li:last-child { border-bottom: 0; }
.rows .grow { flex: 1; min-width: 0; }
.rows .grow b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .grow small { display: block; }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0; border-top: 1px solid var(--line-2); }
.summary > div { padding: 14px 20px; border-right: 1px solid var(--line-2); }
.summary > div:last-child { border-right: 0; }
.summary span { display: block; font-size: .82rem; color: var(--ink-3); }
.summary b { font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; }

.profile-head { display: flex; gap: 16px; align-items: center; padding: 20px; }
.profile-head h2 { font-size: 1.25rem; }

.timeline { list-style: none; margin: 0; padding: 4px 20px 16px; }
.timeline li { position: relative; padding: 12px 0 12px 22px; border-left: 1px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 18px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline .msg { white-space: pre-line; font-size: .9rem; color: var(--ink-2); margin-top: 4px; background: #F7F8F5; border-radius: var(--r-md); padding: 10px 12px; }

/* Barra de progreso del crédito */
.progress { height: 6px; background: #E7EAE5; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* Barras horizontales simples (antigüedad de cartera) */
.hbars { padding: 6px 20px 18px; }
.hbar { display: grid; grid-template-columns: 132px 1fr auto; align-items: center; gap: 12px; padding: 7px 0; font-size: .9rem; }
.hbar .track { height: 10px; background: #EEF0EC; border-radius: 99px; overflow: hidden; }
.hbar .fill { display: block; height: 100%; border-radius: 99px; }

/* Calculadora de venta */
.calc { position: sticky; top: 20px; }
.calc-total { padding: 18px 20px; border-bottom: 1px solid var(--line-2); }
.calc-total span { font-size: .86rem; color: var(--ink-3); }
.calc-total b { display: block; font-size: 2rem; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.calc-lines { padding: 8px 20px 14px; }
.calc-lines div { display: flex; justify-content: space-between; padding: 6px 0; font-size: .92rem; border-bottom: 1px dashed var(--line-2); }
.calc-lines div:last-child { border-bottom: 0; }
.calc-lines .gain { color: var(--ok); font-weight: 600; }
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 140px 36px; gap: 10px; align-items: end; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.item-row:last-child { border-bottom: 0; }

/* Mensaje de WhatsApp */
.wa-preview { background: #E5DDD3; border-radius: var(--r-lg); padding: 18px; min-height: 160px; }
.wa-bubble { background: #D9FDD3; border-radius: 10px 10px 2px 10px; padding: 10px 12px; margin-left: auto; max-width: 92%; white-space: pre-wrap; font-size: .92rem; box-shadow: 0 1px 1px rgba(0,0,0,.08); overflow-wrap: anywhere; }
.vars { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.vars button { font: inherit; font-size: .78rem; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); background: #F7F8F5; color: var(--ink-2); cursor: pointer; }
.vars button:hover { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------------------- Avisos */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--ink); color: #F1F4F2; font-size: .92rem; box-shadow: 0 8px 24px rgba(30, 42, 40, .18); animation: toast-in .25s ease-out; }
.toast.error { background: #5E231E; }
.toast .ic { margin-top: 2px; }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; padding: 0; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); font-size: .92rem; margin-bottom: 16px; }
.alert-warn { background: var(--warn-soft); color: #7A4A12; }
.alert-danger { background: var(--danger-soft); color: #7E2C25; }
.alert-info { background: var(--info-soft); color: #2B4A70; }
.alert .ic { margin-top: 2px; }

.empty { text-align: center; padding: 44px 20px; color: var(--ink-3); }
.empty .ic { color: #B5BDB9; margin-bottom: 10px; }
.empty b { display: block; color: var(--ink); font-size: 1rem; margin-bottom: 4px; }
.empty p { max-width: 380px; margin: 0 auto 14px; }

/* Paginación */
.pager { display: flex; align-items: center; gap: 4px; padding: 14px 16px; border-top: 1px solid var(--line-2); justify-content: flex-end; }
.pager-info { margin-right: auto; font-size: .84rem; color: var(--ink-3); }
.pager a, .pager span.current { min-width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; font-size: .88rem; color: var(--ink-2); }
.pager a:hover { background: #EEF0EC; text-decoration: none; }
.pager .current { background: var(--ink); color: #fff !important; font-weight: 600; }

/* Diálogo */
dialog.modal { border: 0; border-radius: var(--r-lg); padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(30, 42, 40, .25); color: var(--ink); }
dialog.modal::backdrop { background: rgba(30, 42, 40, .35); }
.modal-body { padding: 20px; }
.modal-body h3 { margin-bottom: 6px; font-size: 1.05rem; }

/* Gráficos */
.chart-box { position: relative; height: 260px; padding: 12px 16px 16px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 0 20px 16px; font-size: .84rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ------------------------------------------------------------- Acceso (login) */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.auth-side { background: var(--ink); color: #DCE4E1; padding: 44px 52px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side .brand { color: #fff; padding: 0; }
.auth-side .brand-mark { background: #fff; color: var(--ink); }
.auth-side h1 { color: #fff; font-size: 2.1rem; max-width: 420px; letter-spacing: -0.03em; font-weight: 600; }
.auth-side p { color: #A9B7B3; max-width: 400px; margin-top: 12px; }
.ledger { margin-top: 36px; border-top: 1px solid #33423F; max-width: 420px; }
.ledger div { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid #2B3936; font-size: .92rem; font-variant-numeric: tabular-nums; }
.ledger div span:first-child { color: #A9B7B3; }
.ledger .paid { color: #8FE0D5; }
.ledger .late { color: #F0A49B; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 1.5rem; letter-spacing: -0.02em; }
.auth-card > p { color: var(--ink-3); margin: 6px 0 26px; }
.auth-card .field { margin-bottom: 16px; }
.auth-foot { margin-top: 20px; font-size: .86rem; color: var(--ink-3); text-align: center; }

/* Errores */
.error-page { max-width: 460px; margin: 60px auto; text-align: center; }
.error-page .code { font-size: 4rem; font-weight: 700; color: #C9CFCB; letter-spacing: -0.04em; line-height: 1; }

/* ------------------------------------------------------------- Responsive */
@media (max-width: 1180px) {
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figure:nth-child(3) { border-left: 0; }
  .figure:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .ribbon { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .ribbon-intro { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid #33423F; }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calc { position: static; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease; background: var(--paper);
    box-shadow: 0 0 40px rgba(30, 42, 40, .2);
  }
  body.nav-open .sidebar { transform: none; }
  .main { grid-column: 1; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(30, 42, 40, .35); z-index: 50; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40;
    padding: 10px 16px; background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  }
  .topbar .brand { padding: 0; }
  .topbar .spacer { flex: 1; }
  .content { padding: 20px 16px 90px; }
  .support-bar { padding: 9px 16px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 1.35rem; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 28px 24px; }
  .auth-side h1 { font-size: 1.5rem; }
  .ledger { display: none; }
  .filters .field { max-width: none; }

  /* Tablas en formato tarjeta */
  table.table.stack thead { display: none; }
  table.table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
  .table.stack tbody tr:hover td { background: none; }
  .table.stack td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 14px; text-align: right; }
  .table.stack td::before { content: attr(data-label); color: var(--ink-3); font-size: .84rem; text-align: left; flex: none; }
  .table.stack td[data-label=""]::before, .table.stack td:not([data-label])::before { content: none; }
  .table.stack td.primary { display: block; text-align: left; padding-bottom: 6px; }
  .table.stack td.actions { justify-content: flex-start; padding-top: 8px; flex-wrap: wrap; }
  .table.stack tfoot { display: block; }
  .table.stack tfoot tr { display: flex; justify-content: space-between; flex-wrap: wrap; }
  .table.stack tfoot td { width: auto; }
  .item-row { grid-template-columns: 1fr 70px; }
  .item-row .price { grid-column: 1 / 2; }
}

@media (max-width: 560px) {
  .figures { grid-template-columns: 1fr 1fr; }
  .figure { padding: 14px; }
  .figure .value { font-size: 1.2rem; }
  .ribbon { grid-template-columns: repeat(7, minmax(100px, 1fr)); overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media print {
  .sidebar, .topbar, .page-head .actions, .filters, .pager, .toasts { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}

/* Texto solo visible en móvil */
.hide-d { display: none; }
@media (max-width: 900px) { .hide-d { display: inline; } }
