/* =========================================================
   Quintix — estilos
   Paleta azul corporativa, colores planos.
   ========================================================= */
:root {
  /* Color de marca Quintix: #0303b5 */
  --brand: #0303b5;
  --brand-600: #020294;
  --brand-700: #020274;
  --brand-50: #eeeefb;
  --brand-100: #dadaf6;
  --brand-ring: rgba(3, 3, 181, .14);
  --navy: #0f1b33;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e3e7ee;
  --line-2: #eef1f5;
  --bg: #f4f6f9;
  --card: #ffffff;
  --ok: #15803d; --ok-bg: #e6f6ea;
  --warn: #a16207; --warn-bg: #fdf3d7;
  --bad: #b91c1c; --bad-bg: #fde8e8;
  --info: #0e6a8f; --info-bg: #e2f3fa;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .05);
  --shadow-lg: 0 12px 32px rgba(17, 24, 39, .16);
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- Marca ---------- */
.logo-q { width: 36px; height: 36px; border-radius: 8px; display: block; flex: none; object-fit: cover; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px 16px; font-weight: 700; font-size: 18px; color: var(--ink); letter-spacing: -.01em; }
.brand small { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); letter-spacing: 0; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.empresa-chip { margin: 0 14px 6px; padding: 10px 12px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.empresa-chip img { width: 34px; height: 34px; object-fit: contain; border-radius: 4px; background: #fff; flex: none; }
.empresa-chip b { color: var(--ink); display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empresa-chip > div { min-width: 0; }
.nav { padding: 4px 10px 20px; flex: 1; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #9aa3b1; padding: 16px 12px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 6px; color: var(--ink-2); font-weight: 500; margin-bottom: 1px; position: relative; }
.nav a svg { color: #8a94a6; }
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a.active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.nav a.active svg { color: var(--brand); }
.nav a.active::before { content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.sidebar-foot { padding: 14px 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* Panel del superadministrador: barra lateral oscura para distinguirlo */
.shell.admin .sidebar { background: var(--navy); border-right: 0; }
.shell.admin .brand { color: #fff; }
.shell.admin .brand small { color: #93a4c3; }
.shell.admin .nav a { color: #c7d0df; }
.shell.admin .nav a svg { color: #7f8ca5; }
.shell.admin .nav a:hover { background: rgba(255,255,255,.06); }
.shell.admin .nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.shell.admin .nav a.active svg { color: #fff; }
.shell.admin .nav a.active::before { background: #8b8bf3; }
.shell.admin .sidebar-foot { border-color: rgba(255,255,255,.08); color: #7f8ca5; }
.shell.admin .nav-group { color: #6b7a94; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 28px; position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 17px; font-weight: 600; flex: 1; }
.topbar .menu-btn { display: none; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; color: inherit; }
.user-btn:hover { background: var(--bg); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700); display: grid; place-items: center; font-weight: 600; font-size: 12px; }
.user-btn .who { text-align: left; line-height: 1.2; }
.user-btn .who small { display: block; color: var(--muted); font-size: 11px; }
.dropdown { position: absolute; right: 28px; top: 54px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 210px; padding: 6px; z-index: 50; }
.dropdown button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 6px; font: inherit; color: var(--ink-2); cursor: pointer; text-align: left; }
.dropdown button:hover { background: var(--bg); }
.content { padding: 24px 28px 48px; max-width: 1440px; width: 100%; }

/* Avisos de suscripción */
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 28px; font-size: 13.5px; border-bottom: 1px solid; }
.banner.info { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.banner.warn { background: var(--warn-bg); color: var(--warn); border-color: #f4e2a8; }
.banner.bad { background: var(--bad-bg); color: var(--bad); border-color: #f7c9c9; }

/* ---------- Componentes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.card-h h3 { font-size: 15px; font-weight: 600; flex: 1; }
.card-b { padding: 20px; }
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }

.kpi { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.kpi-ico { width: 38px; height: 38px; border-radius: 6px; display: grid; place-items: center; flex: none; }
.kpi-ico.pri { background: var(--brand-50); color: var(--brand); }
.kpi-ico.blue { background: #eef1f6; color: #475569; }
.kpi-ico.amber { background: var(--warn-bg); color: var(--warn); }
.kpi-ico.red { background: var(--bad-bg); color: var(--bad); }
.kpi-ico.green { background: var(--ok-bg); color: var(--ok); }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 6px; border: 1px solid #d4dae3; background: #fff; color: var(--ink-2); font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; text-decoration: none !important; }
.btn:hover { background: var(--bg); }
.btn:focus-visible, .input:focus-visible { outline: 2px solid rgba(3,3,181,.35); outline-offset: 1px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn.danger { color: var(--bad); border-color: #f3c4c4; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 32px; height: 32px; padding: 0; }
.btn.lg { height: 44px; font-size: 15px; padding: 0 20px; font-weight: 600; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field label .req { color: var(--bad); }
.input, select.input, textarea.input { height: 36px; width: 100%; border: 1px solid #ccd3dd; border-radius: 6px; padding: 0 11px; font: 14px var(--font); color: var(--ink); background: #fff; transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; min-height: 72px; padding: 8px 11px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); outline: none; }
.input.num { text-align: right; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search .input { padding-left: 34px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.toolbar .search { width: 300px; max-width: 100%; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink-2); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 16px; background: #f8f9fb; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t th.num { text-align: right; }
.t td { padding: 11px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tbody tr:hover td { background: #f9fbfd; }
.t tbody tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; }
.t .actions { text-align: right; white-space: nowrap; }
.t .actions .btn + .btn { margin-left: 4px; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 38px; height: 38px; stroke-width: 1.4; color: #c5ccd6; margin-bottom: 8px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 4px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.pri { background: var(--brand-50); color: var(--brand); }
.badge.gray { background: #eef0f3; color: var(--ink-2); }
.code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 12.5px; color: var(--ink-2); background: #f0f2f5; padding: 1px 6px; border-radius: 4px; white-space: nowrap; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--muted); }
.pager .btns { display: flex; gap: 6px; }

/* Medidor de uso del plan */
.meter { margin-bottom: 14px; }
.meter .row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.meter .track { height: 8px; background: #edf0f4; border-radius: 4px; overflow: hidden; }
.meter .fill { height: 100%; background: var(--brand); }
.meter .fill.warn { background: #d97706; }
.meter .fill.bad { background: var(--bad); }

dl.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: 13.5px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 500; }

/* ---------- Modal / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 27, 51, .45); display: grid; place-items: center; padding: 20px; z-index: 100; animation: fade .12s ease; }
.modal { background: #fff; border-radius: 10px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .15s ease; }
.modal.lg { max-width: 860px; }
.modal.sm { max-width: 420px; }
.modal-h { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal-h h3 { flex: 1; font-size: 16px; font-weight: 600; }
.modal-b { padding: 20px; overflow-y: auto; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line-2); background: #fafbfc; border-radius: 0 0 10px 10px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

/* Botón flotante de WhatsApp (soporte y compra de planes) */
.wa-float { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: inline-flex; align-items: center; gap: 8px; background: #1f9d55; color: #fff; border-radius: 999px; padding: 11px 18px 11px 14px; font-weight: 600; font-size: 14px; box-shadow: 0 6px 18px rgba(17,24,39,.22); text-decoration: none !important; }
.wa-float:hover { background: #178244; }
.wa-float svg { width: 22px; height: 22px; }
.btn.wa { background: #1f9d55; border-color: #1f9d55; color: #fff; }
.btn.wa:hover { background: #178244; border-color: #178244; }
.banner a { color: inherit; font-weight: 700; text-decoration: underline; margin-left: 4px; white-space: nowrap; }
@media (max-width: 600px) { .wa-float { padding: 13px; } .wa-float span { display: none; } }
@media print { .wa-float { display: none !important; } }

#toasts { position: fixed; right: 20px; bottom: 84px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { display: flex; align-items: center; gap: 10px; background: #1f2937; color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); font-weight: 500; min-width: 260px; max-width: 420px; animation: pop .2s ease; }
.toast.ok svg { color: #86efac; }
.toast.err { background: #991b1b; }

/* ---------- Autocompletar ---------- */
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; z-index: 60; padding: 4px; }
.ac-item { padding: 8px 12px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.ac-item.on, .ac-item:hover { background: var(--brand-50); }
.ac-item .t1 { font-weight: 600; }
.ac-item .t2 { font-size: 12px; color: var(--muted); }
.ac-empty { padding: 12px; color: var(--muted); font-size: 13px; }

/* ---------- Editor de documentos ---------- */
.doc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 16px; align-items: start; }
.lines td { padding: 8px 10px; }
.lines .input { height: 32px; }
.lines td.w-qty { width: 96px; } .lines td.w-price { width: 140px; } .lines td.w-pct { width: 82px; }
.totals { font-variant-numeric: tabular-nums; }
.totals .row { display: flex; justify-content: space-between; padding: 5px 0; color: var(--ink-2); }
.totals .row.big { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; font-size: 20px; font-weight: 700; color: var(--ink); }
.sticky { position: sticky; top: 80px; }
.seg { display: inline-flex; background: #eceff3; padding: 3px; border-radius: 7px; width: 100%; }
.seg button { flex: 1; white-space: nowrap; border: 0; background: transparent; padding: 6px 10px; border-radius: 5px; font: 500 13px var(--font); color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }

/* ---------- Gráficas ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-l { stroke: #edf0f4; stroke-width: 1; }
.chart .axis-t { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .bar { fill: var(--brand); transition: fill .1s; }
.chart .col.hover .bar { fill: var(--brand-700); }
.chart .hit { fill: transparent; }
.tip { position: absolute; pointer-events: none; background: #1f2937; color: #fff; padding: 7px 10px; border-radius: 6px; font-size: 12px; box-shadow: var(--shadow-lg); transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; z-index: 5; }
.tip b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; margin-bottom: 12px; }
.hbar .lbl { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .track { grid-column: 1 / -1; height: 8px; background: #edf0f4; border-radius: 4px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-hero { background: var(--brand); color: #e3e3fb; padding: 48px 56px; display: flex; flex-direction: column; }
.auth-hero .brand { padding: 0; color: #fff; }
.auth-hero .brand small { color: #b9b9f2; }
.auth-hero .logo-q { width: 44px; height: 44px; border-radius: 10px; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.auth-admin .logo-q { width: 44px; height: 44px; border-radius: 10px; }
.auth-hero h2 { font-size: 34px; font-weight: 700; color: #fff; margin-top: auto; max-width: 500px; line-height: 1.15; letter-spacing: -.01em; }
.auth-hero p { color: #c7c7f5; font-size: 16px; max-width: 470px; margin: 14px 0 28px; }
.checks { list-style: none; padding: 0; margin: 0 0 auto; display: grid; gap: 12px; max-width: 470px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: #ececfd; }
.checks svg { color: #a5a5f5; margin-top: 2px; }
.auth-hero .foot { margin-top: 32px; font-size: 12.5px; color: #a3a3ec; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h1 { font-size: 24px; font-weight: 700; }
.auth-box .sub { color: var(--muted); margin: 6px 0 22px; }
.auth-box .stack > * + * { margin-top: 14px; }
.demo-hint { margin-top: 20px; padding: 11px 14px; border-radius: var(--radius); background: var(--bg); color: var(--ink-2); font-size: 13px; border: 1px solid var(--line); }
.alert { padding: 10px 12px; border-radius: 6px; background: var(--bad-bg); color: var(--bad); font-weight: 500; font-size: 13px; }

/* Login del panel de administración */
.auth-admin { min-height: 100vh; display: grid; place-items: center; background: var(--navy); padding: 24px; }
.auth-admin .card { width: 100%; max-width: 400px; padding: 32px; }

/* Pantalla de cuenta bloqueada */
.blocked { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.blocked .card { max-width: 520px; width: 100%; padding: 36px; text-align: center; }
.blocked .ico { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; background: var(--warn-bg); color: var(--warn); }
.blocked .ico svg { width: 28px; height: 28px; }
.blocked h1 { font-size: 22px; margin-bottom: 8px; }
.blocked .contacto { margin: 20px 0; padding: 14px; border-radius: var(--radius); background: var(--bg); text-align: left; }

/* ---------- Factura (vista / impresión) ---------- */
.invoice { padding: 36px 40px; }
.inv-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 20px; border-bottom: 2px solid var(--ink); }
.inv-head .emp { display: flex; gap: 16px; align-items: flex-start; }
.inv-head .emp img { max-width: 120px; max-height: 80px; object-fit: contain; }
.inv-head h2 { font-size: 21px; font-weight: 700; }
.inv-num { text-align: right; }
.inv-num .n { font-size: 26px; font-weight: 700; color: var(--brand); }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 20px 0; }
.inv-parties h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.inv-items th { background: #f0f2f5; }
.inv-foot { display: grid; grid-template-columns: 1fr 300px; gap: 28px; margin-top: 20px; }
.inv-note { font-size: 12px; color: var(--muted); }
.anulada-stamp { display: inline-block; border: 3px solid var(--bad); color: var(--bad); font-weight: 700; padding: 4px 14px; border-radius: 6px; transform: rotate(-6deg); letter-spacing: .1em; }

/* Logo de empresa en configuración */
.logo-box { display: flex; gap: 16px; align-items: center; }
.logo-box .prev { width: 120px; height: 80px; border: 1px dashed #c5ccd6; border-radius: var(--radius); display: grid; place-items: center; background: #fafbfc; color: var(--muted); font-size: 12px; overflow: hidden; }
.logo-box .prev img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-grid, .g-main { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 90; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .topbar .menu-btn { display: inline-flex; }
  .topbar, .banner { padding-left: 16px; padding-right: 16px; }
  .content { padding: 18px 16px 40px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { display: none; }
  .g-3, .g-2, .inv-parties, .inv-foot { grid-template-columns: minmax(0, 1fr); }
  .toolbar > div:first-child { min-width: 0; }
  .user-btn .who { display: none; }
  .invoice { padding: 20px; }
  dl.kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  dl.kv dd { margin-bottom: 8px; }
}
@media (max-width: 560px) {
  .g-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .toolbar .search { width: 100%; }
  .seg { flex-wrap: wrap; }
}

/* ---------- Impresión ---------- */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .banner, .no-print, #toasts { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; }
  .invoice { padding: 0; }
}
