/* =============================================================
   PROCESS ENGINE — Tokens + base styles
   Atlas CRM design language: 4 themes × 2 densities, sans-only,
   pure white surfaces on cool gray backgrounds.
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;0,6..72,600;0,6..72,700;1,6..72,400&display=swap');

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font: inherit; color: inherit; outline: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: var(--letter-display); font-family: var(--font-display); }
p { margin: 0; }
::selection { background: var(--accent-soft-2); color: var(--text-strong); }

/* ============================================================
   THEME: Coral (default — Hubspot-warm)
   ============================================================ */
:root,
[data-theme="coral"] {
  --accent: #ff7a59;
  --accent-hover: #ee5d3a;
  --accent-soft: #fff1ec;
  --accent-soft-2: #ffe3d9;
  --accent-fg: #ffffff;
  --accent-ring: rgba(255,122,89,0.22);

  --bg: #f5f8fa;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-hover: #f5f8fa;
  --sidebar-bg: #ffffff;
  --sidebar-fg: #213343;
  --sidebar-item-hover: #f5f8fa;
  --sidebar-item-active-bg: #fff1ec;
  --sidebar-item-active-fg: #ee5d3a;

  --text: #213343;
  --text-strong: #0f2236;
  --text-2: #33475b;
  --text-muted: #516f90;
  --text-faint: #99acc2;
  --border: #e5eaf0;
  --border-strong: #cbd6e2;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(33,51,67,0.04);
  --shadow: 0 4px 12px rgba(33,51,67,0.06);
  --shadow-lg: 0 14px 36px rgba(33,51,67,0.10);
  --shadow-panel: 0 16px 48px rgba(33,51,67,0.16), 0 4px 12px rgba(33,51,67,0.08);

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;
  --letter-tight: -0.005em;
  --letter-display: -0.02em;

  --success: #00bf8c;
  --success-soft: #e0f6ee;
  --warning: #f5a623;
  --warning-soft: #fcf2dc;
  --danger: #ef4444;
  --danger-soft: #fde8e8;
  --info: #2596be;
  --info-soft: #e1f0f6;

  /* Phase colors — saturated, layered on the cool palette */
  --phase-1: #2596be;        /* Before — info blue */
  --phase-1-soft: #e1f0f6;
  --phase-1-ink: #0e6585;

  --phase-2: #0d9488;        /* During — teal */
  --phase-2-soft: #ccfbf1;
  --phase-2-ink: #134e4a;

  --phase-3: #00bf8c;        /* After — green */
  --phase-3-soft: #e0f6ee;
  --phase-3-ink: #07634a;

  --phase-4: #f5a623;
  --phase-4-soft: #fcf2dc;
  --phase-4-ink: #92400e;

  --phase-5: #7c3aed;
  --phase-5-soft: #ede9fe;
  --phase-5-ink: #4c1d95;

  --phase-6: #db2777;
  --phase-6-soft: #fce7f3;
  --phase-6-ink: #831843;

  /* Status (map to Atlas semantic colors) */
  --status-draft: #516f90;
  --status-draft-bg: #f0f3f7;
  --status-stable: #00bf8c;
  --status-stable-bg: #e0f6ee;
  --status-gap: #ef4444;
  --status-gap-bg: #fde8e8;
  --status-review: #f5a623;
  --status-review-bg: #fcf2dc;
}

/* ============================================================
   THEME: Mint (teal-forward, also Hubspot-warm)
   ============================================================ */
[data-theme="mint"] {
  --accent: #0d9488;
  --accent-hover: #0b7a70;
  --accent-soft: #e6f6f3;
  --accent-soft-2: #c9ebe5;
  --accent-fg: #ffffff;
  --accent-ring: rgba(13,148,136,0.22);

  --bg: #f6faf9;
  --surface: #ffffff;
  --surface-2: #f4f9f8;
  --surface-hover: #eef6f4;
  --sidebar-bg: #ffffff;
  --sidebar-fg: #0f2e2a;
  --sidebar-item-hover: #eef6f4;
  --sidebar-item-active-bg: #e6f6f3;
  --sidebar-item-active-fg: #0b7a70;

  --text: #0f2e2a;
  --text-strong: #062320;
  --text-2: #2a4742;
  --text-muted: #4f6c66;
  --text-faint: #8aa39c;
  --border: #dceae6;
  --border-strong: #b9d3cc;

  --radius-sm: 7px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(15,46,42,0.04);
  --shadow: 0 4px 14px rgba(15,46,42,0.06);
  --shadow-lg: 0 16px 40px rgba(15,46,42,0.10);
  --shadow-panel: 0 20px 56px rgba(15,46,42,0.18), 0 4px 14px rgba(15,46,42,0.10);

  --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;
  --letter-tight: -0.005em;
  --letter-display: -0.022em;

  --success: #10b981;
  --success-soft: #d1fae5;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #0891b2;
  --info-soft: #cffafe;

  --phase-1: #0891b2;
  --phase-1-soft: #cffafe;
  --phase-1-ink: #075f7a;
  --phase-2: #0d9488;
  --phase-2-soft: #e6f6f3;
  --phase-2-ink: #064e44;
  --phase-3: #10b981;
  --phase-3-soft: #d1fae5;
  --phase-3-ink: #064e3b;
  --phase-4: #d97706;
  --phase-4-soft: #fef3c7;
  --phase-4-ink: #78350f;
  --phase-5: #7c3aed;
  --phase-5-soft: #ede9fe;
  --phase-5-ink: #4c1d95;
  --phase-6: #db2777;
  --phase-6-soft: #fce7f3;
  --phase-6-ink: #831843;

  --status-draft: #4f6c66;
  --status-draft-bg: #eef6f4;
  --status-stable: #10b981;
  --status-stable-bg: #d1fae5;
  --status-gap: #dc2626;
  --status-gap-bg: #fee2e2;
  --status-review: #d97706;
  --status-review-bg: #fef3c7;
}

/* ============================================================
   THEME: Indigo (Linear-crisp)
   ============================================================ */
[data-theme="indigo"] {
  --accent: #5e6ad2;
  --accent-hover: #4f5ac7;
  --accent-soft: #eef0fb;
  --accent-soft-2: #dee2f6;
  --accent-fg: #ffffff;
  --accent-ring: rgba(94,106,210,0.22);

  --bg: #fafbfc;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-hover: #f1f2f5;
  --sidebar-bg: #f7f8fa;
  --sidebar-fg: #1c1f2a;
  --sidebar-item-hover: #eceef2;
  --sidebar-item-active-bg: #ffffff;
  --sidebar-item-active-fg: #0b0d12;

  --text: #0b0d12;
  --text-strong: #000000;
  --text-2: #2a2e3a;
  --text-muted: #5d6478;
  --text-faint: #9ca0ae;
  --border: #eaecf0;
  --border-strong: #d4d6dd;

  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(15,17,26,0.04);
  --shadow: 0 2px 8px rgba(15,17,26,0.06);
  --shadow-lg: 0 12px 32px rgba(15,17,26,0.12);
  --shadow-panel: 0 16px 48px rgba(15,17,26,0.18), 0 4px 12px rgba(15,17,26,0.10);

  --font-sans: 'Geist', system-ui, sans-serif;
  --font-display: 'Geist', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;
  --letter-tight: -0.008em;
  --letter-display: -0.025em;

  --success: #2c8e60;
  --success-soft: #e7f4ec;
  --warning: #c08114;
  --warning-soft: #faf0d8;
  --danger: #d04848;
  --danger-soft: #fbe9e9;
  --info: #3072c6;
  --info-soft: #e4eef9;

  --phase-1: #3072c6;
  --phase-1-soft: #e4eef9;
  --phase-1-ink: #1c4985;
  --phase-2: #2c8e8a;
  --phase-2-soft: #e0f0ee;
  --phase-2-ink: #134e4a;
  --phase-3: #2c8e60;
  --phase-3-soft: #e7f4ec;
  --phase-3-ink: #14532d;
  --phase-4: #c08114;
  --phase-4-soft: #faf0d8;
  --phase-4-ink: #78350f;
  --phase-5: #6f5fc4;
  --phase-5-soft: #ede9fe;
  --phase-5-ink: #4c1d95;
  --phase-6: #b94082;
  --phase-6-soft: #fce7f3;
  --phase-6-ink: #831843;

  --status-draft: #5d6478;
  --status-draft-bg: #f0f1f4;
  --status-stable: #2c8e60;
  --status-stable-bg: #e7f4ec;
  --status-gap: #d04848;
  --status-gap-bg: #fbe9e9;
  --status-review: #c08114;
  --status-review-bg: #faf0d8;
}

/* ============================================================
   THEME: Graphite (mono / editorial)
   ============================================================ */
[data-theme="graphite"] {
  --accent: #18181b;
  --accent-hover: #27272a;
  --accent-soft: #f4f4f5;
  --accent-soft-2: #e7e5e4;
  --accent-fg: #ffffff;
  --accent-ring: rgba(24,24,27,0.18);

  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f6f6f4;
  --surface-hover: #f1f1ef;
  --sidebar-bg: #ffffff;
  --sidebar-fg: #18181b;
  --sidebar-item-hover: #f4f4f5;
  --sidebar-item-active-bg: #18181b;
  --sidebar-item-active-fg: #ffffff;

  --text: #18181b;
  --text-strong: #09090b;
  --text-2: #3f3f46;
  --text-muted: #71717a;
  --text-faint: #a1a1aa;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;

  --radius-sm: 3px;
  --radius: 5px;
  --radius-lg: 8px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 2px 6px rgba(0,0,0,0.05);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.10);
  --shadow-panel: 0 16px 40px rgba(0,0,0,0.16), 0 4px 10px rgba(0,0,0,0.08);

  --font-sans: 'Geist', system-ui, sans-serif;
  --font-display: 'Geist', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;
  --letter-tight: -0.006em;
  --letter-display: -0.028em;

  --success: #166534;
  --success-soft: #ecf3ec;
  --warning: #92400e;
  --warning-soft: #fbf3e6;
  --danger: #991b1b;
  --danger-soft: #f7e8e8;
  --info: #1e40af;
  --info-soft: #eaeef7;

  --phase-1: #1e40af;
  --phase-1-soft: #eaeef7;
  --phase-1-ink: #1e3a8a;
  --phase-2: #115e59;
  --phase-2-soft: #e0efee;
  --phase-2-ink: #134e4a;
  --phase-3: #166534;
  --phase-3-soft: #ecf3ec;
  --phase-3-ink: #14532d;
  --phase-4: #92400e;
  --phase-4-soft: #fbf3e6;
  --phase-4-ink: #78350f;
  --phase-5: #5b21b6;
  --phase-5-soft: #ede9fe;
  --phase-5-ink: #4c1d95;
  --phase-6: #9d174d;
  --phase-6-soft: #fce7f3;
  --phase-6-ink: #831843;

  --status-draft: #71717a;
  --status-draft-bg: #f4f4f5;
  --status-stable: #166534;
  --status-stable-bg: #ecf3ec;
  --status-gap: #991b1b;
  --status-gap-bg: #f7e8e8;
  --status-review: #92400e;
  --status-review-bg: #fbf3e6;
}

/* ============================================================
   THEME: Editorial (cream paper, serif display — original look)
   ============================================================ */
[data-theme="editorial"] {
  --accent: #7C2D12;
  --accent-hover: #5E2210;
  --accent-soft: #FBE9E0;
  --accent-soft-2: #F5D5C4;
  --accent-fg: #FBFAF7;
  --accent-ring: rgba(124,45,18,0.20);

  --bg: #FBFAF7;
  --surface: #FBFAF7;
  --surface-2: #F5F3EE;
  --surface-hover: #EFEDE6;
  --sidebar-bg: #FBFAF7;
  --sidebar-fg: #1A1714;
  --sidebar-item-hover: #F5F3EE;
  --sidebar-item-active-bg: #EFEDE6;
  --sidebar-item-active-fg: #1A1714;

  --text: #1A1714;
  --text-strong: #1A1714;
  --text-2: #2F2A24;
  --text-muted: #58524A;
  --text-faint: #847C71;
  --border: #E6E1D6;
  --border-strong: #D5CEBE;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(26, 23, 20, 0.04);
  --shadow: 0 2px 8px rgba(26, 23, 20, 0.06), 0 1px 2px rgba(26, 23, 20, 0.04);
  --shadow-lg: 0 8px 24px rgba(26, 23, 20, 0.08), 0 2px 6px rgba(26, 23, 20, 0.04);
  --shadow-panel: 0 12px 48px rgba(26, 23, 20, 0.12), 0 4px 12px rgba(26, 23, 20, 0.06);

  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --letter-tight: -0.01em;
  --letter-display: -0.025em;

  --success: #16A34A;
  --success-soft: #DCFCE7;
  --warning: #D97706;
  --warning-soft: #FEF3C7;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --info: #2563EB;
  --info-soft: #DBEAFE;

  /* Saturated phase colors — the original editorial palette */
  --phase-1: #2563EB;
  --phase-1-soft: #DBEAFE;
  --phase-1-ink: #1E3A8A;
  --phase-2: #0D9488;
  --phase-2-soft: #CCFBF1;
  --phase-2-ink: #134E4A;
  --phase-3: #16A34A;
  --phase-3-soft: #DCFCE7;
  --phase-3-ink: #14532D;
  --phase-4: #D97706;
  --phase-4-soft: #FEF3C7;
  --phase-4-ink: #78350F;
  --phase-5: #7C3AED;
  --phase-5-soft: #EDE9FE;
  --phase-5-ink: #4C1D95;
  --phase-6: #DB2777;
  --phase-6-soft: #FCE7F3;
  --phase-6-ink: #831843;

  --status-draft: #847C71;
  --status-draft-bg: #EFEDE6;
  --status-stable: #16A34A;
  --status-stable-bg: #DCFCE7;
  --status-gap: #DC2626;
  --status-gap-bg: #FEE2E2;
  --status-review: #D97706;
  --status-review-bg: #FEF3C7;
}

/* Editorial overrides — serif display, looser radii, lighter weights */
[data-theme="editorial"] .page__title { font-weight: 400; }
[data-theme="editorial"] .stage-card__name { font-weight: 500; }
[data-theme="editorial"] .map-col__title { font-weight: 500; }
[data-theme="editorial"] .side-panel__title { font-weight: 500; }
[data-theme="editorial"] .step-hero__title { font-weight: 400; }
[data-theme="editorial"] .role-hero__title { font-weight: 400; font-style: italic; }
[data-theme="editorial"] .role-section__name { font-weight: 500; }
[data-theme="editorial"] .role-stage-group__title { font-weight: 500; }
[data-theme="editorial"] .variants-right__title { font-weight: 500; }
[data-theme="editorial"] .empty__title { font-weight: 500; }
[data-theme="editorial"] .header__logo { font-style: italic; font-weight: 600; }
[data-theme="editorial"] .header__name { font-weight: 500; }
[data-theme="editorial"] .stage-card[data-variant="numbered"] .stage-card__bignum { font-weight: 300; }
[data-theme="editorial"] .role-hero__icon { font-style: italic; font-weight: 500; }
[data-theme="editorial"] .prose blockquote { font-family: var(--font-display); font-style: italic; font-size: 17px; background: transparent; padding: 4px 16px; }

/* ============================================================
   DARK MODE (overlays on whichever theme)
   ============================================================ */
[data-mode="dark"] {
  --bg: #0a0b0d;
  --surface: #131418;
  --surface-2: #1a1c21;
  --surface-hover: #1f2128;
  --sidebar-bg: #0f1014;
  --sidebar-fg: #e8e9ed;
  --sidebar-item-hover: #1f2128;
  --sidebar-item-active-bg: #1a1c21;
  --sidebar-item-active-fg: #ffffff;

  --text: #e8e9ed;
  --text-strong: #ffffff;
  --text-2: #c2c4cc;
  --text-muted: #8a8f9c;
  --text-faint: #5d6478;
  --border: #25272d;
  --border-strong: #34373f;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 14px 36px rgba(0,0,0,0.6);
  --shadow-panel: 0 16px 48px rgba(0,0,0,0.7), 0 4px 12px rgba(0,0,0,0.5);
}

/* ============================================================
   DENSITY
   ============================================================ */
:root,
[data-density="comfortable"] {
  --row-h: 56px;
  --row-pad-y: 14px;
  --row-pad-x: 16px;
  --cell-pad-y: 14px;
  --section-gap: 24px;
  --fs-body: 14px;
  --fs-sm: 13px;
  --fs-xs: 11.5px;
  --fs-h1: 28px;
  --fs-h2: 20px;
  --card-pad: 18px;
}
[data-density="compact"] {
  --row-h: 38px;
  --row-pad-y: 8px;
  --row-pad-x: 12px;
  --cell-pad-y: 8px;
  --section-gap: 16px;
  --fs-body: 13px;
  --fs-sm: 12px;
  --fs-xs: 11px;
  --fs-h1: 22px;
  --fs-h2: 17px;
  --card-pad: 12px;
}

/* Focus ring */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  letter-spacing: var(--letter-tight);
}

/* Top header */
.header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
}
[data-density="compact"] .header { height: 48px; padding: 0 18px; }

.header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.header__logo {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-fg);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.04em;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.1);
}
[data-theme="graphite"] .header__logo { border-radius: var(--radius-sm); }
[data-theme="indigo"] .header__logo { border-radius: var(--radius-sm); }
.header__name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: var(--letter-display);
  color: var(--text-strong);
  white-space: nowrap;
  flex-shrink: 0;
}
.header__sep {
  color: var(--text-faint);
  font-weight: 300;
  user-select: none;
}
.header__product {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 600;
}
.header__nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 16px;
}
.header__nav a {
  padding: 6px 12px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: color .12s, background .12s;
}
.header__nav a:hover { color: var(--text); background: var(--surface-hover); }
.header__nav a.is-active { color: var(--text); background: var(--surface-hover); font-weight: 600; }
.header__spacer { flex: 1; }
.header__icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: background .12s, color .12s;
}
.header__icon-btn:hover { background: var(--surface-hover); color: var(--text); }

/* Tenant switcher */
.tenant-switcher { position: relative; }
.tenant-switcher__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color .12s, background .12s;
}
.tenant-switcher__trigger:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.tenant-switcher__swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08) inset;
}
.tenant-switcher__name { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.tenant-switcher__chev { color: var(--text-muted); }

.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  padding: 6px;
  z-index: 50;
  animation: dropdown-in 140ms cubic-bezier(.2,.7,.2,1);
}
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.dropdown__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  cursor: pointer;
  width: 100%;
  text-align: left;
  color: var(--text);
  font-weight: 500;
}
.dropdown__item:hover { background: var(--surface-hover); }
.dropdown__item.is-current { background: var(--surface-hover); }
.dropdown__item-meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.dropdown__sep { height: 1px; background: var(--border); margin: 4px 2px; }
.dropdown__footer-link {
  display: block;
  padding: 8px 10px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.dropdown__footer-link:hover { color: var(--text); background: var(--surface-hover); }

/* Filter bar */
.filterbar {
  position: sticky;
  top: 60px;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
}
[data-density="compact"] .filterbar { top: 48px; height: 40px; padding: 0 18px; }
.filterbar__label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  font-weight: 600;
}
.filterbar__right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Filter chip */
.fchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  color: var(--text);
  background: var(--surface);
  transition: border-color .12s, background .12s;
  font-weight: 500;
}
.fchip:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.fchip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
}
.fchip__label { color: var(--text-muted); font-weight: 500; }
.fchip__value { color: var(--text); font-weight: 600; }
.fchip.is-active .fchip__label,
.fchip.is-active .fchip__value { color: var(--accent-hover); }
.fchip__chev { opacity: 0.6; }

/* Page */
.page {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 64px;
}
.page-narrow {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}
[data-density="compact"] .page,
[data-density="compact"] .page-narrow { padding: 20px 18px 40px; }

.page__eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  margin-bottom: 12px;
  font-weight: 600;
}
.page__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h1);
  line-height: 1.1;
  letter-spacing: var(--letter-display);
  color: var(--text-strong);
  margin-bottom: 8px;
}
.page__subtitle {
  font-size: var(--fs-body);
  color: var(--text-muted);
  max-width: 64ch;
  line-height: 1.55;
}

/* Breadcrumb */
.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: 20px;
  flex-wrap: wrap;
  font-weight: 500;
}
.crumbs a:hover { color: var(--text); }
.crumbs__sep { color: var(--text-faint); }
.crumbs__current { color: var(--text); font-weight: 600; }

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
[data-theme="graphite"] .badge,
[data-theme="indigo"] .badge { border-radius: var(--radius-sm); padding: 2px 6px; }
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge--draft { color: var(--status-draft); background: var(--status-draft-bg); }
.badge--stable { color: var(--status-stable); background: var(--status-stable-bg); }
.badge--gap { color: var(--status-gap); background: var(--status-gap-bg); }
.badge--review { color: var(--status-review); background: var(--status-review-bg); }

/* Phase tag */
.phase-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--phase-c, var(--text-muted));
  font-weight: 700;
}
.phase-tag::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--phase-c, var(--text-muted));
}

/* Variant chips */
.vchip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.vchip--all {
  color: var(--text-faint);
  font-style: italic;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s, color .12s, transform .08s;
  white-space: nowrap;
}
.btn:active { transform: translateY(0.5px); }
.btn--primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06), inset 0 -1px 0 rgba(0,0,0,0.08);
}
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface);
}
.btn--ghost:hover { background: var(--surface-hover); }
.btn--text {
  color: var(--text-muted);
  padding: 6px 8px;
  font-weight: 500;
}
.btn--text:hover { color: var(--text); background: var(--surface-hover); }
.btn--danger {
  color: var(--danger);
  border-color: var(--border-strong);
  background: var(--surface);
}
.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn--sm { padding: 4px 10px; font-size: 12.5px; }
[data-density="compact"] .btn { padding: 5px 10px; }

/* ============================================================
   SIDE PANEL
   ============================================================ */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 34, 54, 0.32);
  z-index: 80;
  animation: fade-in 160ms ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(560px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-panel);
  z-index: 90;
  display: flex;
  flex-direction: column;
  animation: slide-in 240ms cubic-bezier(.2,.7,.2,1);
}
@keyframes slide-in {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.side-panel__header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.side-panel__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: var(--letter-display);
  color: var(--text-strong);
  flex: 1;
}
.side-panel__close {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: var(--text-muted);
}
.side-panel__close:hover { background: var(--surface-hover); color: var(--text); }
.side-panel__body { flex: 1; overflow-y: auto; padding: 22px; }
.side-panel__footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: var(--surface-2);
}

/* Form */
.field { margin-bottom: 18px; }
.field__label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.field__hint { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-body);
  transition: border-color .12s, box-shadow .12s;
  color: var(--text);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.textarea { resize: vertical; min-height: 100px; font-family: var(--font-mono); font-size: 13px; line-height: 1.55; }

/* Toast */
.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--text-strong);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  font-weight: 500;
  animation: toast-in 220ms cubic-bezier(.2,.7,.2,1);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast__icon { color: var(--success); }

/* Skeleton */
.skel {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-hover) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: skel-shimmer 1400ms linear infinite;
  border-radius: 4px;
}
@keyframes skel-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   PROCESS MAP
   ============================================================ */
.map-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 24px;
}
@media (max-width: 1000px) {
  .map-grid { grid-template-columns: 1fr; }
}

.map-col__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.map-col__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: var(--letter-display);
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 10px;
}
.map-col__count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  font-weight: 600;
}
.map-col__rule {
  height: 4px;
  background: var(--phase-c);
  width: 28px;
  border-radius: 2px;
  display: inline-block;
}
.map-col__tagline {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: -6px;
  margin-bottom: 16px;
}

.map-col__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Stage card */
.stage-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--card-pad);
  transition: border-color .14s, transform .14s, box-shadow .14s;
  position: relative;
  text-align: left;
  width: 100%;
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.stage-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.stage-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.stage-card__order {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  font-weight: 600;
}
.stage-card__name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: var(--letter-display);
  color: var(--text-strong);
  margin-bottom: 6px;
  line-height: 1.2;
}
.stage-card__desc {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}
.stage-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.stage-card__steps {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  font-weight: 600;
}
.stage-card__steps strong { color: var(--text-strong); font-weight: 700; }

/* Role coverage */
.coverage { display: flex; align-items: center; gap: 8px; }
.coverage__bar { display: flex; gap: 2px; height: 8px; }
.coverage__cell {
  width: 14px;
  height: 8px;
  border-radius: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
}
.coverage__cell.is-on {
  background: var(--phase-c, var(--accent));
  border-color: var(--phase-c, var(--accent));
}
.coverage__cell:hover::after {
  content: attr(data-role);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-strong);
  color: white;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  white-space: nowrap;
  z-index: 10;
  font-family: var(--font-sans);
  font-weight: 500;
}
.coverage__label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* Stage card variants */
.stage-card[data-variant="spine"] {
  padding-left: calc(var(--card-pad) + 6px);
}
.stage-card[data-variant="spine"]::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--phase-c);
}
.stage-card[data-variant="numbered"] {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  align-items: start;
}
.stage-card[data-variant="numbered"] .stage-card__bignum {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  color: var(--phase-c);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.stage-card[data-variant="tinted"] {
  background: color-mix(in oklab, var(--phase-c) 4%, var(--surface));
  border-color: color-mix(in oklab, var(--phase-c) 20%, var(--border));
}

/* ============================================================
   STAGE DETAIL
   ============================================================ */
.stage-hero {
  border-bottom: 1px solid var(--border);
  padding-bottom: 28px;
  margin-bottom: 28px;
}

.flow-strip {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  align-items: stretch;
}
.flow-strip__node {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  position: relative;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.flow-strip__node:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.flow-strip__node.is-current {
  background: var(--surface);
  border-color: var(--phase-c);
  box-shadow: inset 0 -3px 0 0 var(--phase-c);
}
.flow-strip__phase {
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--phase-c);
  font-weight: 700;
}
.flow-strip__name {
  font-size: 12.5px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flow-strip__node.is-current .flow-strip__name { color: var(--text-strong); }

.role-section { margin-bottom: 28px; }
.role-section.is-empty { opacity: 0.55; }
.role-section__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
}
.role-section__chev {
  color: var(--text-muted);
  transition: transform .16s;
}
.role-section.is-collapsed .role-section__chev { transform: rotate(-90deg); }
.role-section__name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: var(--letter-display);
  color: var(--text-strong);
}
.role-section__count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  font-weight: 600;
}
.role-section.is-empty .role-section__count::after {
  content: ' · No steps yet';
  color: var(--status-gap);
}
.role-section__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.role-section.is-collapsed .role-section__body { display: none; }

/* Step row */
.step-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: var(--row-pad-y) 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s;
  text-align: left;
  width: 100%;
}
.step-row:hover { background: var(--surface-hover); }
.step-row__num {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  font-weight: 600;
}
.step-row__main { min-width: 0; }
.step-row__title {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: 2px;
  letter-spacing: var(--letter-tight);
}
.step-row__preview {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.step-row__chips { display: flex; gap: 4px; flex-shrink: 0; }

/* ============================================================
   STEP DETAIL
   ============================================================ */
.step-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 48px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}
@media (max-width: 900px) {
  .step-page { grid-template-columns: 1fr; gap: 32px; }
}
.step-hero { margin-bottom: 32px; }
.step-hero__title {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1.1;
  letter-spacing: var(--letter-display);
  font-weight: 700;
  color: var(--text-strong);
  margin: 14px 0 16px;
  text-wrap: pretty;
}
.step-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.role-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text);
  padding: 3px 9px 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-weight: 600;
}
[data-theme="graphite"] .role-tag,
[data-theme="indigo"] .role-tag { border-radius: var(--radius-sm); }
.role-tag__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--role-c, var(--text-muted));
}

/* Prose */
.prose {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--text-2);
  font-family: var(--font-sans);
  max-width: 64ch;
  letter-spacing: var(--letter-tight);
}
.prose h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: var(--letter-display);
  color: var(--text-strong);
  margin: 32px 0 12px;
  line-height: 1.25;
}
.prose h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-strong);
  margin: 24px 0 8px;
}
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent-hover);
  border: 1px solid var(--border);
}
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 6px 18px;
  margin: 20px 0;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.prose a { color: var(--accent); border-bottom: 1px solid color-mix(in oklab, var(--accent) 40%, transparent); }
.prose a:hover { border-bottom-color: var(--accent); }
.prose strong { color: var(--text-strong); font-weight: 700; }

/* Right rail */
.rail {
  position: sticky;
  top: 124px;
  align-self: start;
}
[data-density="compact"] .rail { top: 96px; }
.rail__title {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  margin-bottom: 10px;
  font-weight: 700;
}
.linked-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 8px;
  transition: border-color .12s, background .12s, box-shadow .12s;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.linked-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.linked-card__type {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
}
.linked-card__title { font-size: 13.5px; font-weight: 600; color: var(--text-strong); letter-spacing: var(--letter-tight); }

.step-nav {
  display: flex;
  gap: 12px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.step-nav__btn {
  flex: 1;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  text-align: left;
  background: var(--surface);
}
.step-nav__btn:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.step-nav__btn--next { text-align: right; align-items: flex-end; }
.step-nav__btn--disabled { opacity: 0.4; pointer-events: none; }
.step-nav__dir {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  font-weight: 700;
}
.step-nav__title { font-size: var(--fs-body); font-weight: 600; color: var(--text-strong); }

/* ============================================================
   ROLE VIEW
   ============================================================ */
.role-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.role-hero__icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-lg);
  background: var(--role-c, var(--accent));
  color: white;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.12);
}
[data-theme="graphite"] .role-hero__icon { border-radius: var(--radius); }
.role-hero__title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: var(--letter-display);
  line-height: 1.1;
  color: var(--text-strong);
}
.role-hero__subtitle {
  font-size: var(--fs-body);
  color: var(--text-muted);
  margin-top: 4px;
}

.role-stage-group { margin-bottom: 28px; }
.role-stage-group__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}
.role-stage-group__phase {
  width: 3px;
  height: 18px;
  background: var(--phase-c);
  border-radius: 2px;
  align-self: center;
}
.role-stage-group__title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: var(--letter-display);
  color: var(--text-strong);
}
.role-stage-group__count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

/* ============================================================
   ADMIN
   ============================================================ */
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-top: 12px;
}
.admin-toolbar__left {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  font-weight: 600;
}
.admin-toolbar__right { margin-left: auto; display: flex; gap: 8px; }

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.table thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-weight: 700;
  padding: 12px var(--row-pad-x);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
[data-theme="graphite"] .table thead th,
[data-theme="indigo"] .table thead th { text-transform: none; letter-spacing: 0; font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 600; }
.table tbody td {
  padding: var(--cell-pad-y) var(--row-pad-x);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr.is-archived { color: var(--text-faint); }
.table tbody tr.is-archived td:nth-child(3) { text-decoration: line-through; }
.table tbody tr.is-dragging { background: var(--surface-2); opacity: 0.7; }

.drag-handle {
  display: inline-flex;
  width: 22px; height: 22px;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  cursor: grab;
  border-radius: 4px;
}
.drag-handle:hover { color: var(--text); background: var(--surface-2); }
.drag-handle:active { cursor: grabbing; }

.row-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity .12s;
}
.table tbody tr:hover .row-actions { opacity: 1; }
.row-action {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--text-muted);
}
.row-action:hover { background: var(--surface-hover); color: var(--text); }
.row-action--danger:hover { background: var(--danger-soft); color: var(--danger); }

.slug {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* Variants two-panel */
.variants-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  min-height: 540px;
  box-shadow: var(--shadow-sm);
}
@media (max-width: 800px) {
  .variants-shell { grid-template-columns: 1fr; }
}
.variants-left {
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  padding: 10px;
  overflow-y: auto;
}
.variants-left__head {
  padding: 8px 10px 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  font-weight: 700;
}
.dim-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 2px;
  position: relative;
}
.dim-item:hover { background: var(--surface-hover); }
.dim-item.is-active {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.dim-item.is-active::before {
  content: '';
  position: absolute;
  left: -1px; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
}
.dim-item__name { font-size: var(--fs-body); font-weight: 600; color: var(--text); }
.dim-item__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 600;
}

.variants-right { padding: 22px; }
.variants-right__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.variants-right__title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: var(--letter-display);
  color: var(--text-strong);
}
.variants-right__hint {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-left: auto;
}

.value-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.value-row:hover { background: var(--surface-hover); }
.value-row__name { font-size: var(--fs-body); font-weight: 600; color: var(--text-strong); }
.value-row__usage {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
  font-weight: 500;
}
.value-row__spacer { flex: 1; }

.confirm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  margin: 12px 0;
  font-size: 13px;
  color: var(--text-2);
}
.confirm-row strong { color: var(--danger); }

/* Markdown editor split */
.md-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.md-editor textarea {
  border: 0;
  border-radius: 0;
  border-right: 1px solid var(--border);
  min-height: 220px;
  background: var(--surface);
  outline: none;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  resize: vertical;
  color: var(--text);
}
.md-editor textarea:focus { box-shadow: none; }
.md-editor__preview {
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  background: var(--surface-2);
  overflow-y: auto;
  max-height: 360px;
}

/* Multi-select pills */
.multi-select {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-height: 44px;
}
.multi-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s, border-color .12s;
  color: var(--text);
  font-weight: 500;
}
.multi-pill:hover { background: var(--surface-hover); }
.multi-pill.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
  font-weight: 600;
}

/* Kbd */
.kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--text-muted);
  border-bottom-width: 2px;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.empty__title { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--text-strong); margin-bottom: 4px; letter-spacing: var(--letter-display); }
.empty__hint { font-size: 13px; }

/* Responsive */
@media (max-width: 700px) {
  .header { padding: 0 16px; gap: 12px; }
  .header__nav { display: none; }
  .page, .page-narrow { padding: 24px 16px 40px; }
  .filterbar { padding: 0 16px; overflow-x: auto; }
  .page__title { font-size: 24px; }
  .step-hero__title { font-size: 28px; }
  .step-page { padding: 20px 16px; }
  .map-grid { gap: 14px; }
}
