:root {
    color-scheme: light;
    --background: #f5f8f5; --paper: #fff; --ink: #233c32; --muted: #596b63;
    --line: #d9e1df; --control-line: #87988f; --soft: #edf3f0; --brand: #2d6653; --brand-ink: #fff;
    --warning: #fff3d8; --warning-line: #d7bf87; --danger: #934435; --focus: #b9821f;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink); background: var(--background); line-height: 1.55; font-size: 14px;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; }
h1 { font-size: clamp(25px, 2.6vw, 33px); letter-spacing: -.8px; margin: 0 0 8px; }
h2 { font-size: 19px; margin: 0 0 12px; letter-spacing: -.3px; }
h3 { font-size: 16px; margin: 0 0 10px; }
p { margin: 10px 0; }
button, select, input, textarea { font: inherit; color: inherit; }
button { border-radius: 8px; padding: 10px 14px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); cursor: pointer; font-weight: 500; min-height: 40px; }
button.secondary { color: var(--ink); background: var(--paper); border-color: var(--line); }
button:hover:not(:disabled) { filter: brightness(.96); }
button:disabled { opacity: .5; cursor: default; }
:where(button, select, input, textarea, summary, a):focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
label { display: block; font-weight: 500; margin-bottom: 8px; }
select, textarea, input:not([type=checkbox]) { background: var(--paper); color: var(--ink); border: 1px solid var(--control-line); border-radius: 8px; padding: 10px 12px; width: 100%; min-width: 0; }
textarea { resize: vertical; line-height: 1.7; }
textarea:read-only { background: var(--paper); }
input[type=checkbox] { accent-color: var(--brand); }
summary { cursor: pointer; font-weight: 500; }
small, .muted { color: var(--muted); font-size: 12px; }
a { color: var(--brand); }
blockquote { margin: 12px 0; padding: 8px 12px; border-left: 3px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.eyebrow { font-size: 10px; letter-spacing: .13em; font-weight: 600; color: var(--muted); margin: 0 0 10px; }
.badge { padding: 5px 10px; border-radius: 20px; background: var(--soft); color: var(--ink); font-size: 12px; }
.brand { font-size: 28px; font-weight: 600; letter-spacing: -1.3px; color: var(--ink); }
.skip-link { position: absolute; left: 16px; top: -90px; z-index: 10; background: var(--paper); padding: 12px; }
.skip-link:focus { top: 12px; }
.app-shell { min-height: 100dvh; }
.is-signed-in .app-shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); }
.app-sidebar { background: var(--paper); border-right: 1px solid var(--line); padding: 28px 16px; display: flex; flex-direction: column; gap: 30px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; align-self: start; }
.app-sidebar .brand { padding-left: 12px; }
.app-navigation { display: grid; gap: 6px; }
.app-navigation button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px; color: var(--muted); background: transparent; border-color: transparent; }
.app-navigation svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.65; fill: none; flex: 0 0 auto; }
.app-navigation button[aria-current=page] { background: var(--soft); color: var(--ink); }
.sidebar-account { margin-top: 26px; border-top: 1px solid var(--line); padding: 18px 12px 0; color: var(--muted); font-size: 12px; }
.sidebar-caption { font-weight: 600; }
.sidebar-account button { font-size: 12px; margin-top: 10px; width: 100%; }
.app-main-column { min-width: 0; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); background: var(--paper); min-height: 76px; padding: 16px 30px; }
#app-page-title { font-weight: 600; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; min-width: 0; }
.account-label { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
#app-main { max-width: 1600px; margin: auto; padding: 30px; }
.app-notice { margin: 0 0 18px; color: var(--danger); overflow-wrap: anywhere; }
.app-notice:empty { display: none; }
.login-page { max-width: 590px; margin: 7vh auto 40px; padding: 40px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; }
.login-page .brand { margin-bottom: 32px; }
.login-page h1 { font-size: clamp(32px, 4vw, 48px); }
.login-page > p:not(.eyebrow) { color: var(--muted); margin: 20px 0 28px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 16px; }
.page-description { color: var(--muted); margin: 0; }
.context-line { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.input-mode { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; margin: 0 0 22px; background: var(--paper); }
.input-mode button { background: transparent; border-color: transparent; color: var(--muted); padding: 8px 15px; }
.input-mode button[aria-pressed=true] { background: var(--soft); color: var(--ink); }
.results-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.results-grid > *, .tariff-column { min-width: 0; }
.journal-input-card, .journal-draft-card, .tariff-start-card, .result-empty, #outcome-zone, .settings-card, .profile-editor, .tools-page { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; padding: 22px; }
.card-heading { margin-bottom: 16px; }
#journal { min-height: 285px; }
#journal-setup { margin-top: 20px; }
#journal-setup > .muted { font-size: 12px; }
.result-empty { min-height: 270px; display: flex; flex-direction: column; justify-content: center; }
.result-empty p { color: var(--muted); max-width: 340px; }
#outcome-zone:has(#job-status:empty):not(:has(.analysis-progress:not([hidden]))):not(:has(#result-details:not([hidden]))) { display: none; }
#job-status { margin: 0 0 12px; }
#result h2 { font-size: 19px; }
#result > p { font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; }
.profile-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.profile-dates label { font-size: 12px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 12px; font-weight: 400; margin-top: 15px; }
.check input { margin: 4px 0 0; flex: 0 0 auto; }
.processing-info { padding: 12px; background: var(--background); border-radius: 8px; margin: 18px 0; font-size: 12px; }
.consultation-footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 26px; padding: 18px 0 0; }
.consultation-footer > div { max-width: 650px; flex: 1 1 320px; }
.consultation-footer p { margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.consultation-footer small { font-size: 11px; }
.consultation-footer button { flex: 0 1 auto; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; max-width: 1000px; align-items: start; }
.quota-list { display: grid; gap: 20px; margin: 24px 0; }
.quota-row { min-width: 0; }
.quota-row h3 { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.quota-balance { margin: 0 0 10px; font-size: 13px; }
.quota-balance strong { font-size: 23px; font-weight: 600; margin-right: 4px; color: var(--ink); }
.quota-detail { font-size: 12px; color: var(--muted); margin: 7px 0 0; }
.quota-progress { display: block; appearance: none; width: 100%; height: 8px; border: 0; border-radius: 9px; overflow: hidden; background: var(--soft); color: var(--brand); accent-color: var(--brand); }
.quota-progress::-webkit-progress-bar { background: var(--soft); border-radius: 9px; }
.quota-progress::-webkit-progress-value { background: var(--brand); border-radius: 9px; }
.quota-progress::-moz-progress-bar { background: var(--brand); border-radius: 9px; }
.quota-low .quota-progress, .quota-exhausted .quota-progress { color: var(--focus); accent-color: var(--focus); }
.quota-low .quota-progress::-webkit-progress-value, .quota-exhausted .quota-progress::-webkit-progress-value { background: var(--focus); }
.quota-low .quota-progress::-moz-progress-bar, .quota-exhausted .quota-progress::-moz-progress-bar { background: var(--focus); }
.quota-warning { font-size: 12px; margin: 6px 0; font-weight: 500; }
.profile-editor > summary { font-size: 17px; }
.profile-editor label { margin: 16px 0 6px; font-size: 13px; }
.profile-editor small { display: block; margin-top: 6px; }
.profile-editor select { margin-bottom: 3px; }
.tools-page:empty { display: none; }
.tools-page > p { color: var(--muted); }
.template-section { margin: 16px 0; padding-top: 14px; border-top: 1px solid var(--line); }
.template-section button { padding: 6px 9px; min-height: 32px; font-size: 12px; margin: 6px 6px 0 0; }
.template-section label { font-size: 12px; }
.template-section input { margin-top: 7px; }
.template-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.template-toolbar h2 { margin: 0; }
.tools-status { margin: 18px 0 0; color: var(--muted); }
.tools-status:empty { display: none; }
.template-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.note-template-picker { display: flex; align-items: center; gap: 12px; margin: 14px 0 6px; }
.note-template-picker label { font-size: 12px; margin: 0; flex: 0 0 auto; }
.note-template-picker select { padding: 7px 10px; }
.tariff-card { margin: 12px 0; padding: 16px 0; border-top: 1px solid var(--line); }
.tariff-card h3, .tariff-card h4 { margin: 0 0 8px; }
.tariff-card p, .tariff-card ul { font-size: 12px; overflow-wrap: anywhere; }
.tariff-choice { display: flex; align-items: flex-start; gap: 10px; margin: 0; cursor: pointer; }
.tariff-choice input { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.tariff-choice span { font-size: 14px; }
.tariff-selection-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.tariff-selection-actions button { font-size: 12px; padding: 8px 10px; }
.tariff-status { display: inline-block; padding: 3px 8px; background: var(--soft); border-radius: 5px; }
.tariff-status.clarify { background: var(--warning); }
.manual-tariff { border-left: 3px solid var(--warning-line); padding-left: 14px; }
.tariff-add { margin: 22px 0; padding-top: 18px; border-top: 1px solid var(--line); }
.tariff-add label { margin-top: 16px; }
.tariff-search-result { padding: 14px 0; border-top: 1px solid var(--line); }
.tariff-search-result button { margin-top: 10px; }
.tariff-search-result small { display: block; color: var(--muted); }
#feedback { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
#feedback > h3 { font-size: 15px; }
#comparison { font-size: 12px; overflow-wrap: anywhere; }
.combination-review { margin: 16px 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--background); font-size: 12px; }
.combination-review > p { margin: 0; }
.combination-conflict { border-left: 3px solid var(--warning-line); padding: 4px 0 8px 12px; margin-top: 12px; }
.combination-conflict > p { font-weight: 600; }
.combination-conflict button { margin: 6px 6px 0 0; font-size: 12px; }
.combination-conflict blockquote { font-size: 12px; }
.analysis-progress { padding: 16px; background: var(--soft); border-radius: 10px; margin: 18px 0; }
.analysis-progress h3 { font-size: 16px; margin: 0 0 12px; }
.analysis-progress p { font-size: 12px; }
.analysis-progress small { font-size: 11px; }
.analysis-progress-track { height: 6px; border-radius: 6px; overflow: hidden; background: var(--line); }
.analysis-progress-track span { display: block; width: 35%; height: 100%; border-radius: inherit; background: var(--brand); animation: analysis-sweep 1.8s ease-in-out infinite; }
@keyframes analysis-sweep { from { transform: translateX(-100%); } to { transform: translateX(390%); } }
.speech-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.speech-heading h2 { font-size: 18px; margin: 0; }
.speech-steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.speech-steps button { background: var(--paper); border-color: var(--line); color: var(--muted); font-size: 12px; padding: 8px 12px; }
.speech-steps button span { display: inline-flex; align-items: center; justify-content: center; background: var(--soft); border-radius: 50%; width: 20px; height: 20px; margin-right: 6px; }
.speech-steps button[aria-current=step] { color: var(--ink); background: var(--soft); border-color: var(--brand); opacity: 1; }
.speech-global-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
#speech-step-prepare { max-width: 730px; padding: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: 13px; }
#speech-status, #speech-warnings { color: var(--danger); font-size: 13px; }
.recording-card { background: var(--soft); border: 1px solid var(--line); border-radius: 13px; padding: 28px; text-align: center; }
.recording-badge { display: inline-flex; align-items: center; gap: 9px; color: var(--danger); font-size: 13px; font-weight: 600; }
.recording-badge span { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
.signal-meter svg { width: min(100%, 440px); height: 115px; }
.signal-meter rect { fill: var(--brand); transition: height 70ms linear, y 70ms linear; }
.signal-meter[data-warning=true] rect { fill: var(--danger); }
.signal-meter p { min-height: 24px; }
.recording-time { font-size: 18px; font-variant-numeric: tabular-nums; }
.transcript-review-layout { display: grid; grid-template-columns: 1fr; gap: 22px; }
.speaker-example { display: block; font-weight: 400; color: var(--muted); font-style: italic; margin: 6px 0; }
#speech-roles { padding: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
#speech-role-status { padding: 10px; background: var(--soft); border-radius: 8px; font-size: 12px; }
#speech-role-list label { margin: 16px 0; font-size: 12px; }
#speech-turns { max-height: 650px; overflow-y: auto; overscroll-behavior: contain; }
.speech-turn { border-left: 3px solid var(--line); padding: 12px 14px; margin: 0 0 12px; background: var(--paper); }
.speech-turn h4 { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.speech-turn button, .speech-turn select { margin-top: 10px; }
.speech-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
#speech-review-zone { padding: 16px 0; }
#speech-note-content > .muted { font-size: 12px; }
#speech-note-text { min-height: 300px; }
#speech-note-status { overflow-wrap: anywhere; font-size: 12px; }
.evidence-dialog { width: min(54rem, calc(100vw - 2rem)); max-height: 85vh; border: 1px solid var(--line); border-radius: 13px; padding: 24px; color: var(--ink); background: var(--paper); }
.evidence-dialog::backdrop { background: rgb(8 25 22 / 55%); }
.evidence-source { margin-top: 16px; }
.evidence-source section { padding: 12px 0; border-top: 1px solid var(--line); }
.evidence-source mark { background: var(--warning); color: var(--ink); padding: 2px 0; }
.evidence-link { display: block; margin: 8px 0; text-align: left; font-size: 12px; }
pre { background: var(--background); padding: 14px; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Local scripted regression pages reuse real components, outside the production shell. */
body:not(.workspace-page) > main { max-width: 1180px; margin: auto; padding: 28px; }
body:not(.workspace-page) > header { padding: 20px; }
.panel { background: var(--paper); border: 1px solid var(--line); padding: 22px; border-radius: 13px; }
@media (min-width: 1100px) {
    .results-grid { grid-template-columns: minmax(0, 1.1fr) minmax(340px, 1fr); }
    .settings-grid { grid-template-columns: minmax(0, 1.3fr) minmax(280px, 1fr); }
    .transcript-review-layout { grid-template-columns: minmax(240px, .7fr) minmax(0, 1.3fr); }
    .template-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .is-signed-in .app-shell { grid-template-columns: 1fr; }
    .app-sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; gap: 16px; position: static; height: auto; }
    .app-sidebar .brand { padding: 0 4px; font-size: 24px; }
    .app-navigation { display: flex; flex-wrap: wrap; gap: 4px; }
    .app-navigation button { width: auto; padding: 9px 10px; font-size: 12px; }
    .app-navigation svg { width: 16px; height: 16px; }
    .sidebar-account { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0; padding: 8px 0 0; }
    .sidebar-account .sidebar-caption, .sidebar-account p { display: none; }
    .sidebar-account button { width: auto; margin: 0; padding: 6px 12px; min-height: 34px; }
    .app-header { padding: 14px 18px; flex-wrap: wrap; min-height: 62px; }
    .header-actions { gap: 10px; }
    #app-main { padding: 20px 16px; }
    .page-heading { flex-wrap: wrap; gap: 12px; }
    .journal-input-card, .journal-draft-card, .tariff-start-card, .result-empty, #outcome-zone, .settings-card, .profile-editor, .tools-page { padding: 17px; }
    .login-page { margin: 30px auto; padding: 24px; }
    input, textarea, select { font-size: 16px; }
    .profile-dates { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .analysis-progress-track span { animation: none; width: 100%; opacity: .6; } .signal-meter rect { transition: none; } }

/* Calm clinical workspace: daylight surfaces, green actions and compact review cards. */
.app-sidebar { background: #f0f6f1; }
.brand, .app-navigation button[aria-current=page] { color: var(--brand); }
.app-navigation button[aria-current=page] { background: #e0eee4; }
.consultation-preflight { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding: 16px 20px; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; margin-bottom: 10px; }
.consultation-preflight .context-line { margin: 4px 0 0; }
.consultation-preflight .eyebrow { margin: 0; }
.consultation-preflight .frame-note { flex-basis: 100%; font-size: 12px; margin: 0; color: var(--muted); }
#physician-profile { margin: 0 0 18px; }
#physician-profile summary { color: var(--brand); }
#physician-profile summary span { margin-left: 10px; font-weight: 400; }
.result-information { margin-bottom: 16px; font-size: 12px; }
.result-information > summary { color: var(--muted); }
.tariff-editor-heading, .tariff-card-heading, .tariff-search-heading, .dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tariff-editor-heading h3 { margin-top: 10px; }
.tariff-selection-actions { margin: 12px 0; }
.tariff-review-editor > p { font-size: 12px; color: var(--muted); }
.tariff-group { margin: 14px 0; }
.tariff-group > summary { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; list-style: none; }
.tariff-group > summary span:first-child::before { content: '›'; display: inline-block; width: 16px; }
.tariff-group[open] > summary span:first-child::before { transform: rotate(90deg); }
.tariff-group > summary span:last-child { border-radius: 20px; padding: 2px 8px; background: var(--soft); color: var(--ink); }
.tariff-card { border: 1px solid var(--line); padding: 15px; border-radius: 10px; margin: 10px 0; background: var(--paper); }
.tariff-card-heading { flex-wrap: wrap; }
.tariff-choice { flex: 1 1 200px; }
.tariff-card-title { display: grid; gap: 3px; }
.tariff-card-title strong { font-size: 16px; color: var(--brand); }
.tariff-card-title > span { font-weight: 400; font-size: 13px; }
.tariff-card-heading .tariff-status { margin: 0; font-size: 11px; white-space: nowrap; }
.tariff-card > p { color: var(--muted); margin: 10px 0; }
.tariff-card > details > summary { font-size: 12px; color: var(--brand); }
.condition-evidence { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 6px; }
.structured-evidence { background: #edf6ef; border-left: 3px solid var(--brand); padding: 10px 12px; margin: 10px 0; display: grid; gap: 3px; font-size: 12px; }
.structured-evidence strong { color: var(--brand); }
.review-leads-trigger { margin: 10px 10px 0 0; }
.combination-review { padding: 10px 12px; margin: 10px 0; }
.combination-review p { font-size: 12px; margin: 0; }
.tariff-search-dialog { color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 16px; width: min(760px, calc(100vw - 24px)); max-height: 85dvh; padding: 24px; }
.tariff-search-dialog::backdrop, .evidence-dialog::backdrop { background: rgb(22 49 35 / 28%); backdrop-filter: blur(3px); }
.dialog-heading h2 { margin: 6px 0; }
.dialog-heading button { flex-shrink: 0; }
.tariff-search-dialog > p, .tariff-search-dialog small, .tariff-search-dialog details p { font-size: 12px; }
.tariff-search-dialog > label { margin-top: 18px; }
.search-scopes { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.search-scopes button[aria-pressed=true] { background: var(--soft); border-color: var(--brand); color: var(--brand); }
.tariff-search-heading h3 { font-size: 13px; font-weight: 500; margin: 6px 0; }
.tariff-search-heading button { font-size: 12px; flex-shrink: 0; margin: 0; }
.tariff-search-result summary { font-size: 12px; color: var(--brand); margin-top: 8px; }
.tariff-search-dialog > details { margin-top: 16px; }
.tariff-search-dialog > details button { display: block; margin: 8px 0; font-size: 12px; text-align: left; }
.evidence-dialog .evidence-legend { border-left: 4px solid var(--brand); background: var(--soft); padding: 10px 12px; font-size: 13px; }
.evidence-source mark { background: #c9eace; color: #193e28; border-radius: 3px; outline: 2px solid #528b63; animation: evidence-pulse 1s ease-in-out 3; }
@keyframes evidence-pulse { 50% { background: #a4d5af; outline-width: 5px; outline-offset: 3px; } }
.performance-details { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.performance-details dl { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; }
.performance-details dt, .performance-details dd { margin: 0; }
@media (min-width: 1100px) { #journal-workspace:has(#result-details:not([hidden])) { grid-template-columns: minmax(280px, .8fr) minmax(440px, 1.2fr); } }
@media (max-width: 760px) {
    .consultation-preflight { padding: 14px; gap: 8px; }
    .tariff-editor-heading, .dialog-heading, .tariff-search-heading { flex-wrap: wrap; }
    .tariff-card-heading .tariff-status { margin-left: 28px; }
    .tariff-search-dialog { padding: 18px; }
    #physician-profile summary span { display: block; margin: 6px 0 0 16px; }
}
@media (prefers-reduced-motion: reduce) { .evidence-source mark { animation: none; outline-width: 3px; } }
