/* KeyHaven web vault — design tokens + components. All colours come from the tokens below; components never hard-code colours. */

@font-face { font-family: 'Plex Sans'; src: url('../fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Sans'; src: url('../fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Plex Sans'; src: url('../fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('../fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('../fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #eceff3;
  --sidebar: #f8f9fb;
  --border: #dce1e8;
  --border-strong: #c3cbd6;
  --text: #172033;
  --text-2: #475266;
  --text-3: #5f6b7d;
  --accent: #1e5bc6;
  --accent-hover: #174ba7;
  --accent-soft: #e7eefb;
  --accent-text: #174ba7;
  --on-accent: #ffffff;
  --danger: #b42318;
  --danger-hover: #95180f;
  --danger-soft: #fdecea;
  --success: #17703f;
  --success-soft: #e5f3ea;
  --warning: #8a5300;
  --warning-soft: #fff3dc;
  --pw-digit: #1e5bc6;
  --pw-symbol: #a14a00;
  --focus-ring: 0 0 0 3px rgba(30, 91, 198, 0.35);
  --overlay: rgba(23, 32, 51, 0.38);
  --shadow-pop: 0 10px 28px rgba(16, 24, 40, 0.14), 0 0 0 1px var(--border);
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.06);
  --tile-1: #dfe9fb; --tile-1-fg: #1d4fa8;
  --tile-2: #e2f1e8; --tile-2-fg: #1b6a3c;
  --tile-3: #fbe7dc; --tile-3-fg: #93400f;
  --tile-4: #ece6f8; --tile-4-fg: #5b3d9c;
  --tile-5: #fdf1d3; --tile-5-fg: #7a5200;
  --tile-6: #dff2f3; --tile-6-fg: #136469;

  --font: 'Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 24px;
  --r-sm: 5px; --r-md: 8px; --r-lg: 12px;
  --sidebar-w: 248px; --topbar-h: 56px; --drawer-w: 420px;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #13161b;
  --surface: #1a1e25;
  --surface-2: #20252e;
  --surface-3: #282e39;
  --sidebar: #161a20;
  --border: #2d3440;
  --border-strong: #3d4655;
  --text: #e6e9ef;
  --text-2: #b0b8c5;
  --text-3: #959eac;
  --accent: #3f72d9;
  --accent-hover: #3566c9;
  --accent-soft: #1f2b45;
  --accent-text: #8fb3fa;
  --on-accent: #ffffff;
  --danger: #e5675c;
  --danger-hover: #ef8278;
  --danger-soft: #3a201f;
  --success: #6bc893;
  --success-soft: #17301f;
  --warning: #eeb35c;
  --warning-soft: #33280f;
  --pw-digit: #8fb3fa;
  --pw-symbol: #f3b26c;
  --focus-ring: 0 0 0 3px rgba(143, 179, 250, 0.45);
  --overlay: rgba(0, 0, 0, 0.55);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--border-strong);
  --shadow-card: none;
  --tile-1: #1f2d4a; --tile-1-fg: #9dbcf8;
  --tile-2: #1b3326; --tile-2-fg: #8fd8ac;
  --tile-3: #3a2519; --tile-3-fg: #f2b48c;
  --tile-4: #2b2440; --tile-4-fg: #c4b1f2;
  --tile-5: #352a12; --tile-5-fg: #edc36e;
  --tile-6: #173336; --tile-6-fg: #86d3d8;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: var(--fs-md); line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }
p { margin: 0; }
a { color: var(--accent-text); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
h1[tabindex='-1']:focus, h1[tabindex='-1']:focus-visible { box-shadow: none; } /* programmatic focus target after navigation */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mono { font-family: var(--mono); }
.small { font-size: var(--fs-xs); }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; }
.gap { gap: 8px; }
.gap-lg { gap: 16px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.right { margin-left: auto; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.noscript { padding: 24px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- Boot ---------- */
.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--text-2); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 500; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
:root[data-theme='dark'] .btn-danger { color: #1a0f0e; }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { height: 28px; padding: 0 10px; font-size: var(--fs-xs); }
.btn-block { width: 100%; height: 40px; font-size: var(--fs-md); }
.icon-btn { width: 32px; height: 32px; padding: 0; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn[aria-pressed='true'] { color: var(--accent-text); background: var(--accent-soft); }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.star-on { color: var(--warning); }
.star-on .icon { fill: currentColor; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
.field-hint { font-size: var(--fs-xs); color: var(--text-3); }
.field-error { font-size: var(--fs-xs); color: var(--danger); }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: var(--fs-md);
}
.textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: var(--focus-ring); outline: none; }
.input[aria-invalid='true'] { border-color: var(--danger); }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .icon-btn, .input-group > .btn { height: 36px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0; width: auto; padding: 0 9px; background: var(--surface-2); }
.input-group > :last-child { border-top-right-radius: var(--r-sm); border-bottom-right-radius: var(--r-sm); }
.check { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r-sm); overflow: hidden; }
.segmented button { border: 0; background: var(--surface); padding: 0 12px; height: 32px; font-size: var(--fs-sm); cursor: pointer; color: var(--text-2); }
.segmented button + button { border-left: 1px solid var(--border-strong); }
.segmented button[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.meter { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; background: var(--danger); }
.meter[data-score='2'] > span { background: var(--warning); }
.meter[data-score='3'] > span, .meter[data-score='4'] > span { background: var(--success); }

/* ---------- Banners, badges ---------- */
.banner { padding: 10px 12px; border-radius: var(--r-sm); font-size: var(--fs-sm); border: 1px solid transparent; }
.banner-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.banner-info { background: var(--accent-soft); color: var(--accent-text); }
.banner-warn { background: var(--warning-soft); color: var(--warning); }
.banner-ok { background: var(--success-soft); color: var(--success); }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 10px; font-size: 11px; font-weight: 500; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-warn { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Auth screens ---------- */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 32px; box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 18px; }
.auth-card.wide { max-width: 560px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: var(--fs-lg); }
.auth-title { font-size: var(--fs-xl); }
.auth-foot { font-size: var(--fs-xs); color: var(--text-3); text-align: center; }
.consent-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: var(--fs-sm); }
.consent-list dt { color: var(--text-3); }
.consent-list dd { margin: 0; word-break: break-all; }
.qr { display: flex; gap: 16px; align-items: center; }
.qr img { width: 160px; height: 160px; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: var(--r-md); border: 1px solid var(--border); }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; padding: 14px; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--r-md); font-family: var(--mono); font-size: var(--fs-md); }

.recovery-key span { display: inline-block; }
.recovery-key { font-family: var(--mono); font-size: 15px; letter-spacing: 0.02em; line-height: 1.9; word-spacing: 4px; padding: 14px 16px; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--r-md); user-select: all; }

/* ---------- Application shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: var(--topbar-h) 1fr; height: 100vh; }
.sidebar { grid-row: 1 / span 2; background: var(--sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.sidebar-brand { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 18px; font-weight: 600; font-size: var(--fs-lg); border-bottom: 1px solid var(--border); flex: none; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; display: flex; flex-direction: column; gap: 1px; }
.nav-group { margin: 14px 8px 4px; font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; display: flex; align-items: center; justify-content: space-between; }
.nav-link { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--r-sm); color: var(--text-2); text-decoration: none; font-size: var(--fs-sm); font-weight: 500; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; }
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link[aria-current='page'] { background: var(--accent-soft); color: var(--accent-text); }
.nav-link .count { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); font-weight: 400; }
.nav-link[aria-current='page'] .count { color: inherit; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 10px; flex: none; }
.vault-state { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--text-3); padding: 4px 10px 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex: none; }

.topbar { grid-column: 2; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--surface); min-width: 0; }
.search { position: relative; flex: 1; max-width: 560px; }
.search .icon { position: absolute; left: 10px; top: 9px; color: var(--text-3); pointer-events: none; }
.search input { padding-left: 34px; padding-right: 36px; background: var(--surface-2); border-color: var(--border); }
.search kbd { position: absolute; right: 8px; top: 8px; font-family: var(--mono); font-size: 11px; color: var(--text-3); border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 5px; line-height: 18px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: var(--fs-xs); flex: none; }
.notif-dot { position: absolute; top: 5px; right: 6px; min-width: 8px; height: 8px; border-radius: 4px; background: var(--danger); }
.rel { position: relative; }
.menu-toggle { display: none; }

.main { grid-column: 2; min-height: 0; min-width: 0; display: flex; overflow: hidden; }
.page { flex: 1; min-width: 0; overflow-y: auto; padding: 24px 28px 48px; }
.page-narrow { max-width: 880px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-title { font-size: var(--fs-xl); }
.page-sub { color: var(--text-2); font-size: var(--fs-sm); margin-top: 2px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .select { width: auto; height: 32px; font-size: var(--fs-sm); }

/* ---------- Panels & tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-card); }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-title { font-size: var(--fs-md); font-weight: 600; }
.panel-body { padding: 18px; }
.panel + .panel { margin-top: 16px; }
.page-narrow > * + * { margin-top: 16px; }
.stats > .panel + .panel, .health > .panel + .panel { margin-top: 0; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-weight: 500; color: var(--text-3); font-size: var(--fs-xs); padding: 9px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.table td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table tbody tr[aria-selected='true'] { background: var(--accent-soft); }
.table .nowrap { white-space: nowrap; }
.with-drawer .hide-drawer { display: none; }
.drawer-host { display: contents; }
.table .actions { width: 1%; white-space: nowrap; text-align: right; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-title { font-weight: 500; color: var(--text); }
.cell-sub { font-size: var(--fs-xs); color: var(--text-3); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 14px 16px; }
.stat-value { font-size: var(--fs-2xl); font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--text-2); font-size: var(--fs-sm); }

/* Site monogram tiles: colour picked deterministically from the site's registrable domain */
.tile { width: 34px; height: 34px; border-radius: var(--r-md); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex: none; background: var(--tile-1); color: var(--tile-1-fg); letter-spacing: -0.01em; }
.tile-lg { width: 48px; height: 48px; font-size: 18px; border-radius: 10px; }
.tile[data-c='2'] { background: var(--tile-2); color: var(--tile-2-fg); }
.tile[data-c='3'] { background: var(--tile-3); color: var(--tile-3-fg); }
.tile[data-c='4'] { background: var(--tile-4); color: var(--tile-4-fg); }
.tile[data-c='5'] { background: var(--tile-5); color: var(--tile-5-fg); }
.tile[data-c='6'] { background: var(--tile-6); color: var(--tile-6-fg); }

/* Card view */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; text-align: left; }
.card:hover { border-color: var(--border-strong); }
.card[aria-selected='true'] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* Empty states */
.empty { text-align: center; padding: 56px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--text-2); }
.empty > .icon { width: 36px; height: 36px; color: var(--text-3); stroke-width: 1.4; }
.empty h3 { color: var(--text); font-size: var(--fs-lg); }
.skeleton { height: 14px; border-radius: 4px; background: var(--surface-3); }

/* ---------- Detail drawer ---------- */
.drawer { width: var(--drawer-w); flex: none; border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid var(--border); }
.drawer-title { font-size: var(--fs-lg); font-weight: 600; word-break: break-word; }
.drawer-body { padding: 8px 18px 24px; display: flex; flex-direction: column; }
.kv { padding: 12px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.kv:last-child { border-bottom: 0; }
.kv-label { font-size: var(--fs-xs); color: var(--text-3); }
.kv-row { display: flex; align-items: center; gap: 6px; min-height: 32px; }
.kv-value { flex: 1; min-width: 0; word-break: break-word; }
.kv-value.pre { white-space: pre-wrap; }
.drawer-actions { display: flex; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; position: sticky; bottom: 0; background: var(--surface); margin-top: auto; }

/* The signature element: secrets rendered in Plex Mono with character-class colouring so 0/O, l/1 and symbols are unambiguous. */
.secret { font-family: var(--mono); font-size: 15px; letter-spacing: 0.04em; word-break: break-all; }
.secret.masked { letter-spacing: 0.18em; color: var(--text-2); }
.secret .d { color: var(--pw-digit); }
.secret .s { color: var(--pw-symbol); }
.gen-output { font-family: var(--mono); font-size: 22px; letter-spacing: 0.05em; padding: 18px 20px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); word-break: break-all; min-height: 68px; }
.gen-output .d { color: var(--pw-digit); }
.gen-output .s { color: var(--pw-symbol); }
.range { width: 100%; accent-color: var(--accent); }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; z-index: 50; overflow-y: auto; }
.modal { width: 100%; max-width: 520px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; max-height: 84vh; }
.modal-lg { max-width: 680px; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: var(--fs-lg); }
.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.menu { position: fixed; min-width: 200px; background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 6px; z-index: 60; display: flex; flex-direction: column; }
.menu-item { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: var(--r-sm); border: 0; background: none; text-align: left; cursor: pointer; font-size: var(--fs-sm); color: var(--text); width: 100%; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); box-shadow: none; }
.menu-item[aria-checked='true'] { color: var(--accent-text); font-weight: 500; }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-head { padding: 8px 10px; font-size: var(--fs-xs); color: var(--text-3); }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 70; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: var(--r-md); font-size: var(--fs-sm); box-shadow: var(--shadow-pop); max-width: 90vw; }
.toast.error { background: var(--danger); color: #fff; }
.notif-list { max-height: 360px; overflow-y: auto; min-width: 320px; }
.notif { padding: 8px 10px; border-radius: var(--r-sm); font-size: var(--fs-sm); display: flex; flex-direction: column; gap: 2px; }
.notif + .notif { border-top: 1px solid var(--border); border-radius: 0; }

/* Settings layout */
.settings-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.settings-row:last-child { border-bottom: 0; }
.settings-row .grow p { color: var(--text-2); font-size: var(--fs-sm); }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-sm); }
.code-inline { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); padding: 1px 6px; border-radius: 4px; word-break: break-all; }
.health { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .drawer { position: fixed; right: 0; top: var(--topbar-h); bottom: 0; z-index: 40; box-shadow: var(--shadow-pop); width: min(var(--drawer-w), 100vw); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw); z-index: 45; transform: translateX(-100%); transition: transform 0.15s ease-out; box-shadow: var(--shadow-pop); }
  .shell[data-nav='open'] .sidebar { transform: none; }
  .topbar, .main { grid-column: 1; }
  .menu-toggle { display: inline-flex; }
  .page { padding: 16px 16px 40px; }
  .search kbd { display: none; }
  .hide-sm { display: none !important; }
  .drawer { top: 0; width: 100vw; }
}
@media (max-width: 560px) {
  .auth-card { padding: 24px 20px; }
  .codes { grid-template-columns: 1fr; }
  .table th.hide-xs, .table td.hide-xs { display: none; }
  .topbar { padding: 0 8px; gap: 4px; }
}
