/* Erfinderchat · quiet workspace. All assets are served locally; no remote fonts. */
:root {
  color-scheme: light;
  font-family: Arial, Helvetica, ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: #2b2927;
  background: #8593a5;
  --ink: #292624;
  --muted: #79736d;
  --line: #e9e5e1;
  --surface: #ffffff;
  --soft: #f7f5f3;
  --sidebar: #fcfbfa;
  --green: #34302d; /* Existing semantic action token; now the neutral brand color. */
  --serif: Georgia, "Times New Roman", serif;
  --focus: #707f95;
  --shadow: 0 3px 7px #28211a05, 0 14px 30px #28211a09;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 300px;
  padding: 12px;
  background: radial-gradient(ellipse at 0% 5%, #658bb2 0, transparent 55%),
              radial-gradient(ellipse at 95% 100%, #b5bbb9 0, transparent 65%),
              linear-gradient(120deg, #8b9aab, #a6a8b3);
  min-height: 100vh;
  min-height: 100dvh;
}
button, input, textarea, select { font: inherit; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid #e4e0dc;
  border-radius: 7px;
  padding: 7px 11px;
  color: var(--ink);
  background: linear-gradient(#fff, #faf9f8);
  box-shadow: 0 1px 2px #231b1305;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.4;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
button:hover, .button:hover { background: #f2efeb; border-color: #d4cec7; }
button:active:not(:disabled), .button:active { background: #eae6e1; }
button:disabled { opacity: .43; cursor: not-allowed; box-shadow: none; }
button:disabled:hover { border-color: #e4e0dc; }
.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.primary:hover { background: #47413b; border-color: #47413b; }
.primary:active:not(:disabled) { background: #171513; }
.secondary { background: #f5f2ee; }
.quiet, .icon-button, .nav-link { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.quiet:hover, .icon-button:hover, .nav-link:hover { color: var(--ink); background: #f2efec; border-color: transparent; }
.quiet { font-size: 12px; padding: 6px 8px; }
.icon-button { width: 32px; height: 32px; min-height: 32px; padding: 7px; flex: 0 0 auto; }
.icon { width: 16px; height: 16px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
input, textarea, select {
  width: 100%; min-width: 0; padding: 10px 12px;
  color: var(--ink); background: #fff;
  border: 1px solid #ddd8d2; border-radius: 7px;
}
input::placeholder, textarea::placeholder { color: #938b83; opacity: 1; }
input:focus, textarea:focus, select:focus, button:focus-visible,
a:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 3px;
}
#work-area:focus { outline: none; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 12px; }
form { display: grid; gap: 10px; }
p { margin: 0 0 12px; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.3; font-weight: 500; letter-spacing: -.02em; }
h1 { font-size: 30px; }
h2 { font-size: 24px; }
h3 { font-size: 17px; }
a { color: var(--green); }
summary { cursor: pointer; color: #4e4740; font-weight: 500; }
summary::marker { color: #9a9188; }
details { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
details p { padding-top: 10px; }
kbd { font: 10px/1.4 Arial, sans-serif; color: #968b7e; border: 1px solid #eae4dc; border-radius: 4px; padding: 1px 4px; white-space: nowrap; }
.muted { color: var(--muted); font-size: 12px; }
.fineprint { color: var(--muted); font-size: 12px; line-height: 1.7; padding: 0 26px 20px; margin: 0; }
.eyebrow { font-size: 10px; letter-spacing: .13em; font-weight: 500; color: #92877b; margin-bottom: 14px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 4px; left: 25px; transform: translateY(-150%); z-index: 100; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 7px; }
.skip-link:focus { transform: none; }

/* Two framed surfaces, matching the compact navigation and open canvas of the reference. */
.app-shell { padding: 10px; border-radius: 14px; background: #f8f7f6; box-shadow: 0 18px 60px #32425814; }
#workspace:not([hidden]) { display: grid; grid-template-columns: 200px minmax(0,1fr); gap: 10px; height: calc(100dvh - 44px); min-height: 340px; }
.sidebar, .work-area { border: 1px solid var(--line); border-radius: 13px; }
.sidebar { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--sidebar); padding: 10px 7px 0; }
.sidebar-brand { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 0 5px 12px; min-height: 41px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: #272326; text-decoration: none; font-size: 17px; letter-spacing: -.7px; }
.brand .icon { width: 24px; height: 24px; stroke-width: 1.8; }
.brand-label { font-size: 16px; }
.sidebar-brand .icon-button { width: 26px; height: 26px; min-height: 26px; padding: 6px; color: #8f8983; }
.sidebar-brand .icon-button .icon { width: 13px; height: 13px; }
.workspace-tabs { display: grid; gap: 4px; }
.workspace-tabs button { justify-content: flex-start; border: 1px solid transparent; border-radius: 7px; box-shadow: none; background: transparent; min-height: 33px; padding: 7px 10px; font-size: 12px; color: #675f59; gap: 10px; }
.workspace-tabs button .icon { width: 14px; height: 14px; color: #928a81; }
.workspace-tabs button:hover { background: #f5f2ef; }
.workspace-tabs button[aria-selected="true"] { background: #f0edeb; color: #25211e; border-color: #f0edeb; }
.workspace-tabs button[aria-selected="true"] .icon { color: #423a33; }
#document-count { font-size: 10px; line-height: 1.5; color: #7b7168; background: #eae5df; border-radius: 5px; padding: 0 5px; margin-left: auto; }
#document-count:empty { display: none; }
.sidebar-section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 25px 6px 8px; border-top: 1px solid var(--line); padding-top: 16px; }
.sidebar-heading { margin: 0; font-family: inherit; font-size: 10px; font-weight: 400; color: #95897d; letter-spacing: .02em; }
.sidebar-section-title .icon-button { width: 24px; height: 24px; min-height: 24px; padding: 5px; }
.sidebar #case-list { display: grid; align-content: start; gap: 6px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 0 1px 12px; }
.case-group { display: grid; gap: 1px; min-width: 0; }
.case-link, .case-documents { border-color: transparent; box-shadow: none; background: transparent; text-align: left; justify-content: flex-start; white-space: normal; }
.case-link { display: flex; width: 100%; font-size: 12px; line-height: 1.5; padding: 8px 9px; gap: 9px; overflow-wrap: anywhere; }
.case-link::before { content: ""; width: 6px; height: 6px; border: 1px solid #bcb3a8; border-radius: 50%; flex: 0 0 auto; }
.case-link.active { background: #f6f3ef; border-color: #ede8e2; }
.case-link.active::before { background: #9b8976; border-color: #9b8976; }
.case-documents { font-size: 11px; color: #8b8075; min-height: 27px; margin-left: 20px; border-left: 1px solid #ded6ce; border-radius: 0 5px 5px 0; padding: 4px 10px; }
.case-documents.active { color: #37302a; background: #f1ece6; }
.search-empty { padding: 15px 9px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.sidebar-footer { margin-top: auto; padding-top: 12px; }
.nav-link { justify-content: flex-start; width: 100%; font-size: 12px; padding: 8px 11px; gap: 10px; }
.nav-link .icon { width: 14px; height: 14px; }
.account-row { margin: 12px -7px 0; padding: 14px 11px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
.account-avatar { flex: 0 0 auto; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #ede6de; color: #7c6b59; font-size: 11px; font-family: var(--serif); }
.account-info { min-width: 0; flex: 1; }
#identity { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-info small { display: block; font-size: 8px; color: #9b9084; margin-top: 2px; }
#logout { width: 25px; min-height: 28px; padding: 6px; }
#logout .icon { width: 13px; height: 13px; }
.work-area { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 65px; padding: 17px 26px; flex: 0 0 auto; }
.heading-group { display: flex; align-items: center; gap: 9px; min-width: 0; }
.page-heading { display: flex; align-items: baseline; gap: 11px; min-width: 0; color: #a3978a; }
.page-heading h1 { font-size: 11px; font-family: inherit; font-weight: 400; letter-spacing: 0; margin: 0; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #93897f; }
#cases-toggle { display: none; }
#mobile-navigation:empty { display: none; }
.workspace-body { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; min-height: 0; flex: 1; padding: 0 36px 0; display: flex; flex-direction: column; }
#case-content { flex: 1; min-width: 0; }
.pane-tools { display: flex; justify-content: flex-end; max-width: 1010px; margin: 14px auto 14px; }
.pane-tools button { font-size: 12px; }
#workspace.sidebar-collapsed { grid-template-columns: 61px minmax(0,1fr); }
.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 3px 0 20px; }
.sidebar-collapsed .brand-label, .sidebar-collapsed #sidebar-collapse,
.sidebar-collapsed .sidebar-section-title, .sidebar-collapsed #case-list,
.sidebar-collapsed .nav-label, .sidebar-collapsed .account-info,
.sidebar-collapsed .account-avatar, .sidebar-collapsed #document-count { display: none !important; }
.sidebar-collapsed .workspace-tabs button, .sidebar-collapsed .nav-link { justify-content: center; padding: 10px; }
.sidebar-collapsed .account-row { justify-content: center; padding: 12px 0; }
.sidebar-collapsed #cases-toggle { display: inline-flex; }

/* Welcome and composer: one clear starting point, not a dashboard of unrelated cards. */
.interview-pane { display: flex; flex-direction: column; width: 100%; max-width: 740px; margin: 0 auto; min-height: calc(100dvh - 175px); }
.interview-pane.is-empty { max-width: 820px; min-height: 0; }
.conversation { padding: 26px 4px 8px; flex: 1; }
.is-empty .conversation { padding: clamp(26px, 6vh, 64px) 0 0; flex: 0; }
.chat-welcome { text-align: center; padding: 0 0 40px; margin: 0 auto; }
.welcome-greeting { color: #978879; font-family: var(--serif); font-size: 33px; letter-spacing: -.65px; line-height: 1.22; margin: 0 0 1px; }
.chat-welcome h2 { font-family: var(--serif); font-weight: 400; font-size: 33px; letter-spacing: -.75px; line-height: 1.22; margin: 0; color: #25211f; text-wrap: balance; }
.chat-message { max-width: 96%; margin: 0 0 28px; overflow-wrap: anywhere; }
.chat-message > small { display: block; font-size: 10px; margin-bottom: 9px; color: #998b7c; }
.chat-message p { white-space: pre-wrap; font-size: 14px; line-height: 1.8; margin: 0 0 10px; }
.from-inventor { margin-left: auto; max-width: 86%; padding: 16px 20px; border: 1px solid #eee8e1; border-radius: 15px 15px 4px 15px; background: #f7f4f0; }
.from-inventor p:last-child { margin: 0; }
.from-model { max-width: 100%; padding: 6px 12px 12px 4px; }
.from-model > small:first-child { font-size: 11px; color: #8b7866; font-weight: 500; }
.from-model .main-question { font-size: 19px; font-family: var(--serif); line-height: 1.55; margin: 12px 0 15px; color: #34302b; }
.conversation-sources { border: 0; padding: 6px 0; font-size: 11px; }
.conversation-sources summary { color: #928375; font-size: 11px; font-weight: 400; }
.conversation-sources blockquote { margin: 12px 0 5px; padding: 0 13px; border-left: 2px solid #cec1b3; font-size: 12px; color: var(--muted); white-space: pre-wrap; }
.conversation-sources pre { max-height: 460px; overflow: auto; }
.conversation-status { color: var(--muted); font-size: 12px; padding: 8px 3px; margin-bottom: 8px; }
.conversation-status:empty { display: none; }
.conversation-status.has-error { padding: 13px 16px; background: #fcf5e9; border: 1px solid #eee0c7; border-radius: 9px; color: #846033; }
.composer { position: relative; gap: 0; border: 1px solid #e0ddda; outline: 2px solid #f0eeec; border-radius: 17px; padding: 9px 12px 11px; background: #fdfcfb; box-shadow: 0 3px 3px #22180e10, 0 16px 26px #22180e13; width: 100%; max-width: 650px; margin: 4px auto 0; }
.composer:focus-within { border-color: #beb1a4; outline-color: #ece6df; box-shadow: 0 3px 4px #22180e0b, 0 16px 30px #22180e13; }
.composer > textarea { border: 0; outline: none; resize: none; min-height: 64px; max-height: 260px; border-radius: 0; padding: 5px 1px 12px; font-size: 13px; line-height: 1.7; background: transparent; }
.composer > textarea:focus { outline: none; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.composer-tool, .composer-options > summary { min-height: 29px; font-size: 11px; padding: 5px 8px; border-radius: 6px; gap: 6px; }
.composer-tool .icon { width: 13px; height: 13px; color: #93887b; }
.composer-options { border: 0; padding: 0; }
.composer-options > summary { position: absolute; bottom: 11px; left: 142px; display: inline-flex; align-items: center; color: #655b51; font-weight: 400; border: 1px solid transparent; }
.composer-options > summary:hover { background: #f1ece6; }
.composer-options[open] > summary { background: #efebe5; border-color: #e7dfd5; }
.composer-options > summary::marker, .composer-options > summary::-webkit-details-marker { display: none; content: ""; }
.composer-options > summary .icon { width: 13px; height: 13px; color: #8e8173; }
.options-label-short { display: none; }
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 3px 0 15px; padding: 17px 4px 13px; border-top: 1px solid var(--line); }
.option-grid label { color: #7a6c5c; font-size: 11px; margin-bottom: 6px; }
.option-grid select, .option-grid input { font-size: 12px; padding: 9px; }
.send-button { width: 30px; height: 30px; min-height: 30px; flex: 0 0 auto; padding: 0; font-size: 22px; font-family: Arial, sans-serif; font-weight: 400; border-radius: 7px; box-shadow: inset 0 1px 1px #ffffff30, 0 2px 3px #332c251a; }
.send-button[data-state="busy"] { font-size: 0; }
.send-button[data-state="busy"]::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid #ffffff60; border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.composer-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; width: 100%; max-width: 650px; margin: 16px auto 0; }
.dialogue-controls { display: flex; flex-wrap: wrap; gap: 5px; }
.dialogue-controls:has(button:not([hidden])) { flex: 1; }
.dialogue-controls .quiet { min-height: 26px; font-size: 11px; color: #8e8070; padding: 3px 0; white-space: normal; text-align: left; }
.dialogue-controls .quiet:hover { color: #4c3e31; background: transparent; text-decoration: underline; text-underline-offset: 3px; }
#composer-note { color: #837566; font-size: 10px; line-height: 1.6; padding: 5px 0 0; text-align: right; max-width: 57%; margin-left: auto; }
.composer-meta:has(+ .conversation-footnote) { padding: 0 2px; }
.conversation-footnote { color: #897b6c; font-size: 11px; text-align: center; margin: 18px auto 20px; max-width: 650px; }
.proposal { border: 1px solid #e5ddd4; padding: 13px 16px; border-radius: 10px; margin: 16px 0; background: #fffdfb; }
.proposal summary { font-size: 12px; }
.proposal > small { display: block; font-size: 10px; color: var(--muted); margin: 12px 0 8px; }
.proposal textarea { font-size: 13px; line-height: 1.7; resize: vertical; min-height: 105px; }
.proposal-actions { display: flex; gap: 8px; margin-top: 13px; flex-wrap: wrap; }
.proposal-actions button { font-size: 11px; white-space: normal; }
.proposal-uncertainty { color: #805c2c; background: #fcf3e3; padding: 9px 12px; border-radius: 5px; font-size: 12px !important; line-height: 1.65 !important; margin-top: 10px !important; }
.superseded { opacity: .62; }

/* Existing source-bound description workflow, now in the same warm-neutral system. */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 13px; }
.working-pane { max-width: 1010px; margin: 0 auto; padding: 30px 34px; }
.narrative-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.narrative-heading h2 { font-family: var(--serif); font-size: 29px; }
.narrative-heading .button { font-size: 11px; }
.narrative-heading { margin-bottom: 18px; }
.revision-picker { display: flex; align-items: center; gap: 12px; margin: 15px 0; flex-wrap: wrap; }
.revision-picker label { margin: 0; font-size: 11px; color: var(--muted); }
.revision-picker select { max-width: 255px; font-size: 12px; padding: 7px 10px; }
.working-text { font-family: inherit; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.narrative-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin: 17px 0; }
.narrative-actions button { font-size: 12px; white-space: normal; }
.narrative-body { max-width: 790px; margin: 32px auto 12px; font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; }
.narrative-title { font-family: var(--serif); font-size: 29px; margin-bottom: 30px; line-height: 1.35; }
.narrative-section { margin: 26px 0; }
.narrative-section h3 { font-family: var(--serif); font-size: 21px; line-height: 1.4; margin-bottom: 16px; }
.narrative-paragraph { margin-bottom: 19px; }
.narrative-paragraph > p { white-space: pre-wrap; }
.narrative-note { border-left: 3px solid #c7b9a6; padding: 9px 14px; background: #f8f5ef; font-size: 12px; line-height: 1.75; white-space: pre-wrap; }
.evidence-note { font-size: 12px; color: #847460; font-style: italic; }
.narrative-empty { padding: 28px 12px 48px; color: var(--muted); max-width: 620px; }
.narrative-details { margin-top: 18px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 0; }
.narrative-details > summary { font-size: 13px; font-weight: 500; }
.narrative-details > div { margin-top: 16px; }
.narrative-job:empty { display: none; }
.narrative-job { font-size: 12px; color: #877052; }
.approved-label { color: #4c715a; font-weight: 600; }
.review-blocker { padding: 10px 13px; background: #faf4e8; border-left: 3px solid #b4863b; font-size: 13px; line-height: 1.65; }
.narrative-approval { max-width: 790px; margin: 24px auto; font-size: 14px; }
.narrative-approval:empty { display: none; }
.narrative-approval .primary { white-space: normal; }
.narrative-edit-block { padding-bottom: 18px; }
.narrative-edit-block textarea { line-height: 1.6; resize: vertical; }
.narrative-paragraph-actions { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.narrative-paragraph-actions .icon-button { width: 40px; height: 40px; min-height: 40px; }

/* PDF interpretation editor. Mirror/textarea metrics must stay identical. */
.description-column { min-width: 0; max-width: 1010px; margin: 0 auto; }
.document-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 auto 16px; max-width: 1010px; }
.document-picker:empty { display: none; }
.document-picker button { min-width: 0; max-width: 100%; text-align: left; white-space: normal; overflow-wrap: anywhere; justify-content: flex-start; padding: 10px 13px; }
.document-picker button small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 3px; }
.document-picker button.active { border-color: #b9a890; box-shadow: inset 0 -2px #b9a890; }
.document-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; padding: 25px 26px 15px; }
.document-heading h2 { font-family: var(--serif); overflow-wrap: anywhere; max-width: 600px; font-size: 27px; }
.document-heading p[role] { font-size: 12px; color: var(--muted); margin: 0; }
.text-link { font-size: 11px; color: #887156; text-decoration: underline; text-underline-offset: 4px; white-space: nowrap; }
.toolbar { display: flex; gap: 5px; flex-wrap: wrap; padding: 11px 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #faf8f5; }
.toolbar button { font-size: 11px; padding: 6px 9px; min-height: 30px; background: #fff; }
.legend { display: flex; align-items: center; gap: 17px; padding: 15px 26px 3px; font-size: 11px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend .muted { font-size: 10px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ded6ce; }
.dot.unclear { background: #d2ad3f; }
.dot.contradiction { background: #c56c5f; }
.editor-wrap { position: relative; margin: 0 6px; min-height: 360px; }
.text-surface { font-family: ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif; font-size: 16px; line-height: 1.85; letter-spacing: 0; word-spacing: 0; tab-size: 4; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; padding: 24px 22px; margin: 0; border: 0; border-radius: 0; width: 100%; min-height: 360px; }
.mirror { position: absolute; inset: 0; pointer-events: none; color: transparent; overflow: hidden; }
.mirror mark { color: transparent; border-radius: 2px; background: #efebe3; }
.mirror mark.unclear { background: #fff0a3; }
.mirror mark.contradiction { background: #ffd2c9; }
#description { position: relative; background: transparent; resize: none; overflow: hidden; display: block; outline-offset: -3px; z-index: 1; }
#description:read-only { opacity: .8; }
.adoptionbar { display: flex; gap: 12px; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding: 19px 26px; }
.adoptionbar p { font-size: 11px; margin: 0; }
.adoptionbar button { font-size: 12px; padding: 12px 15px; }
.notice { padding: 13px 16px; margin: 0 24px 15px; background: #faf5e7; border: 1px solid #ece0bd; border-radius: 7px; font-size: 12px; }
.notice.danger { background: #fff0ec; border-color: #e5b6a9; }
.source-class { display: block; overflow-wrap: anywhere; white-space: normal; font-size: 12px; color: var(--muted); margin: 8px 0; }
.notice.source-class { margin: 0 24px 15px; background: #f6f3ee; border-color: #e8dfd3; }
.document-actions { display: flex; gap: 14px; align-items: center; padding: 0 26px 15px; flex-wrap: wrap; }
.metrics { padding: 16px 26px; border-top: 1px solid var(--line); border-bottom: 0; font-size: 11px; }
.metrics pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; }
.empty { padding: 70px 38px; text-align: center; min-height: 390px; display: flex; flex-direction: column; justify-content: center; }
.empty h2 { font-family: var(--serif); font-size: 31px; }
.empty p { color: var(--muted); max-width: 470px; margin: 0 auto; font-size: 13px; }
#upload-feedback { font-size: 12px; background: #f4f0e9; border: 1px solid #e9e0d4; border-radius: 8px; padding: 12px 16px; margin: 12px auto 18px; max-width: 1010px; overflow-wrap: anywhere; }

/* Dialogs use native modal focus handling; class and processing choices stay explicit. */
.app-dialog, .upload-dialog { width: 560px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 48px); overflow: auto; overscroll-behavior: contain; padding: 28px; border: 1px solid #e5ddd4; border-radius: 16px; color: var(--ink); background: #fffdfb; box-shadow: 0 20px 90px #28211a33; }
.app-dialog::backdrop, .upload-dialog::backdrop { background: #342e2742; backdrop-filter: blur(4px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.dialog-heading h2 { margin: 0; font-family: var(--serif); font-size: 27px; font-weight: 400; text-wrap: balance; }
.dialog-heading .eyebrow { margin: 0 0 9px; font-size: 9px; }
.dialog-heading .quiet { font-size: 24px; line-height: 1; padding: 4px 8px; }
.dialog-description { font-size: 13px; color: var(--muted); margin: 0 0 26px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; margin-top: 13px; }
.dialog-actions button { min-height: 38px; }
.optional { color: var(--muted); font-size: 11px; font-weight: 400; }
.field-hint { font-size: 11px; color: #988977; margin: 0; }
.upload-dialog { width: 590px; }
.upload-dialog form { gap: 12px; }
.upload-dialog .dialog-heading { margin-bottom: 0; }
.upload-dialog label[for="pdf-files"] { font-size: 12px; margin: 2px 0 0; }
.upload-dialog input[type="file"] { max-width: 100%; min-width: 0; font-size: 12px; background: #faf7f3; border: 1px dashed #d5c8b7; padding: 12px; }
.upload-dialog input::file-selector-button { font: inherit; padding: 6px 9px; margin-right: 10px; background: #fff; color: #6d5d48; border: 1px solid #e1d6c7; border-radius: 5px; cursor: pointer; }
.upload-dialog fieldset { border: 0; padding: 0; margin: 9px 0 0; min-width: 0; }
.upload-dialog legend { font-size: 12px; font-weight: 500; margin-bottom: 11px; padding: 0; }
.upload-option { display: flex; align-items: flex-start; gap: 12px; border: 1px solid var(--line); border-radius: 9px; padding: 13px; margin: 0 0 8px; cursor: pointer; font-weight: 400; background: #fff; }
.upload-option:hover { background: #fcf9f5; border-color: #d9cdbd; }
.upload-option:has(input:checked) { border-color: #9a8265; box-shadow: 0 0 0 1px #9a8265; background: #faf6ef; }
.upload-option input { width: 16px; height: 16px; flex-shrink: 0; margin: 2px 0 0; accent-color: #74614b; }
.upload-option strong { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.upload-option small { display: block; color: var(--muted); font-size: 11px; line-height: 1.65; }
.upload-dialog .fineprint { padding: 0; font-size: 11px; }
#upload-status { font-size: 12px; overflow-wrap: anywhere; margin: 0; }
.history-dialog { width: 620px; padding-bottom: 0; }
.history-search { position: relative; margin: 22px 0 12px; }
.history-search > .icon { position: absolute; top: 13px; left: 12px; color: #a0907b; }
.history-search input { padding-left: 38px; background: #faf7f3; font-size: 13px; }
#history-count { margin-bottom: 12px; }
.history-list { max-height: min(420px, 48dvh); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; display: grid; gap: 6px; padding: 4px; margin: 0 -4px; }
.history-item { width: 100%; min-width: 0; text-align: left; justify-content: flex-start; white-space: normal; padding: 13px 12px; background: #fff; border-color: #ede7df; box-shadow: none; gap: 12px; }
.history-item > .icon { color: #a1907c; }
.history-item > span { min-width: 0; flex: 1; }
.history-item strong { display: block; font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.history-item small { display: block; margin-top: 4px; font-size: 11px; color: #998875; }
.history-item[aria-current="page"] { background: #f7f2eb; border-color: #dacebd; }
.history-current { font-size: 10px; color: #9c866a; flex: 0 0 auto !important; }
.history-footer { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding: 14px 28px; margin: 22px -28px 0; font-size: 10px; color: #a19281; }
.help-dialog { width: 580px; }
.help-step { display: flex; align-items: flex-start; gap: 17px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.help-step > span { font-family: var(--serif); font-size: 24px; color: #c0ac91; line-height: 1.3; }
.help-step h3 { font-size: 14px; margin-bottom: 8px; }
.help-step p { color: var(--muted); font-size: 12px; margin: 0; line-height: 1.8; }
.help-shortcuts { display: flex; flex-wrap: wrap; gap: 18px; margin: 20px 0 10px; font-size: 10px; color: var(--muted); }
.help-shortcuts kbd { margin-left: 4px; }
#message { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 100; width: max-content; max-width: min(650px, calc(100vw - 40px)); color: #fffdf9; background: #3f372f; border: 1px solid #766856; border-radius: 10px; box-shadow: 0 6px 35px #22180e30; padding: 14px 19px; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.dialog-message { background: #fff2e6; color: #84512b; border: 1px solid #edcfae; border-radius: 7px; padding: 11px 13px; margin: 14px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.mark-popover { position: fixed; z-index: 30; width: 360px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow: auto; overscroll-behavior: contain; background: #fffdf8; border: 1px solid #d9c680; border-top: 4px solid #d4ac23; border-radius: 10px; padding: 12px 16px 15px; box-shadow: 0 8px 30px #28211a2b; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.mark-popover[data-kind="contradiction"] { border-color: #e1b3ac; border-top-color: #c95d52; }
.mark-popover-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 5px; }
.mark-popover-heading .quiet { font-size: 22px; line-height: 1; padding: 5px 9px; }
.mark-popover p { white-space: pre-wrap; margin: 0 0 10px; }
.mark-popover .muted { font-size: 12px; }
.mark-actions { display: grid; gap: 6px; margin-top: 12px; }
.mark-actions button { font-size: 12px; white-space: normal; justify-content: flex-start; padding: 8px 10px; text-align: left; min-height: 38px; }
.mark-sources { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.mark-sources .working-text { max-height: 240px; overflow: auto; font-size: 12px; }
.mark-sources a { padding: 5px 0; }
.ref-link { display: block; margin: 8px 0; font-size: 12px; }

/* Authentication is part of the same visual language, not a separate generic screen. */
.login-view { min-height: calc(100dvh - 44px); border: 1px solid var(--line); border-radius: 13px; background: #fff; display: flex; flex-direction: column; }
.login-brand { align-self: flex-start; margin: 22px 28px; }
.login-card { width: min(470px, calc(100% - 48px)); margin: auto; padding: 45px 0 70px; }
.login-card h1 { font-family: var(--serif); font-size: 38px; font-weight: 400; line-height: 1.25; letter-spacing: -.8px; }
.login-card h1 > span { color: #a39484; }
.login-intro { color: #948674; font-size: 13px; margin-top: 20px; }
#login-form { gap: 10px; margin: 30px 0 17px; }
#login-form label { margin: 0; color: #665a4c; }
#login-form input { background: #fcfaf7; height: 44px; }
#login-form .primary { height: 43px; margin-top: 4px; justify-content: space-between; padding: 10px 13px; }
#login-help { font-size: 11px; max-width: 420px; color: #998b7a; line-height: 1.8; }
.login-footer { font-size: 10px; color: #b2a593; text-align: center; margin: 0; padding: 20px 24px; }

/* Keep a single live tablist and upload button: shell.js relocates them, never clones. */
@media (min-width: 761px) {
  .is-empty .composer, .is-empty .composer-meta, .is-empty .conversation-footnote { max-width: 550px; }
  .is-empty .composer > textarea { min-height: 46px; padding-bottom: 8px; }
}
@media (min-width: 1600px) {
  #workspace:not([hidden]) { grid-template-columns: 225px minmax(0,1fr); }
  #workspace.sidebar-collapsed { grid-template-columns: 61px minmax(0,1fr); }
  .workspace-body { padding-left: 50px; padding-right: 50px; }
}
@media (max-width: 1120px) and (min-width: 761px) {
  #workspace:not([hidden]) { grid-template-columns: 194px minmax(0,1fr); }
  #workspace.sidebar-collapsed { grid-template-columns: 61px minmax(0,1fr); }
  .brand-label { font-size: 14px; }
  .workspace-body { padding: 0 25px; }
  .topbar { padding-left: 20px; padding-right: 20px; }
  .page-heading h1 { max-width: 165px; }
  .welcome-greeting, .chat-welcome h2 { font-size: 30px; }
  .document-heading { flex-wrap: wrap; gap: 8px; }
  .adoptionbar { flex-wrap: wrap; }
}
@media (max-width: 760px) {
  body { padding: 7px; }
  .app-shell { padding: 6px; border-radius: 12px; }
  #workspace:not([hidden]), #workspace.sidebar-collapsed { display: block; height: calc(100dvh - 26px); }
  .work-area { height: 100%; border-radius: 10px; }
  .sidebar { position: fixed; z-index: 61; left: 13px; top: 13px; bottom: 13px; width: min(280px, calc(100vw - 65px)); padding-top: 14px; background: #fcfbf9; box-shadow: 10px 0 45px #342a1e24; visibility: hidden; transform: translateX(-115%); transition: none; }
  #workspace.show-cases .sidebar { visibility: visible; transform: none; transition: transform .18s; }
  #sidebar-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 60; width: 100%; height: 100dvh; border: 0; border-radius: 0; background: #342e274d; backdrop-filter: blur(3px); cursor: default; }
  #sidebar-collapse { display: inline-flex; }
  #cases-toggle { display: inline-flex; }
  .sidebar-section-title { margin-top: 8px; }
  .sidebar #case-list { padding-bottom: 15px; }
  .sidebar .case-link { min-height: 42px; font-size: 13px; }
  .sidebar .case-documents { min-height: 34px; }
  .sidebar .nav-link { min-height: 42px; }
  .sidebar-brand .brand-label { font-size: 17px; }
  .topbar { min-height: 62px; padding: 13px 15px; gap: 10px; }
  .page-heading h1 { max-width: 215px; font-size: 11px; }
  #mobile-navigation { flex: 0 0 auto; padding: 1px 16px 13px; border-bottom: 1px solid #f1ede8; }
  #mobile-navigation .workspace-tabs { display: flex; gap: 5px; }
  #mobile-navigation .workspace-tabs button { justify-content: center; flex: 1; min-height: 36px; padding: 7px 9px; font-size: 12px; gap: 7px; }
  #document-count { margin-left: 0; }
  .workspace-body { padding: 0 24px; }
  .interview-pane { min-height: calc(100dvh - 220px); }
  .is-empty .conversation { padding-top: 47px; }
  .welcome-greeting, .chat-welcome h2 { font-size: 32px; }
  .chat-welcome { padding-bottom: 32px; }
  .composer { margin-top: 0; }
  .composer > textarea { font-size: 16px; min-height: 83px; }
  .option-grid input, .option-grid select { font-size: 16px; }
  .pane-tools { margin-top: 17px; }
  .working-pane { padding: 24px; }
  .narrative-heading { flex-wrap: wrap; gap: 8px; }
  .narrative-heading h2 { font-size: 27px; }
  .narrative-body { font-size: 15px; margin-top: 25px; }
  .narrative-title { font-size: 26px; }
  .narrative-actions button { min-height: 40px; }
  .narrative-edit-block textarea { font-size: 16px; }
  .narrative-details > summary { line-height: 1.6; }
  .document-heading { padding: 22px; flex-wrap: wrap; gap: 8px; }
  .document-heading h2 { font-size: 24px; }
  .adoptionbar { flex-wrap: wrap; }
  .upload-dialog, .app-dialog { max-height: calc(100dvh - 30px); }
  .login-view { min-height: calc(100dvh - 26px); }
}
@media (max-width: 540px) {
  .heading-group { gap: 4px; }
  .page-heading h1 { max-width: 110px; }
  .topbar { padding: 12px 10px; gap: 7px; }
  #mobile-navigation { padding: 0 10px 12px; }
  #mobile-navigation .workspace-tabs button { font-size: 11px; gap: 6px; padding: 8px 6px; }
  #mobile-navigation .workspace-tabs .icon { width: 13px; height: 13px; }
  .workspace-body { padding: 0 17px; }
  .is-empty .conversation { padding-top: 43px; }
  .welcome-greeting { font-size: 28px; }
  .chat-welcome h2 { font-size: 30px; line-height: 1.22; }
  .chat-welcome { padding-bottom: 31px; }
  .composer { border-radius: 14px; padding: 9px 10px 10px; }
  .composer > textarea { padding: 6px 2px 12px; min-height: 92px; font-size: 16px; line-height: 1.6; }
  .composer-tool { min-height: 34px; font-size: 10px; padding: 6px 7px; gap: 5px; }
  .composer-options > summary { bottom: 10px; left: 127px; padding: 6px 5px; min-height: 34px; font-size: 10px; gap: 5px; }
  .send-button { width: 34px; height: 34px; min-height: 34px; }
  .composer-meta { margin-top: 16px; flex-wrap: wrap; row-gap: 5px; }
  #composer-note { font-size: 9px; }
  .dialogue-controls .quiet { font-size: 11px; }
  .conversation-footnote { font-size: 10px; margin-top: 18px; }
  .option-grid { grid-template-columns: 1fr; gap: 12px; padding: 14px 2px 11px; }
  .option-grid label { font-size: 12px; }
  .chat-message p { font-size: 14px; }
  .from-inventor { max-width: 94%; padding: 14px 16px; }
  .from-model { padding: 3px 5px 8px; }
  .from-model .main-question { font-size: 18px; }
  .working-pane { padding: 21px 17px; }
  .revision-picker select { max-width: 100%; }
  .narrative-actions { gap: 8px; }
  .narrative-approval .primary { width: 100%; }
  .narrative-title { font-size: 24px; }
  .narrative-section h3 { font-size: 19px; }
  .empty { padding: 40px 20px; min-height: 330px; }
  .empty h2 { font-size: 27px; }
  .toolbar { padding: 10px 13px; }
  .toolbar button { min-height: 36px; font-size: 10px; }
  .legend { padding: 13px 20px 3px; gap: 12px; }
  .text-surface { padding: 18px 14px; font-size: 15px; }
  .adoptionbar { flex-direction: column; align-items: stretch; padding: 18px 20px; }
  .adoptionbar button { white-space: normal; min-height: 44px; }
  .document-actions { padding: 0 20px 15px; }
  .document-actions button { white-space: normal; }
  .notice, .notice.source-class { margin-left: 16px; margin-right: 16px; }
  .fineprint { padding: 0 20px 18px; }
  .app-dialog, .upload-dialog { padding: 21px; max-width: calc(100vw - 24px); border-radius: 12px; }
  .dialog-heading h2 { font-size: 26px; }
  .upload-option { padding: 12px; }
  .dialog-actions button, .mark-actions button { min-height: 44px; }
  .upload-dialog input[type="file"] { padding: 10px; }
  .history-footer { margin-left: -21px; margin-right: -21px; padding: 15px 21px; }
  .history-dialog { padding-bottom: 0; }
  .history-current { display: none; }
  .app-dialog input { font-size: 16px; }
  .help-step { gap: 13px; }
  .login-brand { margin: 19px 22px; }
  .login-card { width: calc(100% - 42px); padding: 35px 0 50px; }
  .login-card h1 { font-size: 32px; }
  .login-footer { font-size: 9px; }
}
@media (max-width: 400px) {
  .options-label { display: none; }
  .options-label-short { display: inline; }
  .page-heading h1 { max-width: 94px; }
}
@media (max-width: 350px) {
  .page-heading { display: none; }
  .workspace-body { padding-left: 12px; padding-right: 12px; }
  .welcome-greeting { font-size: 25px; }
  .chat-welcome h2 { font-size: 27px; }
  .composer-options > summary { left: 119px; }
  #document-count { font-size: 8px; padding: 0 3px; }
}
@media (max-height: 560px) and (min-width: 761px) {
  .sidebar-section-title { margin-top: 13px; padding-top: 10px; }
  .account-row { padding-top: 10px; padding-bottom: 10px; }
  .sidebar-footer { padding-top: 4px; }
  .sidebar-footer .nav-link { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: 0s !important; }
}

/* IDA workflow: compact content, visible actions, truthful scoped processing. */
.brand span { display: flex; flex-direction: column; line-height: 1.15; font-size: 23px; }
.brand span small { font: 9px/1.4 var(--font-body, sans-serif); letter-spacing: .015em; white-space: normal; max-width: 150px; }
.brand .icon { width: 38px; height: 38px; flex-shrink: 0; }
.page-heading { min-width: 0; gap: 7px; }
.page-heading h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-row { display: flex; align-items: center; gap: 3px; min-width: 0; }
.case-row > .case-link { flex: 1; min-width: 0; }
.case-menu-toggle { display: inline-flex; flex: 0 0 32px; width: 32px; height: 38px; padding: 3px; justify-content: center; align-items: center; font-size: 21px; background: transparent; border: 0; border-radius: 6px; }
.case-menu-toggle:hover, .case-menu-toggle:focus-visible { background: #e8ded3; }
.case-action-menu { position: fixed; z-index: 1100; width: 210px; max-width: calc(100vw - 16px); padding: 6px; border: 1px solid #d8cec2; border-radius: 9px; background: #fffdfa; box-shadow: 0 10px 32px #38291c24; }
.case-action-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 12px; }
.case-action-menu button:focus, .case-action-menu button:hover { background: #f2ebe2; }
.danger { color: #9e3028; }
button.danger { border-color: #b54e42; }
.dialog-error { color: #9e3028; margin: 12px 0; line-height: 1.5; overflow-wrap: anywhere; }
#delete-case-name { overflow-wrap: anywhere; }
.work-area { position: relative; min-width: 0; }
.processing-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 22px 12px; padding: 9px 12px; border: 1px solid #ded4c7; border-radius: 8px; background: #f5efe6; font-size: 12px; }
.processing-strip > span { flex: 1 1 230px; }
.processing-strip button { min-height: 32px; padding: 5px 8px; font-size: 11px; }
.work-spinner { display: block; width: 27px; height: 27px; border: 3px solid #e7dccd; border-top-color: #88634b; border-radius: 50%; animation: ida-spin 1s linear infinite; }
@keyframes ida-spin { to { transform: rotate(360deg); } }
.empty-workspace { padding: 60px 0; text-align: center; }
.empty-workspace h2 { font-size: 27px; margin: 0 0 20px; }
.is-empty .conversation { padding-top: 26px; }
.chat-welcome { padding-bottom: 20px; }
.chat-welcome h2 { font-size: 29px; max-width: 600px; line-height: 1.3; margin: 0; }
.composer-meta { margin-top: 11px; }
.conversation-status:empty, .narrative-job:empty, #narrative-notice:empty { display: none; }
.review-recommendation { display: flex; align-items: center; gap: 16px; margin: 16px 0; padding: 15px 17px; border: 1px solid #ddd0bf; border-radius: 10px; background: #f3eee4; }
.review-recommendation > div { flex: 1; min-width: 0; }
.review-recommendation strong { font-size: 15px; }
.review-recommendation p { margin: 5px 0 0; font-size: 12px; line-height: 1.6; }
.review-recommendation button { flex-shrink: 0; max-width: 100%; white-space: normal; font-size: 12px; }
.review-recommendation details { margin-top: 7px; font-size: 12px; }
.review-recommendation[data-state='processing'], .review-recommendation[data-state='reviewing'] { background: transparent; }
.working-pane { padding-top: 23px; }
.narrative-heading h2 { font-size: 28px; }
.narrative-heading, .narrative-actions { margin-bottom: 14px; }
.review-summary { padding: 14px 0 5px; border-top: 1px solid #ddd0bf; }
.review-summary strong { font-size: 15px; }
.review-summary p { font-size: 13px; line-height: 1.5; margin: 6px 0; }
.review-item { padding: 13px 0; border-bottom: 1px solid #e1d7ca; }
.review-item h4 { margin: 0 0 6px; font-size: 14px; font-weight: 650; }
.review-item p { font-size: 13px; line-height: 1.6; margin: 6px 0; }
.review-item details { margin: 8px 0; }
.review-item summary { font-size: 12px; }
.review-item button { font-size: 12px; padding: 5px 0; }
.review-item[data-status='open'] h4 { color: #932f25; }
.review-passed, .review-gate, .review-audit { margin-top: 14px; }
.review-audit pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; line-height: 1.6; max-width: 100%; }
.narrative-details { margin: 12px 0 22px; }
.narrative-body { overflow-wrap: anywhere; }
.narrative-section { margin-top: 23px; }
.login-card { padding-top: 55px; }
.login-card h1 { margin-bottom: 20px; }
[hidden] { display: none !important; }
@media (max-width: 760px) {
  .processing-strip { margin: 0 14px 10px; }
  .review-recommendation { flex-direction: column; align-items: stretch; gap: 11px; }
  .review-recommendation button { align-self: flex-start; }
  .page-heading h1 { max-width: 120px; }
  .page-heading { gap: 2px; }
}
@media (max-width: 540px) {
  .is-empty .conversation { padding-top: 22px; }
  .chat-welcome h2 { font-size: 24px; }
  .chat-welcome { padding-bottom: 19px; }
  .page-heading h1 { max-width: 72px; font-size: 13px; }
  .review-recommendation { padding: 12px; }
  .case-menu-toggle { min-width: 40px; min-height: 42px; }
}
@media (max-width: 350px) { .page-heading { display: flex; } .page-heading h1 { max-width: 61px; } }
@media (prefers-reduced-motion: reduce) { .work-spinner { animation: none; border-style: dotted; } }

.case-group { display: grid; grid-template-columns: minmax(0,1fr) 36px; align-items: center; column-gap: 2px; }
.case-group > .case-documents { grid-column: 1 / -1; }
.case-group .case-link { min-width: 0; }

/* 3.5.1 — content first; the existing processing controller owns all worker feedback. */
.processing-strip { flex: 0 0 auto; min-width: 0; padding: 4px 10px; margin-bottom: 8px; font-size: 14px; }
.processing-strip > span { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.processing-strip button { min-height: 36px; font-size: 13px; white-space: normal; min-width: 0; max-width: 100%; }
.processing-strip[data-state="error"], .processing-strip[data-state="unknown"] { border-left: 3px solid #932f25; }
.processing-details { flex: 0 0 auto; width: 100%; max-width: 1010px; margin: 0 auto 14px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); overflow-wrap: anywhere; min-width: 0; }
.processing-detail-heading { display: flex; gap: 12px; align-items: center; justify-content: space-between; min-width: 0; }
.processing-detail-heading > strong { min-width: 0; }
.processing-details p { font-size: 14px; margin: 8px 0; }
.processing-details button { max-width: 100%; white-space: normal; font-size: 13px; }
#processing-jobs { display: grid; grid-template-columns: minmax(0,1fr); }
#processing-jobs article { min-width: 0; padding: 10px 0; border-top: 1px solid var(--line); }
#processing-jobs small { display: block; margin: 4px 0 8px; }
.working-pane { padding-top: 18px; }
.narrative-heading { margin-bottom: 8px; gap: 12px; flex-wrap: wrap; align-items: center; }
.narrative-heading > div { min-width: 0; max-width: 100%; }
.narrative-heading h2 { margin: 0 0 4px; font-size: 26px; }
.document-state { font-size: 13px; margin: 0; overflow-wrap: anywhere; }
.narrative-primary { display: flex; gap: 8px; flex-wrap: wrap; }
.narrative-primary:empty { display: none; }
.narrative-primary button { font-size: 13px; max-width: 100%; white-space: normal; }
.narrative-actions { margin: 8px 0 12px; gap: 6px 12px; }
.narrative-actions button, .narrative-actions .button { font-size: 13px; min-height: 36px; max-width: 100%; white-space: normal; }
.narrative-actions.is-editing { position: sticky; top: 0; z-index: 3; background: var(--surface); padding: 8px 0; border-bottom: 1px solid var(--line); }
.narrative-note { font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
#narrative-alert { margin: 10px 0; border-left-color: #932f25; }
#narrative-notice { margin: 4px 0; font-size: 13px; }
.review-summary { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; padding: 8px 0; font-size: 14px; }
.review-summary > span { flex: 1 1 130px; min-width: 0; overflow-wrap: anywhere; }
.review-summary.needs-attention { border-left: 3px solid #c7b9a6; padding-left: 12px; }
.review-summary button { font-size: 13px; white-space: normal; }
.narrative-body { margin-top: 16px; }
.narrative-title { margin-bottom: 16px; font-size: 27px; }
.narrative-section { margin: 18px 0; }
.narrative-section h3 { margin-bottom: 10px; }
.narrative-details { margin: 0; padding: 12px 0; }
.narrative-details > summary { font-size: 14px; min-height: 32px; padding: 5px 0; }
.narrative-details .fineprint { padding: 12px 0 0; }
.narrative-details h3 { font-family: var(--serif); font-size: 20px; }
#review-counts, #review-binding, #review-result { font-size: 14px; overflow-wrap: anywhere; }
#review-result:empty { display: none; }
.review-item summary, .review-item button { font-size: 14px; }
.review-item button { min-height: 36px; white-space: normal; }
#clarification-focus { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#clarification-focus > span { flex: 1 1 240px; min-width: 0; }
#clarification-focus button { white-space: normal; }
.review-recommendation { margin: 10px 0; padding: 12px 14px; }
.review-recommendation p, .review-recommendation button { font-size: 14px; }
.review-recommendation button { min-width: 0; }
.document-heading { gap: 14px; }
.document-heading > div { min-width: 0; }
.document-heading h2, #document-state { overflow-wrap: anywhere; }
.document-heading > a { flex-shrink: 0; }
#document-state { margin: 4px 0 0; font-size: 14px; }
.document-details { padding: 12px 24px; min-width: 0; }
.document-details > summary { min-height: 36px; padding: 5px 0; font-size: 14px; }
#document-metadata { display: grid; grid-template-columns: minmax(100px,1fr) minmax(0,3fr); gap: 8px 12px; font-size: 14px; }
#document-metadata dt { font-weight: 600; min-width: 0; }
#document-metadata dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
#document-source-detail, .metrics pre { overflow-wrap: anywhere; white-space: pre-wrap; }
.document-picker button, .document-picker span, .document-picker small { min-width: 0; overflow-wrap: anywhere; white-space: normal; }
#active-source-state { padding-top: 10px; padding-bottom: 10px; font-size: 14px; }
@media (max-width: 760px) {
  .narrative-heading { align-items: flex-start; }
  .narrative-primary { width: 100%; }
  .narrative-body { margin-top: 14px; }
  .narrative-title { font-size: 24px; }
  .narrative-primary button, .narrative-actions button, .narrative-actions .button, .review-summary button, .processing-strip button, .processing-details button, .review-recommendation button { min-height: 40px; }
  .narrative-details > summary, .document-details > summary { min-height: 44px; }
  .document-details { padding: 12px 18px; }
  #document-metadata { grid-template-columns: minmax(0,1fr); gap: 2px; }
  #document-metadata dd { margin-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) { .workspace-body { scroll-behavior: auto; } }
.brand,
.brand span,
.brand span small {
  color: #88634b;
}

/* Keep the reply area in view; only the interview history grows and scrolls. */
.work-area[data-pane="interview"] .workspace-body { overflow: hidden; }
.work-area[data-pane="interview"] #case-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.work-area[data-pane="interview"] .interview-pane {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}
.work-area[data-pane="interview"] .conversation {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scroll-padding-block: 12px;
}
.interview-controls {
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  min-height: 0;
  max-height: 85%;
  padding: 4px 4px max(14px, env(safe-area-inset-bottom));
  background: var(--surface);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.interview-guidance {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.interview-controls > .composer, .interview-controls > .composer-meta { flex: 0 0 auto; }
.interview-controls .composer > textarea { min-height: min(64px, 16dvh); max-height: min(260px, 24dvh); }
.interview-controls .option-grid { max-height: 24dvh; overflow-y: auto; overscroll-behavior: contain; }
.work-area[data-pane="interview"] .processing-details { max-height: 25%; overflow-y: auto; }
.work-area[data-pane="interview"] #upload-feedback { flex-shrink: 0; max-height: 15%; overflow-y: auto; }
@media (max-height: 450px) {
  #workspace:not([hidden]):has(.work-area[data-pane="interview"]) { min-height: 0; }
  .interview-controls { padding-bottom: 6px; }
  .interview-controls .composer-meta { margin-top: 6px; }
}

/* Answer drafting: one wrapping toolbar instead of absolute-positioned controls. */
.composer-bottom { align-items: flex-start; gap: 8px; }
.composer-tools { display: flex; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; align-items: center; gap: 4px; }
.composer-tools > #composer-upload-slot { flex: 0 0 auto; }
.composer-tools .composer-tool, .composer-tools .composer-options > summary { min-height: 36px; padding: 7px 8px; font-size: 11px; white-space: nowrap; }
.composer-tools .composer-options { min-width: 0; margin: 0; }
.composer-tools .composer-options > summary { position: static; }
.composer-tools .composer-options[open] { flex-basis: 100%; }
.composer-tools .option-grid { margin: 8px 0 0; padding-bottom: 4px; }
.composer-bottom > .send-button { margin-top: 3px; }
#suggest-answer[aria-busy="true"] .icon { display: none; }
#suggest-answer[aria-busy="true"]::before, .processing-spinner {
  content: ""; display: inline-block; width: 15px; height: 15px; flex: 0 0 15px;
  box-sizing: border-box; border: 2px solid #cbbdae; border-top-color: #70523b;
  border-radius: 50%; animation: ida-spin .9s linear infinite;
}
.processing-strip > .processing-spinner { flex: 0 0 15px; }
.processing-detail-heading > .processing-spinner { margin-right: auto; }
.suggestion-feedback { margin: 2px 0 10px; padding: 9px 10px; background: #f4f0e9; border-left: 2px solid #b29a82; border-radius: 4px; font-size: 12px; line-height: 1.55; }
.suggestion-feedback p { margin: 0; }
.suggestion-actions { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.suggestion-actions button { font-size: 11px; min-height: 36px; padding: 5px 0; text-align: left; white-space: normal; }
#suggestion-preview { border: 0; padding: 4px 0; }
#suggestion-preview summary { font-size: 12px; min-height: 32px; }
#suggestion-preview-text { max-height: 150px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 6px 0; }
@media (max-width: 760px) {
  .composer-tools .composer-tool, .composer-tools .composer-options > summary { min-height: 40px; padding: 6px; }
  .suggestion-actions button { min-height: 40px; }
  .composer-bottom > .send-button { margin-top: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  #suggest-answer[aria-busy="true"]::before, .processing-spinner { animation: none; border-style: dotted; }
}
@media (max-width: 540px) {
  /* Full-width first row keeps both drafting tools adjacent, even at 320 px. */
  .composer-bottom { display: grid; grid-template-columns: max-content minmax(0, 1fr) auto; gap: 4px; }
  .composer-tools { display: contents; }
  #composer-upload-slot { grid-column: 1; grid-row: 1; }
  #suggest-answer { grid-column: 2 / 4; grid-row: 1; justify-self: start; }
  .composer-tools .composer-options { grid-column: 1 / 3; grid-row: 2; }
  .composer-tools .composer-options[open] { grid-column: 1 / -1; }
  .composer-bottom > .send-button { grid-column: 3; grid-row: 2; align-self: start; justify-self: end; margin-top: 3px; z-index: 1; }
  .suggestion-feedback { padding: 7px 8px; margin-bottom: 8px; }
}
@media (max-width: 540px) and (max-height: 700px) {
  /* On short phone screens, leave more room for the question above a draft with feedback. */
  .interview-controls .composer:has(.suggestion-feedback:not([hidden])) > textarea { max-height: 16dvh; }
}
