:root {
  --brand: #4128D1;
  --brand-hover: #3520B4;
  --brand-50: #F4F2FE;
  --brand-100: #E8E4FC;
  --brand-200: #CFC7F8;
  --ink: #1A1730;
  --ink-2: #47445E;
  --muted: #7D7A93;
  --line: #EDEBF4;
  --line-2: #E2DFEC;
  --bg: #F9F8FD;
  --surface: #FFFFFF;
  --ok: #138A4A; --ok-bg: #E7F6EE;
  --warn: #B26A00; --warn-bg: #FFF3DF;
  --bad: #C9343A; --bad-bg: #FDECEC;
  --r-lg: 18px; --r-md: 12px; --r-sm: 9px;
  --shadow: 0 1px 2px rgba(26, 23, 48, .04), 0 6px 20px -14px rgba(26, 23, 48, .18);
  --shadow-pop: 0 24px 60px -20px rgba(26, 23, 48, .35);
  --font: 'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; font-feature-settings: 'tnum' 1; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Login ─────────────────────────────── */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; background: radial-gradient(900px 500px at 85% -10%, var(--brand-50), transparent 70%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 36px 32px; box-shadow: var(--shadow); }
.login-logo { height: 28px; display: block; margin-bottom: 28px; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
.login-card .muted { margin: 0 0 22px; }
.form-error { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: var(--r-sm); margin: 0 0 16px; }
.form-note { background: var(--brand-50); color: var(--brand); padding: 10px 12px; border-radius: var(--r-sm); }
.h-sub { font-size: 15px; margin: 26px 0 10px; }
textarea.code { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px; }

/* ── Campos y botones ─────────────────── */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12px; }
.input, .field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-sm);
  padding: 9px 12px; min-height: 40px; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--r-sm); padding: 0 14px; height: 38px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; background: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-secondary:hover { border-color: var(--brand-200); color: var(--brand); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--brand-50); color: var(--brand); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; height: 44px; margin-top: 6px; }
.btn[disabled] { opacity: .55; cursor: progress; }
.icon-btn { width: 34px; height: 34px; padding: 0; border-radius: 9px; }

/* ── Estructura ───────────────────────── */
.shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 26px 16px 18px; }
.side-logo { height: 26px; margin: 0 10px 34px; align-self: flex-start; }
.nav { display: grid; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; text-align: left; padding: 10px 12px; border-radius: 10px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.nav button svg { width: 18px; height: 18px; color: var(--muted); }
.nav button:hover { background: var(--bg); color: var(--ink); }
.nav button[aria-current="page"] { background: var(--brand-50); color: var(--brand); }
.nav button[aria-current="page"] svg { color: var(--brand); }
.nav .count { margin-left: auto; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 10px 0; border-top: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.side-foot .who { line-height: 1.25; }
.side-foot .who b { display: block; font-size: 13px; }
.side-foot .who span { font-size: 12px; color: var(--muted); }
.side-foot a { margin-left: auto; color: var(--muted); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; }
.side-foot a:hover { background: var(--bg); color: var(--bad); }
.side-foot a svg { width: 17px; height: 17px; }

.main { min-width: 0; padding: 30px 36px 60px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.topbar h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 4px; font-weight: 800; }
.topbar p { margin: 0; color: var(--muted); }
.topbar .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--muted); }
.search input { padding-left: 34px; width: 240px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.panel-head h2 { font-size: 15px; margin: 0; font-weight: 700; }
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.panel-body { padding: 18px 22px 22px; }

/* ── Inicio ──────────────────────────── */
.kpis { display: grid; grid-template-columns: 1.25fr repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.kpi { padding: 20px 22px; }
.kpi .label { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi .label svg { width: 16px; height: 16px; }
.kpi .value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 10px 0 4px; line-height: 1; }
.kpi .hint { font-size: 12.5px; color: var(--muted); }
.kpi.hero { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 18px 40px -22px rgba(65, 40, 209, .75); position: relative; overflow: hidden; }
.kpi.hero::after { content: ''; position: absolute; right: -40px; bottom: -60px; width: 190px; height: 190px; background: url('icon.svg') no-repeat center / contain; filter: brightness(0) invert(1); opacity: .09; }
.kpi.hero .label, .kpi.hero .hint { color: rgba(255, 255, 255, .78); }

.route { margin-bottom: 18px; }
.route-track { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 26px 22px 24px; }
.route-track::before { content: ''; position: absolute; left: calc(22px + (100% - 44px) / 12); right: calc(22px + (100% - 44px) / 12); top: 45px; height: 2px; background: linear-gradient(90deg, var(--brand-200), var(--brand)); border-radius: 2px; }
.stop { min-width: 0; position: relative; display: grid; justify-items: center; text-align: center; gap: 10px; }
.stop .node { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-200); display: grid; place-items: center; font-weight: 800; color: var(--brand); position: relative; z-index: 1; }
.stop.has .node { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 6px var(--brand-50); }
.stop .name { font-weight: 700; font-size: 13.5px; line-height: 1.2; }
.stop .sub { font-size: 12px; color: var(--muted); margin-top: -8px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 24px; }
.chip { font-size: 11.5px; min-width: 0; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: var(--brand-50); color: var(--brand); border: 0; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { background: var(--brand-100); }

.home-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; margin-bottom: 18px; }
.bars { display: grid; grid-template-columns: repeat(6, 1fr); align-items: end; gap: 14px; height: 210px; padding-top: 10px; }
.bar { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 8px; }
.bar-col { display: flex; flex-direction: column; justify-content: flex-end; border-radius: 10px; overflow: hidden; background: var(--bg); position: relative; }
.bar-col .paid { background: var(--brand); }
.bar-col .pending { background: var(--brand-200); }
.bar-col .tip { position: absolute; top: 8px; left: 0; right: 0; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.bar.current .bar-col { box-shadow: inset 0 0 0 2px var(--brand-100); }
.bar .m { font-size: 12px; color: var(--muted); text-align: center; text-transform: capitalize; }
.bar.current .m { color: var(--brand); font-weight: 700; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.todo { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.todo li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.todo li:last-child { border-bottom: 0; }
.todo .dot { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--brand-50); color: var(--brand); }
.todo .dot svg { width: 16px; height: 16px; }
.todo .dot.bad { background: var(--bad-bg); color: var(--bad); }
.todo .dot.warn { background: var(--warn-bg); color: var(--warn); }
.todo .t { flex: 1; min-width: 0; }
.todo .t b { display: block; font-size: 13.5px; }
.todo .t span { font-size: 12.5px; color: var(--muted); }
.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* ── Tablas ──────────────────────────── */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
table.t th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 14px 10px; white-space: nowrap; }
table.t td { padding: 13px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
table.t tr.row { cursor: pointer; }
table.t tr.row:hover td { background: #FCFBFF; }
table.t .num { text-align: right; white-space: nowrap; font-weight: 600; }
table.t .act { text-align: right; white-space: nowrap; width: 1%; }
.biz { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.biz .mono { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.biz b { display: block; }
.biz span { font-size: 12.5px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.brand { background: var(--brand-50); color: var(--brand); }
.pill.neutral { background: #F1F0F5; color: var(--ink-2); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.toolbar .grow { flex: 1; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button svg { width: 15px; height: 15px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(26, 23, 48, .1); }
select.input { width: auto; padding-right: 30px; }

/* ── Tablero ─────────────────────────── */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: #F3F2F9; border-radius: 16px; padding: 12px; min-height: 160px; border: 1px solid transparent; transition: border-color .15s, background .15s; }
.col.over { border-color: var(--brand); background: var(--brand-50); }
.col-head { display: flex; align-items: flex-start; gap: 8px; padding: 2px 4px 12px; }
.col-head .ttl { line-height: 1.25; }
.col-head .ttl small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.col-head .n { margin-top: 1px; }
.col-head b { font-size: 13.5px; }
.col-head .n { font-size: 12px; color: var(--muted); font-weight: 700; background: var(--surface); border-radius: 99px; padding: 0 8px; }
.col-head .sum { margin-left: auto; margin-top: 1px; font-size: 12px; color: var(--muted); font-weight: 600; }
.col.active-stage .col-head b { color: var(--brand); }
.cards { display: grid; gap: 10px; min-height: 40px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; cursor: grab; box-shadow: 0 1px 2px rgba(26, 23, 48, .04); }
.card:hover { border-color: var(--brand-200); }
.card.dragging { opacity: .45; }
.card .top { display: flex; gap: 10px; align-items: flex-start; }
.card .top b { display: block; font-size: 14px; line-height: 1.3; }
.card .top span { font-size: 12.5px; color: var(--muted); }
.card .fee { margin-left: auto; font-weight: 700; font-size: 13px; white-space: nowrap; }
.progress { height: 6px; background: var(--brand-50); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.card .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.add-card { width: 100%; border: 1px dashed var(--line-2); background: none; border-radius: 12px; padding: 9px; color: var(--muted); font-weight: 600; cursor: pointer; margin-top: 10px; }
.add-card:hover { border-color: var(--brand); color: var(--brand); background: var(--surface); }

/* ── Drawer y modal ──────────────────── */
.scrim { position: fixed; inset: 0; background: rgba(26, 23, 48, .32); backdrop-filter: blur(2px); z-index: 40; animation: fade .18s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%); background: var(--surface); z-index: 41; display: flex; flex-direction: column; box-shadow: var(--shadow-pop); animation: slide .22s ease; }
.drawer-head { padding: 24px 28px 0; }
.drawer-head .row { display: flex; align-items: flex-start; gap: 14px; }
.drawer-head .mono { width: 46px; height: 46px; border-radius: 13px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 16px; flex: none; }
.drawer-head h2 { margin: 0; font-size: 20px; letter-spacing: -.01em; line-height: 1.25; }
.drawer-head .sub { color: var(--muted); font-size: 13px; }
.drawer-head .close { margin-left: auto; }
.tabs { display: flex; gap: 4px; margin-top: 18px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 10px 12px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--brand); border-color: var(--brand); }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 28px 28px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 14px 28px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.drawer-foot .left { margin-right: auto; }
.modal { position: fixed; z-index: 51; left: 50%; top: 50%; translate: -50% -50%; width: min(var(--w, 560px), calc(100% - 24px)); max-height: calc(100vh - 40px); background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; animation: pop .18s ease; }
.modal + .scrim, .scrim.top { z-index: 50; }
.modal-head { padding: 22px 26px 6px; display: flex; align-items: flex-start; gap: 10px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.modal-head .close { margin-left: auto; }
.modal-body { padding: 14px 26px; overflow-y: auto; }
.modal-foot { padding: 14px 26px 22px; display: flex; gap: 10px; justify-content: flex-end; }
@keyframes fade { from { opacity: 0 } }
@keyframes slide { from { transform: translateX(30px); opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: scale(.97) } }

.section-title { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title:first-child { margin-top: 0; }
.sum-box { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.sum-line { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; color: var(--ink-2); }
.sum-line.total { border-top: 1px solid var(--line-2); margin-top: 8px; padding-top: 12px; font-weight: 800; font-size: 17px; color: var(--ink); }
.sum-line.total span:last-child { color: var(--brand); }
.items { display: grid; gap: 8px; }
.item-row { display: grid; grid-template-columns: 1fr 70px 110px 110px 34px; gap: 8px; align-items: center; }
.item-row.head { font-size: 12px; color: var(--muted); font-weight: 600; }
.item-row .sub { text-align: right; font-weight: 700; }
.item-row .input { min-height: 36px; padding: 6px 10px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--brand); width: 16px; height: 16px; }
.tasks-month { margin-bottom: 18px; }
.tasks-month h3 { font-size: 14px; margin: 0 0 8px; display: flex; align-items: center; gap: 10px; }
.tasks-month h3 .mini { font-size: 12px; color: var(--muted); font-weight: 600; }
.task { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.task:hover { background: var(--bg); }
.task input { accent-color: var(--brand); width: 17px; height: 17px; flex: none; cursor: pointer; }
.task label { flex: 1; cursor: pointer; }
.task.done label { color: var(--muted); text-decoration: line-through; }
.task .btn { opacity: 0; }
.task:hover .btn, .task .btn:focus-visible { opacity: 1; }
.add-task { display: flex; gap: 8px; margin-top: 6px; }
.links { display: grid; gap: 8px; }
.link-row { display: flex; align-items: center; gap: 10px; }
.link-row svg { width: 16px; height: 16px; color: var(--muted); flex: none; }

/* ── Correo ──────────────────────────── */
.mail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mail-preview { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #F6F5FB; min-height: 380px; }
.mail-preview iframe { width: 100%; height: 100%; min-height: 460px; border: 0; display: block; }
.vars { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.vars button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 99px; padding: 2px 10px; font-size: 12px; color: var(--ink-2); cursor: pointer; font-family: ui-monospace, Menlo, monospace; }
.vars button:hover { border-color: var(--brand); color: var(--brand); }
.tpl-list { display: grid; gap: 6px; }
.tpl-list button { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.tpl-list button[aria-current="true"] { border-color: var(--brand); background: var(--brand-50); }
.tpl-list b { display: block; font-size: 14px; }
.tpl-list span { font-size: 12.5px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-layout { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-bg); color: #6E4300; border-radius: 12px; padding: 12px 14px; font-size: 13px; margin-bottom: 18px; }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

/* ── Toast ───────────────────────────── */
.toasts { position: fixed; right: 22px; bottom: 22px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 16px; font-weight: 600; box-shadow: var(--shadow-pop); display: flex; align-items: center; gap: 10px; max-width: 380px; animation: pop .18s ease; }
.toast svg { width: 17px; height: 17px; flex: none; }
.toast.err { background: var(--bad); }
.loading { display: grid; place-items: center; min-height: 100vh; }
.loading img { width: 42px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35 } }

/* ── Responsive ──────────────────────── */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .home-grid, .mail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); gap: 8px; overflow-x: auto; }
  .side-logo { height: 22px; margin: 0 8px 0 4px; }
  .nav { display: flex; gap: 2px; }
  .nav button { padding: 8px 10px; }
  .nav button span.lbl { display: none; }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .side-foot .who, .side-foot .avatar { display: none; }
  .main { padding: 22px 16px 60px; }
  .route-track { grid-template-columns: repeat(3, 1fr); row-gap: 26px; }
  .route-track::before { display: none; }
  .mail-layout { grid-template-columns: 1fr; }
  .search input { width: 100%; }
  .item-row { grid-template-columns: 1fr 56px 90px 34px; }
  .item-row .sub { display: none; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.kpis > *, .home-grid > *, .mail-grid > *, .mail-layout > * { min-width: 0; }
.modal-head [data-close] { margin-left: auto; }
.modal-head .pill + [data-close] { margin-left: 8px; }
@media (max-width: 880px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .route-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bars { gap: 8px; }
  .bar-col .tip { display: none; }
  .legend { flex-direction: column; gap: 2px; }
  .drawer-head, .drawer-body { padding-left: 18px; padding-right: 18px; }
  .tabs { overflow-x: auto; }
  .modal-head, .modal-body, .modal-foot { padding-left: 18px; padding-right: 18px; }
  .modal-foot { flex-wrap: wrap; }
}
.field[hidden] { display: none; }
