/* --------------------------------------------------------------------------
   Apiro · design system — v3 "Editorial Studio"
   Warm cream surfaces, serif display, restrained typography. Built on the
   same instincts as Anthropic's claude.ai, Mercury, NYT Cooking, and
   Linear's restraint — not the usual AEC techy look.
   ---------------------------------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Warm-stone palette — warm cream surfaces, ink type, burnt-sienna accent */
  --bg:        #F5F1E8;          /* page bone — claude.ai-style warm cream */
  --surface:   #FBF7EE;          /* card surface — slightly warmer than bg */
  --surface-2: #EFEADE;          /* recessed inputs / subtle wells */
  --fg:        #1B1916;          /* warm near-black ink */
  --muted:     #6B6760;          /* warm muted text — readable */
  --muted-2:   #9C988F;
  --line:      #E2DCCE;          /* hairline, warm */
  --line-strong: #C8C0B0;

  --accent:    #B85C38;          /* burnt sienna — premium architectural accent */
  --accent-hi: #A04E2D;
  --accent-soft: #F4E2D6;

  --teal:      #2F5651;          /* deep forest — secondary accent (sparingly) */

  --pass:      #4F7355;          /* sage */
  --pass-soft: #DFE9DD;
  --warn:      #B8771E;
  --warn-soft: #F5E6CC;
  --fail:      #A8472D;
  --fail-soft: #F2D8CC;

  --shadow-xs: 0 1px 2px rgba(46, 38, 25, .04);
  --shadow-sm: 0 1px 3px rgba(46, 38, 25, .05), 0 1px 2px rgba(46, 38, 25, .03);
  --shadow-md: 0 8px 24px rgba(46, 38, 25, .07), 0 2px 6px rgba(46, 38, 25, .04);
  --shadow-lg: 0 24px 56px rgba(46, 38, 25, .12), 0 4px 12px rgba(46, 38, 25, .06);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 28px;

  --serif:     'Fraunces', 'Iowan Old Style', 'Charter', Georgia, serif;
  --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono:      'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* Dark theme — warm-ink reverse of Warm Stone, not cold Slack-blue.
   Activated by system preference unless the user picks a theme manually. */
:root[data-theme="dark"],
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #1A1815;
    --surface:   #221F1B;
    --surface-2: #2B2723;
    --fg:        #ECE7DC;
    --muted:     #9E978A;
    --muted-2:   #6E695F;
    --line:      #34302A;
    --line-strong: #4A4439;
    --accent:    #E89868;   /* sienna shifts warmer in the dark */
    --accent-hi: #F2A87B;
    --accent-soft: #3A2A1F;
    --teal:      #6FA39B;
    --pass:      #80A582;
    --pass-soft: #2A3A2C;
    --warn:      #D9A04C;
    --warn-soft: #3A2E1B;
    --fail:      #D87554;
    --fail-soft: #3A2218;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .25);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .3), 0 1px 2px rgba(0, 0, 0, .2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .22);
    --shadow-lg: 0 24px 56px rgba(0, 0, 0, .5), 0 4px 12px rgba(0, 0, 0, .3);
  }
}
/* Explicit data-theme overrides — manual user choice */
:root[data-theme="dark"] {
  --bg:        #1A1815;
  --surface:   #221F1B;
  --surface-2: #2B2723;
  --fg:        #ECE7DC;
  --muted:     #9E978A;
  --muted-2:   #6E695F;
  --line:      #34302A;
  --line-strong: #4A4439;
  --accent:    #E89868;
  --accent-hi: #F2A87B;
  --accent-soft: #3A2A1F;
  --teal:      #6FA39B;
  --pass:      #80A582;
  --pass-soft: #2A3A2C;
  --warn:      #D9A04C;
  --warn-soft: #3A2E1B;
  --fail:      #D87554;
  --fail-soft: #3A2218;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .3), 0 1px 2px rgba(0, 0, 0, .2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .22);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, .5), 0 4px 12px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "ss02", "cv11";
}
/* Subtle paper grain — barely perceptible, adds material warmth */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: .035;
  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.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 200px 200px;
}
/* In dark mode, multiply blend would darken to black — use screen instead */
:root[data-theme="dark"] body::before { mix-blend-mode: screen; opacity: .04; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body::before { mix-blend-mode: screen; opacity: .04; }
}
body > * { position: relative; z-index: 2; }

/* --- Focus rings — visible for keyboard users, suppressed for mouse --- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-soft) !important;
}

/* --- Skip-to-main link (keyboard accessibility) --- */
.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  background: var(--accent);
  color: #fff;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  z-index: 9999;
  transition: top .15s;
}
.skip-link:focus-visible { top: 8px; outline: 2px solid #fff; outline-offset: 2px; }

/* Reduced motion: honour user preference */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Print: clean editorial print of whatever the current page shows */
@media print {
  /* Hide nav chrome + tools */
  header, aside#left-pane, .skip-link, .cmdk-modal, .tmpl-modal,
  .recent-menu-panel, .toast, #toasts,
  .feedback-panel, .opt-actions, .opt-warnings,
  .save-celebrate, .save-celebrate-label, .next-steps-strip {
    display: none !important;
  }
  /* No animations, no shadows, no decorative bg */
  body, body * {
    animation: none !important;
    transition: none !important;
    box-shadow: none !important;
    background-image: none !important;
  }
  body::before { display: none !important; }
  main { display: block !important; height: auto !important; }
  section#right-pane {
    padding: 0 !important;
    background: #fff !important;
  }
  #options {
    display: block !important;
    gap: 0 !important;
  }
  .option, .option-friendly {
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
    margin-bottom: 18px;
    background: #fff !important;
  }
  .option-friendly .opt-preview-row { background: #fff !important; }
  .option-friendly .opt-preview-row img { filter: none !important; }
  /* Ensure colours don't mess with print */
  * { color: #000 !important; }
  .opt-summary-item strong, .opt-headline h3 { color: #000 !important; }
}

/* --- Header / top nav --- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  height: 64px;
}
header h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--fg);
  font-style: italic;
}
header h1 span {
  font-family: var(--font);
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  margin-left: .6em;
  font-size: 12px;
  letter-spacing: .02em;
  text-transform: lowercase;
}
header nav {
  display: flex;
  gap: 8px;
  align-items: center;
}
header nav a,
header nav button {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
header nav a:hover,
header nav button:hover {
  color: var(--accent);
  background: var(--surface-2);
}
.user-info {
  font-size: 12px;
  color: var(--fg);
  padding: 5px 10px 5px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.user-info .ui-name { color: var(--fg); }
.user-info .role {
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: .12em;
  padding: 2px 7px;
  background: var(--surface-2);
  border-radius: 999px;
}

/* --- Recent designs dropdown menu in header --- */
.recent-menu { position: relative; display: inline-flex; align-items: center; }
.recent-menu > a { padding-right: 4px !important; }
.recent-menu-trigger {
  background: transparent;
  border: 0;
  padding: 6px 4px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
}
.recent-menu-trigger:hover { color: var(--accent); }
.recent-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
  animation: fade-up .18s cubic-bezier(.2, 0, 0, 1);
}
.recent-head {
  padding: 12px 16px 8px;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.recent-loading, .recent-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}
.recent-item {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--fg);
  transition: background .12s;
  border-bottom: 1px solid var(--line);
}
.recent-item:last-of-type { border-bottom: 0; }
.recent-item:hover { background: var(--surface-2); }
.recent-item-thumb {
  width: 48px; height: 48px;
  background: #FFFCF6;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex: 0 0 auto;
  display: grid; place-items: center;
}
.recent-item-thumb img {
  max-width: 100%; max-height: 100%; object-fit: contain;
}
.recent-thumb-placeholder {
  color: var(--muted-2); font-size: 18px;
}
.recent-item-body { min-width: 0; flex: 1; }
.recent-item-title {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -.012em;
  line-height: 1.2;
  color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recent-item-sub {
  margin-top: 2px;
  font-family: var(--font);
  font-size: 11px;
  color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recent-foot {
  display: block;
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-align: center;
  border-top: 1px solid var(--line);
  background: var(--bg);
  text-decoration: none;
}
.recent-foot:hover { background: var(--accent-soft); }

/* --- Theme toggle (sun / moon) --- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: background .15s, border-color .15s, color .15s;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--fg); border-color: var(--line-strong); }
.theme-toggle .ico-dark { display: none; }
.theme-toggle .ico-light { display: inline; }
:root[data-theme="dark"] .theme-toggle .ico-light { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-dark { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .ico-light { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .ico-dark { display: inline; }
}

/* --- Command palette trigger pill in nav --- */
.cmdk-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px 5px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.cmdk-trigger:hover {
  border-color: var(--line-strong);
  color: var(--fg);
  background: var(--bg);
}
.cmdk-trigger svg { opacity: .65; }
.cmdk-trigger kbd {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .04em;
  background: var(--surface-2);
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 4px;
  border: 0;
}

/* --- Personal arrival greeting --- */
.arrival {
  margin-bottom: 22px;
  animation: fade-up .6s cubic-bezier(.2, 0, 0, 1) both;
}
.arrival-greet {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -.022em;
  color: var(--fg);
  margin: 0 0 6px;
  line-height: 1.2;
}
.arrival-greet em {
  font-style: italic;
  color: var(--accent);
}
.arrival-tagline {
  font-family: var(--font);
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.55;
  max-width: 42ch;
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- "Continue where you left off" hospitality card --- */
.continue-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--accent-soft) 0%, transparent 100%);
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius-lg);
  margin-bottom: 22px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .35s ease, transform .35s ease;
}
.continue-card.in {
  opacity: 1;
  transform: translateY(0);
}
.continue-card.dismissed { display: none; }
.continue-card-body { flex: 1; min-width: 0; }
.continue-card-label {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--accent);
  margin-bottom: 4px;
}
.continue-card-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -.012em;
  color: var(--fg);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.continue-card-sub {
  font-family: var(--font);
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.continue-card button.primary {
  flex: 0 0 auto;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 500;
}

/* --- First-run onboarding overlay --- */
.onboarding-overlay {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  opacity: 0;
  transition: opacity .25s ease;
}
.onboarding-overlay.in { opacity: 1; }
.onboarding-backdrop {
  position: absolute; inset: 0;
  background: rgba(27, 25, 22, .65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.onboarding-card {
  position: relative;
  width: min(560px, calc(100vw - 64px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  padding: 44px 44px 36px;
  box-shadow: var(--shadow-lg);
  transform: translateY(-6px) scale(.98);
  opacity: 0;
  transition: transform .35s cubic-bezier(.2,0,0,1), opacity .25s ease;
  overflow: hidden;
}
.onboarding-overlay.in .onboarding-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.onboarding-card::before {
  content: "";
  position: absolute;
  top: -100px; right: -100px;
  width: 320px; height: 320px;
  background: radial-gradient(circle at center, var(--accent-soft) 0%, transparent 70%);
  filter: blur(40px);
  opacity: .85;
  pointer-events: none;
}
.onboarding-card > * { position: relative; }
.onboarding-eyebrow {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 12px;
}
.onboarding-eyebrow::before {
  content: ""; width: 24px; height: 1px; background: var(--accent);
}
.onboarding-title {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -.024em;
  color: var(--fg);
  margin: 0 0 10px;
  line-height: 1.1;
}
.onboarding-sub {
  font-family: var(--font);
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 24px;
  max-width: 44ch;
}
.onboarding-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  counter-reset: ob;
}
.onboarding-steps li {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-family: var(--font);
}
.onboarding-steps li:first-child { border-top: 0; padding-top: 0; }
.onboarding-steps li strong {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 15px;
  color: var(--accent);
  flex: 0 0 80px;
}
.onboarding-steps li span {
  font-size: 13px;
  line-height: 1.55;
  color: var(--fg);
}
.onboarding-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.onboarding-actions .primary.big {
  flex: 1;
  min-width: 200px;
}
.onboarding-foot {
  margin: 0;
  font-family: var(--font);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.onboarding-foot kbd {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

/* --- Brief template picker modal --- */
.tmpl-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease;
}
.tmpl-modal.in { opacity: 1; pointer-events: auto; }
.tmpl-backdrop {
  position: absolute; inset: 0;
  background: rgba(27, 25, 22, .45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.tmpl-panel {
  position: relative;
  width: min(900px, calc(100vw - 48px));
  max-height: 88vh; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  padding: 36px 40px 32px;
  transform: translateY(-6px) scale(.98);
  opacity: 0;
  transition: transform .25s cubic-bezier(.2,0,0,1), opacity .22s ease;
}
.tmpl-modal.in .tmpl-panel { transform: translateY(0) scale(1); opacity: 1; }
.tmpl-head { margin-bottom: 22px; }
.tmpl-eyebrow {
  font-family: var(--font); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em; color: var(--accent);
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 14px;
}
.tmpl-eyebrow::before {
  content: ""; width: 28px; height: 1px; background: var(--accent);
}
.tmpl-title {
  font-family: var(--serif); font-size: 28px; font-weight: 500;
  letter-spacing: -.024em; color: var(--fg); margin: 0 0 6px;
  line-height: 1.1;
}
.tmpl-sub {
  font-family: var(--font); font-size: 14px; color: var(--muted);
  margin: 0; line-height: 1.55;
}
.tmpl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.tmpl-card {
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  cursor: pointer;
  font: inherit;
  color: var(--fg);
  transition: background .15s, border-color .15s, transform .12s;
}
.tmpl-card:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  transform: translateY(-1px);
}
.tmpl-card h3 {
  font-family: var(--serif); font-size: 18px; font-weight: 500;
  letter-spacing: -.014em; margin: 0 0 6px; color: var(--fg);
  line-height: 1.2;
}
.tmpl-card p {
  font-family: var(--font); font-size: 12.5px; color: var(--muted);
  margin: 0; line-height: 1.55;
}
.tmpl-close {
  position: absolute; top: 18px; right: 18px;
  background: transparent; border: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 22px; line-height: 1;
  color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s, color .15s;
}
.tmpl-close:hover { background: var(--surface-2); color: var(--fg); }

/* --- Fill-mode customize block: "Use my brief" vs "Add trending" --- */
.customize-block {
  margin: 16px 0 14px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  animation: fade-up .35s cubic-bezier(.2, 0, 0, 1) both;
}
.customize-eyebrow {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px;
}
.customize-eyebrow::before {
  content: ""; width: 18px; height: 1px; background: var(--muted);
}
.customize-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.customize-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 16px 12px;
  text-align: left;
  font: inherit;
  cursor: pointer;
  color: var(--fg);
  transition: background .15s, border-color .15s, transform .12s;
}
.customize-card:hover {
  background: var(--bg);
  border-color: var(--line-strong);
}
.customize-card.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.customize-card-icon {
  font-size: 18px;
  margin-bottom: 4px;
}
.customize-card strong {
  display: block;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.003em;
  margin-bottom: 4px;
  color: var(--fg);
}
.customize-card span {
  display: block;
  font-family: var(--font);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
}
.customize-card.active strong { color: var(--accent); }

/* Suggestions pane underneath */
.suggest-pane {
  margin-top: 14px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.suggest-loading {
  font-family: var(--font);
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 14px 0;
}
.suggest-empty {
  font-family: var(--font);
  font-size: 13px;
  color: var(--muted);
  padding: 8px 0;
  line-height: 1.5;
}
.suggest-empty strong { color: var(--fg); font-weight: 600; }
.suggest-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-family: var(--font);
  font-size: 12px;
}
.suggest-sector { color: var(--muted); }
.suggest-sector strong { color: var(--accent); font-weight: 600; }
.suggest-meta { color: var(--muted-2); font-style: italic; }
.suggest-summary {
  font-family: var(--font);
  font-size: 13px;
  color: var(--fg);
  line-height: 1.55;
  margin: 0 0 14px;
  padding: 10px 12px;
  background: var(--surface);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.suggest-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.suggest-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.suggest-item:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
}
.suggest-item input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}
.suggest-item-body { min-width: 0; flex: 1; }
.suggest-item-title {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 3px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.suggest-item-meta {
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 400;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.suggest-item-rationale {
  font-family: var(--font);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.suggest-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.suggest-actions-status {
  flex: 1;
  font-family: var(--font);
  font-size: 12px;
  color: var(--muted);
}
.suggest-actions button.primary.small,
.suggest-actions button.ghost.small {
  padding: 7px 14px;
  font-size: 12px;
  flex: 0 0 auto;
}
.suggest-citations {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-family: var(--font);
  font-size: 11.5px;
}
.suggest-citations summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  list-style: none;
  user-select: none;
}
.suggest-citations summary::-webkit-details-marker { display: none; }
.suggest-citations summary::after { content: " ▾"; opacity: .55; }
.suggest-citations[open] summary::after { content: " ▴"; }
.suggest-citations ul {
  list-style: none;
  padding: 8px 0 0;
  margin: 0;
}
.suggest-citations li {
  padding: 3px 0;
  color: var(--muted);
}
.suggest-citations a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.suggest-citations a:hover { text-decoration: underline; }

/* --- Density preview pill above Generate --- */
.density-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 12px 0 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  animation: fade-up .3s cubic-bezier(.2, 0, 0, 1) both;
}
.density-preview-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}
.density-preview-msg strong { color: var(--fg); font-weight: 600; }

/* --- Recent runs list in the generate block --- */
.recent-runs { margin-top: 16px; }
.recent-runs-eyebrow {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px;
}
.recent-runs-eyebrow::before {
  content: ""; width: 16px; height: 1px; background: var(--muted);
}
.recent-runs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.recent-run {
  display: flex;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--fg);
  transition: background .15s, border-color .15s, transform .05s;
  align-items: center;
}
.recent-run:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  transform: translateX(2px);
}
.recent-run img {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: #FFFCF6;
  border: 1px solid var(--line);
  object-fit: contain;
  flex: 0 0 auto;
}
.recent-run-body { min-width: 0; flex: 1; }
.recent-run-line {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recent-run-sub {
  font-family: var(--font);
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

/* --- "What changed in the plan" bullets --- */
.diff-eyebrow {
  font-family: var(--font);
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--accent);
  display: flex; align-items: center; gap: 12px;
}
.diff-eyebrow::before { content:""; width:22px;height:1px;background:var(--accent); }
.diff-bullets {
  display: flex; flex-direction: column; gap: 4px;
}
.diff-bullet {
  display: flex; gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font); font-size: 13px;
  line-height: 1.55;
}
.diff-bullet .diff-icon {
  flex: 0 0 24px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 13px; font-weight: 700;
  background: var(--surface-2); color: var(--muted);
}
.diff-bullet.diff-added .diff-icon    { background: var(--pass-soft); color: var(--pass); }
.diff-bullet.diff-removed .diff-icon  { background: var(--fail-soft); color: var(--fail); }
.diff-bullet.diff-changed .diff-icon  { background: var(--accent-soft); color: var(--accent); }
.diff-bullet.diff-adjacency .diff-icon{ background: var(--accent-soft); color: var(--accent); }
.diff-bullet.diff-placement .diff-icon{ background: var(--warn-soft); color: var(--warn); }
.diff-bullet.diff-none { color: var(--muted); font-style: italic; }
.diff-bullet .diff-text { flex: 1; color: var(--fg); }
.diff-bullet .diff-text strong { font-weight: 600; color: var(--fg); }
.diff-bullet .diff-text code {
  font-family: var(--mono); font-size: 11px;
  background: var(--surface-2); padding: 1px 5px; border-radius: 3px;
  color: var(--muted);
}
.diff-bullet .diff-text em { font-style: italic; color: var(--accent); }
.diff-raw summary { padding: 6px 0; }
.diff-raw summary::-webkit-details-marker { display: none; }
.diff-raw summary::after { content: " ▾"; opacity: .6; }
.diff-raw[open] summary::after { content: " ▴"; }

/* --- "Restored your last brief" eyebrow --- */
.brief-draft-restored {
  font-family: var(--font);
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  margin-bottom: 0;
  text-align: right;
  font-style: italic;
}
.brief-draft-restored a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-style: normal;
  border-bottom: 1px solid transparent;
}
.brief-draft-restored a:hover { border-bottom-color: var(--accent); }

/* --- Brief banner: visible feedback right next to the brief textarea --- */
.brief-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 14px 0 4px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: -.002em;
  animation: fade-up .35s cubic-bezier(.2, 0, 0, 1) both;
}
.brief-banner.busy {
  background: var(--surface);
  border-color: var(--line);
  color: var(--fg);
}
.brief-banner.ok {
  background: var(--pass-soft);
  border-color: rgba(79, 115, 85, .35);
  color: #2e4a35;
}
.brief-banner.err {
  background: var(--fail-soft);
  border-color: rgba(168, 71, 45, .35);
  color: #5a2316;
}
.brief-banner .bb-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 1s ease-in-out infinite;
  flex: 0 0 auto;
}
.brief-banner .bb-tick {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--pass); color: #fff;
  font-size: 13px; font-weight: 700;
  flex: 0 0 auto;
}
.brief-banner .bb-bang {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--fail); color: #fff;
  font-size: 13px; font-weight: 700;
  flex: 0 0 auto;
}
.brief-banner .bb-msg { flex: 1; }
.brief-banner .bb-msg strong { font-weight: 600; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .55; transform: scale(.85); }
}

/* --- "Step Three" header chip in the results pane --- */
.h-step-mini {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
  align-self: center;
  position: relative;
  top: -2px;
}

/* --- Main two-pane layout --- */
main {
  display: grid;
  grid-template-columns: minmax(380px, 460px) 1fr;
  gap: 0;
  height: calc(100vh - 64px);
}

aside#left-pane {
  padding: 32px 32px 48px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--bg);
  scroll-behavior: smooth;
}
aside h2 {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted-2);
  margin: 28px 0 10px;
}
aside h2:first-of-type { margin-top: 0; }

aside select, aside input, aside textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 13px;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: var(--radius);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
aside textarea {
  min-height: 120px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}
/* Make .brief-hero textarea defer to its own styles, not the aside default */
aside.brief-host textarea, aside .brief-hero textarea { font-family: var(--font); }
aside input:focus, aside select:focus, aside textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
aside .row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
aside .row input[type=number] { width: 64px; }
aside label {
  font-size: 13px;
  color: var(--fg);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
aside .hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.45;
}

/* --- Buttons --- */
button.primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -.003em;
  flex: 1;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
  box-shadow: 0 1px 0 rgba(0,0,0,.04), inset 0 1px 0 rgba(255,255,255,.08);
}
button.primary:hover {
  background: var(--accent-hi);
  border-color: var(--accent-hi);
  box-shadow: 0 4px 12px rgba(184, 92, 56, .22);
}
button.primary:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0,0,0,.04); }
button.primary:disabled {
  opacity: .55;
  cursor: not-allowed;
}
aside button:not(.primary) {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
aside button:not(.primary):hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

/* --- Status bar --- */
.status {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  min-height: 1.5em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted-2);
}
.status.busy { background: var(--warn-soft); color: #854d0e; }
.status.busy::before { background: var(--warn); animation: pulse 1.4s infinite; }
.status.ok   { background: var(--pass-soft); color: #14532d; }
.status.ok::before { background: var(--pass); }
.status.err  { background: var(--fail-soft); color: #7f1d1d; }
.status.err::before { background: var(--fail); }
.status a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  margin-left: 4px;
  transition: border-color .15s;
}
.status a:hover { border-bottom-color: var(--accent); }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .55; transform: scale(1.2); }
}

/* --- Right pane --- */
section#right-pane {
  padding: 36px 44px 48px;
  overflow-y: auto;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 80% 10%, var(--accent-soft) 0%, transparent 45%),
    radial-gradient(circle at 0% 100%, rgba(47, 86, 81, .08) 0%, transparent 50%);
  background-attachment: local;
}
section h2 {
  margin: 0 0 22px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -.022em;
  color: var(--fg);
  display: flex;
  align-items: baseline;
  gap: 12px;
}
section h2 span {
  font-family: var(--font);
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0;
}

#options {
  display: grid;
  gap: 28px;
  max-width: 1200px;
}
@media (min-width: 1400px) {
  #options.has-results { grid-template-columns: 1fr 1fr; }
  #options.has-results > .option-top { grid-column: 1 / -1; }
}

/* --- Option cards --- */
.option {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .25s, border-color .25s, transform .25s;
}
.option:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.option-top {
  border-color: var(--line);
  box-shadow: var(--shadow-md);
}
.option-top:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.badge-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
  border-radius: 999px;
  margin-left: 10px;
  vertical-align: middle;
  letter-spacing: 0;
  text-transform: none;
}
.badge-warn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid transparent;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
  letter-spacing: 0;
  text-transform: none;
}

/* --- Friendly option cards — editorial gallery style --- */
.option-friendly {
  display: block !important;
  padding: 0 !important;
  overflow: hidden;
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-xl);
}
.option-friendly .opt-preview-row {
  background: #FFFCF6;                /* slightly brighter than surface for the photograph plinth */
  padding: 28px 32px 20px;
  display: flex;
  justify-content: center;
  position: relative;
}
/* Subtle "hung print" feel — bottom hairline only */
.option-friendly .opt-preview-row::after {
  content: "";
  position: absolute;
  left: 32px; right: 32px; bottom: 0;
  height: 1px;
  background: var(--line);
}
.option-friendly .opt-preview-row img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  background: #fff;
  cursor: zoom-in;
  display: block;
  filter: drop-shadow(0 6px 16px rgba(46, 38, 25, .08));
  transition: transform .35s cubic-bezier(.2, 0, 0, 1);
}
.option-friendly:hover .opt-preview-row img {
  transform: scale(1.015);
}
.option-friendly .opt-headline {
  padding: 22px 28px 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.option-friendly .opt-headline h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -.02em;
  border: none;
  padding: 0;
  line-height: 1.15;
}
.option-friendly .opt-tagline {
  margin: 0;
  font-family: var(--font);
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: -.002em;
}
/* Score circle — a clean ring, not a fluorescent badge */
.option-friendly .opt-score-bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--fg);
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  text-align: center;
  min-width: 88px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.option-friendly .opt-score-bubble strong {
  display: block;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  color: var(--fg);
}
.option-friendly .opt-score-bubble strong small {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 1px;
}
.option-friendly .opt-score-bubble span {
  font-family: var(--font);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 500;
  color: var(--muted);
}
.option-friendly.option-top .opt-score-bubble {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
/* Keyboard focus state — visible ring like Linear's row selection */
.option-friendly.kb-focused {
  box-shadow: 0 0 0 2px var(--accent), var(--shadow-md) !important;
  border-color: var(--accent) !important;
}
.option-friendly.option-top .opt-score-bubble strong,
.option-friendly.option-top .opt-score-bubble strong small,
.option-friendly.option-top .opt-score-bubble span {
  color: #fff;
}

/* Editorial metric strip — captions under the print */
.option-friendly .opt-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 16px 28px 18px;
  margin: 0;
  background: transparent;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.option-friendly .opt-summary-item {
  text-align: left;
  padding: 0 4px;
  border-left: 1px solid var(--line);
  padding-left: 14px;
}
.option-friendly .opt-summary-item:first-child {
  border-left: 0;
  padding-left: 4px;
}
.option-friendly .opt-summary-item strong {
  display: block;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.015em;
}
.option-friendly .opt-summary-item strong small {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
  letter-spacing: 0;
}
.option-friendly .opt-summary-item span {
  display: block;
  margin-top: 4px;
  font-family: var(--font);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 500;
}
.option-friendly .opt-warnings {
  background: var(--warn-soft);
  border-bottom: 1px solid rgba(184, 119, 30, .25);
  padding: 12px 28px;
  font-size: 12px;
  color: #6B4A14;
  line-height: 1.55;
}
.option-friendly .opt-warnings div { margin: 3px 0; }
.option-friendly .opt-actions {
  display: flex;
  gap: 8px;
  padding: 18px 28px;
  flex-wrap: wrap;
  align-items: center;
}
.option-friendly .btn-flat {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 16px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  color: var(--fg);
  letter-spacing: -.003em;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.option-friendly .btn-flat:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.option-friendly .btn-flat.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(184, 92, 56, .15);
}
.option-friendly .btn-flat.primary:hover {
  background: var(--accent-hi);
  color: #fff;
  box-shadow: 0 4px 12px rgba(184, 92, 56, .25);
}
.option-friendly .opt-details {
  flex: 1;
  text-align: right;
}
.option-friendly .opt-details summary {
  display: inline-block;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  list-style: none;
  user-select: none;
  padding: 8px 4px;
}
.option-friendly .opt-details summary::-webkit-details-marker { display: none; }
.option-friendly .opt-details summary:hover { color: var(--fg); }
.option-friendly .opt-details summary::after {
  content: " ▾";
  font-size: 10px;
  opacity: .6;
}
.option-friendly .opt-details[open] summary::after { content: " ▴"; }
.option-friendly .opt-details-body {
  padding: 12px 20px 0;
  text-align: left;
  border-top: 1px solid var(--line);
  margin-top: 8px;
  background: var(--surface-2);
}
.option-friendly .opt-details-body dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
  margin: 0 0 12px;
  font-size: 13px;
}
.option-friendly .opt-details-body dt {
  color: var(--muted);
  font-weight: 500;
}
.option-friendly .opt-details-body dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.option-friendly .opt-downloads {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.option-friendly .opt-downloads a {
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.option-friendly .opt-downloads a:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.option-friendly .feedback-panel {
  margin: 0;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.option-friendly .feedback-panel .fb-toggle {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
}

/* --- Command palette (Cmd+K) --- */
.cmdk-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  opacity: 0;
  transition: opacity .16s ease;
}
.cmdk-modal.in { opacity: 1; }
.cmdk-modal[hidden] { display: none; }
.cmdk-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27, 25, 22, .35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.cmdk-panel {
  position: relative;
  width: min(640px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(-6px) scale(.98);
  opacity: 0;
  transition: transform .22s cubic-bezier(.2,0,0,1), opacity .22s ease;
}
.cmdk-modal.in .cmdk-panel { transform: translateY(0) scale(1); opacity: 1; }
.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.cmdk-input-row svg { color: var(--muted); flex: 0 0 auto; }
.cmdk-input-row input {
  flex: 1;
  font: inherit;
  font-size: 16px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  padding: 0;
  font-family: var(--font);
}
.cmdk-input-row input::placeholder { color: var(--muted-2); }
.cmdk-input-row kbd {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .04em;
  background: var(--surface-2);
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  text-transform: uppercase;
}
.cmdk-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
}
.cmdk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  font-size: 14px;
  color: var(--fg);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .12s;
}
.cmdk-item:hover, .cmdk-item.selected {
  background: var(--accent-soft);
  color: var(--accent);
}
.cmdk-item kbd {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 4px;
  border: 0;
}
.cmdk-item.selected kbd { background: rgba(255,255,255,.5); color: var(--accent); }
.cmdk-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

/* --- Save celebration overlay (Four-Seasons-style acknowledgement) --- */
.save-celebrate {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(251, 247, 238, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 50;
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
  border-radius: inherit;
}
.save-celebrate.in { opacity: 1; }
.save-celebrate.out { opacity: 0; transition: opacity .35s ease; }
.save-celebrate svg {
  width: 64px; height: 64px;
  transform: scale(.6);
  transition: transform .45s cubic-bezier(.2, 0, 0, 1);
}
.save-celebrate.in svg { transform: scale(1); }
.save-celebrate .ring {
  fill: var(--accent);
  opacity: 0;
  transition: opacity .25s ease;
}
.save-celebrate.in .ring { opacity: 1; }
.save-celebrate .tick {
  fill: none;
  stroke: #fff;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  transition: stroke-dashoffset .55s cubic-bezier(.2, 0, 0, 1) .15s;
}
.save-celebrate.in .tick { stroke-dashoffset: 0; }
.save-celebrate-label {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: -.018em;
  color: var(--accent);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .35s ease .25s, transform .35s ease .25s;
}
.save-celebrate.in .save-celebrate-label { opacity: 1; transform: translateY(0); }

/* --- Concierge "Next steps" strip below results --- */
.next-steps-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 18px 22px;
  margin-top: 8px;
}
.next-steps-eyebrow {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--accent);
  margin-bottom: 10px;
}
.next-steps-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ns-chip {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fg);
  cursor: pointer;
  letter-spacing: -.002em;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.ns-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
}

/* --- Choreographed loading surface — replaces skeleton cards --- */
.loading-surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  padding: 64px 48px 56px;
  text-align: center;
  max-width: 640px;
  margin: 32px auto;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  animation: fade-up .6s cubic-bezier(.2, 0, 0, 1) both;
}
.loading-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 0%, var(--accent-soft) 0%, transparent 55%),
    radial-gradient(circle at 0% 100%, rgba(47, 86, 81, .08) 0%, transparent 55%);
  opacity: .85;
  pointer-events: none;
}
.loading-surface > * { position: relative; }
.loading-orb {
  width: 56px; height: 56px;
  margin: 0 auto 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent) 0%, var(--accent-hi) 70%, var(--accent-hi) 100%);
  box-shadow:
    0 0 0 8px rgba(184, 92, 56, .08),
    0 0 0 16px rgba(184, 92, 56, .04),
    0 12px 32px rgba(184, 92, 56, .25);
  animation: orb-pulse 2.4s ease-in-out infinite;
}
@keyframes orb-pulse {
  0%, 100% { transform: scale(1); box-shadow:
    0 0 0 8px rgba(184, 92, 56, .08),
    0 0 0 16px rgba(184, 92, 56, .04),
    0 12px 32px rgba(184, 92, 56, .25); }
  50%      { transform: scale(1.05); box-shadow:
    0 0 0 12px rgba(184, 92, 56, .10),
    0 0 0 24px rgba(184, 92, 56, .04),
    0 16px 40px rgba(184, 92, 56, .30); }
}
.loading-eyebrow {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--accent);
  margin: 0 0 6px;
}
.loading-title {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -.024em;
  color: var(--fg);
  margin: 0 0 16px;
  line-height: 1.1;
}
.loading-phase {
  font-family: var(--font);
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 24px;
  line-height: 1.5;
  min-height: 1.5em;
  transition: opacity .22s ease, transform .22s ease;
}
.loading-bar {
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto 18px;
  max-width: 360px;
}
.loading-bar-fill {
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
  animation: bar-sweep 1.8s cubic-bezier(.4, 0, .6, 1) infinite;
}
@keyframes bar-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}
.loading-meta {
  font-family: var(--font);
  font-size: 12px;
  color: var(--muted-2);
  margin: 0;
  font-style: italic;
}

/* --- First-run empty state on the results pane — editorial --- */
.first-run-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  padding: 56px 48px;
  text-align: center;
  color: var(--muted);
  max-width: 640px;
  margin: 32px auto;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.first-run-state::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 0%, var(--accent-soft) 0%, transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(47, 86, 81, .08) 0%, transparent 50%);
  opacity: .7;
  pointer-events: none;
}
.first-run-state > * { position: relative; }
.first-run-state .frs-icon {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 500;
  font-style: italic;
  margin-bottom: 4px;
  color: var(--accent);
  letter-spacing: -.04em;
}
.first-run-state .frs-illustration {
  width: 100%;
  max-width: 380px;
  height: auto;
  color: var(--accent);
  margin: 0 auto 20px;
  display: block;
}
.first-run-state h3 {
  margin: 6px 0 14px;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -.024em;
  color: var(--fg);
  line-height: 1.15;
}
.first-run-state p {
  margin: 0 auto 28px;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  max-width: 480px;
  color: var(--muted);
}
.first-run-state .frs-steps {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  text-align: left;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.6;
  max-width: 460px;
  counter-reset: step;
}
.first-run-state .frs-steps li {
  padding: 16px 0;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 14px;
  align-items: baseline;
  color: var(--fg);
}
.first-run-state .frs-steps li:first-child { border-top: 0; padding-top: 8px; }
.first-run-state .frs-steps strong {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 16px;
  color: var(--accent);
  flex: 0 0 auto;
  letter-spacing: -.01em;
}
.first-run-state .frs-steps em {
  color: var(--fg);
  font-style: normal;
  font-weight: 500;
}

/* --- Feedback panel inside option cards --- */
.feedback-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.feedback-panel .fb-toggle {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 0;
}
.feedback-panel .fb-toggle:hover { text-decoration: underline; }
.feedback-panel .fb-body { margin-top: 10px; }
.feedback-panel .fb-text {
  width: 100%;
  font-family: var(--font);
  font-size: 13px;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  min-height: 60px;
  resize: vertical;
}
.feedback-panel .fb-text:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.feedback-panel .fb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.feedback-panel .fb-mic,
.feedback-panel .fb-submit {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
}
.feedback-panel .fb-mic {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--fg);
}
.feedback-panel .fb-mic:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}
.feedback-panel .fb-submit {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  margin-left: auto;
}
.feedback-panel .fb-submit:hover { background: var(--accent-hi); }
.feedback-panel .fb-submit:disabled { opacity: .5; cursor: not-allowed; }
.fb-status {
  font-size: 11px;
  color: var(--muted);
}
.fb-status.busy { color: var(--warn); }
.fb-status.ok   { color: var(--pass); font-weight: 500; }
.fb-status.err  { color: var(--fail); font-weight: 500; }

/* --- Regenerate banner --- */
.regen-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  margin-bottom: 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #fef9c3 0%, #fde8a8 100%);
  border: 1px solid #fbbf24;
  font-size: 13px;
  color: #713f12;
}
.regen-banner button { flex: 0 0 auto; }

/* --- Editorial hero surfaces (Step 1 = Brief, Step 2 = Generate) --- */
.brief-hero {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  padding: 28px 26px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
/* Soft warm glow behind the brief input — like v0/Claude */
.brief-hero::before {
  content: "";
  position: absolute;
  top: -120px; right: -120px;
  width: 360px; height: 360px;
  background: radial-gradient(circle at center, var(--accent-soft) 0%, transparent 70%);
  filter: blur(40px);
  opacity: .8;
  pointer-events: none;
  z-index: 0;
}
.brief-hero > * { position: relative; z-index: 1; }
.generate-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  padding: 24px 26px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}

/* Step chips: small caps inter, not garish badges */
.hero-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--accent);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 0;
  border-radius: 0;
  margin-bottom: 14px;
}
.hero-step::before {
  content: "";
  display: inline-block;
  width: 18px; height: 1px;
  background: var(--accent);
  vertical-align: middle;
}
.hero-step.alt { color: var(--teal); }
.hero-step.alt::before { background: var(--teal); }

/* Serif display title — the centerpiece */
.hero-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -.024em;
  color: var(--fg);
  margin: 0 0 8px;
  line-height: 1.1;
}
.hero-sub {
  font-family: var(--font);
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 18px;
  max-width: 42ch;
}
.hero-sub.small { font-size: 13px; margin: 0 0 10px; }

/* The brief textarea — the single most important input in the app */
.brief-hero textarea {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  padding: 18px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--fg);
  width: 100%;
  min-height: 140px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.brief-hero textarea:focus {
  background: #FFFFFF;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  outline: none;
}
.brief-hero textarea::placeholder {
  color: var(--muted-2);
  font-style: normal;
}
.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  align-items: center;
  flex-wrap: wrap;
}
button.primary.big {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  padding: 13px 22px;
  flex: 1;
  min-width: 220px;
  letter-spacing: -.003em;
  border-radius: var(--radius);
}
button.ghost {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 11px 16px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
button.ghost:hover {
  background: var(--surface-2);
  color: var(--fg);
  border-color: var(--line-strong);
}
button.ghost.small { padding: 8px 14px; font-size: 12px; }
button.ghost.icon-only {
  padding: 11px 12px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
button.ghost.icon-only:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.hero-foot {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.hero-foot a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: border-color .15s;
}
.hero-foot a:hover { border-bottom-color: var(--accent); }

/* --- Disclosure for the raw YAML fields (hidden by default) --- */
.yaml-disclosure {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 10px;
  overflow: hidden;
}
.yaml-disclosure summary {
  cursor: pointer;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--fg);
  list-style: none;
  background: var(--surface-2);
  user-select: none;
}
.yaml-disclosure summary::-webkit-details-marker { display: none; }
.yaml-disclosure summary::before {
  content: "›";
  display: inline-block;
  margin-right: 8px;
  font-size: 16px;
  font-weight: 400;
  color: var(--muted);
  transition: transform .15s;
}
.yaml-disclosure[open] summary::before {
  transform: rotate(90deg);
}
.yaml-disclosure summary small {
  color: var(--muted);
  font-weight: 400;
  margin-left: 6px;
  font-family: var(--font);
}
.yaml-disclosure textarea {
  display: block;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  resize: vertical;
}

/* --- Generate step --- */
.option-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.option-count input {
  width: 56px !important;
  text-align: center;
}
.quick-toggle {
  font-size: 12px;
  color: var(--muted);
}
.quick-toggle input { margin-right: 4px; accent-color: var(--accent); }

/* --- Brief input toolbar — pill chips below the textarea --- */
.brief-input-tools {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.brief-input-tools button {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: -.002em;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.brief-input-tools button:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
}
.brief-input-tools button.recording {
  background: var(--fail-soft);
  border-color: var(--fail);
  color: var(--fail);
  animation: pulse-record 1.4s infinite;
}
.sector-pill {
  display: inline-flex; align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit; font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.sector-pill:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.sector-pill-label {
  font-family: var(--font); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted);
}
.sector-pill select {
  font: inherit; font-size: 12px; font-weight: 500;
  background: transparent; border: 0; padding: 4px 18px 4px 4px;
  color: var(--fg); cursor: pointer; outline: none;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%236B6760' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='3 5 6 8 9 5'/></svg>");
  background-repeat: no-repeat; background-position: right 4px center; background-size: 12px;
}
@keyframes pulse-record {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}
.mic-status {
  font-size: 11px;
  color: var(--muted);
  margin-left: 4px;
}
.brief-attachment-preview {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.brief-attachment-preview img {
  max-width: 80px;
  max-height: 80px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  object-fit: contain;
  background: #fff;
}
.brief-attachment-preview .meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.brief-attachment-preview .meta strong { font-weight: 600; color: var(--fg); }
.brief-attachment-preview .meta small  { color: var(--muted); }
.brief-attachment-preview button.remove {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
}
.brief-attachment-preview button.remove:hover { color: var(--fail); }

/* --- Toast notifications --- */
#toasts {
  position: fixed;
  top: 78px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  padding: 14px 18px 14px 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  color: var(--fg);
  display: flex;
  align-items: flex-start;
  gap: 11px;
  pointer-events: auto;
  animation: toast-in .35s cubic-bezier(.2, 0, 0, 1);
  position: relative;
  letter-spacing: -.003em;
}
.toast.ok   { border-left-color: var(--pass); }
.toast.err  { border-left-color: var(--fail); }
.toast.busy { border-left-color: var(--warn); }
.toast .toast-title { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 14px; letter-spacing: -.012em; }
.toast .toast-icon {
  font-size: 16px;
  line-height: 1;
  margin-top: 1px;
  flex-shrink: 0;
}
.toast .toast-body { flex: 1; line-height: 1.5; }
.toast .toast-detail { font-size: 12px; color: var(--muted); margin-top: 2px; }
.toast .toast-close {
  cursor: pointer;
  color: var(--muted-2);
  font-size: 16px;
  background: transparent;
  border: 0;
  padding: 0 4px;
  line-height: 1;
}
.toast .toast-close:hover { color: var(--fg); }
.toast.dismissing { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes toast-out {
  to { transform: translateX(20px); opacity: 0; height: 0; padding: 0; margin: 0; border: 0; }
}

/* --- Skeleton loading cards --- */
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  margin-bottom: 14px;
}
.skeleton-line {
  background: linear-gradient(90deg, var(--surface-2) 0%, #e2e8f0 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
  border-radius: 4px;
  height: 12px;
  margin-bottom: 8px;
}
.skeleton-line.title { height: 18px; width: 60%; margin-bottom: 14px; }
.skeleton-line.short { width: 40%; }
.skeleton-line.med   { width: 65%; }
.skeleton-line.long  { width: 85%; }
.skeleton-img {
  background: var(--surface-2);
  border-radius: var(--radius);
  width: 320px;
  height: 240px;
  animation: shimmer 1.5s linear infinite;
  background: linear-gradient(90deg, var(--surface-2) 0%, #e2e8f0 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Skeleton rows for tables (admin pages) */
tr.skeleton-row td {
  padding: 14px;
}
.skel-cell {
  display: block;
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-2) 0%, #e2e8f0 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}
.skel-cell.short { width: 30%; }
.skel-cell.med   { width: 60%; }
.skel-cell.long  { width: 90%; }

/* --- Help / info tooltips --- */
.help-tip {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  line-height: 12px;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
  position: relative;
}
.help-tip:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.help-tip[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  max-width: 280px;
  white-space: normal;
  width: max-content;
  margin-bottom: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  box-shadow: var(--shadow-sm);
  z-index: 10;
  line-height: 1.4;
}
.help-tip[data-tip]::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
.help-tip[data-tip]:hover::after,
.help-tip[data-tip]:hover::before { opacity: 1; }

/* --- Confirm dialog --- */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(27, 25, 22, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center;
  z-index: 2500;
  animation: fade-in .18s ease-out;
}
.confirm-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  padding: 32px;
  width: min(94vw, 460px);
  box-shadow: var(--shadow-lg);
  animation: pop-in .26s cubic-bezier(.2, 0, 0, 1);
}
.confirm-box h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -.018em;
  color: var(--fg);
  line-height: 1.2;
}
.confirm-box p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}
.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.confirm-actions button {
  font: inherit;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
}
.confirm-actions button:hover { background: var(--surface-2); }
.confirm-actions button.danger {
  background: var(--fail);
  border-color: var(--fail);
  color: #fff;
}
.confirm-actions button.danger:hover { background: #b91c1c; border-color: #b91c1c; }
.confirm-actions button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.confirm-actions button.primary:hover { background: var(--accent-hi); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* --- Drawing modal --- */
.draw-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 1000;
}
.draw-modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 18px;
  width: min(96vw, 1100px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .35);
}
.draw-modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.draw-modal header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.draw-tools {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 1;
}
.draw-tools .dt {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--fg);
  transition: background .15s, border-color .15s, color .15s;
}
.draw-tools .dt:hover {
  background: var(--surface-2);
}
.draw-tools .dt.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.draw-tools .draw-cancel {
  font: inherit;
  font-size: 12px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.draw-tools .draw-save {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 16px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.draw-tools .draw-save:hover { background: var(--accent-hi); }
.draw-canvas-wrap {
  /* Outer container — scrolls if image overflows */
  flex: 1;
  overflow: auto;
  background: var(--surface-2);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  padding: 12px;
}
/* Inner stack — sized exactly to the image. Position:relative so the
   canvas (absolute) is anchored to it, NOT to the outer wrap. This
   keeps the canvas pixel-perfect over the image at every zoom level. */
.draw-img-stack {
  position: relative;
  display: inline-block;
  line-height: 0;       /* removes the tiny gap below the inline img */
}
.draw-img-stack .draw-bg {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}
.draw-img-stack .draw-canvas {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
  /* So a touch device doesn't try to scroll while you draw */
  touch-action: none;
}
.draw-modal footer {
  font-size: 12px;
  color: var(--muted);
}
.fb-drawing-preview {
  margin-top: 6px;
  font-size: 11px;
}
.fb-drawing-preview a { color: var(--accent); }
.option .meta h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.option .meta h3 small {
  color: var(--muted);
  font-weight: 400;
  margin-left: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.option .meta dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  font-size: 13px;
  margin: 14px 0 0;
}
.option .meta dt {
  color: var(--muted);
  font-weight: 500;
}
.option .meta dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--fg);
}

/* --- Check list --- */
.option .checks {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.option .checks .row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 12px;
}
.option .checks .row .tag {
  font-weight: 700;
  min-width: 44px;
  text-align: center;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  letter-spacing: .04em;
}
.option .checks .row .tag.pass { background: var(--pass-soft); color: var(--pass); }
.option .checks .row .tag.fail { background: var(--fail-soft); color: var(--fail); }
.option .checks .row .label {
  color: var(--fg);
  font-weight: 500;
  min-width: 120px;
}
.option .checks .row .detail {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Preview --- */
.option .preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.option .preview img {
  width: 320px;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  cursor: zoom-in;
  background: var(--surface-2);
  transition: transform .15s;
}
.option .preview img:hover { transform: scale(1.01); }
.option .preview .dl {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}
.option .preview .dl a {
  color: var(--fg);
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-weight: 500;
  background: var(--surface);
  transition: background .15s, border-color .15s, color .15s;
}
.option .preview .dl a:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.option .preview .dl a:first-child {
  /* Edit button gets accent treatment */
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.option .preview .dl a:first-child:hover {
  background: var(--accent-hi);
  border-color: var(--accent-hi);
  color: #fff;
}

/* --- Empty state --- */
#options:empty::before {
  content: '🏗  Choose a project (or paste a brief) and click "Run engine →" to see ranked layouts here.';
  display: block;
  padding: 60px 40px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  line-height: 2;
}

/* --- Generic empty-state card (used across admin pages) --- */
.empty-state {
  padding: 64px 36px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  color: var(--muted);
}
.empty-state .icon {
  font-size: 36px;
  display: block;
  margin: 0 auto 18px;
  line-height: 1;
  opacity: .65;
}
.empty-state h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -.02em;
  color: var(--fg);
  line-height: 1.2;
}
.empty-state p {
  margin: 0 auto 20px;
  font-size: 14px;
  max-width: 440px;
  line-height: 1.6;
}
.empty-state a.cta {
  display: inline-block;
  padding: 11px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -.003em;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(184, 92, 56, .15);
  transition: background .15s, box-shadow .15s;
}
.empty-state a.cta:hover { background: var(--accent-hi); box-shadow: 0 4px 12px rgba(184, 92, 56, .25); }
.empty-state a.cta + a.cta { margin-left: 8px; }
.empty-state a.cta.secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line);
  box-shadow: none;
}
.empty-state a.cta.secondary:hover {
  background: var(--surface-2);
  color: var(--fg);
}
.empty-state a.cta.secondary:hover { background: var(--line); }

/* --- Keyboard shortcuts modal --- */
.shortcuts-modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  width: min(94vw, 580px);
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  animation: pop-in .2s cubic-bezier(.3,.7,.3,1.2);
}
.shortcuts-modal h2 {
  margin: 0 0 22px;
  font-size: 18px;
  font-weight: 600;
}
.shortcuts-modal h3 {
  margin: 18px 0 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.shortcuts-modal h3:first-of-type { margin-top: 0; }
.shortcuts-modal dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
}
.shortcuts-modal dt {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.shortcuts-modal dt kbd {
  display: inline-block;
  padding: 2px 8px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
}
.shortcuts-modal dd {
  margin: 0;
  font-size: 13px;
  color: var(--fg);
  align-self: center;
}
.shortcuts-modal .close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 4px;
}
.shortcuts-modal .close-btn:hover { color: var(--fg); background: var(--surface-2); }

/* --- What's new banner --- */
.whats-new {
  margin-bottom: 18px;
  padding: 12px 14px 12px 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #e8f5f0 0%, #f5ede8 100%);
  border: 1px solid #d5e5dd;
  font-size: 13px;
  color: var(--fg);
  line-height: 1.55;
  position: relative;
  padding-left: 42px;
}
.whats-new::before {
  content: '✨';
  position: absolute;
  left: 14px; top: 12px;
  font-size: 16px;
}
.whats-new strong { color: var(--accent); }
.whats-new a { color: var(--accent); text-decoration: none; font-weight: 500; }
.whats-new a:hover { text-decoration: underline; }
.whats-new .dismiss {
  position: absolute; right: 10px; top: 10px;
  background: transparent; border: 0; cursor: pointer;
  color: var(--muted); font-size: 14px; padding: 4px 6px;
}
.whats-new .dismiss:hover { color: var(--fg); }

/* --- Tablet (≤ 900px) ----------------------------------------------------- */
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; height: auto; }
  aside#left-pane { border-right: 0; border-bottom: 1px solid var(--line); }
  .option { grid-template-columns: 1fr; }
  .option .preview img { width: 100%; }
  .option .preview .dl { flex-wrap: wrap; }
  .option .checks .row .detail { white-space: normal; }
  header { padding: 12px 16px; }
  header h1 { font-size: 18px; }
  header h1 span { display: none; }
  header nav { gap: 4px; flex-wrap: wrap; }
  header nav a, header nav button { padding: 6px 8px; font-size: 12px; }
  .user-info { display: none; }
  .cmdk-trigger { display: none; }
  .hero-title { font-size: 24px; }
  .brief-hero, .generate-block { padding: 22px 20px 18px; border-radius: var(--radius-xl); }
  .arrival-greet { font-size: 22px; }
  .first-run-state { padding: 36px 24px; }
  .first-run-state h3 { font-size: 22px; }
  /* Friendly option card stays nicely readable */
  .option-friendly .opt-summary { grid-template-columns: 1fr 1fr; gap: 4px; }
  .option-friendly .opt-summary-item:nth-child(3) { border-left: 0; padding-left: 4px; }
  .option-friendly .opt-summary-item:nth-child(3),
  .option-friendly .opt-summary-item:nth-child(4) { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }
  .option-friendly .opt-headline { padding: 18px 22px 6px; }
  .option-friendly .opt-headline h3 { font-size: 22px; }
  .option-friendly .opt-actions { padding: 14px 18px; }
  .option-friendly .opt-actions .btn-flat { flex: 1; min-width: 130px; text-align: center; }
}

/* --- Mobile (≤ 600px) ----------------------------------------------------- */
@media (max-width: 600px) {
  aside#left-pane { padding: 16px; }
  section#right-pane { padding: 16px; }
  aside select, aside input, aside textarea { font-size: 16px; /* prevent iOS zoom on focus */ }
  .option { padding: 14px; }
  .option .meta dl { grid-template-columns: max-content 1fr; gap: 2px 10px; font-size: 12px; }
  /* Bigger touch targets */
  button.primary, aside button:not(.primary), header nav button {
    min-height: 40px;
  }
  /* Modal fills more of the screen */
  .confirm-box { width: 94vw; padding: 22px; }
  .draw-modal { padding: 12px; gap: 10px; }
  .draw-tools { gap: 4px; flex-wrap: wrap; }
  .draw-tools .dt { padding: 6px 9px; min-height: 36px; }
  /* Toasts dock to bottom on mobile */
  #toasts {
    top: auto; bottom: 12px; left: 12px; right: 12px;
    max-width: none;
    align-items: stretch;
  }
  /* What's-new banner wraps */
  .whats-new { font-size: 12px; padding: 12px 14px 12px 38px; }
  .whats-new::before { left: 12px; }
  .regen-banner { flex-direction: column; align-items: stretch; }
  .regen-banner button { margin-top: 4px; }
}

/* --- Empty-state stays readable on narrow screens --- */
@media (max-width: 600px) {
  #options:empty::before { padding: 30px 20px; font-size: 13px; }
}

/* --- Inline tags / small chips --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--surface-2);
  border-radius: 99px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
