:root {
  color-scheme: light;
  --ink: #1d1d1f;
  --ink-soft: #3a3a3c;
  --muted: #6e6e73;
  --muted-light: #8e8e93;
  --canvas: #f5f5f7;
  --card: rgba(255, 255, 255, .88);
  --card-solid: #ffffff;
  --line: rgba(29, 29, 31, .09);
  --line-strong: rgba(29, 29, 31, .16);
  --accent: #008f67;
  --accent-deep: #006b50;
  --accent-bright: #00a86b;
  --accent-cyan: #00a0a8;
  --accent-soft: #e8f7f0;
  --warning: #a46100;
  --warning-soft: #fff3dd;
  --danger: #c73b32;
  --danger-soft: #fff0ed;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .03), 0 8px 24px rgba(0, 0, 0, .04);
  --shadow-md: 0 18px 50px rgba(0, 33, 24, .09);
  --glass: rgba(255, 255, 255, .78);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -10%, rgba(0, 168, 107, .08), transparent 28rem),
    var(--canvas);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, textarea, input, select { font: inherit; }
button { min-height: 44px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button, textarea, input, select { transition: border-color .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease; }
button:active:not(:disabled) { transform: scale(.98); }
button:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(0, 168, 107, .28); outline-offset: 2px; }
.hidden { display: none !important; }

.shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) 360px; }
.workspace { max-width: 1040px; width: 100%; justify-self: end; padding: 18px 56px 132px; }
body:not(.session-active) .shell { grid-template-columns: minmax(0, 1fr); }
body:not(.session-active) .workspace { max-width: 1120px; justify-self: center; }
body:not(.session-active) .brief-panel { display: none; }

.topbar {
  position: sticky;
  top: 12px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 58px;
  padding: 7px 9px 7px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--glass);
  box-shadow: var(--shadow-sm);
  backdrop-filter: saturate(170%) blur(24px);
  -webkit-backdrop-filter: saturate(170%) blur(24px);
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-bright) 0 49%, var(--accent-cyan) 50% 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28);
}
.brand-mark::after { content: ""; position: absolute; inset: 8px 7px; border-bottom: 2px solid rgba(255, 255, 255, .94); transform: rotate(-35deg); }
.brand-copy { display: flex; align-items: baseline; gap: 7px; letter-spacing: -.02em; }
.brand-copy strong { font-size: 15px; font-weight: 800; }
.brand-copy span { color: var(--muted); font-size: 14px; font-weight: 600; }
.connection { padding: 8px 11px; border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 600; background: rgba(118, 118, 128, .09); white-space: nowrap; }
.connection.online { color: var(--accent-deep); background: var(--accent-soft); }
.connection.warning { color: var(--warning); background: var(--warning-soft); }
.connection.offline { color: var(--danger); background: var(--danger-soft); }
.quiet-button { min-height: 42px; padding: 8px 10px; border: 0; border-radius: 11px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 600; }
.quiet-button:hover { color: var(--ink); background: rgba(118, 118, 128, .08); }

.generation-panel {
  position: sticky;
  top: 84px;
  z-index: 7;
  margin: 14px 0 4px;
  padding: 17px 18px 15px;
  border: 1px solid rgba(0, 143, 103, .16);
  border-radius: 18px;
  background: rgba(240, 252, 247, .9);
  box-shadow: 0 14px 36px rgba(0, 89, 65, .1);
  backdrop-filter: saturate(160%) blur(24px);
  -webkit-backdrop-filter: saturate(160%) blur(24px);
}
.generation-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.generation-head .eyebrow { margin-bottom: 5px; font-size: 9px; }
.generation-head h2 { margin: 0; font-size: 19px; line-height: 1.15; }
.generation-head strong { color: var(--accent-deep); font-size: 13px; font-variant-numeric: tabular-nums; }
.generation-progress { height: 6px; margin-top: 13px; overflow: hidden; border-radius: 999px; background: rgba(0, 107, 80, .1); }
.generation-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-bright), var(--accent-cyan)); transition: width .45s ease; }
.generation-message { margin: 9px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.generation-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.generation-steps li { position: relative; padding-left: 14px; color: var(--muted-light); font-size: 9px; font-weight: 650; white-space: nowrap; }
.generation-steps li::before { content: ""; position: absolute; left: 0; top: .17em; width: 8px; height: 8px; border-radius: 50%; background: rgba(118, 118, 128, .22); }
.generation-steps li.active { color: var(--accent-deep); }
.generation-steps li.active::before { background: var(--accent-bright); box-shadow: 0 0 0 4px rgba(0, 168, 107, .12); animation: generation-pulse 1.3s ease-in-out infinite; }
.generation-steps li.done { color: var(--ink-soft); }
.generation-steps li.done::before { background: var(--accent); }
@keyframes generation-pulse { 50% { box-shadow: 0 0 0 7px rgba(0, 168, 107, .04); } }

.welcome { max-width: 800px; padding: 112px 0 28px; }
.eyebrow { margin: 0 0 12px; color: var(--accent); text-transform: uppercase; letter-spacing: .13em; font-size: 11px; font-weight: 750; }
h1, h2, h3 { letter-spacing: -.038em; }
.welcome h1 { max-width: 780px; margin: 0; font-size: clamp(48px, 6vw, 76px); font-weight: 730; line-height: .98; text-wrap: balance; }
.welcome-copy { max-width: 620px; margin: 28px 0 38px; color: var(--muted); font-size: 18px; line-height: 1.55; letter-spacing: -.012em; }
.topic-form { padding: 22px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: var(--shadow-md); backdrop-filter: blur(24px); }
.topic-form label { display: block; margin: 0 2px 10px; font-size: 13px; font-weight: 700; }
textarea, input, select { width: 100%; border: 1px solid transparent; border-radius: 14px; padding: 14px 15px; color: var(--ink); background: rgba(118, 118, 128, .07); outline: none; line-height: 1.5; }
textarea { resize: vertical; }
textarea::placeholder, input::placeholder { color: var(--muted-light); }
textarea:focus, input:focus, select:focus { border-color: rgba(0, 143, 103, .48); background: #fff; box-shadow: 0 0 0 4px rgba(0, 168, 107, .1); }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; padding: 11px 18px; border: 0; border-radius: 13px; color: #fff; background: var(--accent); box-shadow: 0 8px 20px rgba(0, 143, 103, .2); font-weight: 700; }
.primary-button:hover { background: var(--accent-deep); }
.hint { margin: 15px 2px 0; color: var(--muted-light); font-size: 11px; line-height: 1.5; }

.brief-panel { position: sticky; top: 0; align-self: start; max-height: 100vh; overflow: auto; padding: 34px 28px 56px; border-left: 1px solid var(--line); background: rgba(255, 255, 255, .7); backdrop-filter: saturate(160%) blur(26px); -webkit-backdrop-filter: saturate(160%) blur(26px); }
.brief-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.brief-header h2 { margin: 0; font-size: 23px; line-height: 1.1; }
.readiness { min-width: 48px; padding: 7px 9px; color: var(--accent-deep); border-radius: 999px; background: var(--accent-soft); font-weight: 750; font-size: 11px; text-align: center; }
.progress { height: 5px; margin: 22px 0 17px; overflow: hidden; border-radius: 999px; background: rgba(118, 118, 128, .12); }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-bright), var(--accent-cyan)); transition: width .35s ease; }
.brief-fields { display: grid; gap: 0; }
.brief-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.brief-row dt { margin-bottom: 6px; color: var(--muted-light); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .1em; }
.brief-row dd { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.48; overflow-wrap: anywhere; }
.brief-note { margin: 18px 0 0; color: var(--muted-light); font-size: 11px; line-height: 1.5; }
.edit-brief { width: 100%; margin-top: 18px; }
.coverage-panel { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.coverage-fields { display: grid; gap: 10px; }
.coverage-card { padding: 12px 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(118, 118, 128, .04); }
.coverage-card > div:first-child { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; }
.coverage-card > div:first-child span { color: var(--warning); font-weight: 750; }
.coverage-card.complete > div:first-child span { color: var(--accent); }
.coverage-progress { height: 4px; margin-top: 9px; overflow: hidden; border-radius: 999px; background: rgba(118, 118, 128, .12); }
.coverage-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-bright), var(--accent-cyan)); }
.coverage-card p { margin: 8px 0 0; color: var(--muted-light); font-size: 10px; line-height: 1.45; }

.interview { padding-top: 40px; }
.view-tabs { position: sticky; top: 84px; z-index: 7; display: flex; gap: 3px; width: fit-content; margin-bottom: 32px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: rgba(232, 232, 237, .78); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.view-tab { min-height: 38px; padding: 8px 15px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
.view-tab:hover:not(:disabled) { color: var(--ink); }
.view-tab.active { color: var(--ink); background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .09); }
.view-tab:disabled { color: rgba(110, 110, 115, .48); background: transparent; opacity: .55; cursor: not-allowed; }
.tab-badge { margin-left: 5px; padding: 2px 5px; border-radius: 999px; color: var(--accent-deep); background: var(--accent-soft); font-size: 9px; }
.conversation-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.conversation-head h1 { max-width: 640px; margin: 0; font-size: clamp(36px, 5vw, 54px); font-weight: 720; line-height: 1.03; text-wrap: balance; }
.outline-button { flex: none; min-height: 44px; padding: 9px 14px; border: 1px solid var(--line-strong); border-radius: 12px; color: var(--ink-soft); background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, .03); font-size: 12px; font-weight: 700; }
.outline-button:hover { color: var(--accent-deep); border-color: rgba(0, 143, 103, .28); background: var(--accent-soft); }
.outline-button:disabled, .send-button:disabled, .record-button:disabled, .primary-button:disabled, .quiet-button:disabled { opacity: .5; cursor: not-allowed; }
.messages { display: grid; gap: 15px; margin: 36px 0 24px; }
.message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: start; max-width: 790px; }
.message.user { grid-template-columns: minmax(0, 1fr) 34px; justify-self: end; }
.message.user .avatar { grid-column: 2; color: var(--accent-deep); background: var(--accent-soft); }
.message.user p { grid-column: 1; grid-row: 1; color: #fff; background: var(--accent); border-radius: 18px 5px 18px 18px; box-shadow: 0 7px 18px rgba(0, 143, 103, .13); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--accent-bright), var(--accent-cyan)); font-size: 10px; font-weight: 750; }
.message p { margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 5px 18px 18px 18px; background: var(--card-solid); box-shadow: 0 4px 14px rgba(0, 0, 0, .035); white-space: pre-wrap; line-height: 1.55; font-size: 14px; }
.thinking-indicator { --thinking-color: var(--accent); display: flex; align-items: center; gap: 11px; width: fit-content; max-width: min(580px, calc(100% - 44px)); margin: -7px 0 17px 44px; padding: 11px 14px; border: 1px solid rgba(0, 143, 103, .14); border-radius: 14px; color: var(--ink-soft); background: rgba(232, 247, 240, .78); box-shadow: 0 7px 22px rgba(0, 89, 65, .06); }
.thinking-indicator.whisper { --thinking-color: var(--accent-cyan); background: rgba(230, 248, 249, .84); }
.thinking-dots { display: inline-flex; align-items: center; gap: 3px; min-width: 34px; height: 28px; padding: 0 7px; border-radius: 10px; background: rgba(255, 255, 255, .72); }
.thinking-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--thinking-color); animation: thinking-hop 1.05s ease-in-out infinite; }
.thinking-dots i:nth-child(2) { animation-delay: .14s; }
.thinking-dots i:nth-child(3) { animation-delay: .28s; }
.thinking-copy { display: grid; gap: 2px; }
.thinking-copy strong { font-size: 11px; line-height: 1.25; }
.thinking-copy > span { color: var(--muted); font-size: 10px; line-height: 1.35; }
.composer { position: sticky; bottom: 78px; z-index: 6; display: grid; grid-template-columns: 46px minmax(0, 1fr) 46px; align-items: end; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 22px; background: rgba(255, 255, 255, .9); box-shadow: var(--shadow-md); backdrop-filter: saturate(170%) blur(24px); -webkit-backdrop-filter: saturate(170%) blur(24px); }
.composer:focus-within { border-color: rgba(0, 143, 103, .32); box-shadow: 0 18px 52px rgba(0, 89, 65, .12), 0 0 0 4px rgba(0, 168, 107, .07); }
.composer.processing { border-color: rgba(0, 143, 103, .18); }
.answer-field { display: flex; min-width: 0; flex-direction: column; gap: 2px; padding: 3px 0; }
.answer-field span { display: block; padding: 0 10px; color: var(--muted-light); font-size: 10px; font-weight: 700; line-height: 1.25; }
.composer textarea { min-height: 48px; max-height: 190px; overflow-y: hidden; resize: none; border: 0; border-radius: 10px; padding: 7px 10px 5px; box-shadow: none !important; background: transparent; line-height: 1.5; }
.composer textarea:disabled { color: var(--ink-soft); -webkit-text-fill-color: var(--ink-soft); opacity: 1; }
.send-button, .record-button { align-self: end; width: 44px; height: 44px; border: 0; border-radius: 13px; color: white; font-size: 20px; }
.send-button { background: var(--accent); box-shadow: 0 7px 16px rgba(0, 143, 103, .2); }
.send-button:hover { background: var(--accent-deep); }
.record-button { background: var(--danger); font-size: 24px; line-height: 1; box-shadow: 0 7px 16px rgba(199, 59, 50, .16); }
.record-button.recording { animation: pulse 1.1s ease-in-out infinite; background: #e5484d; }
.record-button.transcribing:disabled { position: relative; color: transparent; opacity: 1; cursor: progress; background: var(--accent-cyan); }
.record-button.transcribing::after { content: ""; position: absolute; inset: 12px; border: 2px solid rgba(255, 255, 255, .38); border-top-color: #fff; border-radius: 50%; animation: thinking-spin .78s linear infinite; }
.voice-meta { display: flex; justify-content: space-between; gap: 12px; min-height: 28px; padding: 8px 5px 0; }
.voice-status { margin: 0; color: var(--muted-light); font-size: 11px; line-height: 1.45; }
.recording-time { color: var(--danger); font-variant-numeric: tabular-nums; font-size: 11px; font-weight: 700; }
.error-text { color: var(--danger); }
.error { padding: 11px 13px; color: var(--danger); border: 1px solid rgba(199, 59, 50, .13); border-radius: 13px; background: var(--danger-soft); font-size: 12px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(229, 72, 77, .16); transform: scale(1.03); } }
@keyframes thinking-hop { 0%, 60%, 100% { transform: translateY(0); opacity: .38; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes thinking-spin { to { transform: rotate(360deg); } }
.thinking-button:disabled { cursor: progress; opacity: .82; }
.thinking-button::before { content: ""; width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: thinking-spin .78s linear infinite; }

.script { padding: 4px 0 32px; }
.plan-view { padding: 4px 0 48px; }
.plan-title { max-width: 820px; }
.plan-title > div, .article-title-line { display: flex; align-items: flex-start; gap: 14px; }
.plan-title h2 { margin: 0; font-size: clamp(40px, 5vw, 60px); font-weight: 730; line-height: 1.02; text-wrap: balance; }
.plan-title > p:last-child { max-width: 720px; color: var(--muted); font-size: 17px; line-height: 1.6; }
.workflow-pill, .priority-pill { flex: none; padding: 6px 9px; border-radius: 999px; color: var(--warning); background: var(--warning-soft); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.workflow-pill.approved, .priority-pill { color: var(--accent-deep); background: var(--accent-soft); }
.workflow-pill.changes { color: var(--danger); background: var(--danger-soft); }
.priority-pill.optional { color: var(--muted); background: rgba(118, 118, 128, .09); }
.plan-actions { display: flex; gap: 9px; margin: 24px 0 30px; }
.plan-actions .primary-button, .review-actions .primary-button { margin-top: 0; }
.plan-list { display: grid; gap: 15px; }
.plan-card { padding: 21px; border: 1px solid var(--line); border-radius: 20px; background: var(--card-solid); box-shadow: var(--shadow-sm); }
.plan-card > header { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 13px; align-items: start; }
.plan-card > header > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--accent-bright), var(--accent-cyan)); font-size: 10px; font-weight: 800; }
.plan-card h3 { margin: 0; font-size: 21px; }
.plan-card header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.plan-card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 20px 0 0 47px; }
.plan-card h4 { margin: 0 0 7px; color: var(--muted-light); font-size: 9px; text-transform: uppercase; letter-spacing: .1em; }
.plan-card ul { margin: 0; padding-left: 17px; color: var(--ink-soft); font-size: 12px; line-height: 1.65; }
.starter-question { margin: 18px 0 0 47px; padding: 14px 16px; border-radius: 14px; background: var(--accent-soft); }
.starter-question span { color: var(--accent); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.starter-question p { margin: 5px 0 0; font-size: 13px; font-weight: 650; line-height: 1.5; }
.script-title { max-width: 800px; }
.script-title h2 { margin: 0 0 16px; font-size: clamp(40px, 5vw, 60px); font-weight: 730; line-height: 1.02; text-wrap: balance; }
.script-title > p:last-child { max-width: 740px; color: var(--muted); font-size: 16px; line-height: 1.55; letter-spacing: -.01em; }
.script-section { margin-top: 34px; }
.script-section h3 { margin: 0 0 8px; color: var(--ink); font-size: 22px; font-weight: 720; }
.purpose { margin: 0 0 14px; color: var(--muted-light); font-size: 12px; line-height: 1.45; }
.section-content { padding: 22px 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--card-solid); box-shadow: var(--shadow-sm); white-space: pre-wrap; line-height: 1.72; }
.source-turns { margin: 8px 4px 0; color: var(--muted-light); font-size: 10px; }
.question-card { padding: 17px 18px; margin: 9px 0; border: 1px solid var(--line); border-radius: 16px; background: var(--card-solid); box-shadow: 0 5px 18px rgba(0, 0, 0, .035); }
.question-card p, .script-section.final p { margin: 0; font-weight: 650; line-height: 1.55; }
.question-card ul, .notes ul, .fact-list { margin: 11px 0 0; padding-left: 19px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.final { padding: 22px 24px; border: 1px solid rgba(0, 143, 103, .12); border-radius: 18px; background: var(--accent-soft); }
.notes, .fact-checks { padding: 20px 22px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 255, 255, .55); }
.fact-list li { margin-bottom: 8px; }
.fact-list a { color: var(--accent-deep); text-decoration-color: rgba(0, 107, 80, .3); text-underline-offset: 3px; }
.fact-status { display: inline-block; min-width: 84px; margin-right: 6px; color: var(--accent); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.fact-status.review { color: var(--warning); }
.export-bar { display: flex; align-items: center; gap: 8px; margin: 26px 0 10px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255, 255, 255, .66); box-shadow: var(--shadow-sm); }
.export-bar div { display: grid; gap: 2px; margin-right: auto; }
.export-bar strong { font-size: 12px; }
.export-bar span { color: var(--muted-light); font-size: 10px; }
.export-bar button, .history-action { min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink-soft); background: #fff; font-size: 11px; font-weight: 700; }
.export-bar button:hover, .history-action:hover { color: var(--accent-deep); border-color: rgba(0, 143, 103, .25); background: var(--accent-soft); }
.danger-action { color: var(--danger); }
.review-workspace { margin-top: 42px; padding: 24px; border: 1px solid rgba(0, 143, 103, .15); border-radius: 22px; background: rgba(232, 247, 240, .52); }
.review-head { display: flex; justify-content: space-between; gap: 20px; }
.review-head h3 { margin: 0; font-size: 24px; }
.review-head > p { margin: 0; color: var(--accent-deep); font-size: 11px; }
.review-form { display: grid; grid-template-columns: minmax(160px, .35fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; margin-top: 20px; }
.review-form label, .plan-main-fields label, .plan-edit-grid label { display: grid; gap: 7px; color: var(--ink-soft); font-size: 10px; font-weight: 750; }
.review-form textarea, .review-form select { background: rgba(255, 255, 255, .8); }
.review-comments { display: grid; gap: 8px; margin-top: 18px; }
.review-comment { padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .72); }
.review-comment > div { display: flex; justify-content: space-between; gap: 12px; }
.review-comment span { color: var(--accent); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.review-comment.open span { color: var(--danger); }
.review-comment p { margin: 6px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.empty-review { margin: 16px 0 0; color: var(--muted-light); font-size: 11px; }
.review-actions { display: flex; justify-content: flex-end; margin-top: 18px; }

.sticky-actions { position: fixed; left: 50%; bottom: 16px; z-index: 12; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; min-width: min(520px, calc(100vw - 28px)); padding: 9px 10px 9px 17px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 18px; background: rgba(29, 29, 31, .9); box-shadow: 0 18px 50px rgba(0, 0, 0, .24); color: white; backdrop-filter: saturate(160%) blur(24px); -webkit-backdrop-filter: saturate(160%) blur(24px); }
.sticky-actions span { margin-right: auto; font-size: 12px; font-weight: 600; }
.sticky-actions button { padding: 9px 14px; border: 0; border-radius: 12px; color: #fff; background: var(--accent); font-size: 12px; font-weight: 750; }

.history-dialog, .brief-dialog, .plan-dialog { width: min(1040px, calc(100vw - 36px)); max-height: calc(100vh - 36px); padding: 0; border: 1px solid rgba(255, 255, 255, .4); border-radius: 24px; color: var(--ink); background: rgba(255, 255, 255, .94); box-shadow: 0 28px 90px rgba(0, 0, 0, .23); backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px); }
.brief-dialog { width: min(760px, calc(100vw - 36px)); }
.plan-dialog { width: min(900px, calc(100vw - 36px)); }
.history-dialog::backdrop, .brief-dialog::backdrop, .plan-dialog::backdrop { background: rgba(0, 0, 0, .34); backdrop-filter: blur(8px); }
.history-shell, .brief-form, .plan-form { padding: 28px; }
.history-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.history-head h2 { margin: 0; font-size: 30px; line-height: 1.08; }
.icon-button { width: 44px; height: 44px; border: 0; border-radius: 50%; color: var(--muted); background: rgba(118, 118, 128, .1); font-size: 24px; line-height: 1; }
.icon-button:hover { color: var(--ink); background: rgba(118, 118, 128, .16); }
.history-help { max-width: 760px; margin: 12px 0 22px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.history-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 22px; }
.history-column-title { margin: 0 0 10px; color: var(--muted-light); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.history-list, .version-list { display: grid; align-content: start; gap: 9px; max-height: min(58vh, 580px); overflow: auto; padding-right: 4px; }
.history-card, .version-card { padding: 14px 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(118, 118, 128, .045); }
.history-card.selected { border-color: rgba(0, 143, 103, .32); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(0, 168, 107, .08); }
.history-card > strong { display: block; line-height: 1.35; }
.history-card p, .version-card p { margin: 6px 0 10px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.history-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.version-card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.version-card-title span { color: var(--accent); font-size: 10px; font-weight: 700; }
.empty-state { margin: 0; padding: 20px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 15px; font-size: 12px; text-align: center; }
.brief-edit-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 20px; }
.brief-edit-field { display: grid; gap: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.brief-edit-field.wide { grid-column: 1 / -1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.plan-main-fields { display: grid; gap: 13px; margin-top: 20px; }
.plan-editor-head, .plan-edit-card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.plan-editor-head { margin: 24px 0 10px; }
.plan-editor-head h3 { margin: 0; font-size: 17px; }
.plan-edit-sections { display: grid; gap: 12px; max-height: 48vh; overflow: auto; padding-right: 4px; }
.plan-edit-card { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(118, 118, 128, .04); }
.plan-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.plan-edit-grid .wide { grid-column: 1 / -1; }

body[data-view="script"] .interview .conversation-head,
body[data-view="script"] .interview .messages,
body[data-view="script"] .interview .thinking-indicator,
body[data-view="script"] .interview .composer,
body[data-view="script"] .interview .voice-meta { display: none; }
body[data-view="plan"] .interview .conversation-head,
body[data-view="plan"] .interview .messages,
body[data-view="plan"] .interview .thinking-indicator,
body[data-view="plan"] .interview .composer,
body[data-view="plan"] .interview .voice-meta { display: none; }
body[data-view="brief"] .shell { grid-template-columns: minmax(0, 1fr); }
body[data-view="brief"] .workspace { justify-self: center; padding-bottom: 12px; }
body[data-view="brief"] .interview .conversation-head,
body[data-view="brief"] .interview .messages,
body[data-view="brief"] .interview .thinking-indicator,
body[data-view="brief"] .interview .composer,
body[data-view="brief"] .interview .voice-meta { display: none; }
body[data-view="brief"] .brief-panel { position: static; justify-self: center; width: min(836px, calc(100% - 104px)); max-height: none; margin-bottom: 100px; padding: 30px 34px; border: 1px solid var(--line); border-radius: 22px; background: rgba(255, 255, 255, .72); box-shadow: var(--shadow-sm); }
body[data-view="brief"] .brief-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 30px; }
body[data-view="conversation"] .script,
body[data-view="brief"] .script,
body[data-view="plan"] .script { display: none !important; }
body[data-view="conversation"] .plan-view,
body[data-view="brief"] .plan-view,
body[data-view="script"] .plan-view { display: none !important; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .workspace { max-width: none; justify-self: stretch; padding: 14px 24px 124px; }
  .brief-panel { position: static; order: 0; max-height: none; padding: 24px 24px 96px; border: 0; border-top: 1px solid var(--line); background: rgba(255, 255, 255, .68); }
  .brief-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 22px; }
  .brief-note { display: none; }
  .welcome { padding-top: 82px; }
  body.session-active:not([data-view="brief"]) .brief-panel { display: none; }
  body[data-view="brief"] .workspace { padding-bottom: 0; }
  body[data-view="brief"] .workspace .topbar,
  body[data-view="brief"] .workspace .conversation-head,
  body[data-view="brief"] .workspace .messages,
  body[data-view="brief"] .workspace .thinking-indicator,
  body[data-view="brief"] .workspace .composer,
  body[data-view="brief"] .workspace .voice-meta { display: none; }
  body[data-view="brief"] .interview { display: block !important; padding-bottom: 0; }
  body[data-view="brief"] .brief-panel { width: calc(100% - 48px); min-height: 0; margin-bottom: 80px; }
}

@media (max-width: 720px) {
  .history-layout { grid-template-columns: 1fr; }
  .history-list, .version-list { max-height: 34vh; }
  .export-bar { align-items: stretch; flex-wrap: wrap; }
  .export-bar div { width: 100%; }
  .export-bar button { flex: 1; }
  .review-form { grid-template-columns: 1fr; }
  .plan-card-grid { grid-template-columns: 1fr; gap: 14px; }
}

@media (max-width: 600px) {
  .workspace { padding: 8px 12px 116px; }
  .topbar { top: 6px; flex-wrap: wrap; gap: 3px; min-height: 54px; padding: 6px 7px 6px 9px; border-radius: 16px; }
  .brand { margin-right: auto; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-copy strong { font-size: 14px; }
  .brand-copy span { display: none; }
  .connection { order: 3; width: 100%; padding: 7px 9px; text-align: center; }
  .generation-panel { top: 116px; margin-top: 8px; padding: 15px; }
  .generation-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 10px; }
  .quiet-button { min-height: 38px; padding: 7px 8px; font-size: 11px; }
  .welcome { padding: 68px 2px 24px; }
  .welcome h1 { font-size: 44px; line-height: 1; }
  .welcome-copy { margin: 22px 0 28px; font-size: 16px; }
  .topic-form { padding: 16px; border-radius: 20px; }
  .primary-button { width: 100%; }
  .interview { padding-top: 28px; }
  .view-tabs { top: 116px; width: 100%; margin-bottom: 26px; }
  .view-tab { flex: 1; padding-inline: 7px; }
  body[data-view="brief"] .brief-panel { width: calc(100% - 24px); padding: 22px 18px; }
  body[data-view="brief"] .brief-fields { grid-template-columns: 1fr; }
  .conversation-head { display: block; }
  .conversation-head .outline-button { display: none; }
  .conversation-head h1 { font-size: 40px; }
  .messages { margin-top: 28px; }
  .message { grid-template-columns: 30px minmax(0, 1fr); gap: 8px; }
  .message.user { grid-template-columns: minmax(0, 1fr) 30px; }
  .avatar { width: 30px; height: 30px; border-radius: 9px; }
  .message p { padding: 12px 14px; }
  .composer { bottom: 72px; grid-template-columns: 44px minmax(0, 1fr) 44px; border-radius: 18px; }
  .thinking-indicator { max-width: calc(100% - 38px); margin-left: 38px; }
  .script-title h2 { font-size: 42px; }
  .plan-title h2 { font-size: 40px; }
  .plan-title > div, .article-title-line { display: grid; }
  .plan-actions { display: grid; }
  .plan-actions .primary-button { width: 100%; }
  .plan-card { padding: 17px; }
  .plan-card > header { grid-template-columns: 30px minmax(0, 1fr); }
  .plan-card .priority-pill { grid-column: 2; justify-self: start; }
  .plan-card-grid, .starter-question { margin-left: 0; }
  .section-content { padding: 18px; }
  .history-dialog, .brief-dialog, .plan-dialog { width: calc(100vw - 12px); max-height: calc(100vh - 12px); border-radius: 20px; }
  .history-shell, .brief-form, .plan-form { padding: 19px; }
  .brief-edit-fields { grid-template-columns: 1fr; }
  .brief-edit-field.wide { grid-column: auto; }
  .plan-edit-grid { grid-template-columns: 1fr; }
  .plan-edit-grid .wide { grid-column: auto; }
  .review-workspace { padding: 18px; }
  .review-head { display: block; }
  .review-actions .primary-button { width: 100%; }
  .sticky-actions { bottom: max(8px, env(safe-area-inset-bottom)); border-radius: 16px; }
  .sticky-actions span { max-width: 150px; }
}

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