/* ─────────────────────────────────────────────────────────────
   Marlow Hub — design system v2
   Dark mode, plum accent. Linear/Notion/Stripe quality bar.

   Spacing scale (use only these): 4 8 12 16 20 24 32 48 64
   Type scale:
     Page title       28 / 600 / -0.02em
     Section header   16 / 600 /  0.005em
     Card title       14 / 600
     Body             14 / 400 / lh 1.55
     Dim              13 / 400 / --text-dim
     Tiny CAPS        11 / 600 /  0.08em / uppercase / --text-dim
     Mono             12 / JetBrains Mono / --text-mute
   ──────────────────────────────────────────────────────────── */

:root {
  --bg: #0F0F14;
  --panel: #15151C;
  --panel-hover: #1B1B24;
  --panel-elev: #1A1A22;
  --text: #F2EFE8;
  --text-dim: #8a8a90;
  --text-mute: #5e5e66;
  --text-faint: rgba(255,255,255,0.15);
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.10);
  --hover-lift: rgba(255,255,255,0.03);

  --accent: #4A3548;
  --accent-light: #6B4F69;
  --accent-soft: rgba(74,53,72,0.12);
  --accent-strong: rgba(74,53,72,0.22);

  --success: #5b8c5a;
  --warn: #c89d5a;
  --danger: #b85c5c;
  --hot: #d97757;
  --warm: #e0b85c;
  --cold: #6b8eb5;

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

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 24px 64px rgba(0,0,0,0.55);

  --t: 150ms ease;
  --t-spring: 320ms cubic-bezier(0.34, 1.56, 0.64, 1);

  --sidebar-w: 224px;
  --topbar-h: 52px;
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01';
  letter-spacing: -0.005em;
  min-height: 100vh;
  overflow-x: hidden;
}
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
code, pre, .mono { font-family: 'JetBrains Mono', Menlo, monospace; }
::selection { background: var(--accent-light); color: var(--text); }
:focus-visible { outline: 1px solid var(--accent-light); outline-offset: 2px; }

/* ─── Brand wordmark ────────────────────────────────────────── */
.brand { display: inline-flex; align-items: baseline; gap: 6px; }
.brand-name { font-weight: 500; letter-spacing: -0.02em; font-size: 15px; }
.brand-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); display: inline-block; }
.brand--lg .brand-name { font-size: 26px; }
.brand--lg .brand-dot { width: 8px; height: 8px; }

/* ─── Login screen ──────────────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, rgba(74,53,72,0.10), transparent 60%), var(--bg);
  z-index: 1000;
  padding: 24px;
}
.login-card { width: 100%; max-width: 320px; text-align: center; padding: 40px 24px; }
.login-tag { margin: 8px 0 28px; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-mute); }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form input {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  font-size: 14px;
}
.login-form input:focus { border-color: var(--accent-light); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-form input.shake { animation: shake 380ms cubic-bezier(0.36, 0.07, 0.19, 0.97); border-color: var(--danger); }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
.login-error { font-size: 12px; color: var(--danger); margin: 4px 0 0; }

/* ─── App shell ─────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "sidebar topbar" "sidebar content";
  min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 12px;
  z-index: 30;
}
.sidebar-brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 12px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--t), color var(--t);
}
.nav-item:hover { background: var(--hover-lift); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--text);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--accent-light);
  border-radius: 0 3px 3px 0;
}
.nav-item i { width: 15px; height: 15px; opacity: 0.85; }
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
  border-top: 1px solid var(--border);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* ─── Top bar ───────────────────────────────────────────────── */
.topbar {
  grid-area: topbar;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-title { font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.topbar-search {
  flex: 1;
  display: flex;
  align-items: center;
  max-width: 380px;
  margin-left: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  gap: 8px;
  transition: border-color var(--t);
}
.topbar-search:focus-within { border-color: var(--border-strong); }
.topbar-search i { width: 13px; height: 13px; color: var(--text-mute); }
.topbar-search input { background: transparent; border: 0; outline: 0; flex: 1; font-size: 12px; color: var(--text); }
.topbar-search input::placeholder { color: var(--text-mute); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-clock {
  font-size: 11px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

/* ─── Main content ──────────────────────────────────────────── */
.content {
  grid-area: content;
  padding: 24px 32px 64px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  transition: background var(--t), border-color var(--t), color var(--t);
  white-space: nowrap;
}
.btn:hover { background: var(--hover-lift); border-color: var(--border-strong); }
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text);
}
.btn--primary:hover { background: var(--accent-light); border-color: var(--accent-light); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn--ghost:hover { background: var(--hover-lift); color: var(--text); border-color: transparent; }
.btn--danger { color: var(--danger); border-color: rgba(184,92,92,0.25); background: transparent; }
.btn--danger:hover { background: rgba(184,92,92,0.08); border-color: rgba(184,92,92,0.4); color: var(--danger); }
.btn--lg { padding: 9px 16px; font-size: 13px; }
.btn--sm { padding: 4px 10px; font-size: 11px; }
.btn i { width: 13px; height: 13px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Pill-style links (used in playbook stage links) */
.btn--pill {
  background: var(--panel-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px 5px 12px;
  font-size: 11px;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn--pill:hover { color: var(--text); border-color: var(--border-strong); background: var(--hover-lift); }
.btn--pill i { width: 11px; height: 11px; opacity: 0.7; }

/* Icon-only button */
.btn--icon {
  padding: 6px;
  min-width: 26px;
  height: 26px;
  justify-content: center;
}
.btn--icon i { width: 13px; height: 13px; }

/* ─── Forms ─────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
}
.input, select.input, textarea.input {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  outline: none;
  color: var(--text);
  font-size: 13px;
  transition: border-color var(--t), box-shadow var(--t);
  width: 100%;
}
.input:hover, textarea.input:hover, select.input:hover { border-color: var(--border-strong); }
.input:focus, textarea.input:focus, select.input:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea.input { resize: vertical; min-height: 72px; line-height: 1.5; }
select.input {
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238a8a90' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}
.input--sm { padding: 5px 9px; font-size: 12px; }

/* ─── Cards / panels ────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-title { font-size: 13px; font-weight: 600; margin: 0 0 14px; letter-spacing: -0.005em; }
.card-sub { font-size: 12px; color: var(--text-dim); margin: 0 0 12px; }

/* ─── Heading hierarchy ─────────────────────────────────────── */
.h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.h2 { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; margin: 0 0 8px; }
.h3 { font-size: 12px; font-weight: 600; margin: 0 0 4px; color: var(--text); letter-spacing: 0; }
.subtitle { font-size: 12px; color: var(--text-dim); margin: 4px 0 24px; line-height: 1.5; }

/* ─── Dashboard ─────────────────────────────────────────────── */
.greeting {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.greeting-time { color: var(--text-mute); font-weight: 400; font-size: 13px; font-variant-numeric: tabular-nums; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0 24px;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--t), background var(--t);
}
.metric:hover { border-color: var(--border-strong); }
.metric-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}
.metric-label i { width: 12px; height: 12px; opacity: 0.6; }
.metric-value {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Quick actions: icon left, title + subtitle, arrow right */
.quick-actions { display: flex; flex-direction: column; gap: 2px; }
.quick-action {
  display: grid;
  grid-template-columns: 28px 1fr 14px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--t);
}
.quick-action:hover { background: var(--hover-lift); }
.qa-icon {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
}
.qa-icon i { width: 14px; height: 14px; }
.qa-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qa-title { font-size: 13px; font-weight: 500; color: var(--text); }
.qa-sub { font-size: 11px; color: var(--text-mute); letter-spacing: 0.01em; }
.qa-arrow { color: var(--text-mute); width: 14px; height: 14px; transition: transform var(--t), color var(--t); }
.quick-action:hover .qa-arrow { color: var(--text-dim); transform: translateX(2px); }

/* Today's hit list — refined list, not boxes */
.hitlist { display: flex; flex-direction: column; }
.hitlist-row {
  display: grid;
  grid-template-columns: 1fr auto 14px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  transition: padding-left var(--t);
}
.hitlist-row:last-child { border-bottom: 0; }
.hitlist-row:hover { padding-left: 4px; }
.hitlist-name { font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.3; }
.hitlist-meta { font-size: 11px; color: var(--text-mute); margin-top: 2px; }
.hitlist-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent-light);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.hitlist-row i { color: var(--text-mute); width: 14px; height: 14px; }

/* Recent activity feed */
.activity-list { display: flex; flex-direction: column; }
.activity-row {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: baseline;
}
.activity-row:last-child { border-bottom: 0; }
.activity-row .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-light);
  align-self: center;
}
.activity-row .text { color: var(--text); line-height: 1.4; }
.activity-row .text strong { font-weight: 500; }
.activity-row .text .note { color: var(--text-dim); font-size: 12px; }
.activity-row .when {
  color: var(--text-mute);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 12px;
  color: var(--text-mute);
  font-size: 12px;
  text-align: center;
}
.empty-state i { width: 18px; height: 18px; opacity: 0.5; }

/* ─── CRM ──────────────────────────────────────────────────── */
.crm-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 14px;
}
.crm-toolbar .input,
.crm-toolbar select.input {
  padding: 6px 10px;
  font-size: 12px;
  height: 32px;
}
.crm-toolbar .input.crm-search { flex: 1 1 220px; min-width: 200px; max-width: 280px; }
.crm-toolbar select.input { flex: 0 1 130px; min-width: 120px; }
.crm-toolbar select.input:last-child { flex: 0 1 150px; }

.crm-table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.crm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.crm-table th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  white-space: nowrap;
}
.crm-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  height: 56px;
}
.crm-table tr { cursor: pointer; transition: background var(--t); }
.crm-table tbody tr:hover { background: var(--hover-lift); }
.crm-table tr:last-child td { border-bottom: 0; }
.crm-table .col-name { min-width: 200px; }
.crm-table .col-name .name { font-weight: 500; color: var(--text); line-height: 1.2; }
.crm-table .col-name .id {
  display: block;
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0;
}
.crm-table .col-dim { color: var(--text-dim); }
.crm-table .col-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
}
.crm-table .col-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-mute);
}
.crm-table .col-num.high { color: var(--accent-light); font-weight: 500; }
.crm-table .empty-cell { color: var(--text-faint); }
.crm-row-actions {
  display: inline-flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--t);
}
.crm-table tbody tr:hover .crm-row-actions { opacity: 1; }
.crm-empty { padding: 56px 20px; text-align: center; color: var(--text-mute); font-size: 13px; }

/* ─── Pills / badges ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  background: var(--accent-soft);
  color: var(--text-dim);
  white-space: nowrap;
  line-height: 1;
}
.badge-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: rgba(255,255,255,0.04);
  color: var(--text-dim);
  min-width: 22px;
  justify-content: center;
  padding: 0 6px;
}
.badge-status.active { background: var(--accent-soft); color: var(--text); }

.badge-temp { padding: 0 9px 0 7px; background: rgba(255,255,255,0.04); }
.badge-temp::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  flex-shrink: 0;
}
.badge-temp.hot  { color: var(--hot); }
.badge-temp.warm { color: var(--warm); }
.badge-temp.cold { color: var(--cold); }

.badge-grade {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  background: rgba(255,255,255,0.04);
  padding: 0 7px;
  letter-spacing: 0;
}
.badge-grade.a { color: var(--success); }
.badge-grade.b { color: #88b888; }
.badge-grade.c { color: var(--warm); }
.badge-grade.d { color: var(--hot); }
.badge-grade.f { color: var(--danger); }

.empty-dash { color: var(--text-faint); font-size: 13px; }

/* ─── Slide-in panel ────────────────────────────────────────── */
.panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  z-index: 90;
  opacity: 0;
  transition: opacity var(--t);
}
.panel-backdrop.show { opacity: 1; }
.panel {
  position: fixed;
  top: 0; right: 0;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--border);
  z-index: 100;
  transform: translateX(100%);
  transition: transform var(--t-spring);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.panel.show { transform: translateX(0); }
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-header .title { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.panel-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ─── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 9px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  z-index: 200;
  box-shadow: var(--shadow);
  transform: translateY(8px);
  opacity: 0;
  transition: transform var(--t), opacity var(--t);
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: rgba(91,140,90,0.4); }
.toast.error { border-color: rgba(184,92,92,0.4); }

/* ─── Quick palette (Cmd+K) ─────────────────────────────────── */
.palette {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  background: rgba(0,0,0,0.55);
}
.palette-card {
  width: 100%;
  max-width: 480px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.palette-card input {
  width: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.palette-results { list-style: none; margin: 0; padding: 4px; max-height: 360px; overflow-y: auto; }
.palette-results li {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.palette-results li.sel { background: var(--accent-soft); }
.palette-results li:hover { background: var(--hover-lift); }
.palette-results .meta { color: var(--text-mute); font-size: 11px; }

/* ─── Playbook ──────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: flex-start;
  margin: 20px 0 24px;
  padding: 4px 0 0;
}
.step {
  flex: 1;
  position: relative;
  cursor: pointer;
  text-align: center;
  padding: 0 4px;
  user-select: none;
}
.step::before {
  content: '';
  position: absolute;
  left: calc(-50% + 14px);
  right: calc(50% + 14px);
  top: 6px;
  height: 1px;
  background: var(--border);
}
.step.completed::before { background: var(--accent-light); }
.step:first-child::before { display: none; }
.step-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  margin: 0 auto;
  position: relative;
  z-index: 1;
  transition: background var(--t), border-color var(--t), transform var(--t);
}
.step:hover .step-dot { border-color: var(--text-dim); }
.step.completed .step-dot {
  background: var(--accent-light);
  border-color: var(--accent-light);
}
.step.active .step-dot {
  background: var(--accent-light);
  border-color: var(--accent-light);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.step-n {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-mute);
  margin-top: 8px;
  letter-spacing: 0;
}
.step-title {
  display: block;
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px;
  color: var(--text-dim);
  line-height: 1.3;
  min-height: 28px;
}
.step.active .step-title { color: var(--text); }
.step.active .step-n { color: var(--accent-light); }

.stage-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}
.stage-card h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.stage-card h2 .stage-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-mute);
  font-weight: 500;
  letter-spacing: 0;
}
.stage-card .goal {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 16px;
  font-style: italic;
  line-height: 1.5;
}
.stage-card h3 {
  font-size: 11px;
  font-weight: 600;
  margin: 16px 0 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.stage-card ul, .stage-card ol { margin: 0 0 12px; padding: 0 0 0 18px; }
.stage-card li { font-size: 13px; margin: 4px 0; line-height: 1.55; }
.stage-card .links-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
  align-items: center;
}
.warning {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  background: rgba(184,92,92,0.08);
  border: 1px solid rgba(184,92,92,0.18);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
}
.warning i { width: 12px; height: 12px; color: var(--danger); flex-shrink: 0; }
.warning-block {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(184,92,92,0.08);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin: 12px 0;
  line-height: 1.5;
}
.warning-block i { width: 14px; height: 14px; flex-shrink: 0; color: var(--danger); margin-top: 2px; }

.kickoff-prompt {
  background: var(--panel-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-dim);
  margin: 8px 0 12px;
  white-space: pre-wrap;
}

/* Path subtitles + nested sections (used by Stage 9 Path C) */
.stage-card .path-sub {
  font-size: 12px;
  color: var(--text-mute);
  margin: 0 0 12px;
  font-style: italic;
  line-height: 1.5;
}
.stage-card .path-section {
  margin: 14px 0 16px;
  padding: 12px 14px;
  background: var(--panel-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.stage-card .path-section-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
  letter-spacing: -0.005em;
  text-transform: none;
}
.stage-card .path-section-sub {
  font-size: 11px;
  color: var(--text-mute);
  margin: 0 0 8px;
  font-style: italic;
}
.stage-card .path-section-body {
  font-size: 13px;
  color: var(--text);
  margin: 0;
  line-height: 1.6;
}
.stage-card .path-section ol {
  margin: 6px 0 0;
  padding-left: 22px;
}
.stage-card .path-section ol li { margin: 4px 0; }
.stage-card .path-section .script-line { margin: 6px 0 0; }

.danger-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 0;
}
.danger-list .warning-block {
  margin: 0;
  font-size: 12px;
  padding: 9px 12px;
}
.danger-list .warning-block i { width: 13px; height: 13px; margin-top: 1px; }

/* ─── Phone script ──────────────────────────────────────────── */
.script-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 4px;
  overflow: hidden;
  transition: border-color var(--t);
}
.script-section:hover { border-color: var(--border-strong); }
.script-section[open] { margin-bottom: 8px; }
.script-section summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 16px;
  font-weight: 500;
  font-size: 13px;
  user-select: none;
  color: var(--text);
}
.script-section summary::-webkit-details-marker { display: none; }
.script-section summary::after {
  content: '';
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--text-mute);
  border-bottom: 1.5px solid var(--text-mute);
  transform: rotate(-45deg);
  transition: transform var(--t);
  margin-right: 4px;
}
.script-section[open] summary::after { transform: rotate(45deg); }
.script-body { padding: 0 16px 14px; }
.script-line {
  background: var(--panel-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 6px 0;
  font-size: 13px;
  line-height: 1.6;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}
.script-line .copy-btn {
  background: transparent;
  border: 0;
  color: var(--text-mute);
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--t), background var(--t);
}
.script-line .copy-btn i { width: 12px; height: 12px; }
.script-line .copy-btn:hover { color: var(--text); background: var(--hover-lift); }
.script-line.note { background: transparent; border-color: transparent; padding: 4px 0; color: var(--text-mute); font-size: 12px; }

.reminder {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-strong);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.4;
}
.reminder i { width: 13px; height: 13px; color: var(--accent-light); flex-shrink: 0; }

/* ─── Email templates ───────────────────────────────────────── */
.templates-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  align-items: start;
}
.tpl-list {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 6px;
  position: sticky;
  top: calc(var(--topbar-h) + 24px);
}
.tpl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background var(--t), color var(--t);
  border-bottom: 1px solid transparent;
}
.tpl-item:hover { background: var(--hover-lift); color: var(--text); }
.tpl-item.active { background: var(--accent-soft); color: var(--text); }
.tpl-item .num {
  display: inline-block;
  width: 22px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0;
}
.tpl-item.active .num { color: var(--accent-light); }
.tpl-detail {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}
.tpl-subject {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.tpl-subject .label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 600;
}
.tpl-subject .text {
  font-size: 15px;
  color: var(--text);
  font-weight: 400;
  line-height: 1.4;
}
.tpl-body {
  background: var(--panel-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  color: var(--text);
}
.tpl-body .field-bracket {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-light);
  padding: 0 5px;
  border-radius: 3px;
  font-weight: 500;
}
.tpl-fills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--panel-elev);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.tpl-fills .field-label { font-size: 10px; }
.tpl-fills .input { padding: 6px 9px; font-size: 12px; }
.tpl-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 14px;
  justify-content: flex-end;
}
.tpl-note {
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(224,184,92,0.06);
  border-left: 2px solid var(--warm);
  padding: 8px 12px;
  margin-bottom: 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.5;
}

/* ─── Contracts ─────────────────────────────────────────────── */
.contract-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.contract-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
  position: relative;
  overflow: hidden;
}
.contract-card:hover { background: var(--hover-lift); border-color: var(--border-strong); }
.contract-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.contract-card.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent-light);
}
.contract-card .h2 { font-size: 13px; margin: 0 0 4px; }
.contract-card .desc { color: var(--text-mute); font-size: 11px; margin: 0; line-height: 1.4; }

.contract-detail {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 16px;
  align-items: start;
}
.contract-body {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  font-size: 13px;
  line-height: 1.75;
  white-space: pre-wrap;
  color: var(--text);
  font-family: 'Inter', sans-serif;
}
.contract-body .contract-head {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-light);
  font-weight: 600;
  margin: 18px 0 6px;
  font-family: 'Inter', sans-serif;
}
.contract-body .contract-head:first-child { margin-top: 0; }
.contract-body .contract-title {
  display: block;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 12px;
  text-align: center;
  font-family: 'Inter', sans-serif;
}

.contract-fills {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: sticky;
  top: calc(var(--topbar-h) + 24px);
}
.contract-fills .h3 {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 600;
  margin: 0 0 10px;
}
.contract-fills .field { margin-bottom: 8px; }
.contract-fills .field-label { font-size: 10px; }
.contract-fills .input { padding: 6px 9px; font-size: 12px; }
.contract-fills .actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.contract-fills .actions .btn { justify-content: center; }

/* ─── Pricing ───────────────────────────────────────────────── */
.pricing-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}
.pricing-section { margin-bottom: 20px; }
.pricing-section h2 {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  margin: 0 0 10px;
}
.tier-grid {
  display: grid;
  gap: 8px;
}
.tier-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tier-grid.cols-addons { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.tier-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  text-align: left;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
  position: relative;
}
.tier-card:hover { background: var(--hover-lift); border-color: var(--border-strong); }
.tier-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.tier-cap {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin: 0;
  font-weight: 600;
}
.tier-card.active .tier-cap { color: var(--accent-light); }
.tier-price {
  font-size: 18px;
  font-weight: 600;
  margin: 3px 0 1px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.tier-price .suffix { font-size: 11px; color: var(--text-mute); font-weight: 400; }
.tier-detail { font-size: 11px; color: var(--text-mute); margin: 0; line-height: 1.4; }

.addon-card { padding: 10px 14px; min-height: 64px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.addon-card .addon-cap {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
.addon-card.active .addon-cap { color: var(--accent-light); }
.addon-card .addon-name { font-size: 12px; font-weight: 500; color: var(--text); line-height: 1.3; }
.addon-card .addon-note { font-size: 11px; color: var(--text-mute); }

.summary {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: sticky;
  top: calc(var(--topbar-h) + 24px);
}
.summary-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin: 0 0 14px;
  font-weight: 600;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 1.4;
}
.summary-row .label { color: var(--text-dim); }
.summary-row .value { font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text); }
.summary-row .value.dim { color: var(--text-mute); }
.summary-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}
.summary-row.total .label { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; }
.summary-row.total .value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.summary-row.subtle { font-size: 11px; }
.summary-row.subtle .label, .summary-row.subtle .value { color: var(--text-mute); }
.summary-row.year1 .value { color: var(--accent-light); font-weight: 500; }
.summary-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.summary-actions .btn { justify-content: center; }

.self-hosted-note { font-size: 11px; color: var(--text-mute); margin: 12px 0 0; line-height: 1.5; }

/* ─── Reference tabs ────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin: 16px 0 24px;
}
.tab {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-mute);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color var(--t), border-color var(--t);
  letter-spacing: 0.005em;
}
.tab:hover { color: var(--text-dim); }
.tab.active { color: var(--text); border-bottom-color: var(--accent-light); }

.ref-section { margin-bottom: 28px; }
.ref-section h2 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 12px;
  letter-spacing: -0.005em;
  color: var(--text);
}
.ref-section ul { margin: 0; padding: 0 0 0 16px; }
.ref-section li { font-size: 13px; line-height: 1.6; margin: 2px 0; color: var(--text); }
.ref-section dl { margin: 0; }
.ref-section dt {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-top: 10px;
  font-weight: 600;
}
.ref-section dd { margin: 2px 0 0; font-size: 13px; line-height: 1.5; color: var(--text); }
.ref-section .ref-quote {
  background: var(--panel-elev);
  border-left: 2px solid var(--accent-light);
  padding: 10px 14px;
  font-size: 13px;
  font-style: italic;
  color: var(--text-dim);
  margin: 8px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.5;
}
.ref-section .body { font-size: 13px; line-height: 1.65; color: var(--text); margin: 0 0 8px; }
.ref-section .footer-note { font-size: 12px; color: var(--text-mute); margin-top: 8px; font-style: italic; line-height: 1.5; }

.ref-section .links a { color: var(--accent-light); }
.ref-section .links a:hover { text-decoration: underline; }

.flagship-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.flagship-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color var(--t), background var(--t);
}
.flagship-card:hover { border-color: var(--border-strong); background: var(--hover-lift); }
.flagship-card .name { font-weight: 600; font-size: 13px; color: var(--text); }
.flagship-card .kind { color: var(--text-dim); font-size: 11px; }
.flagship-card a {
  color: var(--text-mute);
  font-size: 10px;
  word-break: break-all;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 4px;
}
.flagship-card a:hover { color: var(--accent-light); }

.checks { list-style: none; margin: 0; padding: 0; }
.checks li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 13px;
  color: var(--text);
}
.checks li.done { color: var(--text-mute); text-decoration: line-through; text-decoration-color: var(--text-faint); }
.checks li::before {
  content: "";
  width: 14px; height: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
  background: var(--panel);
}
.checks li.done::before {
  background: var(--success);
  border-color: var(--success);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230F0F14' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: 10px;
  background-repeat: no-repeat;
  background-position: center;
}

/* ─── Bottom nav (mobile) ───────────────────────────────────── */
.bottom-nav { display: none; }

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "content";
  }
  .sidebar { display: none; }
  .topbar { padding: 0 16px; }
  .topbar-search { max-width: 100%; }
  .content { padding: 16px 16px 88px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid, .pricing-layout, .templates-layout, .contract-detail { grid-template-columns: 1fr; }
  .stepper { flex-wrap: wrap; gap: 12px 0; }
  .step { flex: 0 0 25%; }
  .step::before { display: none; }
  .step-title { min-height: 0; }
  .crm-table { font-size: 12px; }
  .crm-table .col-hide-mobile { display: none; }
  .crm-table td { height: 52px; }
  .panel { max-width: 100%; }
  .bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    display: flex;
    justify-content: space-around;
    background: var(--panel);
    border-top: 1px solid var(--border);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 50;
  }
  .bnav-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    color: var(--text-mute);
    transition: color var(--t);
  }
  .bnav-item.active { color: var(--accent-light); }
  .bnav-item i { width: 18px; height: 18px; }
  .contract-fills, .summary, .tpl-list { position: static; }
  .tier-grid.cols-3 { grid-template-columns: 1fr; }
  .tpl-fills { grid-template-columns: 1fr; }
}

/* ─── Skeleton loading ──────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--panel) 0%, var(--panel-hover) 50%, var(--panel) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Helpers ───────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.muted { color: var(--text-dim); }
.mute-faint { color: var(--text-faint); }
.flex-1 { flex: 1; }
.text-mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
[hidden] { display: none !important; }
