/* MonitorGuard console — design system
   Light and dark themes share one set of tokens. Every interactive control has an
   explicit border + text colour in BOTH themes so nothing disappears. */

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --surface-3: #edf1f5;
  --line: #dbe2ea;
  --line-strong: #b9c5d3;
  --ink: #0f1b2d;
  --ink-2: #3f4f65;
  --ink-3: #5d6d82;
  --accent: #0a6a85;
  --accent-hover: #085870;
  --accent-ink: #ffffff;
  --accent-soft: #e0f0f5;
  --ok: #0b6b45;
  --ok-soft: #dcf3e6;
  --warn: #8a4b08;
  --warn-soft: #fcecd4;
  --bad: #b0251b;
  --bad-soft: #fde4e1;
  --info: #1d4f91;
  --info-soft: #e2ecf9;
  --side: #0e2036;
  --side-line: #1e3855;
  --side-ink: #c8d5e5;
  --side-ink-strong: #ffffff;
  --side-active: #1a3555;
  --focus: #d97706;
  --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 4px 16px rgba(15, 27, 45, .05);
  --shadow-pop: 0 18px 50px rgba(15, 27, 45, .28);
  --skeleton: #e6ebf1;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090e15;
  --surface: #111a26;
  --surface-2: #0e1722;
  --surface-3: #182435;
  --line: #223146;
  --line-strong: #3a4f6b;
  --ink: #e9eff7;
  --ink-2: #b4c1d4;
  --ink-3: #91a1b8;
  --accent: #4cc3e0;
  --accent-hover: #74d3ea;
  --accent-ink: #04222b;
  --accent-soft: #11303b;
  --ok: #62d9a2;
  --ok-soft: #0f3326;
  --warn: #f3b562;
  --warn-soft: #382710;
  --bad: #ff948b;
  --bad-soft: #3b1815;
  --info: #93bcff;
  --info-soft: #152a4a;
  --side: #0b1420;
  --side-line: #1a2a3f;
  --side-ink: #b4c3d6;
  --side-ink-strong: #ffffff;
  --side-active: #162841;
  --focus: #fbbf24;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 18px rgba(0, 0, 0, .3);
  --shadow-pop: 0 18px 50px rgba(0, 0, 0, .65);
  --skeleton: #1a2536;
}

/* Follow the OS until the person picks a theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #090e15; --surface: #111a26; --surface-2: #0e1722; --surface-3: #182435;
    --line: #223146; --line-strong: #3a4f6b; --ink: #e9eff7; --ink-2: #b4c1d4; --ink-3: #91a1b8;
    --accent: #4cc3e0; --accent-hover: #74d3ea; --accent-ink: #04222b; --accent-soft: #11303b;
    --ok: #62d9a2; --ok-soft: #0f3326; --warn: #f3b562; --warn-soft: #382710;
    --bad: #ff948b; --bad-soft: #3b1815; --info: #93bcff; --info-soft: #152a4a;
    --side: #0b1420; --side-line: #1a2a3f; --side-ink: #b4c3d6; --side-active: #162841;
    --focus: #fbbf24; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 18px rgba(0,0,0,.3);
    --shadow-pop: 0 18px 50px rgba(0,0,0,.65); --skeleton: #1a2536;
  }
}

:root {
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar: 264px;
  --topbar: 60px;
  --font: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--ink); }
h1 { font-size: clamp(1.45rem, 1.1rem + 1.4vw, 2rem); font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.1rem; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
small, .small { font-size: .8125rem; }
.muted { color: var(--ink-3); }
.mono { font-family: var(--mono); font-size: .85em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.stack > *, .two-col > * { min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink);
  padding: 10px 14px; border-radius: 8px; font-weight: 650; text-decoration: none; transition: top .15s;
}
.skip-link:focus { top: 12px; color: var(--accent-ink); }

/* ───────── App shell ───────── */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side);
  color: var(--side-ink); border-right: 1px solid var(--side-line);
  display: flex; flex-direction: column; padding: 20px 14px 16px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 20px; color: var(--side-ink-strong); text-decoration: none; }
.brand:hover { color: var(--side-ink-strong); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(145deg, #0e8fb0, #0a5f78); color: #fff; flex: none;
}
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; line-height: 1.1; display: block; }
.brand-sub { font-size: .75rem; color: var(--side-ink); display: block; margin-top: 2px; }

.nav-group { margin-top: 8px; }
.nav-title { font-size: .72rem; font-weight: 650; color: #8ea3bd; padding: 10px 12px 6px; letter-spacing: .02em; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; margin: 2px 0; border-radius: 9px;
  color: var(--side-ink); text-decoration: none; font-weight: 550; font-size: .925rem; min-height: 42px;
  border: 1px solid transparent; transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--side-active); color: var(--side-ink-strong); }
.nav-link[aria-current="page"], .nav-link.is-active {
  background: var(--side-active); color: var(--side-ink-strong); border-color: #2c4a70; box-shadow: inset 3px 0 0 #4cc3e0;
}
.nav-link .badge-count { margin-left: auto; font-size: .72rem; font-weight: 700; background: #2b4a73; color: #fff; padding: 1px 8px; border-radius: 99px; }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--side-line); display: grid; gap: 10px; }
.sidebar .btn.secondary { background: transparent; color: var(--side-ink-strong); border-color: #3b5c85; width: 100%; }
.sidebar .btn.secondary:hover { background: var(--side-active); border-color: #5b80b0; }

.scrim { display: none; }

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar); display: flex; align-items: center; gap: 12px;
  padding: 0 clamp(16px, 3vw, 40px); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar .crumbs { font-size: .875rem; color: var(--ink-3); display: flex; gap: 8px; align-items: center; min-width: 0; }
.topbar .crumbs strong { color: var(--ink); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topbar .menu-btn { display: none; }

main { padding: clamp(18px, 3vw, 40px); width: 100%; max-width: 1560px; margin: 0 auto; flex: 1; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { margin-top: 6px; max-width: 72ch; color: var(--ink-2); }

/* ───────── Buttons & controls ───────── */
.btn, button.btn, a.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  font: inherit; font-weight: 650; font-size: .9rem; line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap;
  border-radius: 9px; border: 1.5px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-3); border-color: var(--ink-3); color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); border-color: transparent; }
.btn.danger { background: var(--surface); color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.sm { min-height: 34px; padding: 5px 12px; font-size: .84rem; }
.btn.icon { width: 40px; padding: 0; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.btn[aria-busy="true"]::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line-strong);
  border-radius: 9px; padding: 9px 12px; min-height: 40px; max-width: 100%; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 76px; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); outline-offset: 0; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--accent); flex: none; }
input[type="file"] { padding: 7px; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; margin-right: 12px; padding: 6px 12px; border-radius: 7px; border: 1.5px solid var(--line-strong); background: var(--surface-3); color: var(--ink); cursor: pointer; }
select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2391a1b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
label, .label { display: block; font-size: .83rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: .92rem; color: var(--ink); margin: 0; }
.field { min-width: 0; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; align-items: end; }
.form-row.tight { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
form.inline { display: inline; }

/* Theme toggle + language */
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .moon { display: none; }
  :root:not([data-theme]) .theme-toggle .sun { display: block; }
}
.seg { display: inline-flex; border: 1.5px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg a { padding: 7px 11px; font-size: .8rem; font-weight: 700; text-decoration: none; color: var(--ink-2); min-height: 37px; display: inline-flex; align-items: center; }
.seg a + a { border-left: 1px solid var(--line-strong); }
.seg a:hover { background: var(--surface-3); color: var(--ink); }
.seg a[aria-current="true"] { background: var(--accent); color: var(--accent-ink); }

/* ───────── Cards & stats ───────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 20px 22px 0; }
.card-head p { margin-top: 4px; color: var(--ink-2); font-size: .9rem; max-width: 76ch; }
.card-body { padding: 18px 22px 22px; }
.card-body.flush { padding: 14px 0 0; }
.card-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat { padding: 18px 20px; display: grid; gap: 4px; position: relative; overflow: hidden; }
.stat-label { font-size: .84rem; color: var(--ink-2); font-weight: 600; }
.stat-value { font-size: 2.1rem; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-hint { font-size: .78rem; color: var(--ink-3); }
.stat a.stretch { position: absolute; inset: 0; }
a.stat-card { text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
a.stat-card:hover { border-color: var(--accent); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; background: var(--ok); border-radius: 99px; min-width: 0; }

/* ───────── Tables ───────── */
.table-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 0 22px 14px; }
.table-tools .search { position: relative; flex: 1 1 240px; max-width: 360px; }
.table-tools .search svg { position: absolute; left: 11px; top: 11px; color: var(--ink-3); pointer-events: none; }
.table-tools .search input { padding-left: 36px; min-height: 38px; }
.table-count { font-size: .8rem; color: var(--ink-3); margin-left: auto; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); max-height: 640px; }
.table-wrap.auto { max-height: none; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
th, td { text-align: left; padding: 12px 16px; vertical-align: middle; border-bottom: 1px solid var(--line); }
td.top, tr.top td { vertical-align: top; }
th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--ink-2); font-size: .78rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; border-bottom: 1px solid var(--line-strong); }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--ink); background: var(--surface-3); }
th[data-sort]::after { content: "↕"; margin-left: 6px; opacity: .45; font-size: .85em; }
th[aria-sort="ascending"]::after { content: "↑"; opacity: 1; color: var(--accent); }
th[aria-sort="descending"]::after { content: "↓"; opacity: 1; color: var(--accent); }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td:first-child, th:first-child { padding-left: 22px; }
td:last-child, th:last-child { padding-right: 22px; }
td .sub { display: block; font-size: .8rem; color: var(--ink-3); margin-top: 2px; }
td strong { font-weight: 650; }
tr[hidden] { display: none; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
td.empty-cell { padding: 0; }

.empty {
  display: grid; justify-items: center; gap: 8px; text-align: center; padding: 38px 20px; color: var(--ink-2);
}
.empty svg { width: 34px; height: 34px; color: var(--ink-3); stroke-width: 1.4; }
.empty p { max-width: 52ch; font-size: .92rem; }

/* ───────── Pills ───────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 650;
  background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; line-height: 1.4;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill.ok, .pill.approved, .pill.completed, .pill.resolved, .pill.applied, .pill.allow, .pill.low { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.pill.warn, .pill.pending, .pill.investigating, .pill.medium, .pill.alert, .pill.off { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.pill.bad, .pill.denied, .pill.expired, .pill.unavailable, .pill.high, .pill.blocked, .pill.block { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.pill.info, .pill.new { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.pill.closed { background: var(--surface-3); color: var(--ink-2); }
.pill.live::before { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ───────── Toasts / flash ───────── */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: grid; gap: 10px; width: min(420px, calc(100vw - 36px)); }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border-radius: 11px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-left: 5px solid var(--accent); box-shadow: var(--shadow-pop); animation: toast-in .25s ease-out;
}
.toast p { flex: 1; font-size: .92rem; }
.toast button { background: none; border: 0; color: var(--ink-3); cursor: pointer; padding: 2px; border-radius: 6px; min-height: 0; width: auto; }
.toast button:hover { color: var(--ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ───────── Dialog (confirm + lightbox) ───────── */
dialog { border: 1px solid var(--line-strong); border-radius: 16px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); max-width: min(480px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: rgba(5, 10, 18, .6); backdrop-filter: blur(2px); }
.dialog-body { padding: 22px 24px 8px; }
.dialog-body h2 { margin-bottom: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px 22px; flex-wrap: wrap; }
dialog.lightbox { max-width: min(1100px, calc(100vw - 24px)); background: var(--surface); }
dialog.lightbox img { display: block; width: 100%; max-height: 78vh; object-fit: contain; background: #000; border-radius: 16px 16px 0 0; }
dialog.lightbox .dialog-actions { justify-content: space-between; align-items: center; padding: 12px 18px; }

/* ───────── Feature blocks ───────── */
.avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid var(--accent); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 2rem; font-weight: 700; flex: none; }
.avatar.sm { width: 38px; height: 38px; border-width: 2px; font-size: .95rem; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person a { font-weight: 650; }
.profile-top { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.profile-top .meta { display: flex; gap: 10px 16px; flex-wrap: wrap; align-items: center; margin-top: 8px; color: var(--ink-2); font-size: .88rem; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; padding: 18px 22px 22px; }
.shot { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.shot img { display: block; width: 100%; height: 160px; object-fit: cover; background: var(--skeleton); }
.shot-info { padding: 11px 13px; display: grid; gap: 3px; }
.thumb { width: 88px; height: 58px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); vertical-align: middle; margin-right: 10px; }
details.card > summary { cursor: pointer; padding: 18px 22px; font-weight: 650; list-style: none; display: flex; align-items: center; gap: 10px; border-radius: var(--radius-lg); }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "▸"; transition: transform .15s; color: var(--ink-3); }
details.card[open] > summary::before { transform: rotate(90deg); }
.notes { display: grid; gap: 8px; margin-top: 12px; }
.note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; font-size: .84rem; color: var(--ink-2); }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 11px; background: var(--info-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--info) 35%, transparent); font-size: .9rem; }
.callout svg { color: var(--info); margin-top: 2px; }
.feature { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.live-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ───────── Login ───────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-aside { background: var(--side); color: var(--side-ink); padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; gap: 40px; position: relative; overflow: hidden; }
.auth-aside::after { content: ""; position: absolute; inset: auto -120px -160px auto; width: 420px; height: 420px; border-radius: 50%; border: 60px solid #12304e; opacity: .35; z-index: 0; }
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside h2 { color: #fff; font-size: clamp(1.5rem, 1rem + 1.6vw, 2.2rem); letter-spacing: -.02em; max-width: 18ch; }
.auth-aside ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 12px; }
.auth-aside li { display: flex; gap: 10px; align-items: flex-start; }
.auth-aside li svg { color: #4cc3e0; margin-top: 3px; }
.auth-main { display: grid; place-items: center; padding: 28px 20px; position: relative; }
.auth-tools { position: absolute; top: 18px; right: 18px; display: flex; gap: 10px; align-items: center; }
.auth-card { width: min(420px, 100%); display: grid; gap: 20px; }
.auth-card form { display: grid; gap: 16px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 48px; }
.pw-wrap .btn { position: absolute; right: 3px; top: 3px; min-height: 34px; width: 38px; }
.form-error { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); padding: 11px 13px; border-radius: 10px; font-weight: 600; font-size: .9rem; }
.hint-warn { color: var(--warn); font-size: .82rem; font-weight: 600; min-height: 1.2em; }

/* ───────── Responsive ───────── */
@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-pop); }
  body.nav-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(5, 10, 18, .55); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .topbar .menu-btn { display: inline-flex; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .topbar .crumbs .hide-sm { display: none; }
  .card-head, .card-body, .table-tools { padding-left: 16px; padding-right: 16px; }
  td:first-child, th:first-child { padding-left: 16px; }
  td:last-child, th:last-child { padding-right: 16px; }
  th, td { padding: 11px 12px; }
  .stat-value { font-size: 1.75rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stats > .stat:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
  .stat { padding: 14px 16px; }
  .btn { min-height: 44px; white-space: normal; text-align: center; max-width: 100%; }
  .btn.sm { min-height: 38px; }
  input, select { min-height: 44px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; width: auto; }
  .seg a { padding: 8px 10px; }
}
/* Card-style tables on phones for the wide tables flagged .stackable */
@media (max-width: 640px) {
  table.stackable thead { display: none; }
  table.stackable, table.stackable tbody, table.stackable tr, table.stackable td { display: block; width: 100%; }
  table.stackable tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.stackable td { border: 0; padding: 4px 0; }
  table.stackable td::before { content: attr(data-label); display: block; font-size: .72rem; font-weight: 700; color: var(--ink-3); margin-bottom: 1px; }
  table.stackable td:first-child, table.stackable td:last-child { padding-left: 0; padding-right: 0; }
  table.stackable td.empty-cell::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .btn, input, select, textarea, .pill, .card { border: 1px solid CanvasText; }
  .nav-link[aria-current="page"] { outline: 2px solid Highlight; }
}
@media print {
  .sidebar, .topbar, .toasts, .scrim, .btn, .table-tools, form { display: none !important; }
  .app { display: block; }
  body, .card { background: #fff; color: #000; box-shadow: none; }
  .table-wrap { max-height: none; overflow: visible; }
  th { position: static; }
}
