/* IMC Microsites SEO Platform - light theme design system.
   Brand: navy #00005d (primary), blue #426baa (secondary), red #c00000 (accent, sparingly).
   Tints are derived from the brand colours; neutrals are cool greys. All text pairs meet WCAG AA (>= 4.5:1). */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/InterVariable-latin.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
                 U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/InterVariable-latin-ext.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
                 U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  /* brand */
  --navy: #00005d;   --navy-90: #1a1a6d;  --navy-tint: #e6e6f1;  --navy-tint-2: #f1f1f8;
  --blue: #426baa;   --blue-700: #2f5591; --blue-tint: #e7edf6;  --blue-tint-2: #f3f6fb;  --blue-200: #c4d3ea;
  --red: #c00000;    --red-700: #a30000;  --red-tint: #fbe8e8;
  /* neutrals */
  --ink: #1f2433;    --ink-2: #3d4352;    --muted: #5b6170;   --faint: #8a91a0;
  --line: #dfe3ea;   --line-2: #eceff4;   --bg: #f5f6f9;      --surface: #ffffff;
  --grey-tint: #eceef2; --grey-mark: #8a91a0;
  /* type scale */
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 24px; --fs-3xl: 32px;
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --sidebar: 248px;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  font-feature-settings: "cv11", "ss01";
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: var(--fs-md); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { color: var(--navy); margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-xl); font-weight: 650; }
h2 { font-size: var(--fs-lg); font-weight: 650; }
h3 { font-size: var(--fs-md); font-weight: 650; }
p { margin: 0 0 8px; }
.num, table td.num, .kpi-value, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.nowrap { white-space: nowrap; }
/* A protected page restored from the back/forward cache stays hidden until the session is confirmed (app.js). */
.auth-check #root { visibility: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 14px; height: 14px; }

/* ---------------- Shell ---------------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; color: #fff; }
.sidebar .brand img { height: 30px; width: auto; display: block; }
.sidebar .brand span { font-size: var(--fs-sm); font-weight: 600; color: #c9cbe0; border-left: 1px solid rgba(255,255,255,.25); padding-left: 10px; line-height: 1.2; }
.nav { padding: 8px 12px 16px; flex: 1; }
.nav-group { margin-top: 14px; }
.nav-group > .label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #a9acd0; padding: 0 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #dfe0ef; font-weight: 500; font-size: var(--fs-md); position: relative; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav a[aria-current="page"] { background: rgba(255,255,255,.14); color: #fff; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #8fb0e0; }
.nav .count { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 0 6px; line-height: 18px; min-width: 18px; text-align: center; }
.sidebar .foot { padding: 14px 20px 18px; font-size: var(--fs-xs); color: #b9bbd8; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar .foot .mode { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: #fff; }
.sidebar .foot .dot { width: 8px; height: 8px; border-radius: 50%; background: #8fb0e0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.96); backdrop-filter: saturate(1.4) blur(6px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 0 24px; height: 60px; }
.topbar h1 { font-size: var(--fs-lg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .menu-btn { display: none; }
.search { position: relative; margin-left: auto; width: min(360px, 40vw); }
.search input[type=search] { width: 100%; padding: 8px 12px 8px 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); font: inherit; color: var(--ink); }
.search input[type=search]:focus { background: #fff; border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-tint); }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; max-height: 360px; overflow-y: auto; }
.search-results a { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 6px; color: var(--ink); }
.search-results a:hover, .search-results a.active { background: var(--blue-tint-2); text-decoration: none; }
.search-results .type { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; width: 64px; flex: none; }
.search-results .empty { padding: 10px; color: var(--muted); font-size: var(--fs-sm); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--bg); }
.icon-btn .badge-dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid #fff; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: 1px solid transparent; border-radius: 8px; padding: 4px 8px 4px 4px; cursor: pointer; font: inherit; color: var(--ink); }
.user-btn:hover { background: var(--bg); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy-tint); color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: var(--fs-sm); flex: none; }
.user-btn .who { text-align: left; line-height: 1.2; }
.user-btn .who b { display: block; font-size: var(--fs-sm); }
.user-btn .who span { font-size: var(--fs-xs); color: var(--muted); }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; z-index: 40; }
.dropdown .head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px; }
.dropdown button, .dropdown a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: 6px; font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
.dropdown button:hover, .dropdown a:hover { background: var(--bg); text-decoration: none; }

.view { padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; }
.crumbs { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* ---------------- Cards, KPIs ---------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; flex-wrap: wrap; }
.card-head .sub { color: var(--muted); font-size: var(--fs-sm); }
.card-head > * { min-width: 0; }
.card-head h2 { overflow-wrap: anywhere; }
.card-body { padding: 16px 20px 20px; }
.card-body.flush { padding: 12px 0 0; }
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-height: 132px; }
.kpi .label { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.kpi-value { font-size: var(--fs-3xl); font-weight: 650; color: var(--navy); letter-spacing: -0.02em; line-height: 1.1; }
.kpi .foot { font-size: var(--fs-xs); color: var(--muted); margin-top: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi a.foot { color: var(--blue); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: var(--fs-sm); }
.delta.up { color: var(--blue-700); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--muted); }
.seg { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--surface); margin: 6px 0 4px; }
.seg span { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--ink-2); align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend svg { vertical-align: -2px; margin-right: 4px; }

/* verdict families */
.c-run { background: var(--navy); fill: var(--navy); }
.c-fix { background: var(--blue); fill: var(--blue); }
.c-merge { background: var(--grey-mark); fill: var(--grey-mark); }
.c-shut { background: var(--red); fill: var(--red); }

/* ---------------- Badges, chips ---------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; line-height: 1; padding: 5px 9px; border-radius: 999px; white-space: nowrap; background: var(--grey-tint); color: #4b5160; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.plain::before { display: none; }
.badge.run { background: var(--navy-tint); color: var(--navy); }
.badge.fix { background: var(--blue-tint); color: var(--blue-700); }
.badge.merge { background: var(--grey-tint); color: #4b5160; }
.badge.shut { background: var(--red-tint); color: var(--red-700); }
.badge.ok { background: var(--blue-tint); color: var(--blue-700); }
.badge.warn { background: var(--navy-tint-2); color: var(--navy); }
.badge.err { background: var(--red-tint); color: var(--red-700); }
.badge.neutral { background: var(--grey-tint); color: #4b5160; }
.grade { display: inline-flex; width: 24px; height: 24px; border-radius: 6px; align-items: center; justify-content: center; font-weight: 700; font-size: var(--fs-sm); background: var(--grey-tint); color: #4b5160; }
.grade.A { background: var(--navy); color: #fff; }
.grade.B { background: var(--blue-tint); color: var(--blue-700); }
.grade.C { background: var(--grey-tint); color: #4b5160; }
.grade.X { background: var(--red-tint); color: var(--red-700); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: var(--fs-sm); color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { border-color: var(--blue-200); }
.chip[aria-pressed="true"] { background: var(--blue-tint); border-color: var(--blue); color: var(--blue-700); font-weight: 600; }
.chip .n { color: var(--muted); font-weight: 500; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; font: inherit; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs [aria-selected="true"] { color: var(--navy); border-bottom-color: var(--blue); font-weight: 600; }
.tabs .n { margin-left: 6px; font-size: var(--fs-xs); background: var(--grey-tint); color: var(--ink-2); padding: 1px 7px; border-radius: 9px; }

/* ---------------- Buttons and forms ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; font-size: var(--fs-md); cursor: pointer; white-space: nowrap; text-decoration: none; line-height: 1.2; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-90); }
.btn.secondary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.secondary:hover { background: var(--blue-700); }
.btn.danger { background: #fff; border-color: #e6b3b3; color: var(--red); }
.btn.danger:hover { background: var(--red-tint); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--blue); padding-left: 8px; padding-right: 8px; }
.btn.ghost:hover { background: var(--blue-tint-2); }
.btn.sm { padding: 6px 10px; font-size: var(--fs-sm); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn .spinner { width: 14px; height: 14px; border-width: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label-text { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }
.field .err-text { font-size: var(--fs-xs); color: var(--red); font-weight: 500; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=search], input:not([type]), select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #cfd4dd; border-radius: 8px; font: inherit; color: var(--ink); background: #fff; min-height: 40px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--red); }
input[disabled], select[disabled], textarea[disabled] { background: var(--bg); color: var(--muted); }
textarea { min-height: 96px; resize: vertical; }
.form-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); }
.check input { width: 16px; height: 16px; accent-color: var(--navy); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .field { min-width: 160px; }
.filters > select, .filters > input { width: auto; min-width: 180px; max-width: 100%; }
.filters > input[type=search] { min-width: 240px; flex: 1 1 240px; max-width: 420px; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); }
table.data th { text-align: left; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap; position: sticky; top: 0; }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--ink); }
table.data th[aria-sort="ascending"]::after { content: " ↑"; }
table.data th[aria-sort="descending"]::after { content: " ↓"; }
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--blue-tint-2); }
table.data tr.clickable { cursor: pointer; }
table.data td.num, table.data th.num { text-align: right; }
table.data td .sub { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
table.data td.actions { text-align: right; white-space: nowrap; }
table.data a.strong { font-weight: 600; color: var(--navy); }
.meter { height: 6px; background: var(--blue-tint); border-radius: 3px; overflow: hidden; min-width: 60px; }
.meter span { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.trend-up { color: var(--blue-700); }
.trend-down { color: var(--red); }

/* ---------------- States ---------------- */
.state { padding: 40px 20px; text-align: center; color: var(--muted); }
.state .icon { width: 32px; height: 32px; color: var(--faint); margin-bottom: 8px; }
.state h3 { color: var(--ink-2); margin-bottom: 4px; }
.state.error .icon { color: var(--red); }
.state.error h3 { color: var(--red-700); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--blue-tint); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--line-2), #f7f8fb, var(--line-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); background: var(--blue-tint-2); border: 1px solid var(--blue-tint); color: var(--ink); font-size: var(--fs-sm); }
.notice .icon { color: var(--blue); margin-top: 1px; }
.notice.warn { background: var(--red-tint); border-color: #f2caca; }
.notice.warn .icon { color: var(--red); }
.notice b { color: var(--navy); }

/* ---------------- Toasts and dialogs ---------------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(380px, calc(100vw - 40px)); }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: var(--fs-md); display: flex; gap: 10px; align-items: flex-start; animation: rise .18s ease-out; }
.toast.error { background: var(--red); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
dialog.modal { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--ink); }
dialog.modal::backdrop { background: rgba(10, 12, 40, .45); }
dialog.modal .modal-head { padding: 20px 24px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
dialog.modal .modal-body { padding: 16px 24px; }
dialog.modal .modal-foot { padding: 0 24px 20px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
dialog.modal.wide { width: min(860px, calc(100vw - 32px)); }

/* ---------------- Charts ---------------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--line-2); stroke-width: 1; }
.chart .axis-line { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .axis-title { fill: var(--ink-2); font-size: 12px; font-weight: 600; }
.chart .quad-label { fill: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.chart .threshold { stroke: var(--blue-200); stroke-width: 1; }
.chart .pt { stroke: #fff; stroke-width: 2; cursor: pointer; }
.chart .pt:hover, .chart .pt.active { stroke: var(--ink); }
.chart .label { fill: var(--ink-2); font-size: 11px; font-weight: 500; }
.tooltip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: var(--fs-sm); min-width: 180px; z-index: 5; }
.tooltip b { color: var(--navy); }
.tooltip .rowv { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.spark { display: block; }
.chart-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.toggle button { border: 0; background: #fff; padding: 6px 12px; font: inherit; font-size: var(--fs-sm); color: var(--muted); cursor: pointer; }
.toggle button[aria-pressed="true"] { background: var(--blue-tint); color: var(--blue-700); font-weight: 600; }

/* ---------------- Lists ---------------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line-2); }
.list li:first-child { border-top: 0; }
.list .meta { font-size: var(--fs-xs); color: var(--muted); }
.list .title { font-weight: 500; overflow-wrap: anywhere; }
.list .grow { min-width: 0; }
.days { min-width: 64px; text-align: center; border-radius: 8px; padding: 6px 8px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--blue-tint-2); color: var(--navy); line-height: 1.1; }
.days small { display: block; font-size: 10px; font-weight: 600; color: var(--muted); }
.days.soon { background: var(--red-tint); color: var(--red-700); }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: var(--fs-md); }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.reasons { margin: 0; padding-left: 18px; }
.reasons li { margin-bottom: 6px; }

/* ---------------- Auth pages ---------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 1fr) minmax(360px, 560px); background: #fff; }
.auth-brand { background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-brand::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; background: rgba(66, 107, 170, .35); }
.auth-brand img { height: 44px; width: auto; align-self: flex-start; }
.auth-brand h2 { color: #fff; font-size: 30px; line-height: 1.2; max-width: 440px; font-weight: 650; position: relative; z-index: 1; }
.auth-brand p { color: #c9cbe0; max-width: 420px; position: relative; z-index: 1; }
.auth-brand .foot { font-size: var(--fs-xs); color: #a9acd0; position: relative; z-index: 1; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 48px 32px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .logo-sm { display: none; height: 34px; margin-bottom: 28px; }
.auth-card h1 { font-size: var(--fs-2xl); margin-bottom: 8px; }
.auth-card .lead { color: var(--muted); margin-bottom: 24px; }
.auth-card form > * + * { margin-top: 16px; }
.code-input { font-size: 28px !important; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; font-weight: 650; padding: 12px !important; }
.auth-card .alt { margin-top: 20px; font-size: var(--fs-sm); color: var(--muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-card .alt button { background: none; border: 0; color: var(--blue); font: inherit; cursor: pointer; padding: 0; }
.auth-card .alt button:hover { text-decoration: underline; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1200px) {
  .grid.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .grid.side, .grid.two, .grid.three { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar); transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(10, 12, 40, .35); z-index: 25; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .menu-btn { display: inline-flex; }
  .user-btn .who { display: none; }
  .search { width: auto; flex: 1; }
  .view { padding: 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-card .logo-sm { display: block; }
}
@media (max-width: 640px) {
  .filters > select, .filters > input, .filters > input[type=search] { flex: 1 1 100%; max-width: none; }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: var(--fs-2xl); }
  .hide-sm { display: none; }
  .topbar h1 { display: none; }
  .card-head { padding: 14px 16px 0; }
  .card-body { padding: 14px 16px 16px; }
  .list li { padding: 12px 16px; }
}
@media (max-width: 400px) {
  .grid.kpis { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .sidebar, .topbar { display: none; }
  .shell { display: block; }
}
