/* ==========================================================================
   Sigmafy Statistics — design tokens (light)
   Single source of truth. Every component reads these by name.
   Token families: surface · lines · text · semantic · elevation · layout · type
   ========================================================================== */

:root, [data-theme="light"] {
  /* Surface / chrome */
  --color-bg:          #ffffff;
  --color-bg-soft:     #f5f5f7;        /* Apple's signature off-white */
  --color-surface:     #ffffff;
  --color-surface-2:   #fbfbfd;
  --color-surface-3:   #f5f5f7;
  --color-topbar-bg:   rgba(255,255,255,0.72);
  --color-sidebar-bg:  rgba(251,251,253,0.72);
  --color-hover:       rgba(0,0,0,0.04);

  /* Lines */
  --color-border:        rgba(0,0,0,0.08);
  --color-border-subtle: rgba(0,0,0,0.05);

  /* Text */
  --color-fg:        #1d1d1f;
  --color-muted:     #6e6e73;
  --color-mute:      #86868b;

  /* Semantic */
  --color-accent:    #0071e3;
  --color-accent-2:  #5e9eff;
  --color-accent-3:  #00c7be;
  --color-accent-ink:#ffffff;
  --color-success:   #30d158;
  --color-warning:   #ff9f0a;
  --color-danger:    #ff3b30;
  --color-info:      #0a84ff;

  /* Elevation — soft, never heavy */
  --shadow-card:    0 1px 3px rgba(0,0,0,0.04), 0 8px 24px -12px rgba(0,0,0,0.08);
  --shadow-popover: 0 2px 6px rgba(0,0,0,0.06), 0 18px 40px -16px rgba(0,0,0,0.14);
  --shadow-pop:     0 4px 12px rgba(0,0,0,0.05), 0 24px 48px -16px rgba(0,0,0,0.18);
  --shadow-deep:    0 8px 28px -8px rgba(0,0,0,0.12), 0 40px 80px -24px rgba(0,0,0,0.18);

  /* Layout */
  --topbar-h: 56px;
  --sidebar-w: 272px;
  --section-y: clamp(72px, 10vw, 140px);
  --gutter: clamp(20px, 4vw, 40px);
  --max-w: 1100px;
  --max-w-wide: 1240px;

  /* Shape */
  --radius:      14px;
  --radius-sm:   10px;
  --radius-md:   16px;
  --radius-lg:   22px;
  --radius-xl:   28px;
  --radius-pill: 980px;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --text-display-xl: clamp(48px, 7vw, 84px);
  --text-display-lg: clamp(40px, 6vw, 72px);
  --text-display-md: clamp(32px, 4.5vw, 56px);
  --text-headline:   clamp(24px, 3vw, 36px);
  --text-title:      clamp(18px, 2vw, 22px);
  --text-body:       17px;
  --text-meta:       14px;
  --text-caption:    12px;
  --tracking-display: -0.022em;
  --tracking-tight:   -0.012em;

  /* ---- Backwards-compat aliases for existing components ---- */
  --bg:           var(--color-bg);
  --bg-soft:      var(--color-bg-soft);
  --bg-elevate:   var(--color-surface-2);
  --surface:      var(--color-surface);
  --border:       var(--color-border);
  --border-soft:  var(--color-border-subtle);
  --text:         var(--color-fg);
  --text-soft:    var(--color-muted);
  --text-mute:    var(--color-mute);
  --accent:       var(--color-accent);
  --accent-hover: #0077ed;
  --accent-soft:  color-mix(in srgb, var(--color-accent) 8%, transparent);
  --accent-ink:   var(--color-accent-ink);
  --success:      var(--color-success);
  --success-soft: color-mix(in srgb, var(--color-success) 12%, transparent);
  --warn:         var(--color-warning);
  --danger:       var(--color-danger);
  --danger-soft:  color-mix(in srgb, var(--color-danger) 8%, transparent);
  --h1: var(--text-display-lg);
  --h2: var(--text-headline);
  --h3: clamp(22px, 2.6vw, 32px);
  --h4: 20px;
  --body: var(--text-body);
  --small: var(--text-meta);
  --tight: var(--tracking-display);
  --tight-lg: -0.04em;
}

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent-soft); color: var(--text); }

/* ==========================================================================
   Layout primitives
   ========================================================================== */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gutter); }
.container-wide { max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: var(--section-y) 0; }
.section-tight { padding: clamp(48px, 7vw, 88px) 0; }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-soft);
}
.site-header-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 600; font-size: 17px;
  letter-spacing: var(--tight);
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, #0071e3 0%, #5e9eff 100%);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
}
.brand-meta { color: var(--text-mute); font-weight: 400; font-size: 13px; margin-left: 4px; }

.site-nav { display: flex; gap: 28px; align-items: center; }
.site-nav a {
  color: var(--text); font-size: 14px; font-weight: 400;
  letter-spacing: -0.01em;
}
.site-nav a:hover { color: var(--text-soft); }
@media (max-width: 760px) { .site-nav { display: none; } }

.site-cta {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--accent-ink);
  font-size: 14px; font-weight: 500;
  border: none; transition: background 0.15s;
}
.site-cta:hover { background: var(--accent-hover); color: var(--accent-ink); }
.site-cta.ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.site-cta.ghost:hover { background: var(--bg-soft); color: var(--text); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 26px; border-radius: var(--radius-pill);
  font-size: 16px; font-weight: 500; letter-spacing: -0.01em;
  border: 1px solid transparent; cursor: pointer; transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-link { background: transparent; color: var(--accent); padding: 4px 0; border-radius: 0; }
.btn-link:hover { text-decoration: underline; }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-lg { padding: 16px 34px; font-size: 17px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  text-align: center;
  padding: clamp(88px, 12vw, 160px) var(--gutter) clamp(56px, 8vw, 100px);
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-soft) 100%);
}
.hero-eyebrow {
  display: inline-block;
  font-size: 14px; font-weight: 500; color: var(--accent);
  letter-spacing: 0;
  margin-bottom: 14px;
}
.hero-title {
  font-size: var(--h1); font-weight: 700;
  letter-spacing: var(--tight-lg); line-height: 1.05;
  margin: 0 auto 22px; max-width: 18ch;
  color: var(--text);
}
.hero-sub {
  font-size: clamp(19px, 2vw, 24px); line-height: 1.4;
  color: var(--text-soft); margin: 0 auto 36px; max-width: 38ch;
  font-weight: 400; letter-spacing: -0.01em;
}
.hero-actions {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 56px;
}
.hero-shot {
  max-width: 1100px; margin: 0 auto;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}

/* ==========================================================================
   Section header (eyebrow + title + sub)
   ========================================================================== */
.section-head { text-align: center; margin: 0 auto clamp(56px, 7vw, 88px); max-width: 720px; }
.section-eyebrow {
  font-size: 14px; font-weight: 500; color: var(--accent);
  margin-bottom: 12px; letter-spacing: 0;
}
.section-title {
  font-size: var(--h2); font-weight: 700;
  letter-spacing: var(--tight-lg); line-height: 1.1; margin: 0 0 18px;
}
.section-sub {
  font-size: 19px; line-height: 1.5; color: var(--text-soft);
  font-weight: 400; margin: 0;
}

/* ==========================================================================
   Category grid (homepage + index)
   ========================================================================== */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 900px) { .cat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .cat-grid { grid-template-columns: 1fr; } }

.cat-card {
  position: relative;
  display: flex; flex-direction: column; gap: 14px;
  padding: 28px 26px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  text-decoration: none; color: var(--text);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  min-height: 200px;
}
.cat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border);
  color: var(--text);
}
.cat-card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: 22px;
}
.cat-card-title {
  font-size: 21px; font-weight: 600; letter-spacing: var(--tight);
  line-height: 1.2; margin: 0;
}
.cat-card-blurb {
  font-size: 15px; color: var(--text-soft); line-height: 1.5;
  margin: 0; flex: 1;
}
.cat-card-meta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-mute); font-weight: 500;
  margin-top: auto;
}
.cat-card-cta {
  font-size: 14px; font-weight: 500; color: var(--accent);
  display: inline-flex; align-items: center; gap: 4px;
  transition: gap 0.15s;
}
.cat-card:hover .cat-card-cta { gap: 7px; }

/* ==========================================================================
   Tool grid (per-category & search)
   ========================================================================== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 900px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .tool-grid { grid-template-columns: 1fr; } }

.tool-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px 22px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  text-decoration: none; color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  min-height: 140px;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border);
  color: var(--text);
}
.tool-title { font-size: 17px; font-weight: 600; letter-spacing: var(--tight); margin: 0; }
.tool-desc { font-size: 14px; line-height: 1.5; color: var(--text-soft); margin: 0; flex: 1;
             display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tool-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  padding: 4px 9px; border-radius: var(--radius-pill);
  align-self: flex-start;
}

/* ==========================================================================
   Tool runner
   ========================================================================== */
.runner-shell { padding: clamp(48px, 7vw, 88px) 0 clamp(64px, 8vw, 112px); }
.breadcrumb {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 14px; color: var(--text-mute); margin-bottom: 18px;
}
.breadcrumb a { color: var(--text-mute); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--border); }
.breadcrumb-current { color: var(--text); font-weight: 500; }

.runner-head { margin-bottom: 36px; }
.runner-title { font-size: clamp(32px, 4vw, 48px); font-weight: 700; letter-spacing: var(--tight-lg); line-height: 1.1; margin: 0 0 12px; }
.runner-sub { font-size: 18px; color: var(--text-soft); margin: 0; max-width: 56ch; }

.runner-grid {
  display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 32px;
}
@media (max-width: 900px) { .runner-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 26px 24px;
  box-shadow: var(--shadow-card);
}
.panel-title {
  font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-mute); margin: 0 0 18px;
}

/* Form fields */
.field { margin-bottom: 16px; }
/* Slice 17.3 — side-by-side data1/data2 textareas for two-sample tools */
.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.field-pair > .field { margin-bottom: 0; }
@media (max-width: 640px) {
  .field-pair { grid-template-columns: 1fr; }
}
.field-label {
  display: block; font-size: 14px; font-weight: 500;
  color: var(--text); margin-bottom: 6px; letter-spacing: -0.01em;
}
.field-help { font-size: 12px; color: var(--text-mute); margin-top: 4px; }
.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 80px; font-family: var(--font-mono); font-size: 13px; }
.textarea.large { min-height: 140px; }
.checkbox-row { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }

.run-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.btn-run {
  flex: 1; min-width: 140px;
  background: var(--accent); color: var(--accent-ink);
  padding: 12px 22px; border-radius: var(--radius-pill);
  border: none; font-size: 15px; font-weight: 500;
  transition: background 0.15s;
}
.btn-run:hover:not([disabled]) { background: var(--accent-hover); }
.btn-run[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--bg-soft); color: var(--text);
  padding: 12px 22px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); font-size: 14px; font-weight: 500;
}
.btn-secondary:hover { background: var(--border-soft); }

/* Results panel */
.result-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 80px 24px;
  color: var(--text-mute); font-size: 15px;
}
.result-empty-icon { font-size: 32px; opacity: 0.4; margin-bottom: 12px; }
.result-error {
  background: var(--danger-soft); color: var(--danger);
  padding: 14px 16px; border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 18px;
}
.plotly-host { width: 100%; min-height: 320px; }

/* Stat grid (used inside result panels) */
.stat-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px; margin: 16px 0;
}
@media (max-width: 600px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-cell {
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: center;
}
.stat-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-mute); margin-bottom: 4px;
}
.stat-value-lg {
  font-size: 20px; font-weight: 600; color: var(--text);
  letter-spacing: var(--tight); font-variant-numeric: tabular-nums;
}
.stat-pass { color: var(--success); }
.stat-fail { color: var(--danger); }
.stat-warn { color: var(--warn); }
.stat-banner {
  text-align: center;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  margin-bottom: 14px;
  font-size: 17px; font-weight: 600;
}
.stat-banner.pass { background: var(--success-soft); color: var(--success); }
.stat-banner.fail { background: var(--danger-soft); color: var(--danger); }

/* ==========================================================================
   Pricing
   ========================================================================== */
.price-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 900px) { .price-grid { grid-template-columns: 1fr; max-width: 480px; margin: 0 auto; } }

.price-card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 36px 30px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  position: relative;
}
.price-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-pop);
}
.price-badge {
  position: absolute; top: 18px; right: 18px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent);
  padding: 4px 10px; border-radius: var(--radius-pill);
}
.price-tier { font-size: 14px; font-weight: 600; color: var(--accent); letter-spacing: 0.02em; text-transform: uppercase; }
.price-amount { display: flex; align-items: baseline; gap: 6px; }
.price-amount .num { font-size: 48px; font-weight: 700; letter-spacing: var(--tight-lg); line-height: 1; }
.price-amount .unit { font-size: 16px; color: var(--text-soft); font-weight: 400; }
.price-blurb { font-size: 15px; color: var(--text-soft); line-height: 1.5; margin: 0; }
.price-features { list-style: none; padding: 0; margin: 12px 0 24px; display: flex; flex-direction: column; gap: 10px; }
.price-features li { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; line-height: 1.5; color: var(--text); }
.price-features li::before { content: "✓"; color: var(--accent); font-weight: 700; flex-shrink: 0; }

/* ==========================================================================
   Activate / forms / account
   ========================================================================== */
.form-shell {
  max-width: 460px; margin: 0 auto;
  padding: 40px 36px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.form-shell h1 { font-size: 28px; font-weight: 700; letter-spacing: var(--tight); margin: 0 0 8px; }
.form-shell p.lede { font-size: 15px; color: var(--text-soft); margin: 0 0 24px; line-height: 1.5; }
.form-divider { display: flex; align-items: center; gap: 14px; margin: 22px 0;
                font-size: 12px; color: var(--text-mute); letter-spacing: 0.08em; text-transform: uppercase; }
.form-divider::before, .form-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }

.notice {
  padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 18px;
}
.notice-success { background: var(--success-soft); color: #1f8a3a; }
.notice-error { background: var(--danger-soft); color: var(--danger); }
.notice-info { background: var(--accent-soft); color: var(--accent); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--border-soft);
  padding: 56px 0 40px;
  font-size: 13px; color: var(--text-mute);
}
.site-footer-inner { max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter);
                     display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 36px; }
@media (max-width: 760px) { .site-footer-inner { grid-template-columns: 1fr 1fr; } }
.footer-col h4 { font-size: 13px; font-weight: 600; color: var(--text); margin: 0 0 14px; letter-spacing: 0; }
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { color: var(--text-mute); }
.footer-col a:hover { color: var(--text); }
.footer-bottom { max-width: 1240px; margin: 36px auto 0; padding: 24px var(--gutter) 0;
                  border-top: 1px solid var(--border-soft);
                  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 12px; }

/* ==========================================================================
   Misc
   ========================================================================== */
.fade-in { animation: fadeIn 0.25s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--text-mute); }
.kbd { font-family: var(--font-mono); font-size: 12px; background: var(--bg-soft);
        padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); }

/* ==========================================================================
   Motion — agency-style polish (smooth scroll, reveals, blob, marquee, hero)
   ========================================================================== */

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* --- Reveal-on-scroll (driven by IntersectionObserver in motion.js) --- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s cubic-bezier(0.22,1,0.36,1), transform 0.7s cubic-bezier(0.22,1,0.36,1); will-change: opacity, transform; }
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal-left { transform: translateX(-32px); }
.reveal-left.in { transform: translateX(0); }
.reveal-scale { transform: scale(0.95); }
.reveal-scale.in { transform: scale(1); }
/* Stagger children inside a .stagger container */
.stagger > * { opacity: 0; transform: translateY(20px); transition: opacity 0.6s cubic-bezier(0.22,1,0.36,1), transform 0.6s cubic-bezier(0.22,1,0.36,1); }
.stagger.in > * { opacity: 1; transform: translateY(0); }
.stagger.in > *:nth-child(1) { transition-delay: 0.04s; }
.stagger.in > *:nth-child(2) { transition-delay: 0.10s; }
.stagger.in > *:nth-child(3) { transition-delay: 0.16s; }
.stagger.in > *:nth-child(4) { transition-delay: 0.22s; }
.stagger.in > *:nth-child(5) { transition-delay: 0.28s; }
.stagger.in > *:nth-child(6) { transition-delay: 0.34s; }
.stagger.in > *:nth-child(7) { transition-delay: 0.40s; }
.stagger.in > *:nth-child(8) { transition-delay: 0.46s; }
.stagger.in > *:nth-child(9) { transition-delay: 0.52s; }
.stagger.in > *:nth-child(10) { transition-delay: 0.58s; }

/* --- Floating gradient blob behind hero --- */
.hero { position: relative; overflow: hidden; }
.hero-blob {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 0;
}
.hero-blob::before, .hero-blob::after {
  content: ""; position: absolute;
  width: 620px; height: 620px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.55;
  mix-blend-mode: multiply;
  will-change: transform;
}
.hero-blob::before {
  top: -180px; left: -120px;
  background: radial-gradient(circle, rgba(0,113,227,0.45) 0%, rgba(0,113,227,0) 70%);
  animation: blob-drift-1 22s ease-in-out infinite;
}
.hero-blob::after {
  bottom: -240px; right: -160px;
  background: radial-gradient(circle, rgba(94,158,255,0.55) 0%, rgba(94,158,255,0) 70%);
  animation: blob-drift-2 28s ease-in-out infinite;
}
@keyframes blob-drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(80px, 40px) scale(1.08); }
  66%      { transform: translate(-40px, 70px) scale(0.94); }
}
@keyframes blob-drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(-70px, -30px) scale(1.06); }
  66%      { transform: translate(50px, -60px) scale(0.96); }
}
.hero > * { position: relative; z-index: 1; }

/* --- Animated grain texture (very subtle) --- */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  opacity: 0.04; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.5'/></svg>");
}

/* --- Hero rotating word — solid color for cross-renderer reliability --- */
.hero-rotator {
  display: inline-block;
  position: relative;
  color: var(--accent);
}
.hero-rotator-word {
  display: inline-block;
  animation: word-in 0.55s cubic-bezier(0.22,1,0.36,1) both;
  white-space: nowrap;
}
.hero-rotator-word.out { animation: word-out 0.45s cubic-bezier(0.55,0,0.7,0.2) both; }
@keyframes word-in {
  from { opacity: 0; transform: translateY(20px) rotateX(-30deg); }
  to   { opacity: 1; transform: translateY(0)    rotateX(0); }
}
@keyframes word-out {
  from { opacity: 1; transform: translateY(0)     rotateX(0); }
  to   { opacity: 0; transform: translateY(-20px) rotateX(30deg); }
}

/* --- Pulsing beta pill --- */
.brand-meta {
  position: relative; padding-left: 14px;
}
.brand-meta::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(48,209,88,0.55);
  animation: ping 2.4s ease-out infinite;
}
@keyframes ping {
  0%   { box-shadow: 0 0 0 0 rgba(48,209,88,0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(48,209,88,0); }
  100% { box-shadow: 0 0 0 0 rgba(48,209,88,0); }
}

/* --- Counter cards --- */
.metrics-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-soft);
}
@media (max-width: 720px) { .metrics-row { grid-template-columns: repeat(2, 1fr); } }
.metric-cell {
  text-align: center;
  padding: 36px 18px;
  border-right: 1px solid var(--border-soft);
}
.metric-cell:last-child { border-right: none; }
@media (max-width: 720px) {
  .metric-cell:nth-child(2n) { border-right: none; }
  .metric-cell:nth-child(-n+2) { border-bottom: 1px solid var(--border-soft); }
}
.metric-num {
  font-size: clamp(36px, 4.5vw, 56px);
  font-weight: 700; letter-spacing: var(--tracking-display);
  color: var(--color-fg); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.metric-num strong, .metric-num span { color: var(--color-accent); font-weight: 700; }
.metric-label {
  margin-top: 10px;
  font-size: 13px; font-weight: 500; color: var(--text-soft);
  letter-spacing: 0.02em;
}

/* --- Marquee strip (auto-scrolling category names) --- */
.marquee {
  position: relative;
  overflow: hidden;
  padding: 28px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%);
}
.marquee-track {
  display: inline-flex;
  gap: 56px; padding-right: 56px;
  white-space: nowrap;
  animation: marquee 38s linear infinite;
  will-change: transform;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-item {
  display: inline-flex; align-items: center; gap: 12px;
  font-size: 22px; font-weight: 600; letter-spacing: var(--tight);
  color: var(--text-soft);
}
.marquee-item .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  opacity: 0.6;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* --- Card hover spring (overrides existing subtle lift) --- */
.cat-card, .tool-card, .price-card {
  transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1),
              box-shadow 0.28s cubic-bezier(0.22,1,0.36,1),
              border-color 0.2s ease;
}
.cat-card:hover { transform: translateY(-6px) scale(1.01); }
.tool-card:hover { transform: translateY(-4px); }
.price-card:not(.featured):hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

/* Glow ring on category card icon hover */
.cat-card:hover .cat-card-icon {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 20px -4px rgba(0,113,227,0.45);
  transform: scale(1.06) rotate(-3deg);
}
.cat-card-icon { transition: all 0.32s cubic-bezier(0.34,1.56,0.64,1); }

/* --- Magnetic-ish CTA buttons (subtle scale + shine) --- */
.btn-primary, .site-cta, .btn-run {
  position: relative; overflow: hidden;
}
.btn-primary::after, .site-cta::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.7s cubic-bezier(0.22,1,0.36,1);
  pointer-events: none;
}
.btn-primary:hover::after, .site-cta:hover::after { transform: translateX(100%); }

/* --- Hero shot lifts on scroll --- */
.hero-shot { transition: transform 0.6s cubic-bezier(0.22,1,0.36,1), box-shadow 0.6s ease; }
.hero-shot.scrolled { transform: translateY(-12px) scale(1.01); box-shadow: 0 10px 24px rgba(0,0,0,0.06), 0 36px 64px -20px rgba(0,0,0,0.22); }

/* --- Sticky header gets denser shadow when scrolled --- */
.site-header { transition: background 0.25s, box-shadow 0.25s, border-color 0.25s; }
.site-header.scrolled {
  background: rgba(255,255,255,0.94);
  border-bottom-color: var(--border);
  box-shadow: 0 4px 20px -10px rgba(0,0,0,0.08);
}

/* --- Section eyebrow gets a tiny dot leader --- */
.section-eyebrow, .hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
}
.section-eyebrow::before, .hero-eyebrow::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: ping 3s ease-out infinite;
}

/* ==========================================================================
   Autotax-style hero composition + product mockup primitives
   ========================================================================== */

/* Hero outer — replaces the chart-based hero */
.hero-stage {
  position: relative;
  padding: clamp(96px, 13vw, 168px) var(--gutter) clamp(80px, 9vw, 120px);
  overflow: hidden;
  background:
    radial-gradient(80% 60% at 18% 10%, color-mix(in srgb, var(--color-accent) 14%, transparent), transparent 65%),
    radial-gradient(60% 60% at 92% 18%, color-mix(in srgb, var(--color-accent-3) 16%, transparent), transparent 60%),
    radial-gradient(80% 60% at 50% 100%, color-mix(in srgb, var(--color-accent-2) 8%, transparent), transparent 60%),
    var(--color-bg);
}
.hero-stage > * { position: relative; z-index: 1; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
  max-width: var(--max-w-wide);
  margin: 0 auto;
}
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; gap: 56px; text-align: center; }
  .hero-grid .hero-actions { justify-content: center; }
}

.hero-copy { display: flex; flex-direction: column; gap: 22px; }
.hero-copy .hero-eyebrow { align-self: flex-start; }
@media (max-width: 920px) { .hero-copy .hero-eyebrow { align-self: center; } }
.hero-copy .hero-title { margin: 0; max-width: 14ch; font-size: var(--text-display-lg); font-weight: 700; letter-spacing: var(--tracking-display); line-height: 1.04; }
@media (max-width: 920px) { .hero-copy .hero-title { max-width: none; margin: 0 auto; } }
.hero-copy .hero-sub   { margin: 0; max-width: 38ch; font-size: clamp(17px, 1.6vw, 21px); color: var(--color-muted); line-height: 1.45; }
@media (max-width: 920px) { .hero-copy .hero-sub { margin: 0 auto; } }

/* ---- Floating product mockup composition (the autotax move) ---- */
.mockup-stage {
  position: relative;
  height: clamp(420px, 50vw, 560px);
  perspective: 1400px;
}

.mockup-card {
  position: absolute;
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-deep);
  padding: 18px 18px 16px;
  font-size: 13px;
  color: var(--color-fg);
  transition: transform 0.6s cubic-bezier(0.22,1,0.36,1), box-shadow 0.5s ease;
  will-change: transform;
}
.mockup-card .mockup-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
  font-size: 11px; font-weight: 600;
  color: var(--color-muted);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.mockup-card .mockup-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-success); box-shadow: 0 0 10px color-mix(in srgb, var(--color-success) 50%, transparent); }
.mockup-card .mockup-head .accent-dot { background: var(--color-accent); box-shadow: 0 0 10px color-mix(in srgb, var(--color-accent) 50%, transparent); }

/* Card: capability sixpack (foreground) */
.mockup-capability {
  top: 8%; left: 8%; right: 8%;
  z-index: 3;
  padding: 22px 22px 18px;
  animation: mock-float-1 14s ease-in-out infinite;
}
.mockup-capability .verdict {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 16px;
}
.mockup-capability .verdict-num {
  font-size: clamp(40px, 5vw, 56px);
  font-weight: 700; letter-spacing: var(--tracking-display);
  line-height: 1; color: var(--color-fg); font-variant-numeric: tabular-nums;
}
.mockup-capability .verdict-label { font-size: 13px; font-weight: 600; color: var(--color-muted); }
.mockup-capability .verdict-tag {
  margin-left: auto;
  padding: 5px 11px; border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--color-success) 14%, transparent);
  color: #1f8a3a; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.mockup-capability .curve {
  height: 88px; width: 100%; margin: 14px 0 12px;
  background:
    linear-gradient(to right,
      transparent 0%, transparent 22%,
      color-mix(in srgb, var(--color-accent) 22%, transparent) 22%,
      color-mix(in srgb, var(--color-accent) 22%, transparent) 78%,
      transparent 78%, transparent 100%);
  -webkit-mask-image: radial-gradient(120% 90% at 50% 100%, #000 0%, transparent 70%);
          mask-image: radial-gradient(120% 90% at 50% 100%, #000 0%, transparent 70%);
  border-bottom: 1.5px solid color-mix(in srgb, var(--color-accent) 60%, transparent);
  position: relative;
}
.mockup-capability .curve::before, .mockup-capability .curve::after {
  content: ""; position: absolute; bottom: -1.5px; top: 0; width: 1.5px;
  background: var(--color-danger);
  border-radius: 1px;
}
.mockup-capability .curve::before { left: 22%; }
.mockup-capability .curve::after  { right: 22%; }
.mockup-capability .stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.mockup-capability .stat {
  background: var(--color-surface-3);
  border-radius: 8px; padding: 8px 10px; text-align: center;
}
.mockup-capability .stat .lbl { font-size: 9.5px; font-weight: 600; color: var(--color-muted); letter-spacing: 0.06em; text-transform: uppercase; }
.mockup-capability .stat .val { font-size: 16px; font-weight: 600; color: var(--color-fg); font-variant-numeric: tabular-nums; }

/* Card: AI assistant chat bubble (back-left, rotated) */
.mockup-assistant {
  top: 0; left: -2%; width: 64%;
  z-index: 2;
  transform: rotate(-6deg) translateY(0);
  animation: mock-float-2 16s ease-in-out infinite;
  background: var(--color-surface);
}
.mockup-assistant .msg { font-size: 12.5px; line-height: 1.5; padding: 10px 12px; border-radius: 14px; margin-bottom: 8px; max-width: 85%; }
.mockup-assistant .msg.you {
  background: var(--color-surface-3); color: var(--color-fg); margin-left: auto; border-bottom-right-radius: 4px;
}
.mockup-assistant .msg.bot {
  background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--color-accent) 18%, transparent);
  color: var(--color-fg); border-bottom-left-radius: 4px;
}
.mockup-assistant .msg.bot strong { color: var(--color-accent); }

/* Card: gauge R&R verdict (back-right, rotated) */
.mockup-grr {
  bottom: 4%; right: -4%; width: 58%;
  z-index: 2;
  transform: rotate(5deg);
  animation: mock-float-3 18s ease-in-out infinite;
}
.mockup-grr .grr-num {
  font-size: 36px; font-weight: 700; letter-spacing: var(--tracking-display);
  color: var(--color-fg); font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 4px;
}
.mockup-grr .grr-num small { font-size: 18px; color: var(--color-muted); font-weight: 600; }
.mockup-grr .grr-bars { display: flex; gap: 4px; align-items: flex-end; height: 38px; margin-top: 14px; }
.mockup-grr .grr-bars span { flex: 1; background: color-mix(in srgb, var(--color-accent) 65%, transparent); border-radius: 3px 3px 0 0; }
.mockup-grr .grr-bars span:nth-child(1) { height: 60%; background: color-mix(in srgb, var(--color-accent) 35%, transparent); }
.mockup-grr .grr-bars span:nth-child(2) { height: 92%; }
.mockup-grr .grr-bars span:nth-child(3) { height: 50%; background: color-mix(in srgb, var(--color-accent) 50%, transparent); }
.mockup-grr .grr-bars span:nth-child(4) { height: 78%; }
.mockup-grr .grr-bars span:nth-child(5) { height: 40%; background: color-mix(in srgb, var(--color-accent) 40%, transparent); }
.mockup-grr .grr-bars span:nth-child(6) { height: 100%; background: var(--color-accent); }

/* Floating animations — slow, hand-wavy */
@keyframes mock-float-1 {
  0%, 100% { transform: translateY(0) rotateX(0); }
  50%      { transform: translateY(-10px) rotateX(0.6deg); }
}
@keyframes mock-float-2 {
  0%, 100% { transform: rotate(-6deg) translateY(0); }
  50%      { transform: rotate(-5.2deg) translateY(-14px); }
}
@keyframes mock-float-3 {
  0%, 100% { transform: rotate(5deg) translateY(0); }
  50%      { transform: rotate(4.4deg) translateY(-12px); }
}
@media (max-width: 920px) {
  .mockup-stage { height: 460px; max-width: 460px; margin: 0 auto; }
  .mockup-assistant { left: 0; width: 70%; }
  .mockup-grr { right: 0; width: 65%; }
}

/* ==========================================================================
   Glass / surface utilities (Apple-ish chrome)
   ========================================================================== */
.glass {
  background: var(--color-topbar-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.glass-strong {
  background: rgba(255,255,255,0.86);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
}

/* ==========================================================================
   Category card v2 — SVG icon + tinted hover (replaces emoji circle)
   ========================================================================== */
.cat-card .cat-card-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface));
  color: var(--color-accent);
  border: 1px solid color-mix(in srgb, var(--color-accent) 18%, transparent);
  font-size: 0;
  transition: all 0.32s cubic-bezier(0.34,1.56,0.64,1);
}
.cat-card:hover .cat-card-icon {
  background: var(--color-accent);
  color: var(--color-accent-ink);
  border-color: var(--color-accent);
  box-shadow: 0 8px 24px -6px color-mix(in srgb, var(--color-accent) 40%, transparent);
  transform: scale(1.06) rotate(-3deg);
}
.cat-card { padding: 28px 26px; }

/* ==========================================================================
   Soft radial focal point — wrap any section in .focal-bg
   ========================================================================== */
.focal-bg { position: relative; isolation: isolate; }
.focal-bg::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(80% 60% at 30% 0%, color-mix(in srgb, var(--color-accent) 8%, transparent), transparent 60%);
  pointer-events: none;
}
.focal-bg.right::before {
  background: radial-gradient(60% 60% at 90% 20%, color-mix(in srgb, var(--color-accent-3) 12%, transparent), transparent 60%);
}

/* ==========================================================================
   Inline SVG sizing + alignment (used by <Icon />)
   ========================================================================== */
.icon-inline { display: inline-block; vertical-align: -0.18em; }
.icon-bg {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
  color: var(--color-accent);
  border: 1px solid color-mix(in srgb, var(--color-accent) 18%, transparent);
}

/* ==========================================================================
   AI Assistants page — bespoke layout
   ========================================================================== */

/* Typing dots in hero chat */
.typing-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--color-accent);
  display: inline-block;
  animation: typing 1.2s ease-in-out infinite;
}
@keyframes typing {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30%           { opacity: 1;    transform: translateY(-3px); }
}

/* Step grid (How it works) */
.step-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 820px) { .step-grid { grid-template-columns: 1fr; } }
.step-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  position: relative;
  transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.28s;
  box-shadow: var(--shadow-card);
}
.step-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-pop); }
.step-card .step-num {
  font-size: 12px; font-weight: 700; letter-spacing: 0.12em;
  color: var(--color-accent); margin-bottom: 16px;
}

/* Per-assistant cards */
.assistant-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 980px) { .assistant-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .assistant-grid { grid-template-columns: 1fr; } }

.assistant-card {
  display: flex; flex-direction: column; gap: 18px;
  padding: 24px 22px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  text-decoration: none; color: var(--color-fg);
  transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1),
              box-shadow 0.28s ease,
              border-color 0.2s ease;
  box-shadow: var(--shadow-card);
  position: relative; overflow: hidden;
}
.assistant-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--color-accent) 8%, transparent), transparent 60%);
  opacity: 0; transition: opacity 0.4s ease;
}
.assistant-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-pop);
  border-color: color-mix(in srgb, var(--color-accent) 40%, transparent);
  color: var(--color-fg);
}
.assistant-card:hover::before { opacity: 1; }

.assistant-card-head {
  display: flex; align-items: flex-start; gap: 12px;
}
.assistant-card-name {
  font-size: 16px; font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--color-fg);
}
.assistant-card-tagline {
  font-size: 13px; color: var(--color-muted); line-height: 1.45;
  margin-top: 2px;
}

.assistant-card-exchange {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px;
  background: var(--color-bg-soft);
  border-radius: 12px;
  position: relative; z-index: 1;
}
.ex-bubble {
  font-size: 12.5px; line-height: 1.45;
  padding: 8px 11px; border-radius: 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.ex-bubble.you {
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  color: var(--color-fg);
  align-self: flex-start; max-width: 92%;
}
.ex-bubble.bot {
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--color-accent) 25%, transparent);
  color: var(--color-fg);
  align-self: flex-end; max-width: 92%;
  font-weight: 600;
}
.ex-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--color-mute); text-transform: uppercase;
}
.ex-bubble.bot .ex-label { color: var(--color-accent); }

.assistant-card-cta {
  font-size: 13px; font-weight: 600;
  color: var(--color-accent);
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: auto; transition: gap 0.15s;
  position: relative; z-index: 1;
}
.assistant-card:hover .assistant-card-cta { gap: 9px; }

/* Inline code in chat bubbles */
.msg code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: rgba(0,0,0,0.05);
  padding: 1px 6px;
  border-radius: 4px;
}

/* =============================================================================
 *  Stats Co-pilot (Phase 9A) — marketing-surface chat UI.
 *  Mirrors the data + behaviour of the dark-console version at /console#/agent
 *  but uses the marketing site's white-Apple visual language.
 * ============================================================================= */

.copilot { padding: 32px 0 64px; }

.copilot-kicker {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-mute);
    font-weight: 600;
}

.copilot-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}
.copilot-hero h1 { margin: 6px 0 12px; }
.copilot-hero p { color: var(--color-mute); max-width: 640px; line-height: 1.55; }
.copilot-settings-link { white-space: nowrap; }

.copilot-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
}
@media (max-width: 800px) {
    .copilot-grid { grid-template-columns: 1fr; }
}

.copilot-card {
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border-subtle);
    border-radius: 14px;
    padding: 22px;
}
.copilot-card-wide { padding: 28px; }
.copilot-card-aside { background: var(--color-bg-soft); }
.copilot-card-aside h3 { margin: 0 0 8px; font-size: 15px; }
.copilot-card-aside p { color: var(--color-mute); font-size: 13px; line-height: 1.6; margin: 0; }
.copilot-card-aside h4 { margin: 0 0 8px; font-size: 13px; }

.copilot-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.copilot-card-head h3 { margin: 0; font-size: 15px; }
.copilot-card-divider {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--color-border-subtle);
}

.copilot-empty {
    color: var(--color-mute);
    font-size: 13.5px;
    padding: 4px 0;
}
.copilot-empty-dashed {
    padding: 14px 16px;
    border: 1px dashed var(--color-border-subtle);
    border-radius: 10px;
}

.copilot-thread-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.copilot-thread-list a {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    background: var(--color-surface, #fff);
    transition: border-color 0.15s, background 0.15s;
}
.copilot-thread-list a:hover { border-color: var(--accent); background: var(--accent-soft); }
.copilot-thread-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}
.copilot-thread-title {
    font-weight: 500;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.copilot-thread-time { color: var(--color-mute); font-size: 12px; flex-shrink: 0; }
.copilot-thread-meta { color: var(--color-mute); font-size: 12px; margin-top: 3px; }

.copilot-assistant-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 4px;
}
.copilot-tag-default {
    font-size: 10px;
    color: var(--color-mute);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.copilot-tag-muted {
    margin-left: 8px;
    font-size: 10px;
    color: var(--color-mute);
}

.copilot-error {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--danger-soft);
    border: 1px solid var(--danger);
    border-radius: 8px;
    color: var(--danger);
    font-size: 13px;
}

/* ---------- Chat view ---------- */
.copilot-chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.copilot-chat-head h2 { margin: 6px 0 0; }

.copilot-chat {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 240px);
    min-height: 480px;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border-subtle);
    border-radius: 14px;
    overflow: hidden;
}
.copilot-chat-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.copilot-thinking {
    color: var(--accent);
    font-size: 13px;
    font-style: italic;
}
.copilot-chat-input {
    border-top: 1px solid var(--color-border-subtle);
    padding: 14px 16px;
    background: var(--color-bg-soft);
}
.copilot-chat-input form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.copilot-chat-input textarea {
    resize: vertical;
    font-size: 14px;
    line-height: 1.5;
}
.copilot-chat-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.copilot-hint { color: var(--color-mute); font-size: 11.5px; }

.copilot-msg {
    border-radius: 12px;
    padding: 14px 16px;
}
.copilot-msg.is-user {
    background: var(--color-bg-soft);
    border: 1px solid var(--color-border-subtle);
}
.copilot-msg.is-assistant {
    background: var(--accent-soft);
    border: 1px solid var(--accent);
}
.copilot-msg header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}
.copilot-msg-who {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-mute);
    font-weight: 600;
}
.copilot-msg-time { font-size: 11px; color: var(--color-mute); }
.copilot-msg-text { white-space: pre-wrap; font-size: 14.5px; line-height: 1.55; }
.copilot-msg-meta { font-size: 11px; color: var(--color-mute); margin-top: 8px; }
.copilot-msg-receipts { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Receipt card ---------- */
.copilot-receipt {
    border: 1px solid var(--color-border-subtle);
    background: var(--color-surface, #fff);
    border-radius: 10px;
    padding: 10px 14px;
}
.copilot-receipt.is-failed {
    border-color: var(--danger);
    background: var(--danger-soft);
}
.copilot-receipt-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.copilot-receipt-tag {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 4px;
    color: var(--accent);
    background: var(--accent-soft);
}
.copilot-receipt-tag.is-failed { color: var(--danger); background: var(--danger-soft); }
.copilot-receipt-slug {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--color-fg);
}
.copilot-receipt-time {
    margin-left: auto;
    font-size: 11px;
    color: var(--color-mute);
}
.copilot-receipt-stats {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    font-size: 12px;
    font-family: var(--font-mono);
}
.copilot-receipt-k { color: var(--color-mute); margin-right: 4px; }
.copilot-receipt-v { color: var(--color-fg); }
.copilot-receipt-error { margin-top: 6px; font-size: 12.5px; color: var(--danger); }

/* ---------- Settings ---------- */
.copilot-settings-intro {
    color: var(--color-mute);
    margin: -8px 0 22px;
    max-width: 640px;
    line-height: 1.55;
}
.copilot-section { margin-bottom: 12px; }
.copilot-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}
.copilot-section-head h3 { margin: 0 0 4px; font-size: 15px; }
.copilot-section-head p { margin: 0; color: var(--color-mute); font-size: 13px; line-height: 1.5; }
.copilot-section-divider {
    height: 1px;
    background: var(--color-border-subtle);
    margin: 22px 0;
}

.copilot-editor {
    border: 1px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.copilot-editor-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.copilot-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}
.copilot-editor textarea {
    font-family: var(--font-mono);
    font-size: 12.5px;
    resize: vertical;
}

.copilot-spec-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 10px;
}
@media (max-width: 700px) {
    .copilot-spec-grid { grid-template-columns: 1fr 1fr; }
}

.copilot-spec-table {
    border: 1px solid var(--color-border-subtle);
    border-radius: 10px;
    overflow: hidden;
    overflow-x: auto;
}
.copilot-spec-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.copilot-spec-table thead { background: var(--color-bg-soft); }
.copilot-spec-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-mute);
    font-weight: 600;
    border-bottom: 1px solid var(--color-border-subtle);
}
.copilot-spec-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border-subtle);
}
.copilot-spec-table tbody tr:last-child td { border-bottom: none; }
.copilot-spec-table td.mono { font-family: var(--font-mono); }
.copilot-spec-table td.small { font-size: 12px; color: var(--color-mute); }
.copilot-spec-table td.actions {
    text-align: right;
    white-space: nowrap;
}

.copilot-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.copilot-list-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 10px;
    padding: 14px 16px;
    background: var(--color-surface, #fff);
}
.copilot-list-name { font-weight: 500; font-size: 14.5px; }
.copilot-list-slug {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--color-mute);
    margin-top: 2px;
}
.copilot-list-desc { font-size: 13px; color: var(--color-mute); margin-top: 6px; }
.copilot-list-actions { display: flex; gap: 6px; flex-shrink: 0; }

.copilot-btn-danger { color: var(--danger) !important; }

/* ---------- Activation gate ---------- */
.copilot-gate {
    padding: 80px 0;
    text-align: center;
}
.copilot-gate h1 { margin-bottom: 12px; }
.copilot-gate p {
    color: var(--color-mute);
    max-width: 480px;
    margin: 0 auto 24px;
    line-height: 1.55;
}
.copilot-gate-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* =============================================================================
 *  Sixpack + tool visuals (Phase 9A.6 — Minitab-style inline rendering)
 * ============================================================================= */

.copilot-sixpack { margin-top: 14px; }
.copilot-sixpack-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 220px;
    gap: 12px;
}
@media (max-width: 800px) {
    .copilot-sixpack-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 200px; }
}
@media (max-width: 500px) {
    .copilot-sixpack-grid { grid-template-columns: 1fr; }
}
.copilot-sixpack-panel {
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border-subtle);
    border-radius: 10px;
    padding: 4px;
    overflow: hidden;
}
.copilot-sixpack-indices {
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border-subtle);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
}
.copilot-sixpack-indices h4 {
    margin: 0 0 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-mute);
    font-weight: 600;
}
.copilot-sixpack-indices table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.copilot-sixpack-indices th {
    text-align: left;
    font-weight: 500;
    color: var(--color-mute);
    padding: 5px 8px 5px 0;
    width: 1%;
    white-space: nowrap;
}
.copilot-sixpack-indices td {
    font-family: var(--font-mono);
    color: var(--color-fg);
    padding: 5px 12px 5px 0;
}

.copilot-sixpack-verdict {
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    border: 1px solid var(--color-border-subtle);
}
.copilot-sixpack-verdict.is-good { background: rgba(48,209,88,0.08); border-color: rgba(48,209,88,0.3); }
.copilot-sixpack-verdict.is-warn { background: rgba(255,159,10,0.08); border-color: rgba(255,159,10,0.3); }
.copilot-sixpack-verdict.is-bad { background: rgba(255,59,48,0.08); border-color: rgba(255,59,48,0.3); }
.copilot-sixpack-verdict.is-unknown { background: var(--color-bg-soft); }
.copilot-sixpack-verdict-label {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}
.copilot-sixpack-verdict.is-good .copilot-sixpack-verdict-label { color: #1c7e3d; }
.copilot-sixpack-verdict.is-warn .copilot-sixpack-verdict-label { color: #aa6a00; }
.copilot-sixpack-verdict.is-bad .copilot-sixpack-verdict-label { color: #b3261e; }
.copilot-sixpack-verdict-cpk {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--color-mute);
    margin-bottom: 8px;
}
.copilot-sixpack-verdict-blurb {
    font-size: 12px;
    color: var(--color-mute);
    line-height: 1.4;
}

.copilot-chart-single {
    margin-top: 14px;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border-subtle);
    border-radius: 10px;
    height: 280px;
    padding: 4px;
    overflow: hidden;
}

/* =============================================================================
 *  Phase 9C — Stats Workspace
 *  Dedicated dashboard surface. Bypasses the marketing site-header; takes the
 *  full viewport. One card primitive, one button family, one spacing scale,
 *  consistent typography. Apple-style restraint, no decorative gradients.
 *  Namespaced under .ws-* so it can't collide with the marketing styles.
 * ============================================================================= */

:root {
    /* Spacing scale (workspace uses 4/8/12/16/24/32 consistently). */
    --ws-space-1: 4px;
    --ws-space-2: 8px;
    --ws-space-3: 12px;
    --ws-space-4: 16px;
    --ws-space-5: 24px;
    --ws-space-6: 32px;

    /* One radius scale. */
    --ws-radius-sm: 6px;
    --ws-radius: 10px;
    --ws-radius-lg: 14px;

    /* Workspace colours — keyed off marketing tokens but locked in here so
       the workspace doesn't drift if marketing tokens change. */
    --ws-bg: #fafafa;
    --ws-surface: #ffffff;
    --ws-surface-2: #f5f5f7;
    --ws-fg: #1d1d1f;
    --ws-fg-muted: #6e6e73;
    --ws-fg-quiet: #86868b;
    --ws-border: #d2d2d7;
    --ws-border-subtle: #e5e5ea;
    --ws-accent: #0071e3;
    --ws-accent-soft: rgba(0,113,227,0.08);
    --ws-accent-fg: #ffffff;
    --ws-danger: #d32f2f;
    --ws-danger-soft: rgba(211,47,47,0.08);
    --ws-warn: #b25e09;
    --ws-warn-soft: rgba(178,94,9,0.08);
    --ws-good: #1c7e3d;
    --ws-good-soft: rgba(28,126,61,0.08);

    --ws-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    --ws-font-mono: "SF Mono", ui-monospace, Menlo, monospace;
}

/* ---------- Shell + viewport reset ---------- */
.ws-shell {
    position: fixed;
    inset: 0;
    background: var(--ws-bg);
    color: var(--ws-fg);
    font-family: var(--ws-font);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Hide page-level grain + scrollbars; workspace is its own surface. */
.ws-shell ~ .grain { display: none; }

/* ---------- Header ---------- */
.ws-header {
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--ws-space-5);
    background: var(--ws-surface);
    border-bottom: 1px solid var(--ws-border-subtle);
}
.ws-header-left {
    display: flex;
    align-items: center;
    gap: var(--ws-space-3);
    min-width: 0;
}
.ws-header-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--ws-space-2);
    text-decoration: none;
    color: var(--ws-fg);
    font-weight: 600;
    font-size: 14px;
}
.ws-header-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px; height: 24px;
    border-radius: var(--ws-radius-sm);
    background: var(--ws-accent);
    color: var(--ws-accent-fg);
    font-weight: 700;
    font-family: var(--ws-font-mono);
    font-size: 13px;
}
.ws-header-divider { color: var(--ws-fg-quiet); font-weight: 400; }
.ws-header-thread {
    font-size: 13.5px;
    color: var(--ws-fg-muted);
    max-width: 50vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ws-header-right { display: flex; align-items: center; gap: var(--ws-space-2); }

/* ---------- Body layout ---------- */
.ws-body {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* ---------- Sidebar ---------- */
.ws-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--ws-surface);
    border-right: 1px solid var(--ws-border-subtle);
    display: flex;
    flex-direction: column;
    transition: width 0.18s ease;
}
.ws-sidebar.is-collapsed { width: 56px; }

/* Slice 12.1 — 'hover' mode: narrow at rest, expands on mouseover.
 * The wide content tree is always mounted so the expansion is smooth.
 * We pin the sidebar absolutely on hover so the page content underneath
 * doesn't reflow when the user mouses in / out. */
.ws-sidebar.is-hover {
    width: 56px;
    position: relative;
    z-index: 20;
}
.ws-sidebar.is-hover .ws-sidebar-top > :not(.ws-sidebar-toggle),
.ws-sidebar.is-hover .ws-filter,
.ws-sidebar.is-hover .ws-sidebar-threads,
.ws-sidebar.is-hover .ws-sidebar-foot {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.14s ease;
}
.ws-sidebar.is-hover:hover {
    width: 240px;
    box-shadow: 4px 0 16px rgba(15, 17, 21, 0.06);
}
.ws-sidebar.is-hover:hover .ws-sidebar-top > :not(.ws-sidebar-toggle),
.ws-sidebar.is-hover:hover .ws-filter,
.ws-sidebar.is-hover:hover .ws-sidebar-threads,
.ws-sidebar.is-hover:hover .ws-sidebar-foot {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0.04s;
}
.ws-sidebar-top {
    padding: var(--ws-space-3);
    display: flex;
    align-items: center;
    gap: var(--ws-space-2);
    border-bottom: 1px solid var(--ws-border-subtle);
}
.ws-sidebar-toggle {
    width: 32px; height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--ws-fg-muted);
    border-radius: var(--ws-radius-sm);
    font-size: 16px;
}
.ws-sidebar-toggle:hover { background: var(--ws-surface-2); }
.ws-sidebar-threads {
    flex: 1;
    overflow-y: auto;
    padding: var(--ws-space-2);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ws-sidebar-empty {
    padding: var(--ws-space-3);
    font-size: 12.5px;
    color: var(--ws-fg-quiet);
    text-align: center;
}
.ws-sidebar-thread {
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    padding: var(--ws-space-2) var(--ws-space-3);
    border-radius: var(--ws-radius-sm);
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--ws-fg);
    width: 100%;
    overflow: hidden;
}
.ws-sidebar-thread:hover { background: var(--ws-surface-2); }
.ws-sidebar-thread.is-active {
    background: var(--ws-accent-soft);
    color: var(--ws-accent);
}
.ws-sidebar-thread-title {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ws-sidebar-thread-time {
    font-size: 11px;
    color: var(--ws-fg-quiet);
}
.ws-sidebar-foot {
    padding: var(--ws-space-3);
    border-top: 1px solid var(--ws-border-subtle);
}

/* ---------- Main split: chat (left) + artifact (right) ---------- */
.ws-main {
    flex: 1;
    display: flex;
    min-width: 0;
    min-height: 0;
}
.ws-chat-pane {
    flex: 0 1 480px;
    min-width: 360px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--ws-border-subtle);
    background: var(--ws-bg);
    min-height: 0;
}
.ws-artifact-pane {
    flex: 1 1 auto;
    background: var(--ws-bg);
    overflow-y: auto;
    min-height: 0;
}

@media (max-width: 900px) {
    .ws-main { flex-direction: column; }
    .ws-chat-pane { flex: none; max-height: 50vh; border-right: none; border-bottom: 1px solid var(--ws-border-subtle); }
    .ws-artifact-pane { flex: 1; }
}

/* ---------- Empty states ---------- */
.ws-main.ws-empty {
    align-items: center;
    justify-content: center;
}
.ws-empty-card, .ws-artifact-empty {
    text-align: center;
    padding: var(--ws-space-6);
    max-width: 480px;
}
.ws-empty-glyph, .ws-artifact-empty-glyph {
    font-size: 48px;
    font-weight: 600;
    color: var(--ws-accent);
    font-family: var(--ws-font-mono);
    margin-bottom: var(--ws-space-3);
}
.ws-empty-card h2 { font-size: 22px; margin: 0 0 var(--ws-space-2); }
.ws-empty-card p, .ws-artifact-empty p {
    color: var(--ws-fg-muted);
    line-height: 1.55;
    margin: 0 0 var(--ws-space-4);
}
.ws-artifact-empty {
    margin: 0 auto;
    padding-top: 80px;
}
.ws-artifact-empty h3 {
    margin: 0 0 var(--ws-space-2);
    font-size: 18px;
    color: var(--ws-fg);
}

/* ---------- Chat pane ---------- */
.ws-chat-scroll {
    flex: 1;
    overflow-y: auto;
    padding: var(--ws-space-4) var(--ws-space-4);
    display: flex;
    flex-direction: column;
    gap: var(--ws-space-3);
}
.ws-chat-empty {
    padding: var(--ws-space-4);
    color: var(--ws-fg-muted);
    font-size: 14px;
    line-height: 1.55;
}
.ws-chat-empty p { margin: 0 0 var(--ws-space-3); }
.ws-chat-help summary {
    cursor: pointer;
    color: var(--ws-accent);
    font-size: 12.5px;
    user-select: none;
}
.ws-chat-help ul { margin: var(--ws-space-2) 0 0 var(--ws-space-4); font-size: 12.5px; padding: 0; }
.ws-thinking {
    color: var(--ws-accent);
    font-size: 13px;
    font-style: italic;
    padding: var(--ws-space-2) var(--ws-space-3);
}

.ws-msg {
    border-radius: var(--ws-radius);
    padding: var(--ws-space-3) var(--ws-space-4);
}
.ws-msg.is-user {
    background: var(--ws-surface-2);
    border: 1px solid var(--ws-border-subtle);
}
.ws-msg.is-assistant {
    background: var(--ws-surface);
    border: 1px solid var(--ws-border-subtle);
}
.ws-msg-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--ws-space-2);
}
.ws-msg-who {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ws-fg-quiet);
}
.ws-msg-time { font-size: 11px; color: var(--ws-fg-quiet); }
.ws-msg-text {
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ws-fg);
}
.ws-msg-meta {
    margin-top: var(--ws-space-2);
    font-size: 11px;
    color: var(--ws-fg-quiet);
}

/* ---------- Receipt pills ---------- */
.ws-msg-pills {
    margin-top: var(--ws-space-2);
    display: flex;
    flex-wrap: wrap;
    gap: var(--ws-space-2);
}
.ws-receipt-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--ws-space-2);
    padding: 5px var(--ws-space-3);
    background: var(--ws-surface);
    border: 1px solid var(--ws-border-subtle);
    border-radius: 999px;
    cursor: pointer;
    font-size: 11.5px;
    font-family: var(--ws-font);
    color: var(--ws-fg-muted);
    transition: all 0.15s;
}
.ws-receipt-pill:hover {
    border-color: var(--ws-accent);
    color: var(--ws-fg);
}
.ws-receipt-pill.is-selected {
    background: var(--ws-accent-soft);
    border-color: var(--ws-accent);
    color: var(--ws-accent);
    font-weight: 500;
}
.ws-receipt-pill.is-failed {
    border-color: var(--ws-danger);
    background: var(--ws-danger-soft);
    color: var(--ws-danger);
}
.ws-receipt-pill-slug {
    font-family: var(--ws-font-mono);
    font-size: 11px;
    font-weight: 500;
}
.ws-receipt-pill-stat { display: inline-flex; gap: 3px; }
.ws-receipt-pill-k { color: var(--ws-fg-quiet); }
.ws-receipt-pill-v { color: var(--ws-fg); font-family: var(--ws-font-mono); font-weight: 500; }
.ws-receipt-pill.is-selected .ws-receipt-pill-v { color: var(--ws-accent); }
.ws-receipt-pill-fail {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* ---------- Chat input ---------- */
.ws-chat-input {
    flex-shrink: 0;
    padding: var(--ws-space-3) var(--ws-space-4);
    border-top: 1px solid var(--ws-border-subtle);
    background: var(--ws-surface);
    display: flex;
    flex-direction: column;
    gap: var(--ws-space-2);
}
.ws-textarea {
    width: 100%;
    padding: var(--ws-space-3);
    background: var(--ws-bg);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius);
    font-family: var(--ws-font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ws-fg);
    resize: vertical;
    box-sizing: border-box;
}
.ws-textarea:focus {
    outline: none;
    border-color: var(--ws-accent);
    box-shadow: 0 0 0 3px var(--ws-accent-soft);
}
.ws-chat-input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.ws-chat-hint { font-size: 11px; color: var(--ws-fg-quiet); }

/* ---------- Unified card primitive ----------
 * Soft layered card matching the marketing mockup language:
 * a very subtle two-stop shadow gives quiet depth; the gradient
 * fill nudges the surface off pure white so charts feel "on" a
 * card instead of floating on the canvas.
 */
.ws-card {
    background:
        linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius);
    overflow: hidden;
    box-shadow:
        0 1px 2px rgba(15, 17, 21, 0.025),
        0 1px 3px rgba(15, 17, 21, 0.035);
}
.ws-card-flat {
    box-shadow: none;
    background: var(--ws-surface);
}

/* ---------- Unified button family ---------- */
.ws-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ws-space-2);
    padding: 8px 16px;
    border-radius: var(--ws-radius-sm);
    font-family: var(--ws-font);
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    background: var(--ws-surface);
    color: var(--ws-fg);
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.ws-btn:hover { background: var(--ws-surface-2); }
.ws-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ws-btn-primary {
    background: var(--ws-accent);
    color: var(--ws-accent-fg);
}
.ws-btn-primary:hover { background: #0066cc; }
.ws-btn-ghost {
    background: transparent;
    color: var(--ws-fg-muted);
    border-color: var(--ws-border-subtle);
}
.ws-btn-ghost:hover { background: var(--ws-surface-2); color: var(--ws-fg); }
.ws-btn-link {
    background: transparent;
    color: var(--ws-accent);
    border-color: transparent;
    padding: 4px 8px;
}
.ws-btn-link:hover { background: var(--ws-accent-soft); }
.ws-btn-danger { color: var(--ws-danger); }
.ws-btn-danger:hover { background: var(--ws-danger-soft); color: var(--ws-danger); }
.ws-btn-sm { padding: 5px 10px; font-size: 12px; }
.ws-btn-lg { padding: 10px 20px; font-size: 14px; }
.ws-btn-block { width: 100%; }

/* ---------- Artifact pane ---------- */
.ws-artifact-body {
    padding: var(--ws-space-5);
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--ws-space-4);
}
.ws-artifact-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--ws-space-4);
    padding-bottom: var(--ws-space-2);
}
.ws-artifact-head h2 {
    margin: 6px 0 4px;
    font-size: 22px;
    font-weight: 600;
    font-family: var(--ws-font);
    color: var(--ws-fg);
    letter-spacing: -0.01em;
}
.ws-artifact-kicker {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ws-fg-quiet);
    font-weight: 600;
}
.ws-artifact-kicker.is-error { color: var(--ws-danger); }
.ws-artifact-sub {
    font-size: 13px;
    color: var(--ws-fg-muted);
    line-height: 1.45;
    max-width: 540px;
}

/* ---------- Hero tile row (headline 4-up indices) ---------- */
.ws-tile-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--ws-space-3);
}
@media (max-width: 720px) {
    .ws-tile-row { grid-template-columns: repeat(2, 1fr); }
}
.ws-tile {
    background: linear-gradient(180deg, #ffffff 0%, #f7f7fa 100%);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius);
    padding: 14px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow:
        0 1px 2px rgba(15, 17, 21, 0.025),
        0 1px 3px rgba(15, 17, 21, 0.035);
}
.ws-tile-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ws-fg-quiet);
    font-weight: 600;
}
.ws-tile-value {
    font-family: var(--ws-font-mono);
    font-size: 26px;
    font-weight: 600;
    color: var(--ws-fg);
    line-height: 1.05;
    letter-spacing: -0.01em;
}
.ws-tile-hero .ws-tile-value { font-size: 28px; }

/* ---------- Capability sixpack (artifact view) ---------- */
.ws-sixpack-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--ws-space-3);
}
.ws-chart-card {
    padding: var(--ws-space-3);
    min-height: 300px;
}
.ws-chart-card-full {
    min-height: 480px;
    padding: var(--ws-space-4);
}
@media (max-width: 720px) {
    .ws-sixpack-grid { grid-template-columns: 1fr; }
}

.ws-indices-card { padding: var(--ws-space-4); }
.ws-indices-card h3, .ws-stats-card h3, .ws-settings-card h3 {
    margin: 0 0 var(--ws-space-3);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ws-fg-quiet);
}
.ws-indices-grid, .ws-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--ws-space-2);
}
@media (max-width: 500px) { .ws-indices-grid, .ws-stats-grid { grid-template-columns: repeat(2, 1fr); } }
/* Slice 17.4 — Tukey 5-number summary row (Min/Q1/Median/Q3/Max) for the
   Sample card.  Renders all 5 tiles on a single visual line so the
   summary reads as a clean min→max sequence. */
.ws-tukey-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--ws-space-2);
    margin-bottom: var(--ws-space-2);
}
@media (max-width: 640px) { .ws-tukey-row { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 420px) { .ws-tukey-row { grid-template-columns: repeat(2, 1fr); } }
.ws-index-cell {
    padding: 10px 14px 8px;
    background: var(--ws-surface-2);
    border-radius: var(--ws-radius-sm);
    border: 1px solid var(--ws-border-subtle);
}
.ws-index-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ws-fg-quiet);
    font-weight: 600;
}
.ws-index-value {
    font-family: var(--ws-font-mono);
    font-size: 18px;
    font-weight: 500;
    color: var(--ws-fg);
    margin-top: 2px;
    letter-spacing: -0.01em;
}

/* ---------- Verdict pill (header) ---------- */
.ws-verdict-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px 7px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    border: 1px solid transparent;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(15, 17, 21, 0.04);
}
.ws-verdict-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
    flex-shrink: 0;
}
.ws-verdict-pill.is-good { background: var(--ws-good-soft); color: var(--ws-good); border-color: rgba(48, 178, 92, 0.25); }
.ws-verdict-pill.is-warn { background: var(--ws-warn-soft); color: var(--ws-warn); border-color: rgba(180, 120, 0, 0.25); }
.ws-verdict-pill.is-bad { background: var(--ws-danger-soft); color: var(--ws-danger); border-color: rgba(214, 56, 56, 0.25); }
.ws-verdict-pill.is-unknown { background: var(--ws-surface-2); color: var(--ws-fg-muted); border-color: var(--ws-border-subtle); }
.ws-verdict-cpk {
    font-family: var(--ws-font-mono);
    font-weight: 500;
    font-size: 11.5px;
    opacity: 0.8;
    padding-left: 6px;
    border-left: 1px solid currentColor;
    margin-left: 2px;
}

/* ---------- Stats card (generic result) ---------- */
.ws-stats-card { padding: var(--ws-space-4); }
.ws-stats-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--ws-space-3); }
.ws-stats-head h3 { margin: 0; }
.ws-json {
    margin: var(--ws-space-3) 0 0;
    padding: var(--ws-space-3);
    background: var(--ws-surface-2);
    border-radius: var(--ws-radius-sm);
    font-family: var(--ws-font-mono);
    font-size: 11.5px;
    color: var(--ws-fg-muted);
    max-height: 320px;
    overflow: auto;
    white-space: pre;
}

.ws-error-card { padding: var(--ws-space-4); background: var(--ws-danger-soft); border-color: var(--ws-danger); }
.ws-error-card strong { color: var(--ws-danger); display: block; margin-bottom: var(--ws-space-2); font-weight: 600; }
.ws-error-card p { margin: 0; color: var(--ws-fg); font-size: 13px; }

.ws-error {
    padding: var(--ws-space-2) var(--ws-space-3);
    background: var(--ws-danger-soft);
    border: 1px solid var(--ws-danger);
    border-radius: var(--ws-radius-sm);
    color: var(--ws-danger);
    font-size: 12.5px;
}

/* ---------- Settings page ---------- */
.ws-settings-wrap {
    flex: 1;
    overflow-y: auto;
    padding: var(--ws-space-6);
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}
.ws-settings-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--ws-space-2);
}
.ws-settings-head h1 { margin: 0; font-size: 24px; }
.ws-settings-intro {
    color: var(--ws-fg-muted);
    margin: 0 0 var(--ws-space-5);
    max-width: 640px;
}
.ws-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--ws-space-4);
}
@media (max-width: 880px) { .ws-settings-grid { grid-template-columns: 1fr; } }

.ws-settings-card { padding: var(--ws-space-4); }
.ws-settings-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--ws-space-3);
    margin-bottom: var(--ws-space-3);
}
.ws-settings-card-head h3 { margin: 0 0 4px; font-size: 14px; color: var(--ws-fg); text-transform: none; letter-spacing: 0; font-weight: 600; }
.ws-settings-card-head p { margin: 0; font-size: 12.5px; color: var(--ws-fg-muted); }
.ws-settings-empty {
    padding: var(--ws-space-4);
    border: 1px dashed var(--ws-border-subtle);
    border-radius: var(--ws-radius-sm);
    color: var(--ws-fg-quiet);
    font-size: 13px;
    text-align: center;
}

.ws-editor {
    padding: var(--ws-space-4);
    background: var(--ws-accent-soft);
    border: 1px solid var(--ws-accent);
    border-radius: var(--ws-radius);
    display: flex;
    flex-direction: column;
    gap: var(--ws-space-3);
}
.ws-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ws-space-3); }
.ws-field { display: flex; flex-direction: column; gap: 4px; }
.ws-field > span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ws-fg-quiet);
}
.ws-field > span em { font-style: normal; color: var(--ws-fg-quiet); font-weight: 400; text-transform: none; letter-spacing: 0; }
.ws-field input, .ws-field textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--ws-border-subtle);
    background: var(--ws-surface);
    border-radius: var(--ws-radius-sm);
    font-family: var(--ws-font);
    font-size: 13px;
    color: var(--ws-fg);
    box-sizing: border-box;
}
.ws-field textarea { font-family: var(--ws-font-mono); font-size: 12.5px; resize: vertical; }
.ws-field input:focus, .ws-field textarea:focus {
    outline: none;
    border-color: var(--ws-accent);
    box-shadow: 0 0 0 2px var(--ws-accent-soft);
}
.ws-editor-actions { display: flex; justify-content: flex-end; gap: var(--ws-space-2); }
.ws-spec-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: var(--ws-space-2);
}
@media (max-width: 720px) { .ws-spec-grid { grid-template-columns: repeat(2, 1fr); } }

.ws-list { display: flex; flex-direction: column; gap: var(--ws-space-2); }
.ws-list-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--ws-space-3);
    padding: var(--ws-space-3);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius-sm);
    background: var(--ws-surface-2);
}
.ws-list-row-main { flex: 1; min-width: 0; }
.ws-list-row-name { font-weight: 500; font-size: 14px; color: var(--ws-fg); }
.ws-list-row-name code { font-family: var(--ws-font-mono); font-size: 13px; }
.ws-list-row-meta {
    font-size: 12px;
    color: var(--ws-fg-muted);
    margin-top: 2px;
}
.ws-list-row-meta code { font-family: var(--ws-font-mono); }
.ws-list-row-desc { font-size: 12.5px; color: var(--ws-fg-muted); margin-top: var(--ws-space-2); }
.ws-list-row-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ---------- Activation gate ---------- */
.ws-gate {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--ws-space-6);
}
.ws-gate h1 { margin: 0 0 var(--ws-space-2); font-size: 28px; }
.ws-gate p {
    color: var(--ws-fg-muted);
    max-width: 480px;
    margin: 0 0 var(--ws-space-5);
    line-height: 1.55;
}
.ws-gate-actions { display: flex; gap: var(--ws-space-3); flex-wrap: wrap; justify-content: center; }

/* ============================================================================
 *  Phase 10.2 — App Shell (logged-in surface) + icon rail
 *  Reuses the --ws-* tokens so the rail inherits 9C.1 polish.
 * ============================================================================ */

.app-shell {
    position: fixed;
    inset: 0;
    background: var(--ws-bg);
    color: var(--ws-fg);
    font-family: var(--ws-font);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1;
}

/* Slice 14 — persistent app header. Sits above the rail + content row,
 * full-width across the viewport. Hairline bottom border separates it
 * from the work surface. */
.app-shell-header {
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 16px 0 18px;
    background: var(--ws-surface);
    border-bottom: 1px solid var(--ws-border-subtle);
    z-index: 3;
}
.app-shell-header-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--ws-fg);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.005em;
    margin-right: 2px;
}
.app-shell-header-mark {
    font-family: var(--ws-font-mono);
    color: var(--ws-accent);
    font-size: 16px;
    font-weight: 600;
}
.app-shell-header-brand-name { color: var(--ws-fg); }
.app-shell-header-sep {
    color: var(--ws-fg-quiet);
    font-size: 13px;
    margin: 0 2px;
}
.app-shell-header-crumb {
    color: var(--ws-fg-muted);
    text-decoration: none;
    font-size: 13px;
    padding: 4px 6px;
    border-radius: var(--ws-radius-sm);
    transition: background 0.12s, color 0.12s;
    max-width: 32ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-shell-header-crumb:hover { background: var(--ws-surface-2); color: var(--ws-fg); }
.app-shell-header-crumb.is-current { color: var(--ws-fg); font-weight: 500; }
.app-shell-header-right {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* The body row sits below the persistent header — rail + content. */
.app-shell-body {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

.app-shell-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Detach the workspace from the rail — 16px daylight + a soft card frame.
 * The padding only kicks in when the content area is showing the embedded
 * workspace; other surfaces (#/app home, settings, admin, tool embed) stay
 * edge-to-edge because they already manage their own internal padding.
 * :has() is widely supported in 2026 (Chrome 105+, Safari 15.4+, Firefox
 * 121+). */
.app-shell-content:has(> .ws-shell-embedded) {
    padding: 16px;
    background: var(--ws-bg);
}

/* When the workspace is embedded inside the shell, it drops its own
   fixed positioning and just fills the remaining flex space. */
.ws-shell.ws-shell-embedded {
    position: relative;
    inset: auto;
    flex: 1;
    min-height: 0;
    /* Card frame — soft border, rounded corners, subtle layered shadow.
     * Background is white so it stands clear of the page surface
     * (--ws-bg is a touch off-white). */
    background: var(--ws-surface);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius-lg);
    overflow: hidden;
    box-shadow:
        0 1px 2px rgba(15, 17, 21, 0.04),
        0 6px 18px rgba(15, 17, 21, 0.06);
}

/* ---------- Icon rail ---------- */
.app-rail {
    width: 56px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
    border-right: 1px solid var(--ws-border-subtle);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0 12px;
    gap: 4px;
    z-index: 2;
}

.app-rail-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--ws-radius-sm);
    font-family: var(--ws-font-mono);
    font-size: 22px;
    font-weight: 600;
    color: var(--ws-accent);
    text-decoration: none;
    margin-bottom: 4px;
}
.app-rail-brand:hover { background: var(--ws-accent-soft); }

.app-rail-divider {
    width: 28px;
    height: 1px;
    background: var(--ws-border-subtle);
    margin: 6px 0;
    flex-shrink: 0;
}

.app-rail-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--ws-radius-sm);
    color: var(--ws-fg-muted);
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    padding: 0;
}
.app-rail-link:hover {
    background: var(--ws-surface-2);
    color: var(--ws-fg);
}
.app-rail-link.is-active {
    background: var(--ws-accent-soft);
    color: var(--ws-accent);
}
.app-rail-link.is-active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    border-radius: 2px;
    background: var(--ws-accent);
}

.app-rail-tooltip {
    position: absolute;
    left: 48px;
    top: 50%;
    transform: translateY(-50%);
    background: #1d1d1f;
    color: #ffffff;
    font-family: var(--ws-font);
    font-size: 12px;
    padding: 5px 10px;
    border-radius: var(--ws-radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    z-index: 10;
}
.app-rail-link:hover .app-rail-tooltip { opacity: 1; }

.app-rail-spacer { flex: 1; }

.app-rail-signout {
    color: var(--ws-fg-quiet);
}
.app-rail-signout:hover { color: var(--ws-danger); }

/* ---------- Placeholder pages (replaced in slices 10.5 / 10.6) ---------- */
.app-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--ws-space-6);
    background: var(--ws-bg);
}
.app-placeholder-inner {
    max-width: 560px;
    text-align: center;
}
.app-placeholder-kicker {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ws-fg-quiet);
    font-weight: 600;
    margin-bottom: var(--ws-space-2);
}
.app-placeholder h1 {
    margin: 0 0 var(--ws-space-3);
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ws-fg);
}
.app-placeholder p {
    margin: 0 0 var(--ws-space-4);
    color: var(--ws-fg-muted);
    line-height: 1.55;
    font-size: 14.5px;
}
.app-placeholder-meta {
    display: inline-block;
    padding: 5px 12px;
    border: 1px solid var(--ws-border-subtle);
    border-radius: 999px;
    font-size: 12px;
    color: var(--ws-fg-muted);
    background: var(--ws-surface);
}
.app-placeholder-meta strong { color: var(--ws-fg); font-weight: 600; }

/* ============================================================================
 *  Phase 10.3 — Signed-in banner (on marketing pages when logged in)
 * ============================================================================ */

.signed-in-banner {
    background: linear-gradient(180deg, #f0f7ff 0%, #e8f0fb 100%);
    border-bottom: 1px solid rgba(0, 113, 227, 0.18);
    padding: 10px 24px;
}
.signed-in-banner-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
}
.signed-in-banner-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #30b25c;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(48, 178, 92, 0.18);
}
.signed-in-banner-text {
    color: #1d1d1f;
    font-weight: 500;
}
.signed-in-banner-cta {
    margin-left: auto;
    color: #0071e3;
    font-weight: 600;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 999px;
    transition: background 0.12s;
}
.signed-in-banner-cta:hover {
    background: rgba(0, 113, 227, 0.10);
}
@media (max-width: 600px) {
    .signed-in-banner-inner { font-size: 12.5px; gap: 8px; }
    .signed-in-banner-cta { margin-left: 0; }
}

/* ============================================================================
 *  Phase 10.4 — Thread filter (search + chips in the Analyst sidebar)
 * ============================================================================ */

.ws-filter {
    padding: var(--ws-space-2) var(--ws-space-3) var(--ws-space-3);
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid var(--ws-border-subtle);
}

.ws-filter-search {
    width: 100%;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius-sm);
    background: var(--ws-surface);
    color: var(--ws-fg);
    font-family: var(--ws-font);
    font-size: 13px;
    outline: none;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.ws-filter-search:focus {
    border-color: var(--ws-accent);
    box-shadow: 0 0 0 3px var(--ws-accent-soft);
}
.ws-filter-search::placeholder {
    color: var(--ws-fg-quiet);
}

.ws-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.ws-filter-chip {
    height: 26px;
    padding: 0 24px 0 10px;
    border: 1px solid var(--ws-border-subtle);
    border-radius: 999px;
    background: var(--ws-surface);
    color: var(--ws-fg-muted);
    font-family: var(--ws-font);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%2386868b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    line-height: 1;
}
/* Chip that's set to a non-default value gets a quiet accent border so
   the user sees at a glance "this filter is active". */
.ws-filter-chip:not([data-default]):not([value=""]) {
    border-color: var(--ws-accent);
    color: var(--ws-accent);
    background: var(--ws-accent-soft);
}
.ws-filter-chip:hover {
    border-color: var(--ws-fg-muted);
    color: var(--ws-fg);
}
.ws-filter-chip:focus {
    border-color: var(--ws-accent);
    box-shadow: 0 0 0 3px var(--ws-accent-soft);
}

.ws-filter-clear {
    height: 26px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--ws-fg-quiet);
    font-family: var(--ws-font);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    line-height: 1;
}
.ws-filter-clear:hover {
    background: var(--ws-surface-2);
    color: var(--ws-fg);
}

.ws-sidebar-filter-meta {
    padding: 6px 12px;
    font-size: 11px;
    color: var(--ws-fg-quiet);
    border-bottom: 1px solid var(--ws-border-subtle);
}

/* ============================================================================
 *  Phase 10.5 — Bespoke tool embed inside AppShell
 *  The standalone tool pages own their internal layout; AppShell just
 *  wraps. We suppress the marketing-style breadcrumb (it points back to
 *  the marketing catalogue, which is the wrong destination inside the
 *  app shell) and grant the embed its own scroll area so the master
 *  rail stays pinned while the tool form + outputs scroll independently.
 * ============================================================================ */

.app-tool-embed {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--ws-bg);
}

/* Suppress the embedded tool's "Catalogue / Process X / Tool Y" breadcrumb
   when it's rendering inside the AppShell. The rail already tells the user
   where they are. */
.app-shell-content .breadcrumb {
    display: none;
}

/* The embedded tools render inside their own .runner-shell <section>; give
   it a softer top margin so the title sits where the user's eye lands. */
.app-tool-embed .runner-shell {
    padding-top: 24px;
    padding-bottom: 48px;
}

/* Slice 12.7 — container alignment.
 * The marketing .container-wide is sized for a full-bleed marketing page.
 * Inside the AppShell embed it sits inside a sidebar-shrunk content area,
 * so we let it fill rather than fight for its 1240px sweetspot. The
 * inputs panel inside each bespoke tool was margin-auto'd to 720px which
 * made the header and the result grid below sit at visibly different
 * widths — flush-left fixes that. */
.app-tool-embed .container-wide {
    max-width: 100%;
    padding-left: var(--ws-space-5);
    padding-right: var(--ws-space-5);
}
.app-tool-embed .runner-head { margin-bottom: 24px; }
/* Inputs panel inside bespoke tools — let it sit flush-left to align with
 * the header above and the chart grid below, not centred-narrow. */
.app-tool-embed .runner-shell > .container-wide > .panel:first-of-type {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 720px !important;
}

/* ============================================================================
 *  Phase 10.6 — "+ New" split button + History page
 * ============================================================================ */

.ws-new-menu {
    position: relative;
    display: flex;
    flex: 1;
    min-width: 0;
}
.ws-new-menu-trigger {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.ws-new-menu-caret {
    padding: 8px 10px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 12px;
}
.ws-new-menu-pop {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 280px;
    background: var(--ws-surface);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius);
    box-shadow:
        0 8px 24px rgba(15, 17, 21, 0.10),
        0 2px 6px rgba(15, 17, 21, 0.06);
    padding: 6px;
    z-index: 100;
}
.ws-new-menu-section {
    padding: 6px 10px 4px;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--ws-fg-quiet);
}
.ws-new-menu-divider {
    height: 1px;
    background: var(--ws-border-subtle);
    margin: 6px 4px;
}
.ws-new-menu-item {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border: none;
    background: transparent;
    border-radius: var(--ws-radius-sm);
    cursor: pointer;
    text-align: left;
    color: var(--ws-fg);
    transition: background 0.12s;
    font-family: var(--ws-font);
}
.ws-new-menu-item:hover { background: var(--ws-surface-2); }
.ws-new-menu-item-glyph {
    width: 28px;
    height: 28px;
    border-radius: var(--ws-radius-sm);
    background: var(--ws-accent-soft);
    color: var(--ws-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--ws-font-mono);
    font-size: 14px;
    flex-shrink: 0;
}
.ws-new-menu-item strong {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ws-fg);
}
.ws-new-menu-item small {
    display: block;
    font-size: 12px;
    color: var(--ws-fg-muted);
    margin-top: 2px;
    font-weight: 400;
}

/* ---------- History page ---------- */
.app-history {
    flex: 1;
    overflow-y: auto;
    padding: var(--ws-space-6) var(--ws-space-5) var(--ws-space-5);
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
}
.app-history-head { margin-bottom: var(--ws-space-5); }
.app-history-kicker {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: var(--ws-fg-quiet);
    margin-bottom: var(--ws-space-2);
}
.app-history-head h1 {
    margin: 0 0 var(--ws-space-2);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.app-history-head p {
    margin: 0;
    color: var(--ws-fg-muted);
    line-height: 1.55;
    font-size: 14px;
    max-width: 580px;
}

.app-history-filter {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: var(--ws-space-4);
    padding: var(--ws-space-3);
    background: var(--ws-surface);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius);
}
.app-history-filter .ws-filter-search { flex: 1; min-width: 240px; }

.app-history-empty {
    padding: var(--ws-space-6);
    text-align: center;
    color: var(--ws-fg-muted);
    background: var(--ws-surface);
    border: 1px dashed var(--ws-border-subtle);
    border-radius: var(--ws-radius);
    font-size: 13.5px;
}

.app-history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.app-history-row {
    display: flex;
    align-items: center;
    gap: var(--ws-space-3);
    padding: 12px 16px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius-sm);
    transition: border-color 0.12s, background 0.12s;
}
.app-history-row:hover { border-color: var(--ws-fg-muted); }
.app-history-row.is-failed { background: var(--ws-danger-soft); border-color: var(--ws-danger); }
.app-history-row-main { flex: 1; min-width: 0; }
.app-history-row-slug {
    font-family: var(--ws-font-mono);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ws-fg);
}
.app-history-row-meta {
    font-size: 11.5px;
    color: var(--ws-fg-muted);
    margin-top: 2px;
}
.app-history-row-meta code {
    font-family: var(--ws-font-mono);
    background: var(--ws-surface-2);
    padding: 0 4px;
    border-radius: 3px;
}
.app-history-tag {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid;
}
.app-history-tag.is-ok { background: var(--ws-good-soft); color: var(--ws-good); border-color: rgba(28, 126, 61, 0.25); }
.app-history-tag.is-failed { background: var(--ws-danger-soft); color: var(--ws-danger); border-color: rgba(214, 56, 56, 0.25); }

/* ============================================================================
 *  Phase 11 — Settings sub-pages (Keys / Billing / Usage / Account)
 * ============================================================================ */

.app-settings {
    flex: 1;
    overflow-y: auto;
    padding: var(--ws-space-6) var(--ws-space-5) var(--ws-space-6);
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
}
.app-settings-head { margin-bottom: var(--ws-space-5); }
.app-settings-kicker {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: var(--ws-fg-quiet);
    margin-bottom: var(--ws-space-2);
}
.app-settings-head h1 {
    margin: 0 0 var(--ws-space-2);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.app-settings-head p {
    margin: 0;
    color: var(--ws-fg-muted);
    line-height: 1.55;
    font-size: 14px;
    max-width: 620px;
}

.app-settings-body { display: flex; flex-direction: column; gap: var(--ws-space-4); }

.app-settings-card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius);
    padding: var(--ws-space-4);
    box-shadow:
        0 1px 2px rgba(15, 17, 21, 0.025),
        0 1px 3px rgba(15, 17, 21, 0.035);
}
.app-settings-card h3 {
    margin: 0 0 var(--ws-space-3);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ws-fg-quiet);
}
.app-settings-card p {
    margin: 0 0 var(--ws-space-3);
    color: var(--ws-fg-muted);
    font-size: 14px;
    line-height: 1.55;
}

.app-settings-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: var(--ws-space-3);
    padding: 10px 0;
    border-bottom: 1px solid var(--ws-border-subtle);
    align-items: center;
    font-size: 14px;
}
.app-settings-row:last-child { border-bottom: none; }
.app-settings-label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ws-fg-quiet);
    font-weight: 600;
}
.app-settings-quiet { color: var(--ws-fg-quiet); font-style: italic; }
.app-settings-tier {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--ws-accent-soft);
    color: var(--ws-accent);
    border: 1px solid rgba(0, 113, 227, 0.2);
}
.app-settings-key {
    display: flex;
    align-items: center;
    gap: var(--ws-space-2);
    flex-wrap: wrap;
}
.app-settings-key code {
    font-family: var(--ws-font-mono);
    font-size: 13px;
    background: var(--ws-surface-2);
    padding: 5px 10px;
    border-radius: var(--ws-radius-sm);
    border: 1px solid var(--ws-border-subtle);
    color: var(--ws-fg);
    word-break: break-all;
    flex: 1;
    min-width: 220px;
}
.app-settings-key-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.app-settings-loading {
    padding: var(--ws-space-5);
    color: var(--ws-fg-muted);
    text-align: center;
    font-size: 13px;
}
.app-settings-empty {
    padding: var(--ws-space-4);
    color: var(--ws-fg-muted);
    font-size: 13px;
    text-align: center;
}
.app-settings-note {
    padding: var(--ws-space-3) var(--ws-space-4);
    background: var(--ws-surface);
    border: 1px dashed var(--ws-border-subtle);
    border-radius: var(--ws-radius-sm);
    color: var(--ws-fg-muted);
    font-size: 12.5px;
    line-height: 1.55;
}
.app-settings-note a { color: var(--ws-accent); }
.app-settings-note strong { color: var(--ws-fg); }

.app-settings-danger {
    border-color: var(--ws-danger-soft);
}
.app-settings-danger h3 { color: var(--ws-danger); }

/* ---------- Plan / Billing ---------- */
.app-plan-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--ws-space-3);
}
@media (max-width: 720px) { .app-plan-grid { grid-template-columns: 1fr; } }
.app-plan-card {
    position: relative;
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius);
    padding: var(--ws-space-4);
    box-shadow:
        0 1px 2px rgba(15, 17, 21, 0.025),
        0 1px 3px rgba(15, 17, 21, 0.035);
}
.app-plan-card.is-current {
    border-color: var(--ws-accent);
    box-shadow:
        0 0 0 2px var(--ws-accent-soft),
        0 1px 3px rgba(0, 113, 227, 0.10);
}
.app-plan-current-badge {
    position: absolute;
    top: -10px;
    right: 16px;
    background: var(--ws-accent);
    color: white;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 999px;
}
.app-plan-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--ws-fg);
}
.app-plan-price {
    font-family: var(--ws-font-mono);
    font-size: 26px;
    font-weight: 600;
    color: var(--ws-fg);
    margin: 4px 0 var(--ws-space-2);
    letter-spacing: -0.01em;
}
.app-plan-blurb {
    font-size: 13px;
    color: var(--ws-fg-muted);
    margin-bottom: var(--ws-space-3);
    line-height: 1.45;
}
.app-plan-perks {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.app-plan-perks li {
    font-size: 12.5px;
    color: var(--ws-fg);
    padding-left: 18px;
    position: relative;
    line-height: 1.45;
}
.app-plan-perks li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--ws-good);
    font-weight: 600;
}

/* ---------- Usage tile row + bar charts ---------- */
.app-usage-tile-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--ws-space-3);
    margin-bottom: var(--ws-space-2);
}
@media (max-width: 720px) {
    .app-usage-tile-row { grid-template-columns: repeat(2, 1fr); }
}

.app-usage-spark {
    display: flex;
    align-items: flex-end;
    gap: var(--ws-space-2);
    height: 140px;
    padding-top: var(--ws-space-2);
}
.app-usage-spark-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 6px;
}
.app-usage-spark-bar {
    width: 100%;
    max-width: 48px;
    background: linear-gradient(180deg, var(--ws-accent) 0%, rgba(0,113,227,0.5) 100%);
    border-radius: 4px 4px 0 0;
    transition: height 0.25s;
}
.app-usage-spark-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    color: var(--ws-fg-quiet);
}
.app-usage-spark-label strong {
    font-family: var(--ws-font-mono);
    color: var(--ws-fg);
    font-size: 12.5px;
    font-weight: 600;
}

.app-usage-tools {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.app-usage-tool-row {
    display: grid;
    grid-template-columns: 220px 1fr 36px;
    align-items: center;
    gap: var(--ws-space-3);
    padding: 4px 0;
}
.app-usage-tool-slug {
    font-family: var(--ws-font-mono);
    font-size: 12.5px;
    color: var(--ws-fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-usage-tool-bar-wrap {
    height: 6px;
    background: var(--ws-surface-2);
    border-radius: 999px;
    overflow: hidden;
}
.app-usage-tool-bar {
    height: 100%;
    background: var(--ws-accent);
    border-radius: 999px;
    transition: width 0.25s;
}
.app-usage-tool-count {
    font-family: var(--ws-font-mono);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ws-fg);
    text-align: right;
}

/* ============================================================================
 *  Slice 12.2 — Profile dropdown (avatar circle + popover menu)
 * ============================================================================ */
.app-profile-wrap {
    position: relative;
    display: inline-block;
}
.app-profile-trigger {
    width: 32px; height: 32px;
    border-radius: 999px;
    border: 1px solid var(--ws-border-subtle);
    background: linear-gradient(180deg, #ffffff 0%, #f5f5f7 100%);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.14s;
    color: var(--ws-fg);
}
.app-profile-trigger:hover {
    border-color: var(--ws-accent);
    box-shadow: 0 0 0 3px var(--ws-accent-soft);
}
.app-profile-trigger.is-open {
    border-color: var(--ws-accent);
    box-shadow: 0 0 0 3px var(--ws-accent-soft);
}
.app-profile-avatar {
    font-family: var(--ws-font);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--ws-fg);
    user-select: none;
}
.app-profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--ws-surface);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius);
    box-shadow:
        0 4px 12px rgba(15, 17, 21, 0.08),
        0 10px 32px rgba(15, 17, 21, 0.12);
    padding: 6px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 1px;
    animation: app-profile-fade 0.12s ease-out;
}
@keyframes app-profile-fade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.app-profile-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 12px;
    border-bottom: 1px solid var(--ws-border-subtle);
    margin-bottom: 4px;
}
.app-profile-head-avatar {
    width: 36px; height: 36px;
    border-radius: 999px;
    background: var(--ws-accent-soft);
    color: var(--ws-accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}
.app-profile-head-text {
    flex: 1;
    min-width: 0;
}
.app-profile-head-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--ws-fg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-profile-head-tier {
    font-size: 11px;
    color: var(--ws-fg-muted);
    text-transform: capitalize;
    margin-top: 2px;
}
.app-profile-item {
    background: transparent;
    border: none;
    text-align: left;
    padding: 8px 12px;
    border-radius: var(--ws-radius-sm);
    font-size: 13px;
    color: var(--ws-fg);
    cursor: pointer;
    font-family: var(--ws-font);
}
.app-profile-item:hover { background: var(--ws-surface-2); }
.app-profile-item-danger { color: var(--ws-danger); }
.app-profile-item-danger:hover { background: var(--ws-danger-soft); }
.app-profile-divider {
    height: 1px;
    background: var(--ws-border-subtle);
    margin: 4px 0;
}

/* ============================================================================
 *  Slice 12.8 — Billing tier banner
 * ============================================================================ */
.app-billing-banner {
    background: linear-gradient(180deg, var(--ws-accent-soft) 0%, rgba(0,113,227,0.04) 100%);
    border: 1px solid rgba(0, 113, 227, 0.22);
    border-radius: var(--ws-radius);
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 1px 2px rgba(0, 113, 227, 0.04);
}
.app-billing-banner.is-near-limit {
    background: linear-gradient(180deg, var(--ws-warn-soft) 0%, rgba(178, 94, 9, 0.04) 100%);
    border-color: rgba(178, 94, 9, 0.3);
}
.app-billing-banner-text {
    font-size: 14px;
    color: var(--ws-fg);
    line-height: 1.4;
}
.app-billing-banner-text strong {
    font-weight: 600;
    color: var(--ws-fg);
}
.app-billing-banner-quiet {
    color: var(--ws-fg-quiet);
    font-size: 12.5px;
}
.app-billing-banner-bar {
    height: 6px;
    background: rgba(0, 113, 227, 0.10);
    border-radius: 999px;
    overflow: hidden;
}
.app-billing-banner-bar-fill {
    height: 100%;
    background: var(--ws-accent);
    border-radius: 999px;
    transition: width 0.3s ease;
}
.app-billing-banner.is-near-limit .app-billing-banner-bar { background: rgba(178, 94, 9, 0.12); }
.app-billing-banner.is-near-limit .app-billing-banner-bar-fill { background: var(--ws-warn); }

/* ============================================================================
 *  Slice 12.3 — Dashboard landing (#/app)
 *  Hero Analyst input + Quick start grid + Recent + Browse all.
 * ============================================================================ */
.app-home {
    flex: 1;
    overflow-y: auto;
    background: var(--ws-bg);
    padding: 32px var(--ws-space-5) 64px;
}
.app-home-inner {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* ---------- Hero ---------- */
.app-home-hero {
    text-align: left;
}
.app-home-hero-kicker {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--ws-fg-quiet);
    margin-bottom: var(--ws-space-3);
}
.app-home-hero-title {
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0 0 18px;
    color: var(--ws-fg);
}
.app-home-hero-sub-inline {
    color: var(--ws-fg-muted);
    font-weight: 500;
}
.app-home-hero-form {
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius);
    padding: 14px 16px 12px;
    box-shadow:
        0 1px 2px rgba(15, 17, 21, 0.025),
        0 4px 12px rgba(15, 17, 21, 0.04);
    transition: box-shadow 0.15s, border-color 0.15s;
}
.app-home-hero-form:focus-within {
    border-color: var(--ws-accent);
    box-shadow:
        0 0 0 3px var(--ws-accent-soft),
        0 4px 16px rgba(0, 113, 227, 0.10);
}
.app-home-hero-input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--ws-fg);
    font-family: var(--ws-font);
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    padding: 0;
}
.app-home-hero-input::placeholder {
    color: var(--ws-fg-quiet);
}
.app-home-hero-form-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}
.app-home-hero-hint {
    font-size: 11.5px;
    color: var(--ws-fg-quiet);
}

/* ---------- Section heads ---------- */
.app-home-section { display: flex; flex-direction: column; gap: var(--ws-space-3); }
.app-home-section-head {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ws-fg-quiet);
}
.app-home-section-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.app-home-section-link {
    font-size: 12px;
    color: var(--ws-accent);
    text-decoration: none;
}
.app-home-section-link:hover { text-decoration: underline; }

/* ---------- Quick start grid ---------- */
.app-home-quick-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
@media (max-width: 900px) { .app-home-quick-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .app-home-quick-grid { grid-template-columns: 1fr; } }
.app-home-quick-card {
    text-align: left;
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius);
    padding: 16px 18px;
    cursor: pointer;
    transition: transform 0.14s ease, border-color 0.14s, box-shadow 0.14s;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow:
        0 1px 2px rgba(15, 17, 21, 0.025),
        0 1px 3px rgba(15, 17, 21, 0.035);
    color: inherit;
    font-family: var(--ws-font);
}
.app-home-quick-card:hover {
    transform: translateY(-2px);
    border-color: var(--ws-accent);
    box-shadow:
        0 1px 2px rgba(0, 113, 227, 0.04),
        0 8px 24px rgba(0, 113, 227, 0.10);
}
.app-home-quick-card:disabled {
    cursor: wait;
    opacity: 0.6;
}
.app-home-quick-card-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--ws-accent-soft);
    color: var(--ws-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}
.app-home-quick-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ws-fg);
}
.app-home-quick-card-blurb {
    font-size: 12.5px;
    color: var(--ws-fg-muted);
    line-height: 1.45;
}

/* ---------- Recent list ---------- */
.app-home-empty {
    padding: var(--ws-space-4) 0;
    color: var(--ws-fg-quiet);
    font-size: 13.5px;
}
.app-home-recent-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.app-home-recent-row {
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--ws-radius-sm);
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background 0.12s, border-color 0.12s;
    font-family: var(--ws-font);
}
.app-home-recent-row:hover {
    background: var(--ws-surface);
    border-color: var(--ws-border-subtle);
}
.app-home-recent-slug {
    font-family: var(--ws-font-mono);
    font-size: 13px;
    color: var(--ws-fg);
}
.app-home-recent-meta {
    font-size: 11.5px;
    color: var(--ws-fg-quiet);
    flex-shrink: 0;
}

/* ---------- Browse all grid (category cards) ---------- */
.app-home-browse-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
@media (max-width: 900px) { .app-home-browse-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .app-home-browse-grid { grid-template-columns: 1fr; } }
.app-home-browse-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    background: var(--ws-surface);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s;
}
.app-home-browse-card:hover {
    border-color: var(--ws-accent);
    box-shadow: 0 4px 16px rgba(0, 113, 227, 0.06);
    transform: translateY(-1px);
}
.app-home-browse-card-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--ws-accent-soft);
    color: var(--ws-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.app-home-browse-card-text { flex: 1; min-width: 0; }
.app-home-browse-card-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ws-fg);
    margin-bottom: 2px;
}
.app-home-browse-card-blurb {
    font-size: 12px;
    color: var(--ws-fg-muted);
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ============================================================================
 *  Slice 13.2 — Admin surface (Licenses table + Usage dashboard)
 * ============================================================================ */
.app-admin {
    flex: 1;
    overflow-y: auto;
    padding: var(--ws-space-6) var(--ws-space-5);
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--ws-space-4);
}

.app-admin-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-bottom: 4px;
}
.app-admin-meta {
    margin-left: auto;
    font-size: 12px;
    color: var(--ws-fg-quiet);
}

.app-admin-table-wrap {
    background: var(--ws-surface);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius);
    overflow: auto;
    max-height: calc(100vh - 280px);
    box-shadow:
        0 1px 2px rgba(15, 17, 21, 0.025),
        0 1px 3px rgba(15, 17, 21, 0.035);
}
.app-admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.app-admin-table th {
    text-align: left;
    padding: 10px 14px;
    background: var(--ws-surface-2);
    color: var(--ws-fg-quiet);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--ws-border-subtle);
    position: sticky;
    top: 0;
    z-index: 1;
}
.app-admin-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--ws-border-subtle);
    vertical-align: middle;
}
.app-admin-table tr:last-child td { border-bottom: none; }
.app-admin-table tr:hover td { background: var(--ws-surface-2); }
.app-admin-user {
    font-weight: 500;
    color: var(--ws-fg);
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
    white-space: nowrap;
}
.app-admin-user-sub {
    font-size: 11.5px;
    color: var(--ws-fg-quiet);
    margin-top: 2px;
}
.app-admin-num {
    font-family: var(--ws-font-mono);
    text-align: right;
    color: var(--ws-fg);
    width: 1%;
    white-space: nowrap;
}
.app-admin-mute {
    color: var(--ws-fg-muted);
    font-size: 12px;
    white-space: nowrap;
}
.app-admin-key {
    font-family: var(--ws-font-mono);
    font-size: 11.5px;
    color: var(--ws-fg-muted);
    background: var(--ws-surface-2);
    padding: 2px 6px;
    border-radius: 4px;
}
.app-admin-empty {
    padding: 30px 0;
    text-align: center;
    color: var(--ws-fg-quiet);
}

.app-admin-select {
    height: 26px;
    padding: 0 22px 0 8px;
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius-sm);
    background-color: var(--ws-surface);
    color: var(--ws-fg);
    font-family: var(--ws-font);
    font-size: 12px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%2386868b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 6px center;
}
.app-admin-select:hover { border-color: var(--ws-fg-muted); }
.app-admin-select:focus {
    outline: none;
    border-color: var(--ws-accent);
    box-shadow: 0 0 0 3px var(--ws-accent-soft);
}
.app-admin-status.app-admin-status-active   { color: var(--ws-good); border-color: rgba(28,126,61,0.25); background-color: var(--ws-good-soft); }
.app-admin-status.app-admin-status-revoked  { color: var(--ws-danger); border-color: rgba(211,47,47,0.25); background-color: var(--ws-danger-soft); }
.app-admin-status.app-admin-status-expired  { color: var(--ws-warn); border-color: rgba(178,94,9,0.25); background-color: var(--ws-warn-soft); }

/* ============================================================================
 *  Slice 14 — thread cards with tool-icon stacks + pin + filter icons
 * ============================================================================ */

/* ---------- Section heads inside the thread list ---------- */
.ws-thread-section-head {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 12px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ws-fg-quiet);
}
.ws-thread-section-head svg { color: var(--ws-fg-quiet); }

/* ---------- Expanded thread card — Slice 14 (Option C, single row) ----
 * One row: [icon] [title flex-1] [timestamp]
 * Pin button slides in over the timestamp on hover. ~32px tall,
 * roughly 2× the density of the original 3-line card.
 */
.ws-thread-card {
    cursor: pointer;
    padding: 0 10px 0 8px;
    margin: 0 4px 2px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.12s, border-color 0.12s;
    outline: none;
    position: relative;
}
.ws-thread-card:hover {
    background: var(--ws-surface-2);
    border-color: var(--ws-border-subtle);
}
.ws-thread-card:focus-visible {
    border-color: var(--ws-accent);
    box-shadow: 0 0 0 3px var(--ws-accent-soft);
}
.ws-thread-card.is-active {
    background: var(--ws-accent-soft);
    border-color: rgba(0, 113, 227, 0.22);
}
.ws-thread-card.is-active .ws-thread-card-title { color: var(--ws-accent); font-weight: 600; }

/* Icon wrap — small tile, optional +N badge top-right, optional pin
 * overlay bottom-left. Same visual language as the collapsed mode. */
.ws-thread-card-iconwrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--ws-surface);
    border: 1px solid var(--ws-border-subtle);
    color: var(--ws-fg-muted);
    flex-shrink: 0;
}
.ws-thread-card.is-active .ws-thread-card-iconwrap {
    background: rgba(255, 255, 255, 0.9);
    color: var(--ws-accent);
    border-color: rgba(0, 113, 227, 0.28);
}
.ws-thread-card-badge {
    position: absolute;
    top: -5px;
    right: -7px;
    font-family: var(--ws-font);
    font-size: 9px;
    font-weight: 600;
    color: var(--ws-fg-quiet);
    background: var(--ws-surface);
    border: 1px solid var(--ws-border-subtle);
    border-radius: 999px;
    padding: 1px 4px;
    line-height: 1;
}
.ws-thread-card.is-active .ws-thread-card-badge {
    color: var(--ws-accent);
    border-color: rgba(0, 113, 227, 0.3);
}
.ws-thread-card-pin-overlay {
    position: absolute;
    bottom: -3px;
    left: -3px;
    width: 11px;
    height: 11px;
    background: var(--ws-accent);
    color: #ffffff;
    border: 1px solid var(--ws-surface);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ws-thread-card-title {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--ws-fg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}
.ws-thread-card-time {
    font-size: 11px;
    color: var(--ws-fg-quiet);
    flex-shrink: 0;
    transition: opacity 0.12s;
}
.ws-thread-card:hover .ws-thread-card-time { opacity: 0; }

/* Pin button — sits in the timestamp slot, only visible on hover or
 * when the thread is already pinned. */
.ws-thread-pin {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--ws-fg-quiet);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s, color 0.12s, background 0.12s;
}
.ws-thread-card:hover .ws-thread-pin,
.ws-thread-pin.is-pinned { opacity: 1; }
.ws-thread-pin:hover { background: var(--ws-surface); color: var(--ws-fg); }
.ws-thread-pin.is-pinned { color: var(--ws-accent); }

/* ---------- Collapsed (narrow) thread tile ---------- */
.ws-thread-collapsed {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 4px auto;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--ws-surface);
    color: var(--ws-fg-muted);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.ws-thread-collapsed:hover {
    background: var(--ws-surface-2);
    border-color: var(--ws-border-subtle);
    color: var(--ws-fg);
}
.ws-thread-collapsed.is-active {
    background: var(--ws-accent-soft);
    border-color: rgba(0, 113, 227, 0.25);
    color: var(--ws-accent);
}
.ws-thread-collapsed-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: var(--ws-surface);
    color: var(--ws-fg-muted);
    border: 1px solid var(--ws-border-subtle);
    border-radius: 999px;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 4px;
    line-height: 1;
}
.ws-thread-collapsed.is-active .ws-thread-collapsed-badge {
    color: var(--ws-accent);
    border-color: rgba(0, 113, 227, 0.3);
}
.ws-thread-collapsed-pin {
    position: absolute;
    bottom: -2px;
    left: -2px;
    background: var(--ws-accent);
    color: #ffffff;
    border-radius: 999px;
    width: 13px;
    height: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ws-surface);
}
.ws-thread-collapsed-new {
    background: var(--ws-accent);
    color: #ffffff;
    border-color: var(--ws-accent);
}
.ws-thread-collapsed-new:hover {
    background: #0066cc;
    color: #ffffff;
    border-color: #0066cc;
}
.ws-sidebar-foot-narrow {
    border-top: 1px solid var(--ws-border-subtle);
    padding: 6px 0;
    display: flex;
    justify-content: center;
}

/* ---------- Filter icon buttons (Slice 14) ---------- */
.ws-filter-icons {
    display: flex;
    align-items: center;
    gap: 6px;
}
.ws-filter-icon-wrap {
    position: relative;
    flex: 1;
}
.ws-filter-icon {
    width: 100%;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 8px;
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius-sm);
    background: var(--ws-surface);
    color: var(--ws-fg-muted);
    font-family: var(--ws-font);
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    overflow: hidden;
}
.ws-filter-icon:hover {
    border-color: var(--ws-fg-muted);
    color: var(--ws-fg);
}
.ws-filter-icon.is-open,
.ws-filter-icon:focus {
    outline: none;
    border-color: var(--ws-accent);
    box-shadow: 0 0 0 3px var(--ws-accent-soft);
}
.ws-filter-icon.is-active {
    background: var(--ws-accent-soft);
    border-color: rgba(0, 113, 227, 0.3);
    color: var(--ws-accent);
}
.ws-filter-icon-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ws-filter-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 180px;
    max-height: 280px;
    overflow-y: auto;
    background: var(--ws-surface);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius);
    box-shadow:
        0 4px 12px rgba(15, 17, 21, 0.08),
        0 10px 32px rgba(15, 17, 21, 0.12);
    padding: 4px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 1px;
    animation: app-profile-fade 0.12s ease-out;
}
.ws-filter-popover-item {
    background: transparent;
    border: none;
    text-align: left;
    padding: 7px 10px;
    border-radius: var(--ws-radius-sm);
    font-size: 12.5px;
    color: var(--ws-fg);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--ws-font);
}
.ws-filter-popover-item:hover { background: var(--ws-surface-2); }
.ws-filter-popover-item.is-selected {
    color: var(--ws-accent);
    background: var(--ws-accent-soft);
}

/* ---------- Override .ws-filter-clear to be an icon button (Slice 14) ---------- */
.ws-filter-clear {
    width: 30px;
    height: 30px;
    padding: 0;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Sidebar toggle SVG sizing (Slice 14 — replace ☰ glyph) ---------- */
.ws-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Thread title in expanded card needs to wrap nicely when active
 *           with a max width that respects the pin button on the right. */
.ws-thread-card-top .ws-thread-icons { flex: 1; min-width: 0; }

/* ============================================================================
 *  Slice 15 — Admin create-license modal
 * ============================================================================ */
.app-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 21, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: app-profile-fade 0.12s ease-out;
}
.app-modal {
    background: var(--ws-surface);
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius-lg);
    box-shadow:
        0 20px 60px rgba(15, 17, 21, 0.18),
        0 4px 12px rgba(15, 17, 21, 0.08);
    width: 100%;
    max-width: 540px;
    max-height: calc(100vh - 48px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.app-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--ws-border-subtle);
}
.app-modal-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--ws-fg);
    text-transform: none;
    letter-spacing: -0.005em;
}
.app-modal-body {
    padding: 16px 18px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.app-modal-tabs {
    display: inline-flex;
    background: var(--ws-surface-2);
    padding: 3px;
    border-radius: var(--ws-radius-sm);
    align-self: flex-start;
}
.app-modal-tab {
    border: none;
    background: transparent;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 12.5px;
    color: var(--ws-fg-muted);
    cursor: pointer;
    font-family: var(--ws-font);
    font-weight: 500;
}
.app-modal-tab.is-active {
    background: var(--ws-surface);
    color: var(--ws-fg);
    box-shadow: 0 1px 2px rgba(15, 17, 21, 0.06);
}

.app-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

.ws-field-checkbox {
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}
.ws-field-checkbox input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
}
.ws-field-checkbox span {
    font-size: 12.5px;
    color: var(--ws-fg);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}
.ws-field-checkbox em {
    color: var(--ws-fg-quiet);
    font-style: normal;
}

/* ---------- Success screens inside the modal ---------- */
.app-modal-success {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.app-modal-success-head {
    font-size: 14px;
    font-weight: 600;
    color: var(--ws-good);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--ws-border-subtle);
    margin-bottom: 4px;
}
.app-modal-success-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.app-modal-success-label {
    width: 72px;
    flex-shrink: 0;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ws-fg-quiet);
    font-weight: 600;
}
.app-modal-key {
    font-family: var(--ws-font-mono);
    font-size: 12px;
    background: var(--ws-surface-2);
    border: 1px solid var(--ws-border-subtle);
    border-radius: 4px;
    padding: 4px 8px;
    word-break: break-all;
    flex: 1;
    color: var(--ws-fg);
}

/* ---------- Bulk result list ---------- */
.app-modal-bulk-list {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--ws-border-subtle);
    border-radius: var(--ws-radius-sm);
    background: var(--ws-surface-2);
}
.app-modal-bulk-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--ws-border-subtle);
    font-size: 12px;
}
.app-modal-bulk-row:last-child { border-bottom: none; }
.app-modal-bulk-email {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-modal-bulk-key {
    font-family: var(--ws-font-mono);
    font-size: 11px;
    color: var(--ws-fg-muted);
    flex-shrink: 0;
}
.app-modal-bulk-skipped {
    font-size: 12px;
    color: var(--ws-fg-muted);
}
.app-modal-bulk-skipped summary {
    cursor: pointer;
    padding: 6px 0;
    user-select: none;
}
.app-modal-bulk-skipped ul {
    margin: 4px 0 0;
    padding-left: 18px;
}

/* Mark the create button at the end of the admin filters row */
.app-admin-filters .ws-btn-primary { margin-left: auto; }
.app-admin-filters .app-admin-meta + .ws-btn-primary { margin-left: 8px; }
