:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ef;
  --border-strong: #cfd7e3;
  --text: #142033;
  --text-2: #4a5a70;
  --muted: #7a8799;
  --primary: #1e5aa8;
  --primary-600: #174a8c;
  --primary-50: #eaf1fb;
  --side: #0d1b2f;
  --side-2: #14263f;
  --side-text: #b8c4d6;
  --ok: #148a5b;      --ok-bg: #e3f5ed;
  --warn: #b7791f;    --warn-bg: #fdf3e1;
  --bad: #c53030;     --bad-bg: #fde8e8;
  --info: #2b6cb0;    --info-bg: #e6f0fb;
  --purple: #7b4fc4;  --purple-bg: #f0eafb;
  --orange: #c2560c;  --orange-bg: #fdecdf;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 30, 54, .05), 0 1px 3px rgba(16, 30, 54, .06);
  --shadow-lg: 0 12px 32px rgba(16, 30, 54, .18);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; }
code { font-family: var(--mono); font-size: 12px; background: var(--primary-50); color: var(--primary-600); padding: 1px 6px; border-radius: 5px; }
.ico { width: 18px; height: 18px; flex: none; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: none; background: var(--side); color: var(--side-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; color: #fff; text-decoration: none !important; }
.brand strong { display: block; font-size: 15px; }
.brand small { display: block; font-size: 11px; color: var(--side-text); opacity: .8; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #2f7ae0, #1e5aa8); color: #fff; box-shadow: 0 4px 12px rgba(47, 122, 224, .35); }
.brand-mark .ico { width: 20px; height: 20px; }
.sidebar nav { padding: 4px 12px 16px; flex: 1; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6f819b; padding: 16px 10px 6px; font-weight: 600; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--side-text); font-weight: 500; text-decoration: none; margin-bottom: 1px; }
.sidebar nav a:hover { background: var(--side-2); color: #fff; }
.sidebar nav a.active { background: #1e5aa8; color: #fff; box-shadow: inset 3px 0 0 #7fb2ff; }
.sidebar-foot { display: flex; align-items: center; gap: 8px; padding: 14px 14px 16px; border-top: 1px solid #1d324f; }
.sidebar-foot .me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: #fff; text-decoration: none; }
.sidebar-foot .me strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .me small { color: var(--side-text); font-size: 11px; }
.sidebar-foot form { margin: 0; }
.sidebar-foot .icon-btn { color: var(--side-text); }
.sidebar-foot .icon-btn:hover { background: var(--side-2); color: #fff; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #2b4a75; display: grid; place-items: center; font-weight: 600; text-transform: uppercase; flex: none; }

.main { flex: 1; min-width: 0; padding: 22px 28px 48px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar h1 { font-size: 22px; font-weight: 700; }
.topbar .sub { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.menu-btn { display: none; }
.scrim { display: none; }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card > h2 { margin-bottom: 12px; }
.card-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; }
.card-head.pad { padding: 14px 20px; margin: 0; border-bottom: 1px solid var(--border); }
.card.narrow { max-width: 640px; }
.card.empty { text-align: center; padding: 48px 20px; }
.card.empty h2 { font-size: 18px; margin-bottom: 6px; }
.empty-sm { color: var(--muted); text-align: center; padding: 22px 12px; }
.stack > .card:last-child { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack > .card { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin: 26px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.block { display: block; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.strong { font-weight: 700; }
.grow { flex: 1; }
.txt-ok { color: var(--ok); } .txt-bad { color: var(--bad); } .txt-warn { color: var(--warn); }
.link { font-size: 13px; font-weight: 500; }
.hint { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 500 13px var(--font); cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); border-color: #b7c2d2; }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-danger { color: var(--bad); border-color: #f2c4c4; }
.btn-danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn-block { width: 100%; height: 42px; font-size: 14px; }
.btn-link { background: none; border: 0; padding: 0 4px; color: var(--primary); font: 500 13px var(--font); cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--border); }

input, select, textarea {
  font: 14px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); height: 38px; padding: 0 11px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
input[type=file] { padding: 7px 10px; height: auto; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30, 90, 168, .15); }
.select-sm { height: 34px; width: auto; max-width: 240px; font-size: 13px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); }
.form { display: flex; flex-direction: column; gap: 14px; }
.form .row { display: flex; gap: 12px; }
.form .row > label { flex: 1; }
.form-actions, .dialog-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 6px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 14px 16px; }
.filters label { min-width: 140px; }
.filters label.grow { flex: 1; min-width: 200px; }
.filters label.check { min-width: 0; height: 38px; }
.inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.inline-form input[type=date] { width: auto; height: 34px; }
.cmd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.danger-zone { display: flex; align-items: center; gap: 12px; justify-content: space-between; border-top: 1px solid var(--border); margin-top: 22px; padding-top: 16px; }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-weight: 500; border: 1px solid transparent; }
.alert-ok { background: var(--ok-bg); color: #0d6b45; border-color: #bfe7d4; }
.alert-error { background: var(--bad-bg); color: #9b2323; border-color: #f5c6c6; }
.alert-info { background: var(--info-bg); color: #1f528a; border-color: #c5dbf3; }
.info-box { background: var(--primary-50); border: 1px solid #cfe0f6; color: #23446e; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; font-size: 13px; }

.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #edf1f6; color: var(--text-2); 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, .badge-adms { background: var(--info-bg); color: var(--info); }
.badge-archivo { background: var(--purple-bg); color: var(--purple); }
.badge-manual { background: var(--orange-bg); color: var(--orange); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
.scroll-y { max-height: 420px; overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table td { padding: 10px 14px; border-bottom: 1px solid #edf0f5; vertical-align: middle; }
.table tbody tr:hover td { background: #f8fbff; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.compact td, .table.compact th { padding: 7px 12px; }
.table th.right { text-align: right; }
.table tr.anulada td { text-decoration: line-through; color: var(--muted); }
.table tr.inactivo td { color: var(--muted); }
.table tr.no-lab td { background: #fafbfd; color: var(--muted); }
.table form { margin: 0; display: inline; }
.dn { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.pager { display: flex; gap: 8px; justify-content: center; padding: 14px; border-top: 1px solid var(--border); }

/* Matriz mensual */
.matrix th, .matrix td { padding: 6px 4px; text-align: center; }
.matrix th .dn { display: block; font-size: 9.5px; }
.matrix th.we { background: #eef1f6; }
.matrix .sticky { position: sticky; left: 0; background: var(--surface); text-align: left; min-width: 230px; padding-left: 14px; z-index: 2; box-shadow: 1px 0 0 var(--border); }
.matrix th.sticky { z-index: 3; background: var(--surface-2); }
.matrix td.cell { width: 26px; min-width: 26px; font-size: 11.5px; font-weight: 700; border-left: 1px solid #f1f3f7; }
.matrix td.num { font-variant-numeric: tabular-nums; font-weight: 600; padding: 6px 8px; }

/* ---------- Estados de asistencia ---------- */
.st-P { --c: var(--ok); --cb: var(--ok-bg); }
.st-T { --c: var(--warn); --cb: var(--warn-bg); }
.st-T.excedida { --c: #fff; --cb: #d9480f; }
.st-S { --c: var(--orange); --cb: var(--orange-bg); }
.st-I { --c: var(--purple); --cb: var(--purple-bg); }
.st-A { --c: var(--bad); --cb: var(--bad-bg); }
.st-L { --c: var(--info); --cb: var(--info-bg); }
.st-F { --c: #6b7686; --cb: repeating-linear-gradient(45deg, #eef1f5, #eef1f5 4px, #e4e8ee 4px, #e4e8ee 8px); }
.st-N { --c: #a0aab8; --cb: #f3f5f8; }
.st-E { --c: #0f766e; --cb: #dff5f2; }
.st-X { --c: #b5bfcc; --cb: transparent; }
td.cell[class*=st-] { color: var(--c); background: var(--cb); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--c); background: var(--cb); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; background: var(--cb); border: 1px solid var(--c); }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-h { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal-d { min-height: 74px; border-radius: 9px; padding: 7px 8px; background: var(--cb); border: 1px solid color-mix(in srgb, var(--c) 25%, transparent); display: flex; flex-direction: column; gap: 2px; }
.cal-d.st-X { border: 1px dashed var(--border-strong); }
.cal-d.hoy { outline: 2px solid var(--primary); outline-offset: 1px; }
.cal-n { font-weight: 700; font-size: 13px; color: var(--text); }
.cal-d.st-T.excedida .cal-n, .cal-d.st-T.excedida .cal-t { color: #fff; }
.cal-t { font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.cal-s { font-size: 11px; font-weight: 600; color: var(--c); margin-top: auto; }

/* ---------- KPIs y dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpis-sm { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.kpi-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
.kpis-sm .kpi-value { font-size: 24px; }
.kpi-value small { font-size: 14px; color: var(--muted); font-weight: 500; }
.kpi-value.small-val { font-size: 17px; }
.kpi-value.warn { color: var(--warn); } .kpi-value.bad { color: var(--bad); } .kpi-value.ok { color: var(--ok); }
.kpi-foot { font-size: 12px; color: var(--muted); }
.meter { height: 6px; border-radius: 99px; background: #edf1f6; margin-top: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #2f7ae0, #148a5b); border-radius: 99px; transition: width .6s ease; }

.live-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--ok); background: var(--ok-bg); padding: 6px 12px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(20, 138, 91, .6); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(20, 138, 91, 0); } 100% { box-shadow: 0 0 0 0 rgba(20, 138, 91, 0); } }

.feed { display: flex; flex-direction: column; max-height: 560px; overflow-y: auto; margin: 0 -8px; }
.feed-item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 8px; border-radius: 10px; border-bottom: 1px solid #f0f2f6; }
.feed-item.nuevo { animation: flash 2.4s ease-out; }
@keyframes flash { 0% { background: #dcebff; transform: translateY(-4px); } 15% { transform: none; } 100% { background: transparent; } }
.feed-time { font-family: var(--mono); font-weight: 500; font-size: 13px; color: var(--text); }
.feed-time small { display: block; color: var(--muted); font-size: 10.5px; }
.feed-who strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.feed-who span { font-size: 12px; color: var(--muted); }
.feed-meta { text-align: right; font-size: 11.5px; color: var(--muted); }
.feed-meta .badge { margin-bottom: 2px; }

.hbars-chart { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 6px; }
.hbars-chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.hbars-chart .col i { display: block; width: 100%; max-width: 22px; background: #c9dcf5; border-radius: 4px 4px 1px 1px; min-height: 2px; transition: height .5s ease; }
.hbars-chart .col.now i { background: var(--primary); }
.hbars-chart .col b { font-size: 10px; color: var(--text-2); font-weight: 600; min-height: 14px; }
.hbars-chart .col span { font-size: 9.5px; color: var(--muted); }

.bars { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px 28px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px; gap: 4px 10px; align-items: center; font-size: 13px; }
.bar-row .track { grid-column: 1 / -1; height: 7px; border-radius: 99px; background: #edf1f6; overflow: hidden; }
.bar-row .track span { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .6s; }
.bar-row a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.bar-row b { text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.bar-inline { display: flex; align-items: center; gap: 8px; }
.bar-inline span { height: 8px; border-radius: 99px; background: var(--primary); display: block; }
.bar-inline span.good { background: var(--ok); } .bar-inline span.mid { background: #d69e2e; } .bar-inline span.low { background: var(--bad); }
.bar-inline b { font-size: 12px; font-variant-numeric: tabular-nums; }

.reloj-list { display: flex; flex-direction: column; }
.reloj-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid #f0f2f6; color: var(--text); text-decoration: none !important; }
.reloj-row:last-child { border-bottom: 0; }
.reloj-row small { display: block; color: var(--muted); font-size: 11.5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.dot.off { background: #c3cbd6; }
.reloj-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.reloj-card { color: var(--text); text-decoration: none !important; margin: 0; transition: border-color .15s, transform .15s; }
.reloj-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.reloj-top { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 12px 0 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f0f2f6; }
.list li:last-child { border-bottom: 0; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { padding: 6px 0 6px 14px; border-left: 2px solid var(--border); position: relative; }
.timeline li .muted { display: block; }
.month-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.month-nav strong { font-size: 16px; min-width: 150px; text-align: center; }

.dialog { border: 0; border-radius: 14px; padding: 22px 24px; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(13, 27, 47, .45); backdrop-filter: blur(2px); }
.dialog h2 { font-size: 17px; }

#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--side); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13px; animation: toast .3s ease-out; max-width: 340px; }
.toast b { color: #8fc0ff; }
@keyframes toast { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Login ---------- */
.login-body { background: radial-gradient(1200px 600px at 10% 10%, #1b3a66 0%, var(--side) 55%); min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-wrap { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; max-width: 980px; width: 100%; }
.login-hero { color: #dbe6f5; }
.login-hero h2 { font-size: 30px; line-height: 1.25; color: #fff; margin: 32px 0 24px; font-weight: 700; letter-spacing: -.02em; }
.login-hero ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.login-hero li { display: flex; gap: 10px; align-items: center; color: #b8c8de; }
.login-hero li .ico { color: #7fb2ff; }
.brand.big { padding: 0; }
.login-card { background: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); display: flex; flex-direction: column; gap: 16px; }
.login-card h1 { font-size: 22px; }
.login-card p { margin: -10px 0 0; }

.print-head { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-2.wide-left { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(13, 27, 47, .4); z-index: 30; }
  .menu-btn { display: grid; }
  .main { padding: 16px 16px 40px; }
  .topbar h1 { font-size: 19px; }
  .top-actions { margin-left: 0; width: 100%; }
  .login-wrap { grid-template-columns: 1fr; gap: 24px; }
  .login-hero h2 { font-size: 22px; margin: 20px 0 0; }
  .login-hero ul { display: none; }
  .form .row { flex-direction: column; }
  .cmd-grid { grid-template-columns: 1fr; }
  .cal-d { min-height: 56px; padding: 4px 5px; }
  .cal-t { font-size: 9.5px; }
  .cal-s { display: none; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .filters label { min-width: 100%; }
}

/* ---------- Impresión ---------- */
@media print {
  .sidebar, .topbar .top-actions, .no-print, .menu-btn, #toasts, .alert { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; font-size: 11px; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-head { display: block; margin-bottom: 10px; font-size: 13px; }
  .table-wrap { overflow: visible; }
  .matrix .sticky { position: static; min-width: 0; }
  td.cell[class*=st-], .pill, .cal-d { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: landscape; margin: 10mm; }
}
