/* ============ TOKENS ============ */
:root {
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --size-1: 4px;
  --size-2: 8px;
  --size-3: 12px;
  --size-4: 16px;
  --size-5: 20px;
  --size-6: 24px;
  --size-8: 32px;
  --size-10: 40px;
  --size-12: 48px;
  --size-16: 64px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Dark theme — refined Vercel-ish */
[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --surface: #141414;
  --surface-hover: #1a1a1a;
  --border: #262626;
  --border-strong: #383838;
  --fg: #fafafa;
  --fg-muted: #a3a3a3;
  --fg-subtle: #737373;
  --fg-faint: #525252;

  --accent: #10b981;
  --accent-hover: #059669;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --accent-fg: #ffffff;

  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.10);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.10);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.10);

  --grid: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --surface: #fafafa;
  --surface-hover: #f4f4f5;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --fg: #0a0a0a;
  --fg-muted: #525252;
  --fg-subtle: #737373;
  --fg-faint: #a3a3a3;

  --accent: #059669;
  --accent-hover: #047857;
  --accent-soft: rgba(5, 150, 105, 0.10);
  --accent-fg: #ffffff;

  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.08);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.08);

  --grid: rgba(0, 0, 0, 0.04);
}

/* ============ BASE ============ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "ss01", "cv01", "cv02";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent); color: white; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ============ TYPOGRAPHY ============ */
.t-mono { font-family: var(--font-mono); }
.t-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-subtle);
}
.t-h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}
.t-h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0;
}
.t-h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.t-body { font-size: 14px; color: var(--fg); }
.t-muted { color: var(--fg-muted); }
.t-subtle { color: var(--fg-subtle); }
.t-faint { color: var(--fg-faint); }
.t-sm { font-size: 13px; }
.t-xs { font-size: 12px; }
.t-num { font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-weight: 500; }

/* ============ APP LAYOUT ============ */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.18s var(--ease);
}
.app.collapsed { grid-template-columns: 64px 1fr; }

/* Collapsed sidebar tweaks */
.sidebar.is-collapsed { padding: 16px 8px; align-items: center; }
.sidebar.is-collapsed .logo span,
.sidebar.is-collapsed .workspace-name,
.sidebar.is-collapsed .workspace-pill > svg,
.sidebar.is-collapsed .nav-section-label,
.sidebar.is-collapsed .nav-item span,
.sidebar.is-collapsed .nav-item .count,
.sidebar.is-collapsed .user-info,
.sidebar.is-collapsed .credit-card,
.sidebar.is-collapsed .scan-btn-label,
.sidebar.is-collapsed .scan-btn-kbd { display: none; }

.sidebar.is-collapsed .sidebar-header { padding: 4px 0 16px; flex-direction: column; gap: 12px; }
.sidebar.is-collapsed .workspace-pill {
  width: 36px; height: 36px;
  padding: 0;
  margin: 0 0 8px;
  justify-content: center;
}
.sidebar.is-collapsed .scan-btn {
  width: 36px; height: 36px;
  padding: 0;
  justify-content: center;
  margin: 0 0 16px;
}
.sidebar.is-collapsed .nav-item {
  padding: 0;
  width: 36px; height: 36px;
  justify-content: center;
}
.sidebar.is-collapsed .nav-section-spacer { height: 12px; }
.sidebar.is-collapsed .sidebar-footer { width: 100%; padding: 12px 0 0; align-items: center; }
.sidebar.is-collapsed .user-row {
  width: 36px; height: 36px;
  padding: 0;
  justify-content: center;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  letter-spacing: -0.025em;
  font-size: 16px;
  color: var(--fg);
}
.logo-mark-svg { display: block; flex-shrink: 0; }
.logo-word { line-height: 1; }
.sidebar.is-collapsed .logo-word { display: none; }

.icon-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg-muted);
  border-radius: var(--radius-sm);
  transition: all 0.15s var(--ease);
}
.icon-btn:hover { color: var(--fg); border-color: var(--border-strong); background: var(--surface); }

.workspace-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  margin: 0 4px 16px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.workspace-pill:hover { border-color: var(--border-strong); }
.workspace-avatar {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.workspace-name { font-size: 13px; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-section-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
  padding: 14px 10px 6px;
  font-weight: 500;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  font-size: 13.5px;
  font-weight: 450;
  cursor: pointer;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--surface); color: var(--fg); }
.nav-item.active {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border);
}
.nav-item-icon { width: 16px; height: 16px; opacity: 0.85; flex-shrink: 0; }
.nav-item .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-faint);
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 12px 4px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.credit-card {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.credit-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.credit-bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.credit-bar > div { height: 100%; background: var(--accent); }

.user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.user-row:hover { background: var(--surface); }
.user-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 500;
  font-family: var(--font-mono);
  color: var(--fg);
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 500; }
.user-meta { font-size: 11px; color: var(--fg-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ MAIN AREA ============ */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 56px;
}
.breadcrumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px;
  color: var(--fg-muted);
}
.breadcrumbs .sep { color: var(--fg-faint); }
.breadcrumbs .current { color: var(--fg); font-weight: 500; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.content {
  padding: 32px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 24px;
}
.page-header .subtitle {
  color: var(--fg-muted);
  margin-top: 6px;
  font-size: 13.5px;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg);
  transition: all 0.12s var(--ease);
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover { background: var(--surface); }

.btn-primary {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.btn-primary:hover { background: var(--fg-muted); border-color: var(--fg-muted); }

.btn-accent {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-outline {
  border-color: var(--border);
  color: var(--fg);
}
.btn-outline:hover { border-color: var(--border-strong); background: var(--surface); }

.btn-ghost { color: var(--fg-muted); }
.btn-ghost:hover { color: var(--fg); background: var(--surface); }

.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 38px; padding: 0 16px; font-size: 14px; }

.btn-block { width: 100%; }

/* ============ CARDS ============ */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ============ STATS GRID ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}
.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  background: var(--bg-elevated);
  position: relative;
  transition: border-color 0.15s var(--ease);
  cursor: pointer;
}
.stat:hover { border-color: var(--border-strong); }
.stat.active {
  border-color: var(--fg);
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-subtle);
  margin-bottom: 8px;
}
.stat-value {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat-delta {
  margin-top: 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-delta.neg { color: var(--danger); }

/* ============ FILTERS / SEARCH ============ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.input {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
  width: 100%;
  transition: border-color 0.12s var(--ease);
}
.input:focus { outline: none; border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--fg-faint); }
.search {
  position: relative;
  flex: 1;
  min-width: 240px;
}
.search input { padding-left: 32px; }
.search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-faint);
}

/* ============ TAGS / BADGES ============ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  background: var(--surface);
  white-space: nowrap;
}
.tag-accent { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); }
.tag-warn { color: var(--warn); border-color: var(--warn-soft); background: var(--warn-soft); }
.tag-info { color: var(--info); border-color: var(--info-soft); background: var(--info-soft); }
.tag-danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.tag-solid { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--fg-faint);
  display: inline-block;
}
.dot.accent { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ============ TABLES ============ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th, .table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  color: var(--fg-subtle);
  background: var(--surface);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface); }

/* ============ REPORT CARDS GRID ============ */
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}
.report-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.report-card:hover { border-color: var(--border-strong); }
.report-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.report-card-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.brand-mono {
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  flex-shrink: 0;
}
.report-card-meta {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.report-scan {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--fg-muted);
}
.report-scan .label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-faint);
}
.report-card-foot {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--border);
  margin: 0 -18px -18px;
  padding: 12px 18px;
  background: var(--surface);
  font-size: 12.5px;
  color: var(--fg-muted);
}
.report-card-foot:hover .arrow { transform: translateX(3px); color: var(--fg); }
.arrow { transition: transform 0.15s var(--ease), color 0.15s var(--ease); }

/* ============ TABS ============ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab {
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--fg-muted);
  cursor: pointer;
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 450;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--fg); border-bottom-color: var(--fg); font-weight: 500; }

/* ============ FOOTER ============ */
.app-footer {
  border-top: 1px solid var(--border);
  padding: 24px 32px;
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--fg-subtle);
  font-size: 12px;
}
.app-footer .links {
  display: flex; gap: 18px;
  flex-wrap: wrap;
}
.app-footer .links a:hover { color: var(--fg); }

/* ============ PROGRESS ============ */
.progress {
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress > div { height: 100%; background: var(--accent); transition: width 0.3s var(--ease); }

/* ============ PRICING ============ */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.plan {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}
.plan.featured { border-color: var(--fg); }
.plan .badge {
  position: absolute;
  top: -10px;
  right: 20px;
  background: var(--fg);
  color: var(--bg);
  padding: 2px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.plan-name { font-size: 14px; font-weight: 500; color: var(--fg-muted); }
.plan-price {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.plan-price .per { font-size: 13px; font-weight: 400; color: var(--fg-subtle); }
.plan-features {
  list-style: none;
  padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 10px;
  font-size: 13px;
}
.plan-features li {
  display: flex; align-items: flex-start; gap: 8px;
  color: var(--fg-muted);
}
.plan-features li .check {
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
}

/* ============ DIVIDER ============ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ============ FORM ============ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--fg-muted); }
.field .hint { font-size: 12px; color: var(--fg-subtle); }

/* ============ AVATAR ============ */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--fg);
  flex-shrink: 0;
}
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-xl { width: 72px; height: 72px; font-size: 22px; }

/* ============ KBD ============ */
kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--fg-muted);
}

/* ============ SELECT CARDS ============ */
.select-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease);
  background: var(--bg-elevated);
  display: flex; flex-direction: column; gap: 12px;
}
.select-card:hover { border-color: var(--border-strong); }
.select-card.selected {
  border-color: var(--fg);
}
.select-card .icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--fg);
}
.select-card.selected .icon {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  color: var(--accent);
}
.select-card .title { font-size: 14px; font-weight: 500; }
.select-card .desc { font-size: 12.5px; color: var(--fg-muted); line-height: 1.5; }

/* ============ SECTION ============ */
.section { margin-bottom: 40px; }
.section-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 14px;
  gap: 16px;
}

/* ============ MENU ============ */
.menu {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  width: fit-content;
}
.menu-item {
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-muted);
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: all 0.12s var(--ease);
}
.menu-item:hover { color: var(--fg); }
.menu-item.active {
  background: var(--bg-elevated);
  color: var(--fg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* ============ KPI ROW ============ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  overflow: hidden;
}
.kpi {
  padding: 18px 20px;
  border-right: 1px solid var(--border);
}
.kpi:last-child { border-right: none; }
.kpi-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-subtle);
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.kpi-meta { margin-top: 6px; font-size: 12px; color: var(--fg-muted); }

/* ============ CHARTS ============ */
.chart-wrap { padding: 8px 4px; }

/* ============ LIST ITEMS ============ */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--surface); }

/* ============ EMPTY STATE ============ */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--fg-muted);
  font-size: 13px;
}

/* ============ BRAND BOOK SPECIFIC ============ */
.bb-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  background: var(--bg-elevated);
}
.bb-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.bb-field-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-subtle);
  margin-bottom: 8px;
}
.bb-field-value {
  font-size: 14px;
  color: var(--fg);
  line-height: 1.55;
}
.bb-tag-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  background: var(--surface);
  color: var(--fg);
  margin: 0 4px 4px 0;
  font-family: var(--font-mono);
}

/* ============ TIMELINE ============ */
.timeline-step {
  display: flex;
  gap: 14px;
  padding: 10px 0;
}
.timeline-step .num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg);
  flex-shrink: 0;
}
.timeline-step .step-title { font-size: 13.5px; font-weight: 500; }
.timeline-step .step-desc { font-size: 12.5px; color: var(--fg-muted); margin-top: 2px; }

/* ============ QUESTION ROW ============ */
.q-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s var(--ease);
}
.q-row:hover { background: var(--surface); }
.q-row:last-child { border-bottom: none; }
.q-letter {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
}
.q-text { font-size: 13.5px; color: var(--fg); line-height: 1.4; }
.q-meta {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-muted);
  margin-top: 4px;
}
.q-meta .platform { display: flex; align-items: center; gap: 5px; }
.q-actions { display: flex; gap: 6px; }

/* ============ RANKINGS ============ */
.rank-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.rank-row:last-child { border-bottom: none; }
.rank-num {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg);
}
.rank-row.you .rank-num { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.rank-domain { flex: 1; font-size: 13px; }
.rank-score { font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-muted); }

/* ============ LLM RESPONSE ============ */
.llm-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.llm-head {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
}
.llm-body {
  padding: 20px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--fg);
}
.llm-body p { margin: 0 0 12px; }
.llm-body h4 { margin: 16px 0 8px; font-size: 14px; font-weight: 600; }
.llm-body ul { margin: 0 0 12px; padding-left: 20px; }
.llm-body li { margin-bottom: 6px; color: var(--fg-muted); }
.llm-body strong { color: var(--fg); font-weight: 600; }
.llm-body a { color: var(--accent); }
.llm-body a:hover { text-decoration: underline; }

/* ============ UTIL ============ */
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.grow { flex: 1; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.tabular { font-variant-numeric: tabular-nums; }

/* ============ SCROLL ============ */
html { scroll-behavior: smooth; }

/* ============ NOTIFICATIONS ============ */
.notif-wrap { position: relative; }
.notif-trigger {
  position: relative;
  width: 32px; height: 32px;
}
.notif-trigger.has-unread { color: var(--fg); }
.notif-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  display: grid; place-items: center;
  padding: 0 4px;
  border: 2px solid var(--bg);
}
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(0,0,0,0.32), 0 2px 6px rgba(0,0,0,0.18);
  z-index: 50;
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 560px;
  animation: notifIn 0.14s var(--ease);
}
@keyframes notifIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.notif-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
}
.notif-tab {
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--fg-muted);
  cursor: pointer;
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  font-weight: 450;
}
.notif-tab:hover { color: var(--fg); }
.notif-tab.active { color: var(--fg); border-bottom-color: var(--fg); font-weight: 500; }
.notif-list {
  flex: 1;
  overflow-y: auto;
  min-height: 80px;
}
.notif-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s var(--ease);
  position: relative;
}
.notif-item:hover { background: var(--surface); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
}
.notif-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.notif-body { min-width: 0; }
.notif-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 2px;
}
.notif-item:not(.unread) .notif-title { font-weight: 450; color: var(--fg-muted); }
.notif-desc {
  font-size: 12px;
  color: var(--fg-subtle);
  line-height: 1.45;
}
.notif-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  flex-shrink: 0;
}
.notif-time {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-faint);
  white-space: nowrap;
}
.notif-foot {
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  display: flex;
  background: var(--surface);
}

/* ============ RESPONSIVE — TABLET ============ */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-grid .stat:nth-child(n+4) { grid-column: span 1; }
  .content { padding: 28px 24px; }
}

/* ============ RESPONSIVE — MOBILE ============ */
@media (max-width: 768px) {
  /* App becomes single-column; sidebar floats at bottom */
  .app, .app.collapsed {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .sidebar, .sidebar.is-collapsed {
    position: fixed;
    inset: auto 0 0 0;
    top: auto;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: stretch;
    border-right: none;
    border-top: 1px solid var(--border);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    gap: 4px;
    background: var(--bg);
    z-index: 30;
    box-shadow: 0 -2px 16px rgba(0,0,0,0.18);
  }

  /* Hide sidebar chrome that doesn't belong in a tab bar */
  .sidebar .sidebar-header,
  .sidebar .workspace-pill,
  .sidebar .scan-btn,
  .sidebar .nav-section-label,
  .sidebar .sidebar-footer,
  .sidebar .nav-section-spacer { display: none !important; }

  /* Reset desktop-collapse overrides so mobile tab bar always shows labels */
  .sidebar.is-collapsed .nav-item {
    width: auto !important;
    height: auto !important;
    padding: 6px 4px !important;
    justify-content: center !important;
  }
  .sidebar.is-collapsed .nav-item span:not(.count) { display: block !important; }

  /* The remaining children — nav-section divs — flex side-by-side */
  .sidebar > div {
    display: flex;
    flex: 1;
    gap: 4px;
    width: auto;
  }

  .sidebar .nav-item {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    padding: 6px 4px;
    border-radius: var(--radius-md);
    text-align: center;
    min-width: 0;
  }
  .sidebar .nav-item span:not(.count) {
    font-size: 10.5px;
    line-height: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }
  .sidebar .nav-item .count { display: none; }
  .sidebar .nav-item svg { width: 18px; height: 18px; }

  /* Push main content so it's not hidden behind the tab bar */
  .main { padding-bottom: 84px; }

  /* Topbar — tighter, hide kbd/search text */
  .topbar {
    padding: 10px 14px;
    gap: 8px;
    min-height: 52px;
  }
  .topbar .breadcrumbs { font-size: 12.5px; min-width: 0; flex-shrink: 1; overflow: hidden; }
  .topbar .breadcrumbs > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-actions { gap: 4px; }
  .topbar-actions kbd { display: none; }
  .topbar-actions .btn-sm { padding: 0 8px; }
  /* Outline/ghost action buttons become icon-only on mobile */
  .topbar-actions .btn-outline,
  .topbar-actions .btn-ghost {
    width: 32px;
    padding: 0;
    justify-content: center;
  }
  .topbar-actions .btn-outline > :not(svg),
  .topbar-actions .btn-ghost > :not(svg) { display: none; }
  /* Keep primary/accent actions text-visible but tight */
  .topbar-actions .btn-primary,
  .topbar-actions .btn-accent { padding: 0 10px; }

  /* Content */
  .content { padding: 20px 16px 24px; }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
  }
  .page-header > * { width: 100%; }

  .t-h1 { font-size: 22px; }
  .t-h2 { font-size: 17px; }
  .t-h3 { font-size: 14px; }
  .subtitle { font-size: 13px; }

  /* Grids collapse */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 24px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 22px; }

  .form-row { grid-template-columns: 1fr !important; gap: 16px; }
  .pricing-grid { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }

  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .kpi { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 14px 16px; }
  .kpi:nth-child(2n) { border-right: none; }
  .kpi:nth-last-child(-n+2):nth-child(n+3) { border-bottom: none; }
  .kpi-value { font-size: 20px; }

  /* Cards */
  .card-header { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
  .card-header > .row { min-width: 0; flex-wrap: wrap; }
  .card-header .t-h3 { word-break: break-word; }
  .card-body { padding: 16px; }
  .card-footer { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }

  /* Toolbar */
  .toolbar { gap: 8px; }
  .toolbar .search { width: 100%; min-width: 0; flex: 1 1 100%; order: -1; }

  /* Tabs scroll if needed */
  .tabs { overflow-x: auto; gap: 0; }
  .tab { white-space: nowrap; padding: 10px 12px; flex-shrink: 0; }

  /* Question rows — stack the actions */
  .q-row {
    grid-template-columns: 28px 1fr;
    gap: 10px;
    padding: 12px 14px;
  }
  .q-row .q-actions {
    grid-column: 2 / -1;
    justify-content: flex-end;
    margin-top: 4px;
  }
  .q-meta { flex-wrap: wrap; gap: 8px; }

  /* Table — horizontal scroll */
  .card .table { min-width: 560px; }
  .card:has(.table) > table { display: block; overflow-x: auto; }

  /* Plans */
  .plan { padding: 20px; }
  .plan-price { font-size: 28px; }

  /* Brand Book */
  .bb-section { padding: 18px; }
  .bb-fields { grid-template-columns: 1fr; gap: 18px; }

  /* Footer */
  .app-footer { padding: 18px 16px; }
  .app-footer .links { gap: 14px; }

  /* Notifications panel — pin under topbar, full-bleed */
  .notif-panel {
    position: fixed;
    top: 56px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 80px);
  }

  /* Rank rows */
  .rank-row { gap: 8px; padding: 10px 12px; }
  .rank-domain { font-size: 12.5px; }

  /* Hide heavy text in foot strips */
  .report-card { padding: 14px; }
  .report-card-foot { margin: 0 -14px -14px; padding: 10px 14px; }

  /* Section header stacks */
  .section-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ============ EXTRA SMALL ============ */
@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 20px; }
  .sidebar .nav-item span:not(.count) { font-size: 10px; }
  .breadcrumbs .sep, .breadcrumbs a, .breadcrumbs span { font-size: 12px; }
  .topbar-actions .btn { padding: 0 8px; }
}
