:root {
  color-scheme: light;
  --ink: #172220;
  --muted: #65716e;
  --paper: #f4f1e9;
  --surface: #fffdf8;
  --line: #d9d5ca;
  --green: #183f36;
  --green-soft: #e3ece7;
  --gold: #b48337;
  --red: #9b3f35;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; }
.auth-panel { width: min(100%, 460px); padding: 38px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 18px 60px rgba(23, 34, 32, .08); }
.auth-brand { margin-bottom: 26px; }
.auth-brand h1 { margin-bottom: 10px; }
.auth-brand p:last-child { margin: 0; color: var(--muted); line-height: 1.65; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 24px; padding: 4px; background: var(--paper); }
.auth-tabs button { border: 0; border-radius: 2px; color: var(--muted); }
.auth-tabs button.active { background: var(--green); color: white; }
.auth-form { display: grid; gap: 16px; }
.auth-form label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.auth-form input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 3px; background: white; color: var(--ink); outline: none; }
.auth-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(24, 63, 54, .1); }
.auth-form .primary { width: 100%; padding: 11px 16px; }
.auth-form .status { min-height: 20px; margin: 0; }
.auth-hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.account-menu { position: relative; display: flex; align-items: center; color: var(--muted); font-size: 13px; }
.account-button { display: flex; align-items: center; gap: 8px; max-width: 190px; min-height: 40px; padding: 5px 10px 5px 6px; border-color: transparent; }
.account-button > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-avatar, .profile-avatar-preview { flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: var(--green); color: white; background-position: center; background-size: cover; font-weight: 700; }
.account-avatar { width: 28px; height: 28px; font-size: 12px; }
.account-dropdown { position: absolute; z-index: 80; top: calc(100% + 7px); right: 0; width: 156px; padding: 5px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 12px 34px rgba(23, 34, 32, .13); }
.account-dropdown button { width: 100%; padding: 9px 10px; border: 0; border-radius: 2px; text-align: left; }
.account-dropdown button:hover { background: var(--green-soft); }
.account-dropdown #logout-button { margin-top: 4px; border-top: 1px solid var(--line); color: var(--red); }
.shell { max-width: 1120px; margin: 0 auto; padding: 24px 32px 64px; }
.topbar { display: flex; align-items: end; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.eyebrow, .section-label { margin: 0 0 5px; font-size: 11px; font-weight: 700; letter-spacing: .16em; color: var(--gold); }
h1 { margin: 0; font: 500 28px Georgia, "Noto Serif SC", serif; }
nav { display: flex; gap: 4px; }
button { border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 999px; padding: 9px 15px; }
button:hover { border-color: var(--green); }
.nav-button { border-color: transparent; color: var(--muted); }
.nav-button.active { background: var(--green); color: white; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 28px 0 52px; }
.stats > div { background: var(--surface); padding: 18px 22px; display: flex; align-items: baseline; gap: 10px; }
.stats span { font: 500 24px Georgia, serif; }
.stats small { color: var(--muted); }
.stats > .asset-class-breakdown { grid-column: 1 / -1; display: grid; grid-template-columns: 145px minmax(0, 1fr); align-items: center; gap: 18px; padding: 13px 22px; }
.asset-class-breakdown > strong { font-size: 12px; }
.asset-class-breakdown dl { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin: 0; }
.asset-class-breakdown dl > div { min-width: 0; padding: 2px 14px; border-left: 1px solid var(--line); }
.asset-class-breakdown dt { color: var(--muted); font-size: 11px; white-space: nowrap; }
.asset-class-breakdown dd { display: flex; align-items: baseline; gap: 4px; margin: 3px 0 0; white-space: nowrap; }
.asset-class-breakdown dd strong { font: 500 19px Georgia, serif; }
.asset-class-breakdown dd span, .asset-class-breakdown dd small { font: inherit; color: var(--muted); font-size: 10px; }
.view { display: none; }
.view.active { display: block; }
.profile-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.profile-panel { display: grid; gap: 17px; padding: 24px; border: 1px solid var(--line); background: var(--surface); }
.profile-panel h3 { margin: 0; font: 500 22px Georgia, "Noto Serif SC", serif; }
.profile-panel .status { min-height: 18px; margin: 0; font-size: 12px; }
.profile-panel button { justify-self: start; }
.profile-avatar-row { display: flex; align-items: center; gap: 14px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.profile-avatar-preview { width: 68px; height: 68px; font-size: 25px; }
.profile-avatar-row strong, .profile-avatar-row small { display: block; }
.profile-avatar-row small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.password-field { display: grid; gap: 7px; }
.password-input-wrap { position: relative; }
.password-input-wrap input { padding-right: 48px; }
.password-toggle { position: absolute; top: 50%; right: 4px; width: 36px; height: 34px; display: grid; place-items: center; transform: translateY(-50%); padding: 0; border: 0; border-radius: 3px; color: var(--muted); }
.password-toggle:hover { background: var(--green-soft); color: var(--green); }
.password-toggle:focus-visible { outline: 2px solid #91afa3; outline-offset: 1px; }
.password-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.history-tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.history-tabs button { border: 0; border-radius: 0; padding: 10px 14px; color: var(--muted); }
.history-tabs button.active { box-shadow: inset 0 -3px 0 var(--green); color: var(--green); font-weight: 700; }
.date-search-bar { display: grid; grid-template-columns: minmax(220px, 1.5fr) minmax(145px, .65fr) minmax(145px, .65fr) minmax(145px, .65fr) auto; gap: 11px; align-items: end; margin-bottom: 16px; padding: 14px; border: 1px solid var(--line); background: var(--surface); }
.date-search-bar button { min-height: 41px; padding: 9px 16px; }
.history-list { min-height: 310px; border: 1px solid var(--line); background: var(--surface); }
.history-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 16px; align-items: center; min-height: 68px; padding: 12px 16px; border-bottom: 1px solid #e8e4da; }
.history-row:last-child { border-bottom: 0; }
.history-row > div { min-width: 0; }
.history-row strong, .history-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row small, .history-row time { margin-top: 5px; color: var(--muted); font-size: 11px; }
.pagination { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 9px 12px; color: var(--muted); font-size: 12px; }
.pagination button { padding: 6px 11px; font-size: 12px; }
.pagination button:disabled { cursor: default; opacity: .45; }
.hero { max-width: 720px; margin-bottom: 24px; }
.hero.compact { margin-bottom: 28px; }
.hero h2 { margin: 0 0 9px; font: 500 38px/1.2 Georgia, "Noto Serif SC", serif; }
.hero.compact h2 { font-size: 30px; }
.hero p:last-child { margin: 0; color: var(--muted); }
.ask-box, .entry-form, .answer-panel { background: var(--surface); border: 1px solid var(--line); }
.ask-box { padding: 14px; }
textarea { resize: vertical; }
.ask-box textarea { width: 100%; border: 0; outline: 0; background: transparent; padding: 8px; font-size: 18px; line-height: 1.65; color: var(--ink); }
.ask-scope { border-top: 1px solid var(--line); }
.ask-scope summary { display: flex; align-items: center; gap: 10px; padding: 12px 8px; cursor: pointer; color: var(--green); font-size: 13px; font-weight: 600; }
.ask-scope summary small { color: var(--muted); font-size: 11px; font-weight: 400; }
.ask-scope-body { display: grid; gap: 13px; padding: 3px 8px 15px; }
.ask-scope-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 12px; }
.ask-scope-grid label, .ask-custom-dates label, .ask-document-picker label { color: var(--muted); font-size: 11px; }
.ask-scope-grid select, .ask-scope-grid input, .ask-custom-dates input, .ask-document-picker input { padding: 8px 10px; font-size: 12px; }
.ask-filter-picker, .ask-document-picker { position: relative; min-width: 0; }
.ask-filter-results { position: absolute; z-index: 9; top: 58px; left: 0; right: 0; max-height: 220px; overflow: auto; border: 1px solid var(--line); background: white; box-shadow: 0 8px 24px rgb(31 39 35 / 10%); }
.ask-filter-result { display: flex; justify-content: space-between; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; text-align: left; background: white; }
.ask-filter-result:hover { background: #f7f6f0; }
.ask-filter-result span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-filter-result small { color: var(--muted); white-space: nowrap; }
.ask-selected-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.ask-selected-filter { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 4px 5px 4px 8px; border: 1px solid #a8c2b7; background: var(--green-soft); color: var(--green); font-size: 10px; }
.ask-selected-filter span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-selected-filter button { width: 18px; height: 18px; padding: 0; border: 0; color: inherit; background: transparent; font-size: 15px; line-height: 1; }
.ask-asset-groups { min-width: 0; margin: 0; padding: 0; border: 0; }
.ask-asset-groups legend { margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 600; }
.ask-asset-groups > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 8px; }
.ask-asset-option { display: flex; grid-template-columns: 14px minmax(0, 1fr); align-items: center; gap: 6px; min-width: 0; padding: 5px 7px; border: 1px solid var(--line); background: white; font-size: 10px; font-weight: 400; }
.ask-asset-option:has(input:checked) { border-color: #8cab9f; background: var(--green-soft); color: var(--green); }
.ask-asset-option input { width: 13px; height: 13px; margin: 0; padding: 0; }
.ask-custom-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 520px; }
.ask-document-results { position: absolute; z-index: 8; top: 58px; left: 0; right: 0; max-height: 260px; overflow: auto; border: 1px solid var(--line); background: white; box-shadow: 0 8px 24px rgb(31 39 35 / 10%); }
.close-ask-results { position: absolute; z-index: 10; top: 25px; right: 7px; width: 24px; height: 24px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; }
.ask-document-picker:has(.close-ask-results:not([hidden])) input { padding-right: 36px; }
.ask-document-result { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; text-align: left; background: white; }
.ask-document-result:hover { background: #f7f6f0; }
.ask-document-result strong, .ask-document-result small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-document-result strong { color: var(--ink); font-size: 12px; }
.ask-document-result small { grid-column: 1; color: var(--muted); font-size: 10px; }
.ask-document-result time { grid-column: 2; grid-row: 1 / 3; align-self: center; color: var(--muted); font-size: 10px; }
.ask-selected-documents { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.ask-selected-document { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 5px 7px 5px 9px; border: 1px solid #a8c2b7; background: var(--green-soft); color: var(--green); font-size: 11px; }
.ask-selected-document span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-selected-document button { width: 20px; height: 20px; padding: 0; border: 0; color: inherit; background: transparent; font-size: 16px; line-height: 1; }
.ask-journal-toggle { display: flex; grid-template-columns: 16px auto; align-items: center; gap: 8px; width: max-content; color: var(--muted); font-size: 12px; font-weight: 400; }
.ask-journal-toggle input { width: 15px; height: 15px; margin: 0; }
.question-log-filters { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(150px, 1fr) repeat(3, minmax(125px, 1fr)) auto; align-items: end; gap: 10px; padding: 14px; border: 1px solid var(--line); background: var(--surface); }
.question-log-filters input, .question-log-filters select { padding: 8px 10px; font-size: 12px; }
.question-log-list { border: 1px solid var(--line); background: var(--surface); }
.question-log-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 150px; gap: 14px; padding: 14px; border-bottom: 1px solid var(--line); }
.question-log-row:last-child { border-bottom: 0; }
.question-log-identity strong, .question-log-identity time, .question-log-question strong, .question-log-question small { display: block; }
.question-log-identity time, .question-log-question small, .question-log-meta { margin-top: 5px; color: var(--muted); font-size: 11px; }
.question-log-question strong { font-size: 13px; line-height: 1.55; }
.question-log-meta { text-align: right; }
.question-log-meta span { display: block; margin-bottom: 5px; }
.conversation-workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 720px; border: 1px solid var(--line); background: var(--surface); }
.conversation-sidebar { min-width: 0; padding: 20px 16px; border-right: 1px solid var(--line); background: #f7f5ef; }
.conversation-sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.conversation-sidebar-heading h2 { margin: 3px 0 0; font: 500 22px Georgia, "Noto Serif SC", serif; }
.conversation-sidebar-heading .primary { padding: 8px 12px; }
.conversation-search, .conversation-state-filter { margin-bottom: 12px; color: var(--muted); font-size: 11px; }
.conversation-search input, .conversation-state-filter select { padding: 8px 9px; font-size: 12px; }
.conversation-list { display: grid; margin: 16px -16px 0; border-top: 1px solid var(--line); }
.conversation-list-item { width: 100%; display: grid; gap: 5px; padding: 13px 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: inherit; text-align: left; }
.conversation-list-item:hover, .conversation-list-item.active { background: white; }
.conversation-list-item.active { box-shadow: inset 3px 0 0 var(--green); }
.conversation-list-item strong, .conversation-list-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-list-item strong { font-size: 13px; }
.conversation-list-item small { color: var(--muted); font-size: 11px; }
.pagination.compact { justify-content: center; margin-top: 14px; }
.conversation-main { min-width: 0; display: flex; flex-direction: column; }
.conversation-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 22px 26px; border-bottom: 1px solid var(--line); }
.conversation-header h2 { margin: 4px 0 6px; font: 500 25px Georgia, "Noto Serif SC", serif; }
.conversation-header small { color: var(--muted); }
.conversation-header-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.conversation-header-actions button { padding: 8px 11px; font-size: 12px; }
.conversation-empty { display: grid; align-content: center; justify-items: center; flex: 1; min-height: 330px; padding: 44px; text-align: center; }
.conversation-empty h2 { margin: 8px 0; font: 500 31px Georgia, "Noto Serif SC", serif; }
.conversation-empty > p:not(.section-label) { color: var(--muted); }
.conversation-empty .quick-prompts { justify-content: center; margin-top: 18px; }
.conversation-thread { flex: 1; display: grid; align-content: start; gap: 0; padding: 10px 26px 28px; }
.conversation-message { min-width: 0; padding: 22px 0; border-bottom: 1px solid var(--line); }
.conversation-message:last-child { border-bottom: 0; }
.conversation-message-user { justify-self: end; width: min(78%, 760px); margin: 10px 0; padding: 14px 16px; border: 1px solid #cbd9d3; background: var(--green-soft); }
.conversation-message-assistant { width: 100%; }
.conversation-message-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.conversation-message-heading strong { font-size: 13px; }
.conversation-message-heading time { color: var(--muted); font-size: 11px; }
.conversation-answer { line-height: 1.8; overflow-wrap: anywhere; }
.conversation-evidence { margin-top: 18px; border-top: 1px solid var(--line); }
.conversation-evidence summary { padding: 12px 0; color: var(--green); cursor: pointer; font-size: 12px; font-weight: 700; }
.conversation-evidence-list { border-bottom: 1px solid var(--line); }
.conversation-evidence-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.conversation-evidence-row time { color: var(--muted); font-size: 11px; }
.conversation-evidence-row strong { display: block; margin-bottom: 4px; font-size: 13px; }
.conversation-evidence-row p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.link-button { width: auto; padding: 0; border: 0; background: transparent; color: var(--green); text-align: left; }
.link-button:hover { text-decoration: underline; }
.conversation-composer { position: sticky; z-index: 5; bottom: 0; margin: 0; padding: 18px 22px; border-width: 1px 0 0; background: rgba(251, 250, 246, .98); }
.conversation-composer textarea { min-height: 76px; resize: vertical; font-size: 14px; line-height: 1.55; }
.conversation-composer .ask-actions > small { color: var(--muted); }
.admin-conversation-layout { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 18px; align-items: start; }
.admin-conversation-layout .question-log-list { max-height: 720px; overflow-y: auto; }
.admin-conversation-row { width: 100%; display: grid; gap: 7px; padding: 14px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: inherit; text-align: left; }
.admin-conversation-row:hover, .admin-conversation-row.active { background: #f7f5ef; }
.admin-conversation-row.active { box-shadow: inset 3px 0 0 var(--green); }
.admin-conversation-row > span { display: flex; justify-content: space-between; gap: 12px; }
.admin-conversation-row small { color: var(--muted); font-size: 11px; }
.admin-conversation-row p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.admin-conversation-detail { min-height: 360px; padding: 20px; border: 1px solid var(--line); background: var(--surface); }
.admin-conversation-form { display: grid; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.admin-conversation-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.admin-conversation-form textarea { min-height: 72px; resize: vertical; }
.admin-conversation-meta { margin: 0; color: var(--muted); font-size: 11px; }
.admin-conversation-thread { display: grid; gap: 0; }
.ask-actions { display: flex; justify-content: space-between; align-items: center; gap: 18px; border-top: 1px solid var(--line); padding: 14px 4px 0; }
.quick-prompts { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-prompts button { padding: 7px 11px; color: var(--muted); }
.command-model-control { display: flex; align-items: end; gap: 9px; flex: 0 0 auto; }
.command-model-control label { min-width: 210px; color: var(--muted); font-size: 11px; }
.command-model-control select { padding: 8px 10px; font-size: 12px; }
.primary { background: var(--green); border-color: var(--green); color: white; border-radius: 4px; font-weight: 600; }
.primary:hover { background: #24584b; }
.status { display: inline-block; margin: 16px 0; color: var(--muted); }
.status.error, .error { color: var(--red); }
.status.success { color: var(--green); }
.draft-banner { margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--line); background: #fffaf0; line-height: 1.6; }
.draft-banner.success { border-color: #a8c2b7; background: var(--green-soft); color: var(--green); }
.draft-banner.warning { border-color: #d8bb84; color: #7b5622; }
.draft-banner.error { border-color: #d4a19b; background: #fff3f1; }
.answer-panel { margin-top: 28px; padding: 28px; }
.answer-heading { display: flex; justify-content: space-between; align-items: center; }
.answer-heading h3, .evidence-heading { margin: 0; font: 500 22px Georgia, "Noto Serif SC", serif; }
.mode-badge, .citation { display: inline-block; background: var(--green-soft); color: var(--green); border-radius: 999px; padding: 3px 8px; font-size: 12px; white-space: nowrap; }
.answer { margin: 20px 0 30px; line-height: 1.8; }
.evidence-heading { border-top: 1px solid var(--line); padding-top: 24px; }
.evidence-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
.evidence-card { border: 1px solid var(--line); padding: 17px; background: #fff; }
.card-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.evidence-card h4 { margin: 13px 0 8px; }
.evidence-card p { color: var(--muted); font-size: 13px; line-height: 1.6; max-height: 126px; overflow: hidden; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tags span, .row-meta span:not(.citation) { font-size: 11px; color: var(--muted); border-left: 2px solid var(--gold); padding-left: 6px; }
.source { font-size: 12px; }
.source a { color: var(--green); }
.relation-note { border-left: 2px solid var(--gold); padding-left: 9px; }
.entry-form { padding: 28px; display: grid; gap: 19px; }
.intake-dialog { width: min(96vw, 1280px); height: min(94vh, 920px); max-width: none; max-height: none; padding: 0; overflow: hidden; border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: 0 24px 80px rgba(23, 34, 32, .24); }
.intake-dialog::backdrop { background: rgba(23, 34, 32, .54); cursor: default; }
.intake-dialog-content { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
.intake-dialog .intake-head { position: sticky; z-index: 5; top: 0; align-items: center; padding: 20px 26px 16px; border-bottom: 1px solid var(--line); background: rgba(251, 250, 246, .97); }
.intake-dialog .intake-head .hero { padding: 0; }
.intake-dialog .intake-head .hero p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.intake-close { flex: 0 0 auto; width: 38px; height: 38px; padding: 0; font-size: 24px; line-height: 1; }
.intake-steps { position: sticky; z-index: 4; top: 91px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: var(--surface); }
.intake-steps button { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); }
.intake-steps button.active { border-bottom-color: var(--green); background: var(--green-soft); color: var(--green); font-weight: 700; }
.intake-steps span { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid currentColor; border-radius: 50%; font-size: 11px; }
.intake-dialog .draft-banner { margin: 16px 26px 0; }
.intake-dialog .entry-form { border: 0; background: transparent; }
.intake-compose-step { display: grid; gap: 18px; }
.intake-compose-step[hidden] { display: none; }
.source-text-label textarea { min-height: 190px; resize: vertical; background: white; font-size: 14px; line-height: 1.65; }
.draft-step-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.draft-step-heading h3 { margin: 4px 0 0; font-size: 18px; }
.intake-dialog .batch-upload-panel { margin: 0 28px 28px; }
body.intake-dialog-open { overflow: hidden; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 3px; padding: 11px 12px; color: var(--ink); background: white; }
input:focus, textarea:focus, select:focus { outline: 2px solid #b8cbc4; border-color: var(--green); }
.form-grid { display: grid; gap: 16px; }
.form-grid.two { grid-template-columns: repeat(2, 1fr); }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.file-drop { padding: 18px; border: 1px dashed #a8aaa2; background: #faf8f1; }
.file-drop input { border: 0; padding: 0; background: transparent; }
.file-drop span { color: var(--muted); font-size: 12px; font-weight: 400; }
.capture-zone { border: 1px dashed #8f9d97; background: #f5f8f5; padding: 24px; display: grid; place-items: center; gap: 15px; text-align: center; transition: background .15s ease, border-color .15s ease; }
.capture-zone.dragging { background: var(--green-soft); border-color: var(--green); }
#capture-copy { display: grid; gap: 6px; }
#capture-copy strong { font-size: 17px; }
#capture-copy span { color: var(--muted); font-size: 12px; }
#capture-preview { display: block; max-width: min(100%, 720px); max-height: 420px; object-fit: contain; border: 1px solid var(--line); background: white; }
#capture-preview[hidden] { display: none; }
.capture-image-previews { width: min(100%, 820px); display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; text-align: left; }
.capture-image-previews:empty { display: none; }
.capture-image-preview { position: relative; min-width: 0; border: 1px solid var(--line); background: white; }
.capture-image-preview img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #f3f1eb; }
.capture-image-preview small { display: block; padding: 7px 34px 7px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.capture-image-preview button { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; padding: 0; border-color: rgba(23, 34, 32, .22); background: rgba(255,255,255,.94); font-size: 17px; line-height: 1; }
.capture-file-preview { min-width: min(100%, 420px); display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; align-items: center; padding: 18px; border: 1px solid var(--line); background: white; text-align: left; }
.capture-file-preview[hidden] { display: none; }
.capture-file-preview .file-icon { grid-row: 1 / 3; display: grid; place-items: center; width: 52px; height: 62px; background: #a53131; color: white; font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.capture-file-preview strong { overflow-wrap: anywhere; }
.capture-file-preview small { color: var(--muted); }
.capture-actions { width: min(100%, 760px); display: grid; grid-template-columns: auto minmax(260px, 1fr) auto; gap: 10px; align-items: end; }
.capture-actions button { white-space: nowrap; }
.analysis-model-control { min-width: 0; color: var(--muted); text-align: left; }
.analysis-model-control select { padding: 8px 10px; font-size: 12px; }
.capture-zone .status { margin: 0; }
.intake-mode-control { max-width: 520px; }
.trading-comment-composer { display: grid; gap: 14px; padding: 22px; border: 1px solid var(--line); background: #fbfaf6; }
.trading-comment-composer[hidden] { display: none; }
.trading-comment-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.trading-comment-heading h3 { margin: 4px 0 0; font-size: 18px; }
.trading-comment-heading > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.trading-comment-editor-label textarea { min-height: 170px; resize: vertical; background: white; }
.trading-comment-editor-label textarea.paste-active { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-soft); }
.trading-comment-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.trading-comment-previews:empty { display: none; }
.trading-comment-preview { position: relative; min-width: 0; border: 1px solid var(--line); background: white; }
.trading-comment-preview img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #f3f1eb; }
.trading-comment-preview small { display: block; padding: 7px 34px 7px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.trading-comment-preview button { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; padding: 0; border-color: rgba(23, 34, 32, .22); background: rgba(255,255,255,.94); font-size: 17px; line-height: 1; }
.trading-comment-actions { display: grid; grid-template-columns: auto minmax(260px, 1fr) auto; align-items: end; gap: 10px; }
.trading-comment-actions .analysis-model-control { min-width: 0; }
.pillar-fieldset { border: 1px solid var(--line); padding: 14px 16px; display: flex; gap: 17px; flex-wrap: wrap; }
.pillar-fieldset legend { padding: 0 7px; font-size: 13px; font-weight: 600; }
.pillar-fieldset label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.pillar-fieldset input { width: auto; }
.submit-row { display: flex; justify-content: space-between; align-items: center; }
.intake-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.single-draft-fields { display: grid; gap: 19px; }
.single-draft-fields[hidden] { display: none; }
.library-head { display: flex; justify-content: space-between; align-items: center; }
.library-head-actions { display: flex; gap: 8px; }
.library-filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; background: var(--surface); border: 1px solid var(--line); padding: 14px; margin-bottom: 20px; }
.batch-library-notice { margin: 0 0 14px; padding: 12px 14px; border: 1px solid #a8c2b7; background: var(--green-soft); color: var(--green); font-size: 13px; }
.batch-library-notice.error { border-color: #d4a19b; background: #fff3f1; color: var(--red); }
.batch-upload-panel { margin: 0 0 20px; padding: 20px; border: 1px solid var(--line); background: var(--surface); }
.batch-panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 24px; }
.batch-panel-heading h3 { margin: 0 0 5px; font: 500 24px Georgia, "Noto Serif SC", serif; }
.batch-panel-heading p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.batch-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; }
.batch-controls > div { display: flex; align-items: center; gap: 9px; }
.batch-controls span { color: var(--muted); font-size: 12px; }
.batch-controls button { padding: 7px 12px; }
.batch-overall { margin-top: 18px; }
.batch-overall > div { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.batch-overall progress { width: 100%; height: 10px; accent-color: var(--green); }
.batch-upload-panel > .status { margin: 10px 0 0; }
.batch-file-list { margin-top: 12px; border-top: 1px solid var(--line); }
.batch-file-row { display: grid; grid-template-columns: minmax(220px, 1fr) 110px minmax(110px, .7fr); gap: 14px; align-items: center; min-height: 58px; padding: 9px 4px; border-bottom: 1px solid #e8e4da; }
.batch-file-copy { min-width: 0; }
.batch-file-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.batch-file-copy small { color: var(--muted); font-size: 10px; }
.batch-file-state { color: var(--muted); font-size: 11px; text-align: right; }
.batch-file-state.success { color: var(--green); }
.batch-file-state.error { color: var(--red); }
.batch-file-progress { height: 7px; overflow: hidden; border-radius: 999px; background: #e8e5dc; }
.batch-file-progress span { display: block; width: 0; height: 100%; background: var(--green); transition: width .15s ease; }
.batch-file-row.failed .batch-file-progress span { background: var(--red); }
.batch-file-row.completed { cursor: pointer; }
.batch-file-row.completed:hover { background: #f6f8f5; }
.batch-file-row.editable { cursor: pointer; }
.batch-file-row.editable:hover, .batch-file-row.selected { background: var(--green-soft); box-shadow: inset 3px 0 0 var(--green); }
.batch-draft-editor { display: grid; gap: 16px; margin-top: 22px; padding: 22px; border: 1px solid var(--line); background: #fbfaf6; }
.batch-draft-editor[hidden] { display: none; }
.batch-draft-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.batch-draft-heading h3 { margin: 5px 0 0; font: 500 20px Georgia, "Noto Serif SC", serif; overflow-wrap: anywhere; }
.batch-draft-heading > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.library-explorer { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .85fr); min-height: 610px; background: var(--surface); border: 1px solid var(--line); }
.explorer-list-pane { min-width: 0; border-right: 1px solid var(--line); }
.explorer-toolbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #faf8f2; }
.explorer-toolbar > span { color: var(--muted); font-size: 12px; }
.explorer-toolbar > div { display: flex; gap: 7px; }
.explorer-toolbar button { padding: 7px 11px; font-size: 12px; }
.explorer-toolbar button:disabled { cursor: default; opacity: .45; }
button.danger { color: var(--red); }
button.danger:not(:disabled):hover { border-color: var(--red); background: #fff3f1; }
.explorer-columns { display: grid; grid-template-columns: minmax(210px, 1fr) 92px 82px 45px; gap: 12px; padding: 8px 13px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.library-list { min-height: 480px; }
.library-row { display: grid; grid-template-columns: minmax(210px, 1fr) 92px 82px 45px; gap: 12px; align-items: center; min-height: 67px; padding: 9px 13px; border-bottom: 1px solid #e8e4da; cursor: default; outline: none; }
.library-row:hover { background: #f7f6f1; }
.library-row.selected { background: var(--green-soft); box-shadow: inset 3px 0 0 var(--green); }
.library-row:focus-visible { outline: 2px solid #91afa3; outline-offset: -2px; }
.file-name-cell { min-width: 0; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; align-items: center; }
.file-type-icon { width: 34px; height: 40px; display: grid; place-items: center; border: 1px solid #c9d6d0; border-radius: 3px; background: white; color: var(--green); font-size: 10px; font-weight: 700; }
.file-name-copy { min-width: 0; }
.file-name-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file-name-copy small { display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; }
.file-date, .file-kind, .file-count { color: var(--muted); font-size: 11px; }
.file-count { text-align: right; }
.mobile-row-preview { display: none; }
.document-preview { min-width: 0; background: #fbfaf6; overflow: hidden; }
.preview-placeholder { min-height: 480px; display: grid; align-content: center; justify-items: center; gap: 8px; padding: 36px; text-align: center; color: var(--muted); }
.preview-placeholder p { max-width: 260px; margin: 0; font-size: 12px; line-height: 1.6; }
.preview-folder-icon { width: 56px; height: 56px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: white; color: var(--green); font: 500 27px Georgia, serif; }
.preview-content { padding: 22px; }
.preview-heading { display: flex; justify-content: space-between; gap: 14px; align-items: start; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.preview-heading h3 { margin: 5px 0 0; font: 500 22px/1.35 Georgia, "Noto Serif SC", serif; overflow-wrap: anywhere; }
.preview-heading .citation { flex: 0 0 auto; }
.preview-category { flex: 0 0 auto; padding: 4px 8px; background: var(--green-soft); color: var(--green); font-size: 11px; }
.preview-heading-actions { display: grid; justify-items: end; gap: 8px; }
.preview-mobile-actions { display: none; }
.preview-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; }
.preview-meta div { border-left: 2px solid var(--gold); padding-left: 8px; }
.preview-meta dt { color: var(--muted); font-size: 10px; }
.preview-meta dd { margin: 3px 0 0; font-size: 12px; }
.preview-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 18px; }
.preview-tags span { border-radius: 999px; padding: 4px 8px; background: var(--green-soft); color: var(--green); font-size: 11px; }
.preview-note { min-height: 120px; height: 210px; max-height: 70vh; overflow: auto; resize: vertical; padding: 13px; border: 1px solid var(--line); background: white; white-space: pre-wrap; font-size: 12px; line-height: 1.7; }
.preview-section-title { margin: 21px 0 9px; font-size: 13px; }
.attachment-list { display: grid; gap: 7px; }
.attachment-item { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 9px; border: 1px solid var(--line); background: white; }
.attachment-item span:first-child { color: var(--red); font-size: 10px; font-weight: 700; }
.attachment-item strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.attachment-actions { display: flex; align-items: center; gap: 7px; }
.attachment-actions button { padding: 5px 9px; color: var(--green); font-size: 11px; }
.attachment-actions a { color: var(--green); font-size: 11px; }
.attachment-preview-host:empty { display: none; }
.attachment-preview { width: 100%; height: 430px; margin-top: 12px; border: 1px solid var(--line); background: white; }
.attachment-preview.image { height: auto; max-height: 430px; object-fit: contain; }
.preview-edit-form { display: grid; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); background: #f8f5ed; }
.preview-edit-actions { display: flex; justify-content: flex-end; gap: 8px; }
.preview-edit-actions button { padding: 7px 12px; }
.empty { color: var(--muted); padding: 32px 0; }

.model-control-panel { background: var(--surface); border: 1px solid var(--line); padding: 24px; margin-bottom: 34px; }
.model-select-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.model-select-grid small { color: var(--muted); font-weight: 400; }
.model-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.model-presets > span { color: var(--muted); font-size: 12px; margin-right: 4px; }
.model-presets button { padding: 7px 11px; }
.model-save-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 12px; }
.model-save-row .status { margin: 0; }
.model-catalog-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.model-catalog-heading h3 { margin: 0 0 5px; font: 500 24px Georgia, "Noto Serif SC", serif; }
.model-catalog-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.model-catalog-heading a, .model-card-actions a { color: var(--green); font-size: 13px; }
.model-card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.model-card { position: relative; background: var(--surface); border: 1px solid var(--line); padding: 20px; overflow: hidden; }
.model-card.selected-vision { box-shadow: inset 4px 0 0 var(--gold); }
.model-card.selected-document { box-shadow: inset 0 4px 0 #7294a8; }
.model-card.selected-vision.selected-document { box-shadow: inset 4px 0 0 var(--gold), inset 0 4px 0 #7294a8; }
.model-card.selected-answer { border-color: var(--green); }
.model-card.selected-vision.selected-answer { background: #fbfcf8; }
.model-card-top { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.model-card-top h3 { margin: 5px 0 0; font: 500 21px Georgia, "Noto Serif SC", serif; }
.model-card-top code { color: var(--muted); font-size: 11px; background: #f1efe8; padding: 5px 7px; border-radius: 3px; }
.model-tier { color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.model-capabilities { display: flex; flex-wrap: wrap; gap: 6px; margin: 15px 0; }
.capability { border-radius: 999px; border: 1px solid var(--line); color: var(--muted); padding: 3px 8px; font-size: 11px; }
.capability.yes { background: var(--green-soft); border-color: transparent; color: var(--green); }
.capability.no { color: var(--red); }
.capability.thinking { background: #f7ead6; border-color: transparent; color: #7b5622; }
.model-summary { min-height: 44px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.model-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0 10px; }
.model-facts div { border-top: 1px solid var(--line); padding-top: 8px; }
.model-facts dt { color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.model-facts dd { margin: 4px 0 0; font-size: 12px; font-weight: 600; line-height: 1.45; }
.price-note { min-height: 32px; margin: 0 0 14px; color: var(--muted); font-size: 11px; }
.model-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.model-card-actions button { padding: 7px 10px; font-size: 12px; }
.model-card-actions button:disabled { cursor: not-allowed; opacity: .4; }
.model-card-actions a { margin-left: auto; }
.model-price-date { color: var(--muted); font-size: 12px; text-align: right; margin-top: 12px; }
.journal-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.journal-heading-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.journal-streak { min-width: 126px; padding: 10px 14px; border-left: 3px solid var(--gold); background: var(--surface); }
.journal-streak span { display: block; font: 500 28px Georgia, serif; }
.journal-streak small { color: var(--muted); }
.journal-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.journal-form, .journal-history { border: 1px solid var(--line); background: var(--surface); }
.journal-form { display: grid; gap: 18px; padding: 26px; }
.journal-form-head, .journal-history-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.journal-form-head h3, .journal-history-head h3 { margin: 3px 0 0; font: 500 23px Georgia, "Noto Serif SC", serif; }
.journal-cross-check { display: grid; gap: 14px; margin: 2px 0; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.journal-cross-check-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.journal-cross-check-head h4 { margin: 3px 0 0; font-size: 15px; }
.cross-check-state { flex: 0 0 auto; padding: 5px 8px; border: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 700; }
.cross-check-state.aligned, .cross-check-state.mostly_aligned { border-color: #8ca99b; color: var(--green); background: var(--green-soft); }
.cross-check-state.mixed, .cross-check-state.insufficient { border-color: #c7a75c; color: #775b18; background: #fff8e6; }
.cross-check-state.conflict { border-color: #c58d87; color: var(--red); background: #fff1ef; }
.journal-cross-check-controls { align-items: end; }
.cross-check-uploaders { display: grid; gap: 8px; }
.cross-check-uploaders > label { color: var(--muted); font-size: 11px; }
.cross-check-user-results { display: grid; max-height: 180px; overflow-y: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cross-check-user-results button { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 4px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; text-align: left; }
.cross-check-user-results button:last-child { border-bottom: 0; }
.cross-check-user-results button:hover { background: #f7f5ee; }
.cross-check-user-results small { color: var(--muted); }
.journal-cross-check-action { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.journal-cross-check-action .status { margin: 0; }
.journal-cross-check-result { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 14px 18px; padding: 16px 0 0; border-top: 1px solid var(--line); }
.cross-check-score { display: grid; align-content: center; justify-items: center; min-height: 82px; border-left: 3px solid var(--gold); background: #f5f2ea; }
.cross-check-score.aligned, .cross-check-score.mostly_aligned { border-left-color: var(--green); background: var(--green-soft); }
.cross-check-score.conflict { border-left-color: var(--red); background: #fff1ef; }
.cross-check-score strong { font: 500 26px Georgia, serif; }
.cross-check-score span { margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.cross-check-summary { align-self: center; margin: 0; line-height: 1.7; }
.cross-check-columns { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.journal-cross-check-result > section, .journal-cross-check-result > details, .cross-check-recommendation { grid-column: 1 / -1; }
.journal-cross-check-result h5 { margin: 0 0 8px; font-size: 11px; }
.journal-cross-check-result ul { display: grid; gap: 8px; margin: 0; padding-left: 18px; }
.journal-cross-check-result li { color: var(--muted); font-size: 11px; line-height: 1.6; }
.journal-cross-check-result li small { display: block; margin-top: 3px; }
.cross-check-citation { display: inline-block; margin-right: 4px; color: var(--green); font-weight: 700; }
.cross-check-recommendation { margin: 0; padding: 11px 12px; border-left: 2px solid var(--gold); background: #faf8f2; font-size: 12px; line-height: 1.65; }
.cross-check-recommendation strong { margin-right: 8px; }
.journal-cross-check-result details summary { color: var(--green); cursor: pointer; font-size: 11px; font-weight: 700; }
.cross-check-evidence { margin-top: 10px !important; }
.cross-check-evidence li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
.cross-check-evidence small { margin: 0 !important; white-space: nowrap; }
.cross-check-detail { padding: 14px 15px; border-left: 3px solid var(--gold); background: #faf8f2; }
.cross-check-detail.aligned, .cross-check-detail.mostly_aligned { border-left-color: var(--green); background: var(--green-soft); }
.cross-check-detail.conflict, .cross-check-detail.missing { border-left-color: var(--red); background: #fff1ef; }
.cross-check-detail > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cross-check-detail > div span { font-size: 11px; font-weight: 700; }
.cross-check-detail details { margin-top: 10px; font-size: 11px; }
.cross-check-detail li { margin-top: 7px; }
.cross-check-detail li small { display: block; color: var(--muted); }
.viewer-field { margin: 0; padding: 14px 16px; border: 1px solid var(--line); }
.viewer-field legend { padding: 0 7px; font-size: 13px; font-weight: 600; }
.viewer-search-label { display: block; margin-bottom: 7px; font-size: 12px; }
.viewer-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; margin-top: 12px; }
.viewer-options label { display: flex; align-items: center; gap: 7px; min-width: 0; font-weight: 400; }
.viewer-options input { width: auto; }
.viewer-options span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-options strong, .viewer-options small { display: block; overflow: hidden; text-overflow: ellipsis; }
.viewer-options small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.selected-viewers { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.selected-viewer { display: inline-flex; align-items: center; gap: 5px; padding: 4px 5px 4px 9px; border: 1px solid var(--line); background: #faf8f2; font-size: 12px; }
.selected-viewer button { width: 24px; height: 24px; padding: 0; border: 0; color: var(--muted); font-size: 18px; line-height: 1; }
.selected-viewer button:hover { color: var(--danger); }
.position-control { display: grid; grid-template-columns: minmax(250px, 1.25fr) minmax(150px, .75fr) minmax(120px, .55fr); gap: 14px; align-items: end; }
.segmented-control { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin: 0; padding: 4px; border: 1px solid var(--line); background: #f5f2ea; }
.segmented-control legend { padding: 0 7px; color: var(--muted); font-size: 12px; font-weight: 600; }
.segmented-control label { position: relative; display: block; font-weight: 500; }
.segmented-control input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.segmented-control span { display: block; padding: 9px 12px; border: 1px solid transparent; text-align: center; }
.segmented-control input:checked + span { border-color: var(--green); background: white; color: var(--green); font-weight: 700; }
.segmented-control input:focus-visible + span { outline: 2px solid #b8cbc4; }
.journal-file-summary { margin-top: -10px; padding: 10px 12px; border-left: 2px solid var(--gold); color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.journal-existing-attachments { display: grid; gap: 8px; padding: 13px; border: 1px solid var(--line); background: #faf8f2; }
.journal-existing-attachments > strong, .journal-card-attachments > strong { font-size: 12px; }
.journal-existing-attachments > small { color: var(--muted); line-height: 1.5; }
.journal-history { min-height: 620px; overflow: hidden; }
.journal-history-head { padding: 20px; border-bottom: 1px solid var(--line); }
.journal-history-actions { display: flex; align-items: center; gap: 10px; }
.journal-history-actions .status { margin: 0; font-size: 12px; }
.journal-filter-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); background: #faf8f2; }
.journal-filter-row input, .journal-filter-row select { padding: 8px 9px; font-size: 12px; }
.journal-library-layout { display: grid; grid-template-columns: minmax(430px, .95fr) minmax(0, 1.05fr); min-height: 520px; }
.journal-list-pane { min-width: 0; border-right: 1px solid var(--line); }
.journal-columns, .journal-row { display: grid; grid-template-columns: minmax(126px, 1.35fr) minmax(92px, .95fr) 62px 72px minmax(88px, .8fr); gap: 8px; align-items: center; }
.journal-columns { min-height: 36px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #f5f2ea; color: var(--muted); font-size: 10px; font-weight: 700; }
.journal-list { max-height: 66vh; overflow-y: auto; }
.journal-empty { padding: 38px 22px; color: var(--muted); text-align: center; line-height: 1.7; }
.journal-row { min-height: 72px; padding: 11px 12px; border-bottom: 1px solid #e8e4da; cursor: pointer; transition: background .15s ease, box-shadow .15s ease; }
.journal-row:last-child { border-bottom: 0; }
.journal-row:hover, .journal-row:focus-visible { outline: 0; background: #f7f5ee; }
.journal-row.selected { background: var(--green-soft); box-shadow: inset 3px 0 0 var(--green); }
.journal-summary-title, .journal-summary-asset { min-width: 0; }
.journal-summary-title strong, .journal-summary-title time, .journal-summary-asset strong, .journal-summary-asset small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.journal-summary-title strong, .journal-summary-asset strong { font-size: 12px; }
.journal-summary-title time, .journal-summary-asset small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.journal-summary-owner, .journal-summary-pnl { min-width: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.journal-summary-pnl { color: var(--ink); font-weight: 600; }
.trade-status { display: inline-flex; align-items: center; min-height: 22px; padding: 3px 8px; border-radius: 999px; background: #eeeae1; color: var(--muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.trade-status.open { background: var(--green-soft); color: var(--green); }
.trade-status.closed { background: #e7ecef; color: #425c68; }
.trade-status.planned { background: #f7ead6; color: #7b5622; }
.journal-detail { min-width: 0; max-height: 72vh; overflow-y: auto; background: #fffdf8; }
.journal-detail-placeholder { display: grid; place-items: center; align-content: center; min-height: 520px; padding: 30px; color: var(--muted); text-align: center; }
.journal-detail-placeholder strong { color: var(--ink); }
.journal-detail-placeholder p { max-width: 330px; margin: 8px 0 0; font-size: 12px; line-height: 1.6; }
.journal-detail-content { padding: 24px; }
.journal-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.journal-detail-head h3 { margin: 4px 0 7px; font: 500 25px Georgia, "Noto Serif SC", serif; overflow-wrap: anywhere; }
.journal-detail-head p { margin: 0; color: var(--muted); font-size: 12px; }
.journal-detail-head > div:last-child { display: flex; align-items: center; gap: 7px; }
.close-journal-detail { padding: 5px 9px; font-size: 11px; }
.journal-detail-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 18px 0 0; border: 1px solid var(--line); }
.journal-detail-facts div { min-width: 0; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.journal-detail-facts div:nth-child(odd) { border-right: 1px solid var(--line); }
.journal-detail-facts div:nth-last-child(-n + 2) { border-bottom: 0; }
.journal-detail-facts dt { color: var(--muted); font-size: 10px; font-weight: 700; }
.journal-detail-facts dd { margin: 5px 0 0; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.journal-detail-section { margin-top: 20px; }
.journal-detail-section h4 { margin: 0 0 7px; font-size: 12px; }
.journal-detail-section > p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.trade-timeline { position: relative; display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.trade-timeline::before { position: absolute; top: 7px; bottom: 7px; left: 80px; width: 1px; background: var(--line); content: ""; }
.trade-timeline li { position: relative; display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 24px; font-size: 11px; }
.trade-timeline li::before { position: absolute; top: 5px; left: 76px; width: 7px; height: 7px; border: 2px solid var(--surface); border-radius: 50%; background: var(--gold); content: ""; }
.trade-timeline time { color: var(--muted); }
.trade-timeline strong, .trade-timeline span { display: block; }
.trade-timeline span { margin-top: 3px; color: var(--muted); }
.trade-timeline p { margin: 6px 0 0; line-height: 1.55; white-space: pre-wrap; }
.journal-detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); }
.journal-detail-actions button { padding: 7px 10px; font-size: 11px; }
.journal-detail-actions .danger { color: var(--red); }
.trade-update-form { display: grid; gap: 11px; margin-top: 13px; padding: 13px; border: 1px solid var(--line); background: #f8f5ed; }
.trade-update-form button { justify-self: end; }
.journal-card-attachments { display: grid; gap: 7px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.journal-attachment-item { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 11px; }
.journal-attachment-item > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.journal-attachment-actions { display: flex; gap: 8px; }
.journal-attachment-actions a { color: var(--green); }
.journal-execution-dialog { width: min(92vw, 580px); padding: 0; border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: 0 24px 80px rgba(23, 34, 32, .22); }
.journal-execution-dialog::backdrop { background: rgba(23, 34, 32, .48); }
.journal-execution-dialog form { display: grid; gap: 17px; padding: 24px; }
.dialog-heading, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog-heading h3 { margin: 3px 0 0; font: 500 23px Georgia, "Noto Serif SC", serif; }
.dialog-heading > button { width: 34px; height: 34px; padding: 0; font-size: 20px; }
.dialog-actions { justify-content: flex-end; padding-top: 4px; }
.member-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.member-manager { border: 1px solid var(--line); background: var(--surface); }
.member-columns, .member-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) 90px 110px minmax(180px, 1fr) 86px; gap: 14px; align-items: center; }
.member-columns { padding: 10px 16px; border-bottom: 1px solid var(--line); background: #faf8f2; color: var(--muted); font-size: 11px; }
.member-row { min-height: 72px; padding: 12px 16px; border-bottom: 1px solid #e8e4da; }
.member-row:last-child { border-bottom: 0; }
.member-identity { min-width: 0; }
.member-identity strong, .member-identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-identity small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.member-state { justify-self: start; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.member-state.active { background: var(--green-soft); color: var(--green); }
.member-state.inactive { background: #eeeae1; color: var(--muted); }
.member-row time, .member-content-count, .member-action-note { color: var(--muted); font-size: 12px; }
.member-actions { display: flex; justify-content: flex-end; }
.member-actions button { min-width: 62px; padding: 7px 10px; font-size: 12px; }
.model-provider-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.model-provider-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.model-provider-card { min-width: 0; display: grid; gap: 16px; padding: 22px; border: 1px solid var(--line); background: var(--surface); }
.model-provider-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.model-provider-card-heading h3 { margin: 0 0 5px; font: 500 22px Georgia, "Noto Serif SC", serif; }
.model-provider-card-heading code { color: var(--muted); font-size: 11px; }
.model-provider-card label small { color: var(--muted); font-weight: 400; }
.provider-enabled, .clear-provider-key { display: flex; grid-auto-flow: column; align-items: center; justify-content: start; gap: 7px; }
.provider-enabled input, .clear-provider-key input { width: auto; }
.model-provider-test { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; align-items: end; padding: 14px; border: 1px solid var(--line); background: #faf8f2; }
.model-provider-test-actions { display: flex; gap: 8px; }
.model-provider-test-actions button { padding: 9px 12px; white-space: nowrap; }
.model-provider-test-actions button:disabled { cursor: default; opacity: .45; }
.provider-test-status { grid-column: 1 / -1; min-height: 18px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.provider-test-status.success { color: var(--green); }
.provider-test-status.error { color: var(--red); }
.model-provider-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.clear-provider-key { color: var(--muted); font-size: 11px; font-weight: 400; }

@media (max-width: 720px) {
  body.preview-modal-open, body.journal-detail-open { overflow: hidden; }
  .shell { padding: 18px 16px 48px; }
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 16px; }
  .topbar > div:first-child { min-width: 0; }
  .topbar nav { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .nav-button { min-width: 0; padding: 8px 10px; white-space: nowrap; }
  .account-menu { grid-column: 2; grid-row: 1; }
  .account-button { max-width: 155px; }
  .account-dropdown { position: fixed; top: 68px; right: 16px; }
  .stats { margin-bottom: 38px; }
  .stats > div { padding: 13px; flex-direction: column; gap: 2px; }
  .stats > .asset-class-breakdown { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .asset-class-breakdown dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asset-class-breakdown dl > div { padding: 7px 8px; border-left: 0; border-top: 1px solid var(--line); }
  .hero h2 { font-size: 30px; }
  .intake-head { align-items: stretch; flex-direction: column; }
  .intake-head > button { align-self: flex-start; }
  .library-head { align-items: flex-start; gap: 12px; }
  .library-head-actions { flex-direction: column; }
  .library-head-actions button { padding: 7px 11px; }
  .ask-actions { align-items: stretch; flex-direction: column; }
  .conversation-workspace { grid-template-columns: 1fr; min-height: 0; }
  .conversation-sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .conversation-list { max-height: 220px; overflow-y: auto; }
  .conversation-header { padding: 17px 16px; flex-direction: column; }
  .conversation-header-actions { width: 100%; }
  .conversation-header-actions button { flex: 1; }
  .conversation-empty { min-height: 280px; padding: 34px 18px; }
  .conversation-thread { padding: 6px 16px 18px; }
  .conversation-message-user { width: 92%; }
  .conversation-evidence-row { grid-template-columns: 1fr; gap: 4px; }
  .conversation-composer { position: static; padding: 15px; }
  .admin-conversation-layout { grid-template-columns: 1fr; }
  .admin-conversation-layout .question-log-list { max-height: none; }
  .admin-conversation-form-grid { grid-template-columns: 1fr; }
  .ask-scope-grid, .ask-custom-dates { grid-template-columns: 1fr; }
  .question-log-filters { grid-template-columns: 1fr 1fr; }
  .question-log-filters > label:first-child, .question-log-filters > button { grid-column: 1 / -1; }
  .question-log-row { grid-template-columns: 1fr; }
  .question-log-meta { text-align: left; }
  .ask-actions .primary { width: 100%; }
  .command-model-control { align-items: stretch; flex-direction: column; }
  .command-model-control label { min-width: 0; }
  .capture-actions, .trading-comment-actions { width: 100%; grid-template-columns: 1fr; align-items: stretch; }
  .capture-actions button, .trading-comment-actions button { width: 100%; }
  .evidence-list, .form-grid.two, .form-grid.three, .library-filters, .model-select-grid, .model-card-grid, .library-explorer, .journal-layout, .profile-layout, .position-control { grid-template-columns: 1fr; }
  .date-search-bar { grid-template-columns: 1fr 1fr; }
  .date-search-bar > label:first-child, .date-search-bar > button { grid-column: 1 / -1; }
  .date-search-bar button { width: 100%; }
  .history-row { grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; }
  .history-row time { grid-column: 1; }
  .history-row .trade-status { grid-column: 2; grid-row: 1 / 3; }
  .viewer-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-form, .answer-panel { padding: 19px; }
  .intake-dialog { width: 100vw; height: 100dvh; border: 0; }
  .intake-dialog .intake-head { padding: 14px 16px; }
  .intake-dialog .intake-head .hero p:last-child { display: none; }
  .intake-steps { top: 78px; }
  .intake-dialog .draft-banner { margin: 12px 16px 0; }
  .intake-dialog .batch-upload-panel { margin: 0 16px 20px; }
  .explorer-list-pane { border-right: 0; border-bottom: 1px solid var(--line); }
  .batch-upload-panel { padding: 16px; }
  .batch-panel-heading, .batch-controls { align-items: stretch; flex-direction: column; }
  .batch-controls > div { justify-content: space-between; }
  .batch-controls > div:last-child { flex-wrap: wrap; }
  .batch-controls > div:last-child button { flex: 1; min-width: 112px; }
  .batch-file-row { grid-template-columns: minmax(0, 1fr) 78px; gap: 8px; }
  .batch-file-progress { grid-column: 1 / -1; }
  .batch-draft-editor { padding: 16px; }
  .batch-draft-heading { flex-direction: column; }
  .explorer-columns { display: none; }
  .library-row { grid-template-columns: minmax(0, 1fr) 34px; }
  .library-row .file-date, .library-row .file-kind { display: none; }
  .desktop-file-count { display: none; }
  .mobile-row-preview { display: inline; color: var(--green); font-weight: 700; }
  .document-preview { display: none; }
  .document-preview.mobile-open { position: fixed; inset: 0; z-index: 2000; display: block; min-height: 100dvh; overflow-y: auto; background: var(--surface); }
  .document-preview.mobile-open .preview-content { padding: 16px; }
  .document-preview.mobile-open .preview-heading { position: sticky; top: 0; z-index: 2; margin: -16px -16px 16px; padding: 14px 16px; background: var(--surface); }
  .preview-mobile-actions { display: flex; gap: 6px; }
  .preview-mobile-actions button { padding: 6px 9px; font-size: 11px; }
  .preview-heading-actions { min-width: 116px; }
  .preview-meta { grid-template-columns: 1fr; }
  .preview-note { max-height: 70vh; }
  .attachment-item { grid-template-columns: 30px minmax(0, 1fr); }
  .attachment-actions { grid-column: 2; justify-content: flex-end; }
  .attachment-actions button, .attachment-actions a { padding: 7px 10px; }
  .attachment-preview { height: 55vh; }
  .preview-placeholder .close-mobile-preview { position: absolute; top: 14px; right: 14px; }
  .explorer-toolbar { align-items: stretch; flex-direction: column; }
  .explorer-toolbar > div { justify-content: flex-end; }
  .model-control-panel { padding: 18px; }
  .model-save-row, .model-catalog-heading { align-items: stretch; flex-direction: column; }
  .model-save-row .primary { width: 100%; }
  .model-facts { grid-template-columns: 1fr 1fr; }
  .journal-heading { align-items: stretch; flex-direction: column; }
  .journal-heading-actions { align-items: stretch; justify-content: space-between; margin: -10px 0 22px; }
  .journal-streak { min-width: 108px; }
  .journal-heading-actions > .primary { align-self: center; }
  .journal-form { padding: 19px; }
  .journal-cross-check-head, .journal-cross-check-action { align-items: stretch; flex-direction: column; }
  .journal-cross-check-action button { width: 100%; }
  .journal-cross-check-result { grid-template-columns: 1fr; }
  .cross-check-score { min-height: 72px; }
  .cross-check-summary, .cross-check-columns { grid-column: 1; }
  .cross-check-columns { grid-template-columns: 1fr; }
  .cross-check-evidence li { grid-template-columns: 1fr; gap: 2px; }
  .cross-check-evidence small { white-space: normal; }
  .journal-history { position: static; max-height: none; }
  .journal-history-head { align-items: flex-start; padding: 16px; }
  .journal-history-actions { align-items: flex-end; flex-direction: column; }
  .journal-library-layout { grid-template-columns: 1fr; min-height: 360px; }
  .journal-list-pane { border-right: 0; }
  .journal-columns { display: none; }
  .journal-list { max-height: none; }
  .journal-row { grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; min-height: 84px; padding: 12px 14px; }
  .journal-summary-title { grid-column: 1; grid-row: 1; }
  .journal-summary-asset { grid-column: 1; grid-row: 2; }
  .journal-row .trade-status { grid-column: 2; grid-row: 1; }
  .journal-summary-owner { grid-column: 2; grid-row: 2; text-align: right; }
  .journal-summary-pnl { grid-column: 1 / -1; grid-row: 3; }
  .journal-detail { display: none; }
  .journal-detail.mobile-open { position: fixed; inset: 0; z-index: 2000; display: block; max-height: none; min-height: 100dvh; overflow-y: auto; background: var(--surface); }
  .journal-detail-content { padding: 16px; }
  .journal-detail-head { position: sticky; top: 0; z-index: 2; margin: -16px -16px 16px; padding: 14px 16px; background: var(--surface); }
  .journal-detail-head h3 { font-size: 20px; }
  .journal-detail-head .section-label { display: none; }
  .journal-detail-facts { grid-template-columns: 1fr; }
  .journal-detail-facts div:nth-child(odd) { border-right: 0; }
  .journal-detail-facts div:nth-last-child(2) { border-bottom: 1px solid var(--line); }
  .journal-detail-actions { justify-content: stretch; }
  .journal-detail-actions button { flex: 1; min-width: 115px; }
  .journal-filter-row { grid-template-columns: 1fr; }
  .journal-execution-dialog { width: calc(100vw - 24px); }
  .journal-execution-dialog form { padding: 18px; }
  .member-heading, .model-provider-heading { flex-direction: column; }
  .model-provider-list { grid-template-columns: 1fr; }
  .model-provider-card { padding: 18px; }
  .model-provider-test { grid-template-columns: 1fr; }
  .model-provider-test-actions button { flex: 1; }
  .model-provider-actions { align-items: stretch; flex-direction: column; }
  .model-provider-actions .primary { width: 100%; }
  .member-columns { display: none; }
  .member-row { grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; }
  .member-state { grid-column: 2; grid-row: 1; }
  .member-row time, .member-content-count { grid-column: 1; }
  .member-actions { grid-column: 2; grid-row: 2 / 4; align-self: center; }
}
