:root {
  color-scheme: dark;
  --ink: #eef8ff;
  --ink-soft: #8ba6bd;
  --paper: #020814;
  --surface: rgba(7, 20, 37, 0.82);
  --surface-strong: #07172a;
  --line: rgba(113, 205, 255, 0.14);
  --line-dark: rgba(113, 205, 255, 0.3);
  --moss: #53ddff;
  --moss-dark: #c5f6ff;
  --moss-soft: rgba(36, 185, 255, 0.12);
  --rust: #ff7f9c;
  --rust-soft: rgba(255, 89, 125, 0.11);
  --gold: #9d8cff;
  --gold-soft: rgba(139, 114, 255, 0.12);
  --blue: #2388ff;
  --blue-bright: #62e7ff;
  --glass: rgba(5, 17, 32, 0.72);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.48), 0 0 45px rgba(27, 136, 255, 0.06);
  font-family: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -10%, rgba(19, 146, 255, 0.24), transparent 36rem),
    radial-gradient(circle at 12% 55%, rgba(35, 105, 255, 0.09), transparent 28rem),
    radial-gradient(circle at 92% 72%, rgba(74, 226, 255, 0.06), transparent 28rem),
    var(--paper);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .22;
  background-image:
    linear-gradient(rgba(91, 199, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 199, 255, .05) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 82%);
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .08;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.65'/%3E%3C/svg%3E");
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(83, 221, 255, 0.28);
  outline-offset: 3px;
}

svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.app-shell { position: relative; z-index: 1; max-width: 1480px; margin: 0 auto; padding: 0 32px 72px; }

.auth-gate { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.auth-gate[hidden] { display: none; }
.auth-card { width: min(460px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); }
.auth-mark { width: 46px; height: 46px; margin-bottom: 24px; }
.auth-card h1 { font-size: 48px; line-height: 1; }
.auth-card > p:not(.eyebrow):not(.auth-note) { color: var(--ink-soft); line-height: 1.6; }
.auth-form { display: grid; gap: 9px; margin-top: 25px; }
.auth-form label { margin-top: 5px; font-size: 13px; font-weight: 700; }
.auth-form input { width: 100%; padding: 13px 14px; border: 1px solid var(--line-dark); border-radius: 11px; background: white; }
.auth-form .button { margin-top: 8px; width: 100%; }
.auth-error { margin: 3px 0 0; color: var(--rust); font-size: 13px; }
.auth-note { margin: 22px 0 0; color: var(--ink-soft); font-size: 11px; text-align: center; }

.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.topbar-right { display: flex; align-items: center; gap: 18px; }
.brand-button { border: 0; background: none; padding: 0; cursor: pointer; }

.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -0.02em; }
.brand-mark, .ai-avatar {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--moss); color: white; font-family: "Newsreader", serif; font-weight: 600; letter-spacing: -0.04em;
}

.status-pill { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.status-pill.is-ready .status-dot { background: var(--moss); box-shadow: 0 0 0 4px var(--moss-soft); }
.status-pill.is-error .status-dot { background: var(--rust); box-shadow: 0 0 0 4px var(--rust-soft); }

.app-nav { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 6px; margin: 18px auto 0; padding: 7px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,254,250,.92); box-shadow: 0 10px 34px rgba(35,44,39,.07); backdrop-filter: blur(12px); }
.nav-item { border: 0; border-radius: 9px; background: transparent; padding: 10px 14px; color: var(--ink-soft); cursor: pointer; font-size: 13px; font-weight: 700; }
.nav-item:hover { background: var(--paper); color: var(--ink); }
.nav-item.is-active { background: var(--moss); color: white; }
.nav-item:disabled { cursor: default; opacity: .45; }
.nav-item span { display: inline-grid; min-width: 20px; height: 20px; margin-left: 5px; place-items: center; border-radius: 999px; background: rgba(49,95,73,.12); font-size: 10px; }
.nav-item.is-active span { background: rgba(255,255,255,.2); }
.setup-banner { display: flex; gap: 8px; align-items: center; margin-top: 14px; padding: 12px 15px; border: 1px solid #d7a095; border-radius: 12px; background: var(--rust-soft); color: #753b30; font-size: 12px; }
.setup-banner[hidden] { display: none; }

main { padding-top: 54px; }
.view { display: none; }
.view.is-visible { display: block; animation: reveal .35s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }

.intro { max-width: 760px; margin: 0 auto 34px; text-align: center; }
.eyebrow { margin: 0 0 10px; color: var(--moss); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1, h2 { font-family: "Newsreader", Georgia, serif; letter-spacing: -0.03em; }
h1 { margin: 0; font-size: clamp(38px, 6vw, 64px); line-height: .98; font-weight: 600; }
.intro > p:last-child { max-width: 640px; margin: 18px auto 0; color: var(--ink-soft); line-height: 1.65; }

.brief-form {
  display: grid; grid-template-columns: 1fr 1fr; gap: 22px 20px;
  max-width: 900px; margin: 0 auto; padding: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field label, .field legend, .subject-picker label { font-size: 13px; font-weight: 700; }
.field label span { color: var(--rust); }
.field input, .field textarea, .field select, .chat-form textarea, .subject-picker select {
  width: 100%; border: 1px solid var(--line-dark); border-radius: 11px; background: var(--surface-strong); color: var(--ink); padding: 13px 14px; resize: vertical;
}
.field input::placeholder, .field textarea::placeholder, .chat-form textarea::placeholder { color: #929a95; }
.field input:focus, .field textarea:focus, .field select:focus, .chat-form textarea:focus, .subject-picker select:focus { border-color: var(--moss); outline: 3px solid rgba(49,95,73,.12); }
.field-hint { margin: -2px 0 0; color: var(--ink-soft); font-size: 12px; }
.source-options { display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; border: 0; padding: 0; margin: 0; }
.source-options legend { width: 100%; margin-bottom: 2px; }
.check { display: flex; align-items: center; gap: 7px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-strong); cursor: pointer; font-size: 12px !important; font-weight: 500 !important; }
.check:has(input:checked) { border-color: var(--moss); background: var(--moss-soft); color: var(--moss-dark); }
.check input { accent-color: var(--moss); margin: 0; }
.form-footer { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding-top: 8px; }
.form-footer p { max-width: 520px; margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.form-actions { display: flex; gap: 9px; flex: 0 0 auto; }
.source-plan { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #faf8f2; }
.source-plan strong, .source-plan p { width: 100%; }
.source-plan strong { font-size: 13px; }
.source-plan span { padding: 7px 9px; border-radius: 999px; background: var(--moss-soft); color: var(--moss-dark); font-size: 11px; font-weight: 700; }
.source-plan p { margin: 3px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.research-error { grid-column: 1 / -1; padding: 15px 17px; border: 1px solid #d7a095; border-radius: 12px; background: var(--rust-soft); color: #753b30; }
.research-error[hidden] { display: none; }
.research-error strong { display: block; margin-bottom: 5px; }
.research-error p { margin: 3px 0 0; font-size: 13px; line-height: 1.5; }

.button { border: 1px solid transparent; border-radius: 999px; padding: 12px 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; cursor: pointer; transition: transform .18s ease, background .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .6; transform: none; }
.button svg { width: 18px; height: 18px; }
.button-primary { color: white; background: var(--moss); }
.button-primary:hover { background: var(--moss-dark); }
.button-ghost { background: transparent; border-color: var(--line-dark); }
.button-ghost:hover { background: var(--surface); }

.view-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; max-width: 940px; margin: 0 auto 18px; }
.view-header h1 { font-size: clamp(36px, 5vw, 54px); }
.view-header.compact { align-items: center; }
.view-header.compact h1 { font-size: 42px; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.deck-progress { flex: 0 0 auto; text-align: right; }
.deck-progress strong { display: block; font-size: 18px; }
.deck-progress span { color: var(--ink-soft); font-size: 12px; }
.progress-track { max-width: 940px; height: 3px; margin: 0 auto 30px; background: var(--line); overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--moss); transition: width .35s ease; }

.story-stage { max-width: 820px; margin: 0 auto; }
.story-card, .draft-card { background: var(--surface); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); overflow: hidden; }
.story-card { padding: clamp(24px, 5vw, 46px); }
.story-card.is-leaving-left { animation: leaveLeft .25s ease both; }
.story-card.is-leaving-right { animation: leaveRight .25s ease both; }
.story-card.is-entering { animation: enterCard .3s ease both; }
@keyframes leaveLeft { to { opacity: 0; transform: translateX(-70px) rotate(-2deg); } }
@keyframes leaveRight { to { opacity: 0; transform: translateX(70px) rotate(2deg); } }
@keyframes enterCard { from { opacity: 0; transform: translateY(14px) scale(.99); } }
.card-topline { display: flex; align-items: center; justify-content: space-between; }
.source-label { display: inline-flex; padding: 6px 9px; border-radius: 999px; background: var(--moss-soft); color: var(--moss-dark); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: transparent; display: grid; place-items: center; cursor: pointer; }
.icon-button svg { width: 17px; height: 17px; }
.icon-button:hover, .icon-button.is-active { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }
.story-card h2 { margin: 24px 0 10px; font-size: clamp(30px, 5vw, 44px); line-height: 1.04; }
.story-lede { margin: 0; color: var(--ink-soft); font-size: 17px; line-height: 1.65; }
.story-arc { display: grid; grid-template-columns: 1fr 20px 1fr 20px 1fr; gap: 10px; align-items: center; margin: 30px 0; }
.story-arc > svg { width: 16px; height: 16px; color: var(--line-dark); }
.story-arc span, .bridge-box span { display: block; margin-bottom: 6px; color: var(--moss); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.story-arc p { margin: 0; font-size: 13px; line-height: 1.5; }
.story-card blockquote { margin: 0 0 26px; padding: 18px 20px; border-left: 3px solid var(--gold); background: var(--gold-soft); font-family: "Newsreader", serif; font-size: 22px; line-height: 1.25; }
.bridge-box { padding: 18px 20px; background: var(--moss-soft); border-radius: 14px; }
.bridge-box p { margin: 0; color: var(--moss-dark); font-weight: 600; line-height: 1.5; }
.sources-panel { margin-top: 25px; border-top: 1px solid var(--line); padding-top: 18px; }
.sources-panel summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; color: var(--ink-soft); font-size: 13px; font-weight: 700; list-style: none; }
.sources-panel summary::-webkit-details-marker { display: none; }
.sources-panel summary svg { width: 18px; height: 18px; transition: transform .2s ease; }
.sources-panel[open] summary svg { transform: rotate(180deg); }
.source-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.source-item:last-child { border-bottom: 0; }
.source-item a { color: var(--moss); font-weight: 700; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.source-item p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.source-caveat { margin: 14px 0 0; color: var(--rust); font-size: 12px; line-height: 1.5; }

.swipe-actions { display: flex; justify-content: center; gap: 18px; margin: 26px 0 0; }
.swipe-button { width: 82px; height: 72px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; cursor: pointer; font-size: 11px; font-weight: 700; transition: transform .18s ease, box-shadow .18s ease; }
.swipe-button:hover { transform: translateY(-3px); box-shadow: 0 10px 25px rgba(35,44,39,.1); }
.swipe-button svg { width: 23px; height: 23px; }
.swipe-button.dislike { color: var(--rust); }
.swipe-button.like { color: var(--moss); }
.swipe-button.superlike { color: var(--gold); }

.deck-complete { max-width: 820px; margin: 70px auto 0; text-align: center; }
.complete-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 18px; border-radius: 50%; background: var(--moss); color: white; font-size: 25px; }
.deck-complete h2 { margin: 0; font-size: 38px; }
.deck-complete p { margin: 12px auto 24px; color: var(--ink-soft); line-height: 1.6; }
.deck-complete .button + .button { margin-left: 8px; }
.liked-story-picker { display: grid; gap: 10px; margin: 24px 0; text-align: left; }
.library-story { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; }
.library-story:has(input:checked) { border-color: var(--moss); box-shadow: 0 0 0 3px rgba(49,95,73,.1); }
.library-story input { margin-top: 5px; accent-color: var(--moss); }
.library-story strong { display: block; margin-bottom: 4px; }
.library-story p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.library-story small { color: var(--moss); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.library-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; }
.library-actions .button + .button { margin-left: 0; }

.collection-intro { max-width: 940px; margin: -2px auto 26px; color: var(--ink-soft); }
.collection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 940px; margin: 0 auto; }
.memory-card { display: flex; flex-direction: column; gap: 13px; min-height: 230px; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 12px 34px rgba(35,44,39,.07); }
.memory-card .card-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink-soft); font-size: 11px; }
.memory-card h2 { margin: 0; font-size: 28px; line-height: 1.05; }
.memory-card p { margin: 0; color: var(--ink-soft); line-height: 1.55; }
.memory-card .memory-bridge { padding: 12px; border-radius: 11px; background: var(--moss-soft); color: var(--moss-dark); font-size: 12px; }
.memory-card .card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.memory-card .card-actions .button { flex: 1; }
.memory-card .card-actions .button-archive { flex: 0 0 auto; border-color: #d7a095; color: var(--rust); }
.memory-card.is-archived { background: #f7f5ef; opacity: .9; }
.draft-grid .memory-card { min-height: 205px; }
.draft-preview { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.empty-state { max-width: 940px; margin: 50px auto; padding: 45px; border: 1px dashed var(--line-dark); border-radius: 20px; text-align: center; }
.empty-state h2 { margin: 0; font-size: 32px; }
.empty-state p { color: var(--ink-soft); }

.draft-card { max-width: 840px; margin: 0 auto; }
.draft-header { display: flex; justify-content: space-between; gap: 20px; padding: 30px 36px; border-bottom: 1px solid var(--line); background: var(--moss-soft); }
.draft-story-label { margin: 0 0 7px; color: var(--moss); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.draft-header h2 { margin: 0 0 7px; font-size: 30px; }
.preview-text { margin: 0; color: var(--ink-soft); font-size: 13px; }
.text-button { align-self: flex-start; border: 0; background: transparent; color: var(--moss); padding: 0; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.email-body { padding: 38px 56px; font-family: "DM Sans", sans-serif; line-height: 1.72; }
.email-body p { margin: 0 0 1em; }
.draft-notes { padding: 26px 36px; border-top: 1px solid var(--line); background: #faf8f2; }
.draft-notes h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.draft-notes ul { margin: 0 0 18px; padding-left: 18px; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }

.refine-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: stretch; height: 100%; min-height: 0; }
.editor-column, .chat-column { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); }
.editor-column { min-width: 0; overflow-y: auto; }
.editor-column .view-header { padding: 26px 30px; margin: 0; border-bottom: 1px solid var(--line); }
.editor-actions { display: flex; align-items: center; gap: 14px; }
.save-status { color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.subject-picker { padding: 20px 30px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.final-email { display: block; width: 100%; height: auto; min-height: 520px; padding: 34px 42px 48px; border: 0; border-radius: 0; outline: 0; overflow: hidden; resize: none; background: var(--surface); color: var(--ink); font: 15px/1.72 "DM Sans", sans-serif; }
.final-email:focus { background: #fff; box-shadow: inset 0 0 0 2px rgba(49,95,73,.16); }
.editor-sources { border-top: 1px solid var(--line); background: #faf8f2; }
.editor-sources summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 30px; cursor: pointer; color: var(--moss); font-size: 13px; font-weight: 700; list-style: none; }
.editor-sources summary::-webkit-details-marker { display: none; }
.editor-sources summary small { color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.editor-source-list { display: grid; gap: 10px; padding: 0 30px 20px; }
.editor-source-item { padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.editor-source-item a, .editor-source-item strong { color: var(--moss); font-size: 13px; font-weight: 700; }
.editor-source-item p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.editor-source-notes { padding: 18px 30px 28px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.editor-source-notes strong { display: block; margin-bottom: 8px; color: var(--ink); }
.editor-source-notes ul { margin: 0; padding-left: 18px; }
.chat-column { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.chat-heading { display: flex; align-items: center; gap: 11px; padding: 20px; border-bottom: 1px solid var(--line); }
.chat-heading p { margin: 3px 0 0; color: var(--ink-soft); font-size: 11px; }
.chat-messages { min-height: 0; overflow-y: auto; padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.chat-message { max-width: 88%; padding: 13px 15px; border-radius: 16px; font-size: 14px; line-height: 1.55; }
.chat-message.assistant { align-self: flex-start; background: var(--moss-soft); color: var(--moss-dark); border-bottom-left-radius: 4px; }
.chat-message.user { align-self: flex-end; background: var(--ink); color: white; border-bottom-right-radius: 4px; }
.chat-form { border-top: 1px solid var(--line); padding: 18px; background: #faf8f2; }
.chat-form textarea { margin-bottom: 10px; }
.chat-form .button { width: 100%; }

body.is-refine-mode { overflow: hidden; }
body.is-refine-mode .app-shell { max-width: none; height: 100dvh; padding: 0 18px 14px; }
body.is-refine-mode .topbar { display: none; }
body.is-refine-mode .app-nav { margin-top: 12px; }
body.is-refine-mode .setup-banner { display: none; }
body.is-refine-mode main { height: calc(100dvh - 76px); padding-top: 12px; }
body.is-refine-mode #view-refine { height: 100%; }

.loading-overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgba(31,40,36,.6); backdrop-filter: blur(9px); }
.loading-overlay[hidden] { display: none; }
.loading-card { width: min(470px, 100%); padding: 46px 38px; text-align: center; background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); }
.loading-card h2 { margin: 7px 0 12px; font-size: 36px; }
#loading-copy { color: var(--ink-soft); line-height: 1.6; }
.loading-card .loading-elapsed { margin: 18px 0 0; color: var(--moss); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.radar { position: relative; width: 76px; height: 76px; margin: 0 auto 28px; border: 1px solid var(--moss); border-radius: 50%; background: var(--moss-soft); overflow: hidden; }
.radar::before, .radar::after { content: ""; position: absolute; background: rgba(49,95,73,.25); }
.radar::before { width: 1px; height: 100%; left: 50%; }
.radar::after { height: 1px; width: 100%; top: 50%; }
.radar span { position: absolute; inset: 10px; border: 1px solid rgba(49,95,73,.3); border-radius: 50%; }
.radar i { position: absolute; width: 50%; height: 50%; left: 50%; top: 0; transform-origin: left bottom; background: linear-gradient(45deg, rgba(49,95,73,.32), transparent); animation: scan 1.6s linear infinite; }
.radar b { position: absolute; width: 7px; height: 7px; left: 53px; top: 29px; border-radius: 50%; background: var(--moss); animation: pulse 1.6s ease infinite; }
@keyframes scan { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.8); opacity: .5; } }

.toast { position: fixed; z-index: 30; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 11px 16px; border-radius: 999px; background: var(--ink); color: white; opacity: 0; pointer-events: none; transition: .25s ease; font-size: 13px; box-shadow: var(--shadow); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--rust); }

/* Neural glass visual system */
.topbar {
  min-height: 86px;
  border-bottom-color: rgba(104, 206, 255, .1);
}
.brand { color: var(--ink); font-family: "Space Grotesk", sans-serif; letter-spacing: -.025em; }
.brand-mark, .ai-avatar {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(130, 225, 255, .55);
  background:
    radial-gradient(circle at 35% 28%, #a7f5ff 0 4%, transparent 5%),
    radial-gradient(circle at 45% 40%, #35dfff, #116adf 55%, #06142c 100%);
  color: white;
  font-family: "Space Grotesk", sans-serif;
  box-shadow: 0 0 24px rgba(36, 174, 255, .35), inset 0 0 12px rgba(255, 255, 255, .16);
}
.brand-mark::after, .ai-avatar::after {
  content: "";
  position: absolute;
  inset: 6px -7px;
  border: 1px solid rgba(168, 238, 255, .45);
  border-radius: 50%;
  transform: rotate(-34deg);
}
.status-pill {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 23, 43, .55);
  backdrop-filter: blur(16px);
}
.status-dot { background: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft), 0 0 14px var(--gold); }
.status-pill.is-ready .status-dot { background: #55f0c0; box-shadow: 0 0 0 4px rgba(85,240,192,.12), 0 0 14px #55f0c0; }
.status-pill.is-error .status-dot { background: var(--rust); box-shadow: 0 0 0 4px var(--rust-soft), 0 0 14px var(--rust); }
.text-button { color: var(--moss); }

.app-nav {
  top: 14px;
  width: max-content;
  max-width: 100%;
  margin: 12px auto 0;
  padding: 6px;
  border-color: rgba(103, 209, 255, .18);
  border-radius: 999px;
  background: rgba(4, 15, 29, .76);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .32), inset 0 1px rgba(255,255,255,.035);
  backdrop-filter: blur(22px) saturate(1.35);
}
.nav-item { border-radius: 999px; color: #7794ad; font-size: 12px; letter-spacing: .015em; }
.nav-item:hover { background: rgba(53, 172, 255, .08); color: var(--ink); }
.nav-item.is-active {
  background: linear-gradient(135deg, #1589ff, #36cfff);
  color: #fff;
  box-shadow: 0 0 24px rgba(32, 153, 255, .38), inset 0 1px rgba(255,255,255,.22);
}
.nav-item span { background: rgba(86, 214, 255, .1); }
.nav-item.is-active span { background: rgba(1, 25, 57, .24); }

main { position: relative; padding-top: 68px; }
.view.is-visible { animation: reveal .4s cubic-bezier(.22, .8, .32, 1) both; }
#view-brief { position: relative; isolation: isolate; }
#view-brief::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 360px;
  height: 360px;
  top: -54px;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid rgba(92, 226, 255, .22);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 27%, rgba(208, 251, 255, .95) 0 1%, rgba(92, 231, 255, .25) 3%, transparent 8%),
    radial-gradient(circle at 38% 34%, #176ad7 0, #07376e 28%, #03162d 62%, #020711 100%);
  box-shadow:
    0 0 28px rgba(47, 213, 255, .42),
    0 0 100px rgba(23, 133, 255, .28),
    inset -28px -32px 65px rgba(0, 0, 0, .72),
    inset 20px 18px 44px rgba(72, 214, 255, .18);
  opacity: .58;
  animation: coreBreath 7s ease-in-out infinite;
}
#view-brief::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 430px;
  height: 115px;
  top: 65px;
  left: 50%;
  transform: translateX(-50%) rotate(-8deg);
  border: 1px solid rgba(82, 221, 255, .22);
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(47, 213, 255, .08);
  opacity: .6;
}
@keyframes coreBreath {
  0%, 100% { transform: translateX(-50%) scale(1); filter: brightness(.9); }
  50% { transform: translateX(-50%) scale(1.025); filter: brightness(1.15); }
}
.intro { position: relative; z-index: 1; max-width: 800px; margin-bottom: 48px; padding-top: 54px; }
.eyebrow { color: var(--moss); font-size: 10px; letter-spacing: .2em; text-shadow: 0 0 14px rgba(83, 221, 255, .38); }
h1, h2 { font-family: "Space Grotesk", sans-serif; letter-spacing: -.045em; }
h1 { font-weight: 500; text-shadow: 0 5px 40px rgba(0,0,0,.75); }
.intro > p:last-child { color: #9ab4ca; }

.auth-card, .brief-form, .story-card, .draft-card, .editor-column, .chat-column, .memory-card, .loading-card {
  border-color: rgba(105, 207, 255, .17);
  background: linear-gradient(145deg, rgba(9, 28, 51, .86), rgba(3, 12, 25, .88));
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.035);
  backdrop-filter: blur(22px) saturate(1.15);
}
.auth-card { position: relative; overflow: hidden; }
.auth-card::before {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  top: -150px;
  right: -90px;
  border-radius: 50%;
  background: #168cff;
  filter: blur(65px);
  opacity: .22;
}
.auth-card h1 { font-weight: 500; }
.auth-form input,
.field input, .field textarea, .field select,
.chat-form textarea, .subject-picker select {
  border-color: var(--line-dark);
  background: rgba(2, 12, 25, .72);
  color: var(--ink);
  box-shadow: inset 0 1px 10px rgba(0, 0, 0, .18);
}
.auth-form input { background: rgba(2, 12, 25, .72); }
.field input::placeholder, .field textarea::placeholder, .chat-form textarea::placeholder { color: #577189; }
.field input:focus, .field textarea:focus, .field select:focus, .chat-form textarea:focus, .subject-picker select:focus {
  border-color: var(--moss);
  outline: 3px solid rgba(83,221,255,.09);
  box-shadow: 0 0 22px rgba(31, 168, 255, .1), inset 0 1px 10px rgba(0,0,0,.18);
}
.brief-form { position: relative; overflow: hidden; max-width: 940px; padding: 36px; }
.brief-form::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(96, 225, 255, .65), transparent);
}
.source-plan, .check, .library-story, .empty-state {
  border-color: var(--line);
  background: rgba(6, 21, 39, .56);
}
.source-plan { position: relative; }
.source-plan span, .source-label {
  border: 1px solid rgba(83, 221, 255, .12);
  background: rgba(29, 170, 255, .1);
  color: #8beaff;
}
.check:has(input:checked) { border-color: var(--moss); background: var(--moss-soft); color: var(--moss-dark); }
.field label span { color: var(--rust); }

.button {
  border-radius: 11px;
  letter-spacing: -.01em;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.button-primary {
  border-color: rgba(118, 226, 255, .38);
  background: linear-gradient(135deg, #147df3, #34c9f3);
  color: #fff;
  box-shadow: 0 0 25px rgba(27, 145, 255, .28), inset 0 1px rgba(255,255,255,.22);
}
.button-primary:hover { background: linear-gradient(135deg, #258eff, #52dcff); box-shadow: 0 0 34px rgba(33, 165, 255, .42), inset 0 1px rgba(255,255,255,.24); }
.button-ghost { border-color: var(--line-dark); background: rgba(5, 20, 38, .42); }
.button-ghost:hover { border-color: rgba(103, 218, 255, .54); background: rgba(30, 158, 255, .1); }
.button-finish {
  border-color: rgba(88, 240, 192, .35);
  background: rgba(53, 205, 161, .1);
  color: #72f0c8;
  box-shadow: inset 0 1px rgba(255,255,255,.04), 0 0 22px rgba(53,205,161,.06);
}
.button-finish:hover {
  border-color: rgba(101, 255, 207, .65);
  background: rgba(53, 205, 161, .18);
  box-shadow: 0 0 26px rgba(53,205,161,.13);
}
.memory-card.is-finished { border-color: rgba(80, 231, 188, .2); }
.memory-card.is-finished::before {
  content: "Finished";
  align-self: flex-start;
  padding: 5px 8px;
  border: 1px solid rgba(88, 240, 192, .2);
  border-radius: 999px;
  background: rgba(53, 205, 161, .08);
  color: #72f0c8;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.view-header h1 { font-weight: 500; }
.deck-progress strong { color: var(--moss); text-shadow: 0 0 18px rgba(83,221,255,.28); }
.progress-track { height: 2px; border-radius: 99px; background: rgba(81, 179, 225, .12); }
.progress-track span { background: linear-gradient(90deg, #168cff, #5bedff); box-shadow: 0 0 14px rgba(56, 202, 255, .55); }
.story-card, .draft-card { position: relative; }
.story-card::before, .draft-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(89, 221, 255, .52), transparent);
}
.story-lede, .preview-text { color: #9ab3c8; }
.story-arc > svg { color: #39617d; }
.story-arc span, .bridge-box span { color: var(--moss); }
.story-card blockquote {
  border-left-color: var(--gold);
  background: linear-gradient(90deg, rgba(130, 107, 255, .13), rgba(26, 93, 157, .05));
  color: #e8e5ff;
  font-family: "Space Grotesk", sans-serif;
}
.bridge-box, .memory-card .memory-bridge {
  border: 1px solid rgba(73, 211, 255, .13);
  background: linear-gradient(135deg, rgba(28, 164, 255, .12), rgba(25, 205, 235, .055));
}
.bridge-box p, .memory-card .memory-bridge { color: #c8f5ff; }
.source-item a, .editor-source-item a, .editor-source-item strong { color: var(--moss); }

.swipe-button {
  border-color: var(--line);
  background: rgba(5, 19, 36, .8);
  box-shadow: inset 0 1px rgba(255,255,255,.03);
}
.swipe-button:hover { border-color: currentColor; box-shadow: 0 0 28px color-mix(in srgb, currentColor 24%, transparent); }
.swipe-button.dislike { color: var(--rust); }
.swipe-button.like { color: #4ce7bf; }
.swipe-button.superlike { color: var(--gold); }
.complete-icon {
  border: 1px solid rgba(109, 230, 255, .55);
  background: radial-gradient(circle at 35% 30%, #7ef1ff, #167ef0 58%, #082c65);
  box-shadow: 0 0 34px rgba(36, 176, 255, .38);
}
.library-story:has(input:checked) { border-color: var(--moss); box-shadow: 0 0 0 3px rgba(83,221,255,.08), 0 0 30px rgba(29,145,255,.08); }

.memory-card { transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.memory-card:hover { transform: translateY(-3px); border-color: rgba(104, 216, 255, .31); box-shadow: 0 24px 64px rgba(0,0,0,.38), 0 0 34px rgba(21,130,255,.08); }
.memory-card .card-meta { color: #718da5; }
.memory-card .card-actions .button-archive { border-color: rgba(255, 127, 156, .27); color: var(--rust); }
.memory-card.is-archived { background: rgba(7, 17, 30, .62); opacity: .72; }
.empty-state { border-style: dashed; }

.draft-header {
  border-bottom-color: var(--line);
  background: linear-gradient(135deg, rgba(27, 146, 255, .13), rgba(4, 17, 32, .25));
}
.email-body { font-family: "Inter", sans-serif; }
.draft-notes { border-top-color: var(--line); background: rgba(3, 14, 28, .7); }
.editor-column, .chat-column { border-radius: 18px; }
.editor-column .view-header, .subject-picker, .chat-heading, .chat-form { border-color: var(--line); }
.editor-column .view-header { background: linear-gradient(135deg, rgba(17, 110, 218, .09), transparent); }
.subject-picker { background: rgba(4, 15, 29, .52); }
.final-email {
  background: rgba(2, 11, 23, .52);
  color: #dbe9f4;
  font: 15px/1.76 "Inter", sans-serif;
  caret-color: var(--moss);
}
.final-email:focus { background: rgba(3, 15, 30, .72); box-shadow: inset 0 0 0 1px rgba(83,221,255,.22), inset 0 0 35px rgba(20,110,210,.04); }
.editor-sources, .chat-form { background: rgba(3, 14, 28, .82); }
.chat-form { position: relative; }
.client-mention-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  margin-bottom: 10px;
}
.client-mention-trigger, .client-mention-clear {
  border: 1px solid rgba(80, 190, 255, .28);
  background: rgba(13, 58, 101, .35);
  color: #9ddcff;
  font: 600 11px/1 "Inter", sans-serif;
  cursor: pointer;
}
.client-mention-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 29px;
  padding: 0 10px 0 7px;
  border-radius: 999px;
}
.client-mention-trigger:hover, .client-mention-trigger[aria-expanded="true"] {
  border-color: rgba(83, 221, 255, .62);
  background: rgba(15, 103, 170, .42);
  box-shadow: 0 0 18px rgba(23, 156, 255, .16);
}
.client-mention-trigger.is-active {
  color: #9af5d0;
  border-color: rgba(70, 230, 176, .42);
  background: rgba(14, 100, 79, .25);
}
.mention-symbol {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1b8dff, #51e0ff);
  color: #031226;
  font-size: 12px;
}
.client-mention-trigger.is-active .mention-symbol { background: linear-gradient(135deg, #50e4ac, #7ef1ff); }
.client-mention-clear {
  width: 27px;
  height: 27px;
  padding: 0;
  border-radius: 50%;
  font-size: 17px;
}
.client-mention-status { color: #6988a2; font-size: 10px; }
.client-mention-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 12;
  width: min(340px, calc(100vw - 72px));
  padding: 7px;
  border: 1px solid rgba(83, 221, 255, .3);
  border-radius: 14px;
  background: rgba(4, 18, 35, .98);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .46), 0 0 32px rgba(24, 143, 255, .1);
}
.client-mention-option {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #d8eafa;
  text-align: left;
  cursor: pointer;
}
.client-mention-option:hover, .client-mention-option:focus-visible { background: rgba(27, 139, 239, .15); outline: none; }
.client-mention-option:disabled { cursor: not-allowed; opacity: .45; }
.client-mention-option .mention-symbol { grid-row: 1 / span 2; width: 30px; height: 30px; }
.client-mention-option strong { font-size: 12px; }
.client-mention-option small { color: #7896ae; font-size: 10px; line-height: 1.35; }
.chat-form textarea {
  min-height: 92px;
  margin-bottom: 0;
  padding-right: 62px;
}
.chat-form .chat-send-button {
  position: absolute;
  right: 29px;
  bottom: 29px;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  box-shadow: 0 0 22px rgba(27, 145, 255, .32), inset 0 1px rgba(255,255,255,.22);
}
.chat-form .chat-send-button svg { width: 19px; height: 19px; }
.button-spinner {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, .36);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.manual-search-header, #view-manual-search > .collection-intro { max-width: 1120px; }
.manual-search-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  max-width: 1120px;
  margin: 30px auto 0;
  min-height: 640px;
  height: min(720px, calc(100dvh - 275px));
}
.manual-search-guide, .manual-chat-panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(9, 28, 51, .86), rgba(3, 12, 25, .88));
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.035);
  backdrop-filter: blur(22px) saturate(1.15);
}
.manual-search-guide {
  position: relative;
  overflow: hidden;
  padding: 28px;
}
.manual-search-guide::before {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  top: -120px;
  right: -90px;
  border-radius: 50%;
  background: #178eff;
  filter: blur(55px);
  opacity: .22;
}
.manual-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin-bottom: 26px;
  border: 1px solid rgba(83, 221, 255, .24);
  border-radius: 50%;
  box-shadow: 0 0 28px rgba(35, 143, 255, .14);
}
.manual-orbit::before, .manual-orbit::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(83, 221, 255, .18);
  border-radius: 50%;
}
.manual-orbit::before { width: 86px; height: 28px; transform: rotate(-28deg); }
.manual-orbit::after { width: 28px; height: 86px; transform: rotate(35deg); }
.manual-orbit i {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #a7f5ff, #188cff 45%, #06142c 100%);
  box-shadow: 0 0 23px rgba(56, 204, 255, .58);
}
.manual-search-guide > strong { display: block; margin-bottom: 8px; font: 600 21px/1.2 "Space Grotesk", sans-serif; }
.manual-search-guide > p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.6; }
.manual-prompts { display: grid; gap: 9px; margin: 25px 0; }
.manual-prompts button, .manual-followup {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(20, 85, 145, .08);
  color: #c9e9f7;
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.4;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.manual-prompts button:hover, .manual-followup:hover { border-color: rgba(83, 221, 255, .42); background: rgba(30, 158, 255, .12); transform: translateY(-1px); }
.manual-search-guide .manual-guide-note { padding-top: 20px; border-top: 1px solid var(--line); font-size: 11px; }
.manual-chat-panel { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; min-height: 0; overflow: hidden; }
.manual-search-messages { min-height: 0; overflow-y: auto; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.manual-message { max-width: 92%; font-size: 14px; line-height: 1.62; }
.manual-message > p { margin: 8px 0 0; }
.manual-message-label { display: block; color: var(--moss); font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.manual-message.user {
  align-self: flex-end;
  max-width: 78%;
  padding: 14px 16px;
  border: 1px solid rgba(114, 221, 255, .27);
  border-radius: 16px 16px 4px 16px;
  background: linear-gradient(135deg, rgba(18,111,218,.9), rgba(22,158,201,.78));
  box-shadow: 0 8px 24px rgba(12, 91, 180, .16);
}
.manual-message.user .manual-message-label { color: rgba(255,255,255,.68); }
.manual-message.user p { margin: 4px 0 0; }
.manual-message.assistant {
  align-self: flex-start;
  padding: 18px;
  border: 1px solid rgba(77, 211, 255, .12);
  border-radius: 16px 16px 16px 4px;
  background: rgba(13, 49, 80, .28);
}
.manual-message.assistant.is-error { border-color: rgba(255, 127, 156, .3); background: rgba(108, 24, 50, .2); }
.manual-message h3 { margin: 24px 0 12px; font: 600 16px/1.2 "Space Grotesk", sans-serif; }
.manual-leads { display: grid; gap: 12px; }
.manual-lead-card { padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: rgba(2, 13, 27, .55); }
.manual-lead-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.manual-lead-top h4 { margin: 0; font: 600 17px/1.2 "Space Grotesk", sans-serif; }
.manual-lead-top span { flex: 0 0 auto; max-width: 32%; color: var(--moss); font-size: 10px; text-align: right; }
.manual-lead-card > p { margin: 9px 0 0; color: #aec4d6; }
.manual-lead-insight { margin-top: 12px; padding: 11px 12px; border-left: 2px solid rgba(83, 221, 255, .35); background: rgba(32, 130, 190, .06); }
.manual-lead-insight strong { display: block; color: #91eaff; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.manual-lead-insight p { margin: 4px 0 0; color: #b6cad9; font-size: 12px; }
.manual-lead-card .manual-evidence-limit { color: #d5b8c2; font-size: 11px; }
.manual-lead-sources, .manual-additional-sources { margin-top: 13px; border-top: 1px solid var(--line); padding-top: 11px; }
.manual-lead-sources summary, .manual-additional-sources summary { color: var(--moss); cursor: pointer; font-size: 11px; font-weight: 700; }
.manual-source { padding: 10px 0; border-bottom: 1px solid var(--line); }
.manual-source:last-child { border-bottom: 0; }
.manual-source a, .manual-source strong { color: #8beaff; font-size: 12px; font-weight: 700; text-underline-offset: 3px; }
.manual-source p { margin: 3px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.manual-followups { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 17px; }
.manual-followup { padding: 8px 10px; color: #8beaff; }
.manual-search-form { padding: 18px; border-top: 1px solid var(--line); background: rgba(3, 14, 28, .86); }
.manual-search-form textarea {
  display: block;
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 1px solid var(--line-dark);
  border-radius: 14px;
  background: rgba(2, 12, 25, .72);
  color: var(--ink);
  padding: 14px;
  font: 14px/1.5 "Inter", sans-serif;
}
.manual-search-form textarea:focus { border-color: var(--moss); outline: 3px solid rgba(83,221,255,.09); }
.manual-search-form textarea::placeholder { color: #577189; }
.manual-search-form-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 10px; }
.manual-search-form-footer > span { color: var(--ink-soft); font-size: 10px; }
.manual-search-submit { width: 40px; height: 40px; flex: 0 0 auto; padding: 0; border-radius: 12px; }
.manual-search-submit svg { width: 19px; height: 19px; }
.editor-source-item { border-color: var(--line); background: rgba(8, 28, 50, .7); }
.chat-heading { background: linear-gradient(90deg, rgba(15, 105, 210, .1), transparent); }
.chat-message.assistant {
  border: 1px solid rgba(77, 211, 255, .12);
  background: rgba(22, 127, 199, .13);
  color: #d7f7ff;
}
.chat-message.user {
  border: 1px solid rgba(114, 221, 255, .28);
  background: linear-gradient(135deg, #126fda, #169ec9);
  box-shadow: 0 8px 24px rgba(12, 91, 180, .18);
}
.save-status { color: #6eddbd; }

.setup-banner, .research-error {
  border-color: rgba(255, 127, 156, .35);
  background: rgba(108, 24, 50, .3);
  color: #ffc1cf;
}
.loading-overlay { background: rgba(0, 5, 13, .78); backdrop-filter: blur(15px); }
.loading-card { position: relative; overflow: hidden; }
.loading-card::before {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  top: -230px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #178eff;
  filter: blur(65px);
  opacity: .32;
}
.radar {
  border-color: var(--moss);
  background: radial-gradient(circle, rgba(38, 185, 255, .17), rgba(5, 25, 48, .7));
  box-shadow: 0 0 38px rgba(44, 190, 255, .28), inset 0 0 20px rgba(44, 190, 255, .12);
}
.radar::before, .radar::after { background: rgba(83,221,255,.25); }
.radar span { border-color: rgba(83,221,255,.3); }
.radar i { background: linear-gradient(45deg, rgba(61,210,255,.38), transparent); }
.radar b { background: #8ff3ff; box-shadow: 0 0 12px #53ddff; }
.toast { border: 1px solid var(--line-dark); background: rgba(4, 17, 32, .94); box-shadow: 0 15px 50px rgba(0,0,0,.5), 0 0 22px rgba(25,140,255,.12); }
.toast.is-error { border-color: rgba(255,127,156,.34); background: #6d1f39; }

@supports not (background: color-mix(in srgb, white 50%, black)) {
  .swipe-button:hover { box-shadow: 0 0 28px rgba(43, 175, 255, .18); }
}

@media (max-width: 820px) {
  .app-shell { padding: 0 18px 48px; }
  .app-nav { overflow-x: auto; }
  .nav-item { white-space: nowrap; }
  .brief-form { padding: 24px; grid-template-columns: 1fr; }
  .field, .field-wide { grid-column: 1; }
  .form-footer { flex-direction: column; align-items: stretch; }
  .form-actions { flex-direction: column; }
  .view-header { align-items: flex-start; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .story-arc { grid-template-columns: 1fr; gap: 14px; }
  .story-arc > svg { transform: rotate(90deg); justify-self: center; }
  .refine-layout { grid-template-columns: 1fr; }
  body.is-refine-mode { overflow: auto; }
  body.is-refine-mode .app-shell, body.is-refine-mode main, body.is-refine-mode #view-refine { height: auto; }
  .editor-column { min-height: 700px; }
  .chat-column { height: 700px; min-height: 0; }
  .collection-grid { grid-template-columns: 1fr; }
  .manual-search-layout { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .manual-search-guide { padding: 24px; }
  .manual-orbit { width: 58px; height: 58px; }
  .manual-orbit::before { width: 70px; }
  .manual-orbit::after { height: 70px; }
  .manual-chat-panel { height: 720px; }
}

@media (max-width: 560px) {
  .topbar { min-height: 68px; }
  .status-pill span:last-child { display: none; }
  .topbar-right { gap: 10px; }
  main { padding-top: 38px; }
  .brief-form { padding: 20px 16px; border-radius: 18px; }
  .source-options { align-items: flex-start; }
  .view-header { display: block; }
  .header-actions { justify-content: flex-start; margin-top: 14px; }
  .deck-progress { margin-top: 14px; text-align: left; }
  .story-card { border-radius: 20px; }
  .swipe-actions { gap: 10px; }
  .swipe-button { width: 74px; height: 68px; }
  .draft-header { display: block; padding: 24px 20px; }
  .text-button { margin-top: 16px; }
  .email-body, .final-email { padding: 28px 22px; }
  .editor-sources summary, .editor-source-list, .editor-source-notes { padding-left: 22px; padding-right: 22px; }
  .editor-column .view-header { padding: 22px; }
  .editor-column .view-header .button { margin-top: 16px; }
  .deck-complete .button { width: 100%; }
  .deck-complete .button + .button { margin: 9px 0 0; }
  .library-story { grid-template-columns: auto 1fr; }
  .library-story small { grid-column: 2; }
  .manual-search-header .button { margin-top: 14px; }
  .manual-search-messages { padding: 18px; }
  .manual-message, .manual-message.user { max-width: 100%; }
  .manual-lead-top { display: block; }
  .manual-lead-top span { display: block; max-width: none; margin-top: 5px; text-align: left; }
  .manual-search-form-footer > span { max-width: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* ─────────────────────────────────────────────────────────────
   MONOCHROME EDITION
   Cinematic black, soft white, restrained light, zero color noise.
   ───────────────────────────────────────────────────────────── */

:root {
  color-scheme: dark;
  --ink: #f4f4f1;
  --ink-soft: #8b8b87;
  --paper: #050505;
  --surface: rgba(12, 12, 12, .9);
  --surface-strong: #101010;
  --line: rgba(255, 255, 255, .09);
  --line-dark: rgba(255, 255, 255, .19);
  --moss: #f4f4f1;
  --moss-dark: #ffffff;
  --moss-soft: rgba(255, 255, 255, .055);
  --rust: #b8b8b4;
  --rust-soft: rgba(255, 255, 255, .055);
  --gold: #d4d4d0;
  --gold-soft: rgba(255, 255, 255, .05);
  --blue: #f4f4f1;
  --blue-bright: #ffffff;
  --glass: rgba(9, 9, 9, .8);
  --shadow: 0 28px 80px rgba(0, 0, 0, .52), inset 0 1px 0 rgba(255, 255, 255, .025);
  font-family: "Inter", system-ui, sans-serif;
}

body {
  color: var(--ink);
  background:
    radial-gradient(ellipse 56% 34% at 92% -8%, rgba(255, 255, 255, .14), transparent 68%),
    radial-gradient(ellipse 42% 28% at -8% 106%, rgba(255, 255, 255, .1), transparent 70%),
    linear-gradient(180deg, #030303, #070707 46%, #040404);
}

body::before {
  opacity: 1;
  background:
    radial-gradient(ellipse 22% 54% at 91% 4%, rgba(255, 255, 255, .055), transparent 72%),
    linear-gradient(112deg, transparent 0 76%, rgba(255, 255, 255, .026) 76.1%, transparent 76.35%);
  background-size: auto;
  -webkit-mask-image: none;
  mask-image: none;
}

body::after {
  opacity: .035;
  filter: grayscale(1) contrast(1.4);
}

button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 1px solid #fff;
  outline-offset: 4px;
}

h1, h2, .manual-search-guide > strong, .manual-message h3, .manual-lead-top h4 {
  font-family: "Space Grotesk", "Inter", sans-serif;
  letter-spacing: -.055em;
}

h1, h2 { font-weight: 500; }

.app-shell { max-width: 1500px; }

.topbar {
  min-height: 74px;
  border-bottom-color: var(--line);
}

.brand {
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.025em;
}

.brand-mark, .ai-avatar {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 50%;
  background: #f4f4f1;
  color: #070707;
  box-shadow: 0 0 24px rgba(255, 255, 255, .1);
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -.04em;
}
.brand-mark::after, .ai-avatar::after { display: none; }

.brand-mark,
.ai-avatar {
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: 0 0 26px rgba(255, 255, 255, .11);
}

.brand-mark img,
.ai-avatar img {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-name {
  font-family: "Space Grotesk", sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.055em;
}

.auth-mark {
  width: 52px;
  height: 52px;
}

.status-pill {
  padding: 8px 11px;
  border-color: rgba(255, 255, 255, .09);
  background: rgba(255, 255, 255, .025);
  color: #777773;
  font-size: 11px;
  letter-spacing: .01em;
  backdrop-filter: blur(18px) saturate(0);
}
.status-dot, .status-pill.is-ready .status-dot, .status-pill.is-error .status-dot {
  width: 6px;
  height: 6px;
  background: #ddd;
  box-shadow: 0 0 10px rgba(255, 255, 255, .42);
}
.status-pill.is-error .status-dot { background: #777; box-shadow: none; }

.app-nav {
  width: fit-content;
  max-width: 100%;
  margin-top: 14px;
  padding: 5px;
  border-color: rgba(255, 255, 255, .12);
  border-radius: 999px;
  background: rgba(5, 5, 5, .78);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .35), inset 0 1px rgba(255, 255, 255, .035);
  backdrop-filter: blur(24px) saturate(0);
}

.nav-item {
  padding: 9px 15px;
  border-radius: 999px;
  color: #777773;
  font-size: 11px;
  font-weight: 600;
}
.nav-item:hover { background: rgba(255, 255, 255, .055); color: #ddd; }
.nav-item.is-active { background: #f2f2ef; color: #080808; box-shadow: 0 0 22px rgba(255, 255, 255, .08); }
.nav-item span { background: rgba(255, 255, 255, .08); color: #aaa; }
.nav-item.is-active span { background: rgba(0, 0, 0, .1); color: #111; }

main { padding-top: 64px; }
.intro { max-width: 850px; margin-bottom: 40px; }
.eyebrow {
  margin-bottom: 13px;
  color: #8b8b87;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .24em;
  text-shadow: none;
}
.intro h1 { color: #f4f4f1; font-size: clamp(44px, 6vw, 72px); font-weight: 400; text-shadow: 0 8px 48px rgba(0, 0, 0, .65); }
.intro > p:last-child { max-width: 590px; color: #858581; font-size: 14px; }

#view-brief::before {
  width: 330px;
  height: 330px;
  top: -40px;
  border-color: rgba(255, 255, 255, .09);
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, .9) 0 1%, rgba(255, 255, 255, .2) 2%, transparent 8%),
    radial-gradient(circle at 40% 36%, #4b4b49 0, #202020 31%, #0c0c0c 65%, #050505 100%);
  box-shadow:
    0 0 35px rgba(255, 255, 255, .09),
    0 0 120px rgba(255, 255, 255, .045),
    inset -32px -36px 70px rgba(0, 0, 0, .86),
    inset 20px 18px 45px rgba(255, 255, 255, .055);
  opacity: .34;
  filter: grayscale(1);
}
#view-brief::after {
  width: 410px;
  border-color: rgba(255, 255, 255, .075);
  box-shadow: 0 0 24px rgba(255, 255, 255, .025);
  opacity: .42;
}

.auth-gate {
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, .12), transparent 16rem),
    transparent;
}
.auth-card {
  position: relative;
  overflow: hidden;
  padding: 48px;
  border-color: rgba(255, 255, 255, .13);
  border-radius: 20px;
  background: rgba(7, 7, 7, .88);
  box-shadow: 0 40px 120px rgba(0, 0, 0, .7), inset 0 1px rgba(255, 255, 255, .035);
  backdrop-filter: blur(20px) saturate(0);
}
.auth-card::before {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  top: -145px;
  right: -55px;
  border-radius: 50%;
  background: #fff;
  filter: blur(22px);
  opacity: .18;
  pointer-events: none;
}
.auth-card h1 { font-size: 46px; font-weight: 400; }
.auth-form input { background: #0b0b0b; color: #fff; }

.brief-form,
.story-card,
.draft-card,
.memory-card,
.editor-column,
.chat-column,
.manual-search-guide,
.manual-chat-panel,
.loading-card,
.auth-card {
  border-color: rgba(255, 255, 255, .1);
  background: linear-gradient(145deg, rgba(15, 15, 15, .92), rgba(7, 7, 7, .94));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(0);
}

.brief-form {
  max-width: 920px;
  padding: 38px;
  border-radius: 20px;
}
.brief-form::before { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .2), transparent); }

.field label, .field legend, .subject-picker label {
  color: #c8c8c4;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
}
.field label span { color: #8c8c88; }
.field-hint { color: #696965; font-size: 10px; }
.field input, .field textarea, .field select,
.chat-form textarea, .subject-picker select,
.manual-search-form textarea {
  border-color: rgba(255, 255, 255, .13);
  border-radius: 11px;
  background: rgba(2, 2, 2, .72);
  color: #ededeb;
  box-shadow: inset 0 1px rgba(255, 255, 255, .015);
}
.field input::placeholder, .field textarea::placeholder,
.chat-form textarea::placeholder, .manual-search-form textarea::placeholder { color: #4d4d4a; }
.field input:focus, .field textarea:focus, .field select:focus,
.chat-form textarea:focus, .subject-picker select:focus,
.manual-search-form textarea:focus {
  border-color: rgba(255, 255, 255, .55);
  outline: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .025);
}

.source-plan {
  border-color: var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .025);
}
.check {
  border-color: rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .03);
  color: #8e8e8a;
}
.check:has(input:checked) { border-color: #ddd; background: #ededeb; color: #080808; }
.check input { accent-color: #fff; }
.source-plan span {
  border: 1px solid rgba(255, 255, 255, .09);
  background: rgba(255, 255, 255, .045);
  color: #aaa;
  font-weight: 500;
}
.source-plan p, .form-footer p { color: #686865; }

.button {
  min-height: 40px;
  border-radius: 999px;
  padding: 10px 17px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: -.01em;
  box-shadow: none;
}
.button-primary, .button-finish {
  border-color: #f1f1ee;
  background: #f1f1ee;
  color: #080808;
  box-shadow: 0 0 28px rgba(255, 255, 255, .07);
}
.button-primary:hover, .button-finish:hover {
  border-color: #fff;
  background: #fff;
  color: #000;
  box-shadow: 0 0 34px rgba(255, 255, 255, .14);
}
.button-ghost {
  border-color: rgba(255, 255, 255, .15);
  background: transparent;
  color: #c2c2be;
}
.button-ghost:hover { border-color: rgba(255, 255, 255, .34); background: rgba(255, 255, 255, .055); }

.view-header { max-width: 1000px; }
.view-header h1 { font-weight: 400; }
.deck-progress strong { color: #f1f1ef; text-shadow: none; }
.progress-track { background: rgba(255, 255, 255, .08); }
.progress-track span { background: #f3f3f0; box-shadow: 0 0 12px rgba(255, 255, 255, .18); }

.story-stage { max-width: 860px; }
.story-card, .draft-card { border-radius: 18px; }
.story-card::before, .draft-card::before { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .18), transparent); }
.source-label {
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .045);
  color: #a0a09c;
  font-size: 8px;
  letter-spacing: .17em;
}
.icon-button { border-color: rgba(255, 255, 255, .12); color: #aaa; }
.icon-button:hover, .icon-button.is-active { border-color: #eee; background: #eee; color: #080808; }
.story-card h2 { font-weight: 400; }
.story-lede, .preview-text { color: #858581; }
.story-arc > svg { color: #464643; }
.story-arc span, .bridge-box span { color: #858581; }
.story-card blockquote {
  border-left: 1px solid rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .035);
  color: #d5d5d1;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 400;
}
.bridge-box, .memory-card .memory-bridge {
  border-color: rgba(255, 255, 255, .09);
  background: rgba(255, 255, 255, .04);
}
.bridge-box p, .memory-card .memory-bridge { color: #c3c3bf; }
.source-item a, .editor-source-item a, .editor-source-item strong,
.manual-source a, .manual-source strong { color: #e2e2de; }
.source-caveat { color: #8b8b87; }

.swipe-actions { gap: 10px; }
.swipe-button {
  width: 78px;
  height: 70px;
  border-color: rgba(255, 255, 255, .1);
  border-radius: 14px;
  background: rgba(10, 10, 10, .9);
  color: #8b8b87 !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, .025);
}
.swipe-button:hover {
  border-color: rgba(255, 255, 255, .48);
  background: rgba(255, 255, 255, .065);
  color: #fff !important;
  box-shadow: 0 14px 35px rgba(0, 0, 0, .45);
}
.swipe-button.superlike { border-color: rgba(255, 255, 255, .18); color: #d0d0cc !important; }
.complete-icon {
  border: 1px solid #f2f2ef;
  background: #f2f2ef;
  color: #080808;
  box-shadow: 0 0 30px rgba(255, 255, 255, .11);
}

.library-story {
  border-color: rgba(255, 255, 255, .1);
  background: #0a0a0a;
}
.library-story:has(input:checked) { border-color: #ddd; box-shadow: 0 0 0 1px #ddd; }
.library-story input { accent-color: #fff; }
.library-story small { color: #aaa; }

.collection-intro { max-width: 1000px; color: #777773; }
.collection-grid { max-width: 1000px; gap: 12px; }
.memory-card {
  min-height: 235px;
  border-radius: 16px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, .28), inset 0 1px rgba(255, 255, 255, .02);
}
.memory-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, .24);
  box-shadow: 0 28px 75px rgba(0, 0, 0, .45), inset 0 1px rgba(255, 255, 255, .03);
}
.memory-card .card-meta { color: #656562; }
.memory-card h2 { font-weight: 400; }
.memory-card p { color: #858581; }
.memory-card .card-actions .button-archive { border-color: rgba(255, 255, 255, .12); color: #898985; }
.memory-card.is-archived { background: #090909; opacity: .62; }
.memory-card.is-finished { border-color: rgba(255, 255, 255, .18); }
.memory-card.is-finished::before {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .06);
  color: #b4b4b0;
}
.empty-state { border-color: rgba(255, 255, 255, .14); }

.draft-header { background: rgba(255, 255, 255, .025); }
.draft-story-label, .text-button { color: #a7a7a3; }
.draft-notes { background: #090909; }

/* Manual research: the glowing sphere becomes the only strong motif. */
.manual-search-layout { max-width: 1180px; gap: 12px; }
.manual-search-guide, .manual-chat-panel { border-radius: 17px; }
.manual-search-guide::before {
  width: 220px;
  height: 220px;
  top: -165px;
  right: -100px;
  background: #fff;
  filter: blur(58px);
  opacity: .11;
}
.manual-orbit {
  width: 58px;
  height: 58px;
  border: 0;
  background: radial-gradient(circle at 38% 34%, #fff 0 32%, #c9c9c5 55%, #666 100%);
  box-shadow: 0 0 20px rgba(255, 255, 255, .35), 0 0 70px rgba(255, 255, 255, .12);
}
.manual-orbit::before, .manual-orbit::after { display: none; }
.manual-orbit i { display: none; }
.manual-search-guide > strong { font-weight: 450; }
.manual-search-guide > p, .manual-guide-note { color: #73736f; }
.manual-prompts button, .manual-followup {
  border-color: rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .025);
  color: #aaa;
}
.manual-prompts button:hover, .manual-followup:hover {
  border-color: rgba(255, 255, 255, .32);
  background: rgba(255, 255, 255, .055);
  color: #eee;
}
.manual-search-form { background: #080808; }
.manual-message-label { color: #777773; }
.manual-message.user {
  border-color: #ecece9;
  background: #ecece9;
  color: #080808;
  box-shadow: none;
}
.manual-message.user .manual-message-label { color: #686864; }
.manual-message.assistant {
  border-color: rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .035);
}
.manual-message.assistant.is-error { border-color: rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .055); }
.manual-lead-card { border-color: rgba(255, 255, 255, .09); background: #090909; }
.manual-lead-top span, .manual-lead-insight strong, .manual-lead-sources summary, .manual-additional-sources summary { color: #aaa; }
.manual-lead-card > p, .manual-lead-insight p { color: #92928e; }
.manual-lead-insight { border-left-color: rgba(255, 255, 255, .27); background: rgba(255, 255, 255, .025); }

/* Full-screen editor */
.editor-column, .chat-column { border-radius: 14px; }
.editor-column .view-header { background: #090909; }
.editor-column .view-header, .subject-picker, .chat-heading, .chat-form { border-color: rgba(255, 255, 255, .09); }
.subject-picker { background: #080808; }
.final-email {
  background: #070707;
  color: #dededb;
  caret-color: #fff;
  font: 14px/1.8 "Inter", sans-serif;
}
.final-email:focus { background: #090909; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.editor-sources, .chat-form { background: #080808; }
.editor-source-item { border-color: rgba(255, 255, 255, .08); background: #0b0b0b; }
.chat-heading { background: #090909; }
.chat-heading p { color: #6e6e6a; }
.chat-message.assistant {
  border-color: rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .045);
  color: #d2d2ce;
}
.chat-message.user {
  border-color: #ededeb;
  background: #ededeb;
  color: #090909;
  box-shadow: none;
}
.save-status { color: #999995; }

.client-mention-trigger, .client-mention-clear {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .035);
  color: #aaa;
}
.client-mention-trigger:hover, .client-mention-trigger[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, .38);
  background: rgba(255, 255, 255, .07);
  box-shadow: none;
}
.client-mention-trigger.is-active { border-color: #ddd; background: rgba(255, 255, 255, .08); color: #eee; }
.mention-symbol, .client-mention-trigger.is-active .mention-symbol {
  background: #e9e9e6;
  color: #080808;
}
.client-mention-status { color: #5f5f5c; }
.client-mention-menu {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(8, 8, 8, .98);
  box-shadow: 0 24px 65px rgba(0, 0, 0, .68);
}
.client-mention-option { color: #ddd; }
.client-mention-option:hover, .client-mention-option:focus-visible { background: rgba(255, 255, 255, .06); }
.client-mention-option small { color: #6e6e6a; }
.chat-form .chat-send-button, .manual-search-submit { box-shadow: 0 0 24px rgba(255, 255, 255, .08); }

.setup-banner, .research-error {
  border-color: rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .06);
  color: #cacac6;
}
.loading-overlay { background: rgba(0, 0, 0, .84); backdrop-filter: blur(18px) saturate(0); }
.loading-card::before {
  background: #fff;
  filter: blur(70px);
  opacity: .13;
}
.radar {
  border-color: rgba(255, 255, 255, .7);
  background: radial-gradient(circle, rgba(255, 255, 255, .13), rgba(5, 5, 5, .8));
  box-shadow: 0 0 45px rgba(255, 255, 255, .12), inset 0 0 22px rgba(255, 255, 255, .07);
}
.radar::before, .radar::after { background: rgba(255, 255, 255, .18); }
.radar span { border-color: rgba(255, 255, 255, .2); }
.radar i { background: linear-gradient(45deg, rgba(255, 255, 255, .27), transparent); }
.radar b { background: #fff; box-shadow: 0 0 13px #fff; }
.toast {
  border-color: rgba(255, 255, 255, .18);
  background: rgba(9, 9, 9, .96);
  color: #ddd;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .65);
}
.toast.is-error { border-color: rgba(255, 255, 255, .3); background: #171717; }

.recipe-picker {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.recipe-picker legend {
  margin-bottom: 10px;
  color: #c8c8c4;
  font-size: 11px;
  font-weight: 600;
}
.recipe-picker legend span { color: #8c8c88; }
.recipe-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.recipe-option {
  position: relative;
  display: flex;
  min-height: 132px;
  flex-direction: column;
  gap: 7px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 13px;
  background: rgba(255, 255, 255, .025);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.recipe-option:hover {
  border-color: rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .045);
  transform: translateY(-1px);
}
.recipe-option:has(input:checked) {
  border-color: #efefec;
  background: #efefec;
  color: #080808;
}
.recipe-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.recipe-option:has(input:focus-visible) { outline: 2px solid #fff; outline-offset: 3px; }
.recipe-family {
  color: #666662;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.recipe-option:has(input:checked) .recipe-family { color: #575753; }
.recipe-option strong {
  color: #e7e7e4;
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
  line-height: 1.15;
  letter-spacing: -.03em;
}
.recipe-option:has(input:checked) strong { color: #080808; }
.recipe-option p {
  margin: 0;
  color: #777773;
  font-size: 10px;
  line-height: 1.5;
}
.recipe-option:has(input:checked) p { color: #464643; }
.field label small {
  margin-left: 5px;
  color: #666662;
  font-size: 9px;
  font-weight: 500;
}
.source-plan-tags {
  display: flex;
  width: 100%;
  flex-wrap: wrap;
  gap: 7px;
}

@media (max-width: 820px) {
  .app-nav { width: 100%; border-radius: 15px; }
  .nav-item { border-radius: 10px; }
  .brief-form { padding: 26px; }
  .recipe-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manual-search-layout { gap: 10px; }
}

@media (max-width: 560px) {
  .app-shell { padding-left: 12px; padding-right: 12px; }
  .topbar { padding: 0 5px; }
  main { padding-top: 42px; }
  .intro h1 { font-size: 42px; }
  .brief-form { padding: 20px 16px; border-radius: 14px; }
  .recipe-options { grid-template-columns: 1fr; }
  .recipe-option { min-height: 0; }
  .story-card, .memory-card, .manual-search-guide, .manual-chat-panel { border-radius: 14px; }
  .auth-card { padding: 34px 25px; }
}
