/* ═══════════════════════════════════════════════════════════════
   Retainr — Unified Design System
   Dark editorial theme. shell.css + auth.css merged.
   ═══════════════════════════════════════════════════════════════ */

/* ── 0. Fonts ── */
html, body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── 1. Design Tokens ── */
:root {
  --bg:          #0A0A14;
  --bg-2:        #121228;
  --bg-3:        #181A33;
  --paper:       #18192E;
  --paper-2:     #1F2140;

  --ink:         rgba(255,255,255,0.94);
  --ink-2:       rgba(255,255,255,0.78);
  --ink-3:       rgba(255,255,255,0.55);
  --ink-4:       rgba(255,255,255,0.32);

  --line:        rgba(255,255,255,0.13);
  --line-soft:   rgba(255,255,255,0.07);
  --line-strong: rgba(255,255,255,0.22);

  --accent:      #7C6FFF;
  --accent-2:    #9D93FF;
  --accent-3:    #2ECC9A;
  --accent-rgb:  124, 111, 255;

  --green:       #2ECC9A;
  --red:         #FF6B6B;
  --yellow:      #E8B23A;
  --blue:        #5BB5FF;

  --font-sans:   'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:   'Inter', system-ui, -apple-system, sans-serif;

  --shadow-sm:   0 1px 2px rgba(0,0,0,0.35);
  --shadow-md:   0 6px 18px rgba(0,0,0,0.40), 0 1px 3px rgba(0,0,0,0.20);
  --shadow-lg:   0 30px 80px rgba(0,0,0,0.55), 0 6px 18px rgba(0,0,0,0.35);

  /* Legacy aliases — old code keeps working */
  --surface:     #121228;
  --surface2:    #18192E;
  --border:      rgba(255,255,255,0.13);
  --border-hi:   rgba(255,255,255,0.22);
  --text:        rgba(255,255,255,0.94);
  --muted:       rgba(255,255,255,0.55);
  --danger:      #FF6B6B;
  --success:     #2ECC9A;
  --radius:      13px;
  --radius-sm:   9px;
  --shadow:      0 28px 90px rgba(0,0,0,0.75);
  --shadow-soft: 0 6px 22px rgba(0,0,0,0.42);
  --hover:       rgba(255,255,255,0.06);
  --fg:          rgba(255,255,255,0.90);
  --ks-border:   rgba(255,255,255,0.08);
  --ks-card:     #121228;
  --ks-muted:    rgba(255,255,255,0.46);
  --ks-accent:   #7C6FFF;
  --accent2:     #9D93FF;
  --accent2-rgb: 157, 147, 255;
  --success-rgb: 46, 204, 154;
}

/* ── 1b. Theme overrides (class set on <html> by retainrSetTheme) ── */

html.theme-onyx {
  --bg:        #0d0d0d;  --bg-2:    #161616;  --bg-3:    #1e1e1e;
  --paper:     #161616;  --paper-2: #1e1e1e;
  --surface:   #161616;  --surface2:#1e1e1e;  --ks-card: #161616;
  --accent:    #10b981;  --accent-2:#34d399;  --accent-rgb:16,185,129;
  --ks-accent: #10b981;
  color-scheme: dark;
}

html.theme-arctic {
  --bg:        #050d1a;  --bg-2:    #091428;  --bg-3:    #0d1f38;
  --paper:     #091428;  --paper-2: #0d1f38;
  --surface:   #091428;  --surface2:#0d1f38;  --ks-card: #091428;
  --accent:    #38bdf8;  --accent-2:#7dd3fc;  --accent-rgb:56,189,248;
  --ks-accent: #38bdf8;
  color-scheme: dark;
}

html.theme-rose {
  --bg:        #120810;  --bg-2:    #1c0f1a;  --bg-3:    #241624;
  --paper:     #1c0f1a;  --paper-2: #241624;
  --surface:   #1c0f1a;  --surface2:#241624;  --ks-card: #1c0f1a;
  --accent:    #f472b6;  --accent-2:#f9a8d4;  --accent-rgb:244,114,182;
  --ks-accent: #f472b6;
  color-scheme: dark;
}

html.theme-light {
  --bg:          #f4f5f9;  --bg-2:       #ffffff;   --bg-3:       #eaecf4;
  --paper:       #ffffff;  --paper-2:    #f0f2f7;
  --ink:         rgba(0,0,0,0.87);   --ink-2:      rgba(0,0,0,0.65);
  --ink-3:       rgba(0,0,0,0.42);   --ink-4:      rgba(0,0,0,0.24);
  --line:        rgba(0,0,0,0.10);   --line-soft:  rgba(0,0,0,0.06);
  --line-strong: rgba(0,0,0,0.18);
  --surface:     #ffffff;  --surface2:   #f0f2f7;
  --ks-card:     #ffffff;  --ks-border:  rgba(0,0,0,0.08);
  --ks-muted:    rgba(0,0,0,0.40);
  --border:      rgba(0,0,0,0.10); --border-hi:  rgba(0,0,0,0.18);
  --text:        rgba(0,0,0,0.87); --muted:      rgba(0,0,0,0.42);
  --fg:          rgba(0,0,0,0.87); --hover:      rgba(0,0,0,0.04);
  --shadow-sm:   0 1px 2px rgba(0,0,0,0.08);
  --shadow-md:   0 4px 14px rgba(0,0,0,0.10), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg:   0 20px 60px rgba(0,0,0,0.14), 0 4px 16px rgba(0,0,0,0.08);
  color-scheme: light;
}

/* ── 2. Base reset ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100vh; }
body {
  font-size: 14px; line-height: 1.55;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, textarea, select { font-family: inherit; color: inherit; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--ink); }
em { font-style: italic; color: var(--accent); font-weight: inherit; }
::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--line-strong); background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* Sidebar nav: thin, unobtrusive scrollbar so it doesn't bleed into the footer */
.sidebar nav::-webkit-scrollbar { width: 3px; }
.sidebar nav::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; border: none; background-clip: unset; }
.sidebar nav::-webkit-scrollbar-track { background: transparent; }

/* ══════════════════════════════════════════════════════
   SHELL LAYOUT
══════════════════════════════════════════════════════ */

.app-shell {
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  width: 256px;
  flex-shrink: 0;
}
.brand-row {
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.brand {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-weight: 700; font-size: 22px;
  letter-spacing: -0.03em; color: var(--ink);
  text-decoration: none;
}
.brand .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  display: inline-block; transform: translateY(-2px);
}
.workspace-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-3);
}
.workspace-pill::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent-3);
}

.sidebar-section { padding: 16px 14px 4px; }
.sidebar-section h5 {
  margin: 0 0 8px; padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 500;
  color: var(--ink-4);
  text-transform: uppercase; letter-spacing: 0.16em;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px;
  font-size: 13px; color: var(--ink-2);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  position: relative; font-weight: 500;
  background: transparent; border: none; cursor: pointer;
  width: 100%;
}
.nav-item:hover { background: var(--bg-2); color: var(--ink); }
.nav-item.active { background: var(--bg-2); color: var(--ink); }
.nav-item.active::before {
  content: "";
  position: absolute; left: -14px; top: 6px; bottom: 6px;
  width: 2px; background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.nav-item.active .nav-label { font-style: italic; color: var(--accent-2); }
.nav-item .nav-icon { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.65; }
.nav-item:hover .nav-icon, .nav-item.active .nav-icon { opacity: 1; }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-item .nav-label { flex: 1; }
.nav-count { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.nav-badge {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  padding: 1px 6px; border-radius: 99px;
  background: var(--accent); color: #fff;
  letter-spacing: 0.04em; text-transform: uppercase;
}

.sidebar-section-label {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 500;
  color: var(--ink-4);
  text-transform: uppercase; letter-spacing: 0.16em;
  padding: 16px 18px 8px;
  display: block;
}

.sidebar-foot-actions {
  margin-top: auto; padding: 6px 14px 0;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 1px;
}
/* No second border-top — foot-actions already draws the separator */
.sidebar-foot-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; margin: 0; width: 100%;
  background: transparent; border: none;
  border-radius: 6px; cursor: pointer;
  color: var(--ink-2); font-family: inherit; text-align: left;
  transition: background 0.15s, color 0.15s;
}
.sidebar-foot-btn:hover { background: var(--bg-2); color: var(--ink); }
.user-block { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role {
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.1em;
}

/* ─── Main column ─── */
.main { display: flex; flex-direction: column; min-width: 0; flex: 1; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 32px; height: 56px;
  border-bottom: 1px solid var(--line);
  background: rgba(10,10,20,0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  position: sticky; top: 0; z-index: 30;
}
.topbar-spacer { flex: 1; }
.topbar-meta {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.12em;
}
.topbar-meta strong { color: var(--ink-2); font-weight: 500; }

.crumbs {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.12em;
}
.crumbs strong { color: var(--ink); font-weight: 600; }
.crumbs a { color: var(--ink-3); text-decoration: none; transition: color 0.12s; }
.crumbs a:hover { color: var(--accent-2); }
.crumbs .sep { color: var(--ink-4); margin: 0 6px; }

.page-wrap {
  padding: 48px 32px 100px;
  max-width: 1320px; width: 100%;
  margin: 0 auto;
}

/* ─── Page header ─── */
.page-head {
  display: grid; grid-template-columns: 1fr auto;
  gap: 32px; align-items: end;
  padding-bottom: 36px; margin-bottom: 40px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.page-head::before {
  content: "";
  position: absolute; left: 0; bottom: -1px;
  width: 80px; height: 2px; background: var(--accent);
}
.page-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.14em;
  margin-bottom: 18px;
}
.page-eyebrow .ch {
  color: var(--accent-2); border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 99px; font-size: 10px;
}
.page-title {
  font-size: clamp(32px, 4vw, 52px); font-weight: 700;
  letter-spacing: -0.04em; line-height: 1.02;
  margin: 0; color: var(--ink); text-wrap: balance;
}
.page-title em { font-style: italic; color: var(--accent); font-weight: 400; }
.page-sub {
  margin: 14px 0 0; font-size: 15px; line-height: 1.55;
  color: var(--ink-2); max-width: 56ch;
}
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ─── Filter bar ─── */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 24px; flex-wrap: wrap;
  padding-bottom: 18px; border-bottom: 1px solid var(--line-soft);
}
.search-box {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 999px;
  flex: 1; min-width: 220px; max-width: 380px;
  transition: border-color 0.12s;
}
.search-box:focus-within { border-color: var(--accent); }
.search-box input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 13px; color: var(--ink);
}
.search-box input::placeholder { color: var(--ink-4); }
.search-box svg { color: var(--ink-3); flex-shrink: 0; }
.chip-filter {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; background: transparent;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 12px; font-weight: 500; color: var(--ink-2);
  cursor: pointer; transition: all 0.12s; font-family: inherit;
}
.chip-filter:hover { border-color: var(--line-strong); color: var(--ink); }
.chip-filter.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-filter .ct { font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.chip-filter.on .ct { color: var(--bg); opacity: 0.6; }

/* Compact tag chip used in sidebar tag filter and note editor */
.tag-chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px; background: transparent;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 11px; color: var(--ink-3);
  cursor: pointer; font-family: inherit;
  transition: all 0.12s; line-height: 1.4;
}
.tag-chip:hover { border-color: var(--line-strong); color: var(--ink); }
.tag-chip.on { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.tag-chip-remove { margin-left: 4px; opacity: 0.6; }
.tag-chip-remove:hover { opacity: 1; }

/* Markdown preview inside the notes editor */
.note-preview {
  padding: 8px 0 60px;
  font-size: 15px; line-height: 1.65; color: var(--ink);
  font-family: var(--font-body, inherit);
}
.note-preview h1 { font-size: 28px; font-weight: 700; margin: 24px 0 12px; letter-spacing: -0.02em; }
.note-preview h2 { font-size: 22px; font-weight: 700; margin: 22px 0 10px; letter-spacing: -0.01em; }
.note-preview h3 { font-size: 18px; font-weight: 600; margin: 18px 0 8px; }
.note-preview p  { margin: 10px 0; }
.note-preview ul, .note-preview ol { margin: 10px 0; padding-left: 28px; }
.note-preview li { margin: 4px 0; }
.note-preview blockquote {
  border-left: 3px solid var(--accent); margin: 14px 0; padding: 4px 14px;
  color: var(--ink-2); background: var(--bg-2); border-radius: 0 4px 4px 0;
}
.note-preview code {
  background: var(--bg-2); padding: 1px 6px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 13px; color: var(--accent);
}
.note-preview pre {
  background: var(--bg-2); padding: 14px; border-radius: 8px;
  overflow-x: auto; margin: 14px 0; border: 1px solid var(--line);
}
.note-preview pre code { background: transparent; padding: 0; color: var(--ink); font-size: 13px; }
.note-preview a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.note-preview hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.note-preview table { border-collapse: collapse; margin: 14px 0; }
.note-preview th, .note-preview td { border: 1px solid var(--line); padding: 6px 10px; font-size: 13px; }
.note-preview th { background: var(--bg-2); }
.note-preview input[type="checkbox"] { margin-right: 8px; transform: translateY(1px); }

.entity-ref {
  display: inline-flex; align-items: center;
  background: rgba(var(--accent-rgb), 0.10);
  border: 1px solid rgba(var(--accent-rgb), 0.30);
  border-radius: 4px; padding: 0 6px;
  text-decoration: none !important; font-size: 90%;
  color: var(--accent) !important;
}
.entity-ref:hover { background: rgba(var(--accent-rgb), 0.18); }

/* ─── Command Palette (Cmd/Ctrl+K) ─── */
.cmdk-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 2000; display: flex; align-items: flex-start;
  justify-content: center; padding-top: 14vh;
}
.cmdk {
  width: 100%; max-width: 580px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
}
.cmdk-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  color: var(--ink-3);
}
.cmdk-input {
  flex: 1; background: transparent; border: none; outline: none;
  font-size: 15px; color: var(--ink); font-family: inherit;
}
.cmdk-kbd {
  display: inline-flex; align-items: center; padding: 2px 6px;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 4px;
  background: var(--bg-2);
}
.cmdk-results { max-height: 380px; overflow-y: auto; padding: 6px 0; }
.cmdk-group {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.14em;
  padding: 10px 16px 4px;
}
.cmdk-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 8px 16px; background: transparent; border: none;
  text-align: left; cursor: pointer; color: var(--ink); font-family: inherit;
  font-size: 14px; transition: background 0.08s;
}
.cmdk-item:hover, .cmdk-item.active { background: var(--bg-2); }
.cmdk-item-icon { font-size: 14px; width: 18px; text-align: center; }
.cmdk-item-label { flex: 1; }
.cmdk-item-hint { font-size: 12px; color: var(--ink-4); }
.cmdk-empty { padding: 24px 16px; text-align: center; color: var(--ink-4); font-size: 13px; }
.cmdk-footer {
  display: flex; gap: 16px; padding: 10px 16px;
  border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-4);
}

/* ─── Empty state ─── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 56px 24px;
  color: var(--ink-3);
}
.empty-state-icon {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--bg-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); margin-bottom: 18px;
}
.empty-state-title { font-size: 18px; font-weight: 600; color: var(--ink); }
.empty-state-sub { font-size: 13px; margin-top: 6px; max-width: 44ch; line-height: 1.55; }

/* ─── Activity feed (dashboard) ─── */
.activity-feed { display: flex; flex-direction: column; }
.activity-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 18px; border-bottom: 1px solid var(--line);
  transition: background 0.08s;
}
.activity-row:last-child { border-bottom: none; }
.activity-row[role="button"] { cursor: pointer; }
.activity-row[role="button"]:hover { background: var(--bg-2); }
.activity-icon {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-3);
}
.activity-icon.ok     { background: rgba(34,197,94,.10);  border-color: rgba(34,197,94,.30);  color: #22c55e; }
.activity-icon.danger { background: rgba(239,68,68,.10);  border-color: rgba(239,68,68,.30);  color: #f87171; }
.activity-icon.info   { background: rgba(var(--accent-rgb),.12); border-color: rgba(var(--accent-rgb),.30); color: var(--accent); }
.activity-body { flex: 1; min-width: 0; }
.activity-main { font-size: 13px; color: var(--ink); }
.activity-main strong { font-weight: 600; }
.activity-action { color: var(--ink-2); margin-left: 4px; }
.activity-details {
  font-size: 11px; color: var(--ink-4); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.activity-time { font-size: 11px; color: var(--ink-4); font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* ─── Onboarding wizard ─── */
.wizard-modal { width: 560px; max-width: 95vw; }
.wizard-steps {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 8px 24px 18px;
  border-bottom: 1px solid var(--line);
}
.wizard-step { display: flex; align-items: center; gap: 8px; }
.wizard-step + .wizard-step::before {
  content: ""; width: 22px; height: 1px; background: var(--line); margin: 0 2px;
}
.wizard-step-dot {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-3);
  transition: all 0.15s;
}
.wizard-step.current .wizard-step-dot {
  background: var(--accent); color: var(--bg); border-color: var(--accent);
}
.wizard-step.done .wizard-step-dot {
  background: rgba(34,197,94,.15); border-color: rgba(34,197,94,.4); color: #22c55e;
}
.wizard-step-label { font-size: 12px; color: var(--ink-3); }
.wizard-step.current .wizard-step-label { color: var(--ink); font-weight: 600; }
.wizard-pane { padding: 6px 0; }
.wizard-h { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 6px; color: var(--ink); }
.wizard-p { font-size: 13px; color: var(--ink-2); margin: 0; line-height: 1.55; }

/* ─── Bulk action bar ─── */
.bulk-bar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; z-index: 500;
  animation: bulkBarIn 0.18s ease-out;
}
@keyframes bulkBarIn { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.bulk-bar-count { font-weight: 600; font-size: 13px; color: var(--ink); white-space: nowrap; }
.bulk-bar-actions { display: flex; gap: 6px; }
.bulk-checkbox-col { width: 32px; }
.bulk-checkbox-col input { transform: translateY(1px); cursor: pointer; }

/* ─── Stat strip ─── */
.stat-strip {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0; margin-bottom: 36px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.stat-card {
  padding: 22px 24px 24px;
  border-right: 1px solid var(--line);
  background: transparent; position: relative;
}
.stat-card:last-child { border-right: none; }
.stat-card::before {
  content: ""; position: absolute; top: -1px; left: 0;
  width: 24px; height: 2px; background: var(--accent);
  opacity: 0; transition: opacity 0.18s;
}
.stat-card:hover::before { opacity: 1; }
.stat-label {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.14em;
  margin-bottom: 12px;
}
.stat-value {
  font-size: 32px; font-weight: 700; letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1;
}
.stat-value em { color: var(--accent); font-style: italic; }
.stat-delta {
  margin-top: 10px; font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-3); font-variant-numeric: tabular-nums; letter-spacing: 0.04em;
}
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--red); }

/* ─── Table ─── */
.table-wrap {
  border: 1px solid var(--line);
  background: transparent; overflow: hidden;
}
table.data {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
table.data thead th {
  text-align: left; font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 500; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.12em;
  padding: 14px 18px; background: var(--bg-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data tbody tr { transition: background 0.1s; }
table.data tbody tr:hover { background: var(--bg-2); }
table.data td {
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle; color: var(--ink-2);
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-family: var(--font-mono); font-size: 12.5px; }
table.data .em { color: var(--ink); font-weight: 600; }

/* ─── Status chips ─── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
  font-family: var(--font-mono); letter-spacing: 0.04em;
}
.chip.ok    { background: rgba(46,204,154,0.12); color: var(--green); }
.chip.warn  { background: rgba(232,178,58,0.14); color: var(--yellow); }
.chip.bad   { background: rgba(255,107,107,0.14); color: var(--red); }
.chip.muted { background: var(--bg-2); color: var(--ink-3); border: 1px solid var(--line-soft); }
.chip.blue  { background: rgba(91,181,255,0.12); color: var(--blue); }
.chip.dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* ─── Avatars ─── */
.av { display: inline-flex; align-items: center; gap: 10px; }
.av-circle {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.av-c1 { background: linear-gradient(135deg,#7C6FFF,#B5A8FF); }
.av-c2 { background: linear-gradient(135deg,#5BB5FF,#2ECC9A); }
.av-c3 { background: linear-gradient(135deg,#2ECC9A,#87E0BC); }
.av-c4 { background: linear-gradient(135deg,#FF6B9D,#C589E8); }

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg,var(--accent),var(--accent-2));
  color: #fff; font-weight: 600; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; background: transparent;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  cursor: pointer; text-decoration: none; transition: all 0.12s;
  font-family: inherit; white-space: nowrap;
}
.btn:hover { border-color: var(--ink); background: var(--bg-2); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: #fff; color: var(--bg); border-color: #fff; }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-2); border-color: var(--accent-2); transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-2); color: var(--ink); }
.btn-danger { background: rgba(255,107,107,0.15); color: var(--red); border-color: rgba(255,107,107,0.3); }
.btn-danger:hover { background: rgba(255,107,107,0.25); }
.btn-sm { padding: 6px 12px; font-size: 11.5px; }
.btn .arrow { transition: transform 0.18s; }
.btn:hover .arrow { transform: translateX(3px); }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ─── Panel ─── */
.panel {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 26px 28px;
}
.panel-title {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.14em;
  margin: 0 0 14px;
}
.panel-h {
  font-size: 28px; font-weight: 700; letter-spacing: -0.03em;
  margin: 0 0 6px; color: var(--ink); font-variant-numeric: tabular-nums;
}
.panel-h em { font-style: italic; color: var(--accent); }
.panel-sub { font-size: 13px; color: var(--ink-3); margin: 0 0 20px; max-width: 56ch; }

/* ─── Form / Drawer ─── */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity 0.18s; z-index: 50;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 580px; max-width: 92vw;
  background: var(--paper); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.32,0.72,0.28,1);
  z-index: 51; overflow-y: auto; display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 28px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--paper); z-index: 1;
}
.drawer-title {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.14em;
}
.drawer-close {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink-2); transition: all 0.12s;
}
.drawer-close:hover { background: var(--bg-2); color: var(--ink); border-color: var(--line-strong); }
.drawer-body { padding: 28px; flex: 1; }
.drawer-foot {
  padding: 16px 28px; border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: flex-end;
  background: var(--paper); position: sticky; bottom: 0;
}

.form-grid { display: grid; gap: 18px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 0; }
.field label, .field-label {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.14em;
}
.field input, .field select, .field textarea,
.input, .inputx {
  padding: 10px 14px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 6px; font-size: 13.5px; outline: none;
  color: var(--ink); transition: border-color 0.12s, background 0.12s;
  font-family: inherit; width: 100%;
}
.field input::placeholder, .field textarea::placeholder,
.input::placeholder, .inputx::placeholder { color: var(--ink-4); }
.field input:focus, .field select:focus, .field textarea:focus,
.input:focus, .inputx:focus {
  border-color: var(--accent); background: var(--bg);
}
.field textarea { resize: vertical; min-height: 88px; }
.field-hint { font-size: 11.5px; color: var(--ink-3); }
.field-error { font-size: 12px; color: var(--red); display: none; }
.field.has-error input { border-color: var(--red); }
.field.has-error .field-error { display: block; }

/* ─── Detail rows ─── */
.detail-section { margin-bottom: 32px; }
.detail-section h4 {
  margin: 0 0 14px; font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 500; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.14em;
}
.detail-row {
  display: grid; grid-template-columns: 150px 1fr;
  gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--line-soft); font-size: 13.5px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .l { color: var(--ink-3); }
.detail-row .v { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ─── Empty state ─── */
.empty { text-align: center; padding: 64px 24px; color: var(--ink-3); }
.empty-h { font-size: 18px; font-weight: 600; color: var(--ink); margin-bottom: 8px; letter-spacing: -0.015em; }

/* ─── Burndown ─── */
.bd-row {
  display: grid; grid-template-columns: 150px 1fr 90px;
  gap: 14px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px;
}
.bd-row:last-child { border-bottom: none; }
.bd-bar { position: relative; height: 6px; background: var(--bg-3); border-radius: 99px; overflow: hidden; }
.bd-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.3s; }
.bd-bar > span.ok   { background: var(--green); }
.bd-bar > span.warn { background: var(--yellow); }
.bd-bar > span.bad  { background: var(--red); }
.bd-num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }

/* ─── Section heading ─── */
.section-h { font-size: 22px; font-weight: 700; letter-spacing: -0.025em; margin: 12px 0 18px; color: var(--ink); }
.section-h em { font-style: italic; color: var(--accent); }

/* ─── Split view ─── */
.split-view { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; }

/* ═══════════════════════════════════════════════════════════════
   AUTH LAYOUT
═══════════════════════════════════════════════════════════════ */

.auth {
  display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh;
}

/* Marketing panel */
.auth-mkt {
  background: var(--bg-2); border-right: 1px solid var(--line);
  padding: 36px 48px;
  display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.auth-mkt::before {
  content: ""; position: absolute; top: -180px; right: -180px;
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(124,111,255,0.18), transparent 60%);
  pointer-events: none;
}
.auth-mkt::after {
  content: ""; position: absolute; bottom: -180px; left: -120px;
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(46,204,154,0.12), transparent 60%);
  pointer-events: none;
}
.auth-brand {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-weight: 700; font-size: 26px; letter-spacing: -0.03em;
  color: var(--ink); text-decoration: none;
  position: relative; z-index: 2;
}
.auth-brand .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  display: inline-block; transform: translateY(-3px);
}
.auth-mkt-eyebrow {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.16em;
  margin: 56px 0 22px;
  display: inline-flex; align-items: center; gap: 12px;
  position: relative; z-index: 2;
}
.auth-mkt-eyebrow::before { content: ""; width: 28px; height: 1px; background: var(--accent); }
.auth-mkt h1 {
  font-size: clamp(36px, 4.4vw, 56px); font-weight: 700;
  letter-spacing: -0.04em; line-height: 1.04; margin: 0;
  text-wrap: balance; max-width: 13ch; position: relative; z-index: 2;
}
.auth-mkt h1 em { color: var(--accent); font-weight: 400; }
.auth-mkt-lede {
  margin: 22px 0 0; font-size: 16px; line-height: 1.55;
  color: var(--ink-2); max-width: 42ch; position: relative; z-index: 2;
}
.auth-quote {
  margin-top: auto; padding: 28px 32px;
  border: 1px solid var(--line); border-radius: 14px;
  background: rgba(10,10,20,0.6);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  position: relative; z-index: 2; max-width: 520px;
}
.auth-quote-mark {
  font-family: var(--font-mono); font-size: 11px; color: var(--accent-2);
  letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.auth-quote-mark::before { content: ""; width: 18px; height: 1px; background: var(--accent); }
.auth-quote-text {
  font-size: 18px; line-height: 1.42; letter-spacing: -0.015em;
  color: var(--ink); margin: 0 0 18px; text-wrap: pretty;
}
.auth-quote-text em { color: var(--accent); font-style: italic; }
.auth-quote-by { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.auth-quote-by .av {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px; color: #fff;
}
.auth-quote-by .nm { font-weight: 600; color: var(--ink); }
.auth-quote-by .role { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.12em; }
.auth-trusted {
  margin-top: 26px; font-family: var(--font-mono);
  font-size: 10.5px; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: 0.18em;
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.auth-trusted .star { color: var(--accent); }

/* Form panel */
.auth-form-wrap {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 56px 48px; position: relative;
}
.auth-form-top {
  position: absolute; top: 32px; right: 48px;
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--ink-3); letter-spacing: 0.04em;
}
.auth-form-top a {
  color: var(--ink); font-weight: 500; margin-left: 8px;
  border-bottom: 1px solid var(--accent); padding-bottom: 1px;
}
.auth-form-top a:hover { color: var(--accent-2); }
.auth-form { width: 100%; max-width: 380px; }
.auth-eyebrow {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.16em;
  margin-bottom: 14px; display: inline-flex; align-items: center; gap: 8px;
}
.auth-eyebrow .ch {
  color: var(--accent-2); border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 99px; font-size: 10px;
}
.auth-form h2 {
  font-size: 36px; font-weight: 700; letter-spacing: -0.035em;
  line-height: 1.05; margin: 0 0 10px; color: var(--ink); text-wrap: balance;
}
.auth-form h2 em { color: var(--accent); }
.auth-form .sub {
  margin: 0 0 28px; font-size: 14.5px; color: var(--ink-2);
  line-height: 1.5; max-width: 36ch;
}

/* Sep divider */
.sep {
  display: flex; align-items: center; gap: 12px; margin: 20px 0;
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: 0.18em;
}
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Auth field overrides */
.auth-form .field { margin-bottom: 16px; }
.auth-form .field label {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.14em;
  display: flex; align-items: center; justify-content: space-between;
}
.auth-form .field label .hint-link {
  font-family: var(--font-sans); font-size: 11.5px;
  text-transform: none; letter-spacing: 0; color: var(--accent-2);
}
.auth-form .field input {
  padding: 12px 14px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; outline: none; color: var(--ink);
  transition: border-color 0.12s, background 0.12s; font-family: inherit;
}
.auth-form .field input::placeholder { color: var(--ink-4); }
.auth-form .field input:focus { border-color: var(--accent); background: var(--bg); }
.auth-form .field-hint { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* Password strength */
.pw-strength { display: flex; gap: 4px; margin-top: 8px; }
.pw-strength i { flex: 1; height: 3px; border-radius: 2px; background: var(--bg-3); display: block; }
.pw-strength.s1 i:nth-child(-n+1) { background: var(--red); }
.pw-strength.s2 i:nth-child(-n+2) { background: var(--yellow); }
.pw-strength.s3 i:nth-child(-n+3) { background: var(--green); }
.pw-strength.s4 i { background: var(--accent); }

/* Checkbox */
.check { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; user-select: none; margin: 4px 0 18px; }
.check input { position: absolute; opacity: 0; }
.check .box {
  width: 16px; height: 16px; border: 1.5px solid var(--line-strong);
  border-radius: 4px; background: var(--bg-2); flex-shrink: 0; margin-top: 2px;
  display: inline-flex; align-items: center; justify-content: center; transition: all 0.12s;
}
.check input:checked ~ .box { background: var(--accent); border-color: var(--accent); }
.check input:checked ~ .box::after {
  content: ""; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg) translateY(-1px);
}
.check .lbl { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.check .lbl a { color: var(--accent-2); }

/* Auth primary button */
.btn-auth-primary {
  width: 100%; padding: 13px 18px;
  background: var(--accent); border: 1px solid var(--accent);
  border-radius: 8px; font-size: 14px; font-weight: 600; color: #fff;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  letter-spacing: -0.005em;
}
.btn-auth-primary:hover { background: var(--accent-2); border-color: var(--accent-2); transform: translateY(-1px); }
.btn-auth-primary .arrow { transition: transform 0.15s; }
.btn-auth-primary:hover .arrow { transform: translateX(3px); }
.btn-auth-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.form-foot { margin-top: 22px; text-align: center; font-size: 13.5px; color: var(--ink-3); }
.form-foot a { color: var(--ink); font-weight: 500; border-bottom: 1px solid var(--accent); padding-bottom: 1px; }
.form-foot a:hover { color: var(--accent-2); }

.auth-foot {
  position: absolute; bottom: 24px; left: 48px; right: 48px;
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: 0.14em;
}
.auth-foot a { color: var(--ink-3); }
.auth-foot a:hover { color: var(--ink); }

/* Envelope illustration */
.envelope {
  width: 84px; height: 84px; margin: 0 auto 24px;
  border: 1.5px solid var(--accent); border-radius: 14px;
  position: relative; background: var(--bg-2);
  display: flex; align-items: center; justify-content: center;
}
.envelope::before {
  content: ""; position: absolute; top: 14px; left: 14px; right: 14px; height: 32px;
  border: 1.5px solid var(--accent); border-bottom: none;
  transform: skewY(-12deg); transform-origin: left; border-radius: 4px 4px 0 0;
}
.envelope::after {
  content: ""; width: 32px; height: 32px; background: var(--accent);
  border-radius: 50%; position: absolute; top: -10px; right: -10px;
}
.success-ring {
  width: 84px; height: 84px; margin: 0 auto 24px; border-radius: 50%;
  background: rgba(46,204,154,0.12); border: 1.5px solid var(--accent-3);
  display: flex; align-items: center; justify-content: center; color: var(--accent-3);
}

/* ═══════════════════════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════════════════════ */

.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--paper); border: 1px solid var(--line);
  color: var(--ink); padding: 12px 18px; border-radius: 999px;
  font-size: 13px; box-shadow: var(--shadow-lg); z-index: 100;
  display: none; align-items: center; gap: 10px;
}
.toast.show, .toast.toast-ok, .toast.toast-err { display: flex; animation: toastIn 0.22s; }
.toast.toast-ok  { border-color: rgba(46,204,154,0.4); }
.toast.toast-err { border-color: rgba(255,107,107,0.4); }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast-x {
  background: none; border: none; color: var(--ink-3); cursor: pointer;
  font-size: 14px; padding: 0 0 0 8px; line-height: 1;
}
.toast-x:hover { color: var(--ink); }

/* ═══════════════════════════════════════════════════════════════
   NOTES EDITOR
═══════════════════════════════════════════════════════════════ */

/* Escape page-wrap padding so the editor fills edge-to-edge vertically */
.page-view-shell {
  max-width: 720px; margin: -48px auto 0;
  display: flex; flex-direction: column;
  min-height: calc(100vh - 56px);
  padding: 0 8px 80px;
}

.page-view-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.page-view-toolbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-view-toolbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.page-view-back {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; color: var(--ink-3);
  text-decoration: none; white-space: nowrap;
  transition: color 0.12s;
}
.page-view-back:hover { color: var(--ink); }

.page-view-header { padding: 24px 0 6px; }

/* Explicit dark background — 'transparent' defers to browser field colour (white in light mode) */
.page-view-title {
  width: 100%;
  background: var(--bg); color: var(--ink);
  border: none; outline: none;
  font-size: 28px; font-weight: 800;
  letter-spacing: -0.03em; font-family: inherit;
  line-height: 1.2; padding: 0;
  color-scheme: dark;
}
.page-view-title::placeholder { color: var(--ink-4); }

.page-view-body { padding: 16px 0; }

.page-view-content {
  width: 100%; display: block;
  background: var(--bg); color: var(--ink);
  border: none; outline: none; resize: none;
  font-size: 15px; line-height: 1.75; font-family: inherit;
  padding: 0; min-height: 480px;
  color-scheme: dark;
}
.page-view-content::placeholder { color: var(--ink-4); }

.page-view-footer {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-3);
}
.page-view-wordcount { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); }

/* ═══════════════════════════════════════════════════════════════
   LEGACY BACKWARD-COMPAT ALIASES
   Existing page HTML continues to work without changes.
═══════════════════════════════════════════════════════════════ */

/* Old sidebar wrappers */
.main-column { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.main-content { flex: 1; padding: 40px 32px 80px; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.sidebar-brand-name { font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.sidebar-brand-text { display: flex; flex-direction: column; }
.sidebar-agency-name { font-size: 10.5px; color: var(--ink-3); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; }
.sidebar-collapse-btn { background: none; border: none; color: var(--ink-3); cursor: pointer; padding: 4px; margin-left: auto; border-radius: 4px; }
.sidebar-collapse-btn:hover { color: var(--ink); background: var(--bg-2); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-bottom { border-top: 1px solid var(--line); padding: 8px 0; }
.sidebar-section { padding: 8px 14px 4px; }
.sidebar-section-label {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.16em;
  padding: 8px 10px 4px; display: block;
}
.sidebar-section-label-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 4px; }
.sidebar-pages-add { background: none; border: none; color: var(--ink-4); cursor: pointer; padding: 2px; border-radius: 3px; }
.sidebar-pages-add:hover { color: var(--ink); background: var(--bg-2); }
.sidebar-pages-empty { font-size: 12px; color: var(--ink-4); padding: 4px 10px 8px; }
.sidebar-pages-new { display: flex; align-items: center; gap: 8px; padding: 4px 10px; }
.sidebar-pages-input { background: transparent; border: none; outline: none; color: var(--ink); font-size: 13px; font-family: inherit; flex: 1; }
.side-link {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 6px;
  font-size: 13px; color: var(--ink-2);
  text-decoration: none; transition: background 0.12s, color 0.12s;
  font-weight: 500;
}
.side-link:hover { background: var(--bg-2); color: var(--ink); }
.side-link.active { background: var(--bg-2); color: var(--ink); }
.side-link.active svg { color: var(--accent); }
.side-link svg, .side-icon {
  width: 15px; height: 15px; flex-shrink: 0; opacity: 0.65;
  stroke: currentColor; fill: none; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.side-link:hover svg, .side-link.active svg { opacity: 1; }
.side-link--admin { margin-top: 2px; }
.side-link-row { position: relative; display: flex; align-items: center; }
.side-link-row .side-link { flex: 1; }
.side-link-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-link--page { font-size: 12.5px; }
.page-menu-btn { background: none; border: none; color: var(--ink-4); cursor: pointer; padding: 4px 6px; font-size: 14px; border-radius: 4px; }
.page-menu-btn:hover { color: var(--ink); background: var(--bg-2); }

/* Sidebar resize handle */
.sidebar-resize-handle {
  position: absolute; right: -3px; top: 0; bottom: 0; width: 6px;
  cursor: col-resize; z-index: 10;
}
.sidebar-resize-handle:hover, .sidebar-resize-handle.dragging {
  background: var(--accent);
}

/* TabBar */
.tab-bar {
  display: flex; align-items: center;
  border-bottom: 1px solid var(--line); background: var(--bg-2);
  overflow-x: auto; flex-shrink: 0; min-height: 0; max-height: 0;
  overflow: hidden; /* hidden by default in new design */
}

/* Sidebar avatar */
.sidebar-avatar-wrap { padding: 4px 14px 8px; }
.sidebar-avatar-btn {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border-radius: 6px;
  background: transparent; border: none; cursor: pointer; color: var(--ink);
  font-family: inherit; transition: background 0.12s;
}
.sidebar-avatar-btn:hover { background: var(--bg-2); }
.sidebar-user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* User popup */
.user-popup-overlay { position: fixed; inset: 0; z-index: 100; }
.user-popup {
  position: fixed; bottom: 72px; left: 8px; width: 224px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  z-index: 101; padding: 6px;
}
.user-popup-email {
  padding: 8px 10px 6px;
  font-size: 11px; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-popup-divider { height: 1px; background: var(--line); margin: 4px 0; }
.user-popup-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 6px;
  font-size: 13px; color: var(--ink-2);
  background: transparent; border: none; cursor: pointer; width: 100%; text-align: left;
  font-family: inherit; text-decoration: none; transition: background 0.1s, color 0.1s;
}
.user-popup-item:hover { background: var(--bg-2); color: var(--ink); }
.user-popup-item--danger { color: var(--red); }
.user-popup-item--danger:hover { background: rgba(255,107,107,0.1); color: var(--red); }

/* Page context menu */
.page-menu-overlay { position: fixed; inset: 0; z-index: 200; }
.page-menu-dropdown {
  position: fixed; background: var(--paper); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow-md);
  z-index: 201; min-width: 180px; padding: 4px;
}
.page-menu-header { font-size: 11px; color: var(--ink-4); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em; padding: 6px 10px; }
.page-menu-divider { height: 1px; background: var(--line); margin: 3px 0; }
.page-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 5px;
  font-size: 13px; color: var(--ink-2);
  background: transparent; border: none; cursor: pointer; width: 100%; text-align: left;
  font-family: inherit; text-decoration: none; transition: background 0.1s;
}
.page-menu-item:hover { background: var(--bg-2); color: var(--ink); }
.page-menu-item--danger { color: var(--red); }
.page-menu-item--danger:hover { background: rgba(255,107,107,0.1); }

/* Settings modal */
.smodal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.82);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.smodal {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); width: 700px; max-width: 95vw;
  max-height: 90vh; display: flex; overflow: hidden;
}
.smodal--sm { width: 420px; }
.smodal-nav {
  width: 180px; flex-shrink: 0; border-right: 1px solid var(--line);
  padding: 24px 12px;
}
.smodal-nav-section { font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.14em; padding: 0 10px 10px; }
.smodal-nav-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px;
  font-size: 13px; color: var(--ink-2); background: transparent; border: none;
  cursor: pointer; width: 100%; font-family: inherit; transition: all 0.1s;
}
.smodal-nav-item:hover { background: var(--bg-2); color: var(--ink); }
.smodal-nav-item.active { background: var(--bg-2); color: var(--ink); }
.smodal-nav-icon { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; flex-shrink: 0; }
.smodal-body { flex: 1; overflow-y: auto; padding: 28px 32px; position: relative; }
.smodal-close {
  position: absolute; top: 16px; right: 16px;
  background: transparent; border: 1px solid var(--line); border-radius: 50%;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink-3);
}
.smodal-close:hover { color: var(--ink); background: var(--bg-2); }
.smodal-page-title { font-size: 20px; font-weight: 700; color: var(--ink); margin-bottom: 4px; letter-spacing: -0.02em; }
.smodal-page-sub { font-size: 13px; color: var(--ink-3); margin-bottom: 24px; }
.smodal-section-title { font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 10px; }
.smodal-divider { height: 1px; background: var(--line); margin: 0 0 16px; }
.smodal-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 12px 0; }
.smodal-setting-info { flex: 1; }
.smodal-setting-label { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 3px; }
.smodal-setting-sub { font-size: 12px; color: var(--ink-3); }
.smodal-theme-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: transparent; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px; cursor: pointer; transition: border-color 0.12s;
}
.theme-swatch:hover { border-color: var(--accent); }
.swatch-active { border-color: var(--accent); }
.theme-swatch-preview { width: 48px; height: 32px; border-radius: 5px; }
.theme-swatch-midnight { background: linear-gradient(135deg,#0A0A14,#121228); }
.theme-swatch-onyx     { background: linear-gradient(135deg,#111,#222); }
.theme-swatch-arctic   { background: linear-gradient(135deg,#0a1628,#1a2a4a); }
.theme-swatch-rose     { background: linear-gradient(135deg,#1a0a14,#2a1020); }
.theme-swatch-light    { background: linear-gradient(135deg,#f8fafc,#e2e8f0); }
.theme-swatch-name { font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; }

/* Desktop app modal */
.desktop-install-steps { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.desktop-install-step { display: flex; gap: 12px; font-size: 13px; color: var(--ink-2); }
.desktop-install-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--bg-2);
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--accent); flex-shrink: 0;
}

/* ConfirmDialog */
.confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  z-index: 400; display: flex; align-items: center; justify-content: center;
}
.confirm-box {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 28px; width: 420px; max-width: 92vw; box-shadow: var(--shadow-lg);
}
.confirm-title { font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 10px; letter-spacing: -0.02em; }
.confirm-msg { font-size: 14px; color: var(--ink-2); margin-bottom: 24px; line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Old button classes */
.btnx {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  background: transparent; border: 1px solid var(--line);
  color: var(--ink); cursor: pointer; font-family: inherit;
  text-decoration: none; transition: all 0.12s; white-space: nowrap;
}
.btnx:hover { background: var(--bg-2); border-color: var(--line-strong); }
.btnx-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btnx-primary:hover { background: var(--accent-2); border-color: var(--accent-2); transform: translateY(-1px); }
.btnx-danger { background: rgba(255,107,107,0.15); border-color: rgba(255,107,107,0.3); color: var(--red); }
.btnx-danger:hover { background: rgba(255,107,107,0.25); }
.btnx-success { background: rgba(46,204,154,0.12); border-color: rgba(46,204,154,0.3); color: var(--green); }
.btnx-success:hover { background: rgba(46,204,154,0.22); }
.btnx-sm { padding: 5px 11px; font-size: 11.5px; }
.btnx:disabled, .btnx[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* Old card classes */
.cardx { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 16px; }
.cardx-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.cardx-hd .title { font-size: 14px; font-weight: 600; color: var(--ink); }
.cardx-bd { padding: 18px 20px; }
.cardx-ft { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

/* Old table */
.tablex { width: 100%; border-collapse: collapse; font-size: 13px; }
.tablex th {
  text-align: left; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.12em;
  padding: 12px 16px; background: var(--bg-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tablex td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; color: var(--ink-2); }
.tablex tbody tr:last-child td { border-bottom: none; }
.tablex tbody tr:hover { background: var(--bg-2); }
.tablex .right { text-align: right; }
.tablex .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.tablex .muted { color: var(--ink-3); }
.tablex .center { text-align: center; }
.tablex .mono { font-family: var(--font-mono); }
.tablex .bold { font-weight: 600; color: var(--ink); }
.tablex .small { font-size: 12px; }

/* Old badge classes */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 500; font-family: var(--font-mono);
}
.badge.success, .badge-on { background: rgba(46,204,154,0.12); color: var(--green); }
.badge.danger              { background: rgba(255,107,107,0.12); color: var(--red); }
.badge.info                { background: rgba(91,181,255,0.12); color: var(--blue); }
.badge.warning             { background: rgba(232,178,58,0.14); color: var(--yellow); }
.badge-off                 { background: var(--bg-2); color: var(--ink-3); border: 1px solid var(--line-soft); }

/* Spinner */
.spinner {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Button loading state — add class="loading" to show spinner in place of text */
.btn.loading {
  position: relative; color: transparent !important;
  pointer-events: none; cursor: wait;
}
.btn.loading::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(100,116,139,0.3);
  border-top-color: var(--ink);
  animation: spin .55s linear infinite;
}
.btn-accent.loading::after {
  border-color: rgba(255,255,255,0.25);
  border-top-color: rgba(255,255,255,0.9);
}
.btn-danger.loading::after {
  border-color: rgba(255,107,107,0.25);
  border-top-color: var(--red);
}
/* Disabled buttons get a not-allowed cursor */
.btn[disabled]:not(.loading) { cursor: not-allowed; }

/* Save status indicator (PageView) */
.save-status {
  font-size: 12px; display: inline-flex; align-items: center; gap: 5px;
  transition: opacity .3s;
}
.save-status.idle   { opacity: 0; }
.save-status.saving { opacity: 0.6; color: var(--ink-3); }
.save-status.saved  { opacity: 1;   color: var(--green); }
.save-status.error  { opacity: 1;   color: var(--red); }

/* toast-bad alias */
.toast.toast-bad { border-color: rgba(255,91,91,0.45); display: flex; animation: toastIn 0.22s; }

/* Old modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.62);
  backdrop-filter: blur(4px); z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); width: 480px; max-width: 92vw; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.modal-bd { padding: 20px; flex: 1; overflow-y: auto; }
.modal-ft { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.iconbtn { background: none; border: none; color: var(--ink-3); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }
.iconbtn:hover { color: var(--ink); }

/* Old misc */
.stack { display: flex; flex-direction: column; gap: 14px; }
.right { text-align: right; }
.muted { color: var(--ink-3); }
.center { text-align: center; }
.bold, .name { font-weight: 600; color: var(--ink); }
.small { font-size: 12px; }
.mono { font-family: var(--font-mono); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.status-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.status-pills button {
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: transparent; border: 1px solid var(--line); color: var(--ink-2);
  cursor: pointer; font-family: inherit; transition: all 0.1s;
}
.status-pills button:hover { border-color: var(--line-strong); color: var(--ink); }
.status-pills button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Pager */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 16px 0; }
.pager-btn { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 5px 12px; font-size: 12px; color: var(--ink-2); cursor: pointer; font-family: inherit; }
.pager-btn:hover { border-color: var(--accent); color: var(--ink); }
.pager-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Report tabs */
.report-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; }
.report-tab {
  padding: 7px 16px; background: transparent; border: 1px solid var(--line);
  border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--ink-3);
  cursor: pointer; font-family: inherit; transition: all 0.12s;
}
.report-tab:hover { border-color: var(--line-strong); color: var(--ink); }
.report-tab.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Auth legacy */
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px;
}
.login-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 40px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; color: var(--ink); margin-bottom: 28px; letter-spacing: -0.02em; }
.login-btn { width: 100%; justify-content: center; border-radius: 8px; padding: 12px 18px; font-size: 14px; }
.login-error { background: rgba(255,107,107,0.12); border: 1px solid rgba(255,107,107,0.25); color: var(--red); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.login-success { background: rgba(46,204,154,0.12); border: 1px solid rgba(46,204,154,0.25); color: var(--green); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }

/* Home shell */
.home-shell { padding: 0; }
.home-metrics { margin-bottom: 16px; }
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.metric { background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.metric-label { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 8px; }
.metric-value { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; color: var(--ink); }
.metric-hint { font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.metric.neg .metric-value { color: var(--red); }
.metric.pos .metric-value { color: var(--green); }
.metric-revenue .metric-value { color: var(--accent); }
.skel { border-radius: 4px; background: var(--line); animation: pulse 1.2s ease-in-out infinite; }
.skel-label { height: 12px; width: 80px; margin-bottom: 8px; }
.skel-value { height: 28px; width: 60px; }
@keyframes pulse { 0%,100%{opacity:0.4} 50%{opacity:0.7} }

/* Progress bars (dashboard) */
.prog-list { display: flex; flex-direction: column; gap: 14px; }
.prog-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; gap: 8px; }
.prog-name { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.prog-pct, .prog-amt { font-size: 12px; font-weight: 700; flex-shrink: 0; }
.prog-track { height: 6px; background: rgba(255,255,255,.07); border-radius: 99px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 99px; transition: width .4s ease; min-width: 2px; }
.prog-sub { font-size: 11px; color: var(--ink-3); margin-top: 3px; }

/* Pages */
.page-card {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--ink-2); text-decoration: none;
  transition: all 0.12s; background: var(--bg-3);
}
.page-card:hover { border-color: var(--accent); color: var(--ink); background: var(--bg-2); }
.page-card-icon { color: var(--accent); display: flex; }
.page-card-icon svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.pages-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Home hero / tiles */
.home-hero .cardx-bd { padding: 20px; }
.home-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.home-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.home-badges { display: flex; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--ink-3); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.home-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.home-tile { background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; padding: 16px; text-decoration: none; transition: all 0.12s; }
.home-tile:hover { border-color: var(--accent); background: var(--bg-2); }
.tile-title { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.tile-sub { font-size: 12px; color: var(--ink-3); }

/* Error page */
.error-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
.error-inner { text-align: center; max-width: 480px; }
.error-code { font-size: 96px; font-weight: 800; letter-spacing: -0.06em; line-height: 1; color: var(--accent); margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.error-title { font-size: 26px; font-weight: 700; color: var(--ink); margin-bottom: 12px; letter-spacing: -0.02em; }
.error-msg { font-size: 15px; color: var(--ink-2); margin-bottom: 32px; line-height: 1.55; }

/* SuperAdmin stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat-item { background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; }

/* Responsive */
@media (max-width: 1100px) {
  .stat-strip { grid-template-columns: repeat(2, 1fr); border-bottom: none; }
  .stat-card:nth-child(2) { border-right: none; }
  .stat-card:nth-child(1), .stat-card:nth-child(2) { border-bottom: 1px solid var(--line); }
  .split-view { grid-template-columns: 1fr; }
  .home-grid { grid-template-columns: repeat(2,1fr); }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; width: 100%; }
  .form-grid.cols-2 { grid-template-columns: 1fr; }
  .page-head { grid-template-columns: 1fr; gap: 18px; }
  .page-actions { justify-self: start; }
  .page-wrap { padding: 32px 20px 80px; }
  .auth { grid-template-columns: 1fr; }
  .auth-mkt { padding: 28px 28px 36px; min-height: auto; }
  .auth-mkt-eyebrow { margin: 28px 0 16px; }
  .auth-mkt h1 { font-size: 32px; }
  .auth-quote { display: none; }
  .auth-form-wrap { padding: 36px 24px 80px; }
  .auth-form-top { top: 14px; right: 24px; }
  .auth-foot { left: 24px; right: 24px; }
  .metrics-grid { grid-template-columns: repeat(2,1fr); }
  .home-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   PHONE INPUT COMPONENT
═══════════════════════════════════════════════════════════════ */

.phone-input-row {
  display: flex; align-items: stretch; gap: 0;
}

.phone-code-wrapper { position: relative; flex-shrink: 0; }

.phone-code-btn {
  display: flex; align-items: center; gap: 6px;
  height: 42px; padding: 0 10px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-right: none; border-radius: 6px 0 0 6px;
  color: var(--ink); font-family: inherit; font-size: 13px;
  cursor: pointer; white-space: nowrap; transition: border-color 0.12s;
}
.phone-code-btn:hover { border-color: var(--line-strong); color: var(--ink); }

.phone-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0;
  min-width: 210px; max-height: 252px; overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow-md);
  z-index: 500; padding: 4px;
}

.phone-dropdown-item {
  display: block; width: 100%; text-align: left;
  padding: 7px 10px; border: none; border-radius: 5px;
  background: transparent; color: var(--ink);
  font-family: inherit; font-size: 13px;
  cursor: pointer; white-space: nowrap; transition: background 0.1s;
}
.phone-dropdown-item:hover { background: var(--bg-3); }
.phone-dropdown-item.active { background: var(--bg-3); color: var(--accent); font-weight: 600; }

.phone-local-input {
  flex: 1; height: 42px; padding: 0 14px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 0 6px 6px 0;
  color: var(--ink); font-family: inherit; font-size: 13.5px;
  outline: none; transition: border-color 0.12s;
}
.phone-local-input:focus { border-color: var(--accent); }
.phone-local-input::placeholder { color: var(--ink-4); }

/* ── Blazor reconnect overlay ──────────────────────────────── */
#components-reconnect-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
#components-reconnect-modal.components-reconnect-show {
  display: flex;
}
#components-reconnect-modal.components-reconnect-hide {
  display: none;
}
#components-reconnect-modal.components-reconnect-failed .reconnect-message,
#components-reconnect-modal.components-reconnect-rejected .reconnect-message {
  display: none;
}
#components-reconnect-modal.components-reconnect-failed .reconnect-failed-msg,
#components-reconnect-modal.components-reconnect-rejected .reconnect-failed-msg {
  display: block;
}
.reconnect-inner {
  background: var(--bg-2, #1a1d23);
  border: 1px solid var(--border, #2e3138);
  border-radius: 12px;
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--ink, #e8eaf0);
  font-family: inherit;
}
.reconnect-spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border, #2e3138);
  border-top-color: var(--accent, #7c6ff7);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.reconnect-message { font-size: 14px; color: var(--ink-3, #9399a6); }
.reconnect-failed-msg {
  display: none;
  font-size: 14px;
  color: var(--ink-3, #9399a6);
}
.reconnect-failed-msg a { color: var(--accent, #7c6ff7); text-decoration: none; }
.reconnect-failed-msg a:hover { text-decoration: underline; }
