:root {
  color-scheme: light;
  --ink: #192620;
  --muted: #68746e;
  --green: #176f5b;
  --green-dark: #0d5746;
  --green-soft: #e9f5f1;
  --amber: #b9781e;
  --amber-soft: #fff5df;
  --surface: #fff;
  --canvas: #f4f6f3;
  --line: #dce3de;
  --shadow: 0 18px 50px rgba(28, 52, 43, .10);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 14px/1.45 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, .upload-drop:focus-within { outline: 2px solid var(--green); outline-offset: 2px; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.eyebrow { margin: 0 0 5px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
h1, h2, h3, p { margin-top: 0; }
.login-shell { min-height: 100%; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 20% 10%, #dff1ea, transparent 34%), linear-gradient(135deg, #f8faf8, #edf3ee); }
.login-card { width: min(510px, 100%); padding: 44px; border: 1px solid rgba(255,255,255,.8); background: rgba(255,255,255,.9); border-radius: 28px; box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.brand-mark, .assistant-orb { display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #23856e, #105b4a); box-shadow: 0 10px 24px rgba(16,91,74,.25); }
.brand-mark { width: 58px; height: 58px; margin-bottom: 28px; border-radius: 18px; font-weight: 800; letter-spacing: .06em; }
.login-card h1 { margin-bottom: 14px; font-size: clamp(28px, 5vw, 40px); line-height: 1.06; letter-spacing: -.04em; }
.lede { color: var(--muted); font-size: 16px; }
label { display: grid; gap: 7px; color: #34453e; font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #ccd6d0; background: #fff; color: var(--ink); border-radius: 12px; padding: 11px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,111,91,.12); }
textarea { resize: vertical; }
.token-field { position: relative; }
.token-field input { padding-right: 48px; }
.token-field .icon-button { position: absolute; right: 5px; top: 4px; }
.button { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 750; }
.button.primary { color: #fff; background: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { color: var(--green); background: var(--green-soft); }
.button.ghost { color: var(--ink); background: #edf1ee; }
.button.wide { width: 100%; margin-top: 15px; }
.button.compact { padding: 8px 11px; font-size: 12px; }
.icon-button, .link-button { border: 0; background: transparent; color: var(--muted); }
.icon-button { min-width: 38px; min-height: 38px; border-radius: 10px; }
.icon-button:hover { background: #edf1ee; }
.link-button { padding: 0; color: var(--green); font-weight: 750; }
.safety-note { display: flex; align-items: center; gap: 9px; margin: 22px 0 0; color: var(--muted); font-size: 12px; }
.safety-dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(185,120,30,.13); }
.app-shell { height: 100vh; height: 100dvh; min-height: 0; display: grid; grid-template-columns: 260px minmax(380px, 1fr) minmax(350px, 430px); overflow: hidden; }
.sidebar, .proposal-panel { background: var(--surface); }
.sidebar { min-height: 0; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); }
.sidebar-head { display: grid; gap: 18px; padding: 20px 18px 14px; }
.sidebar-head > div { display: flex; align-items: center; gap: 10px; }
.brand-small { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; background: var(--green); font-size: 11px; font-weight: 900; }
.section-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px 12px 10px; }
.section-tab { flex: 1; border: 0; border-radius: 9px; padding: 8px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 750; }
.section-tab.active { color: var(--ink); background: #eef2ef; }
.thread-list { min-height: 0; flex: 1; overflow: auto; padding: 4px 10px; }
.thread-card { width: 100%; display: grid; gap: 4px; padding: 12px; border: 0; border-radius: 12px; text-align: left; color: var(--ink); background: transparent; }
.thread-card:hover, .thread-card.active { background: var(--green-soft); }
.thread-card strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.thread-card span { color: var(--muted); font-size: 11px; }
.sidebar-foot { display: grid; gap: 13px; padding: 16px 18px; border-top: 1px solid var(--line); }
.sidebar-foot > div { display: flex; gap: 9px; color: var(--muted); font-size: 11px; }
.chat-main { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto auto; background: #f8faf8; }
.chat-header { grid-row: 1; min-height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 15px 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.86); backdrop-filter: blur(10px); }
.chat-header h2 { margin: 0; font-size: 18px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.status-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; color: var(--muted); background: #edf1ee; font-size: 11px; font-weight: 800; }
.status-pill.amber { color: #7a4d0d; background: var(--amber-soft); }
.connection-banner { grid-row: 2; margin: 12px 24px 0; padding: 10px 13px; border: 1px solid #efd7a9; border-radius: 12px; color: #72531c; background: var(--amber-soft); font-size: 12px; }
.empty-chat { grid-row: 3; align-self: center; justify-self: center; max-width: 690px; padding: 40px; text-align: center; }
.assistant-orb { width: 64px; height: 64px; margin: 0 auto 22px; border-radius: 21px; font-weight: 850; }
.empty-chat h2 { margin-bottom: 8px; font-size: 25px; }
.empty-chat > p { color: var(--muted); font-size: 15px; }
.starter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 25px; }
.starter { min-height: 88px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; color: #3d5047; background: #fff; text-align: left; font-size: 12px; font-weight: 700; }
.starter:hover { border-color: #9fc6ba; box-shadow: 0 6px 18px rgba(25,65,52,.07); }
.message-feed { grid-row: 3; min-height: 0; overflow: auto; padding: 28px max(24px, calc((100% - 760px) / 2)); scroll-behavior: smooth; }
.message { display: flex; gap: 10px; margin: 0 0 20px; }
.message.user { justify-content: flex-end; }
.message-bubble { max-width: 82%; border-radius: 17px; padding: 12px 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.assistant .message-bubble { border: 1px solid var(--line); background: #fff; border-bottom-left-radius: 5px; }
.message.user .message-bubble { color: #fff; background: var(--green); border-bottom-right-radius: 5px; }
.message.pending .message-bubble { opacity: .78; }
.message-meta { display: block; margin-top: 7px; opacity: .72; font-size: 11px; }
.thinking-dots { display: inline-flex; align-items: center; gap: 4px; min-width: 38px; min-height: 14px; }
.thinking-dots i { width: 6px; height: 6px; border-radius: 50%; background: #7d9188; animation: thinking-pulse 1s infinite ease-in-out; }
.thinking-dots i:nth-child(2) { animation-delay: .14s; }
.thinking-dots i:nth-child(3) { animation-delay: .28s; }
@keyframes thinking-pulse { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
  .thinking-dots i { animation: none; opacity: .55; }
  .message-feed { scroll-behavior: auto; }
  .vault-card:hover { transform: none; }
  .line-highlight { animation: none; background: var(--amber-soft); }
}
.message-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 9px; padding: 6px 8px; color: inherit; background: rgba(127,140,132,.12); text-decoration: none; font-size: 11px; }
.file-thumb img { display: block; max-width: min(220px, 100%); max-height: 150px; border-radius: 10px; border: 1px solid rgba(25,38,32,.14); }
.pending-thumb { width: 26px; height: 26px; flex: 0 0 auto; object-fit: cover; border-radius: 6px; }
.attachment-tray { grid-row: 4; display: flex; gap: 8px; overflow-x: auto; padding: 8px 24px 0; }
.pending-file { display: flex; align-items: center; gap: 8px; max-width: 230px; border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; background: #fff; font-size: 11px; }
.pending-file span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pending-file button { border: 0; color: var(--muted); background: transparent; }
.composer { grid-row: 5; align-self: end; display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 12px 24px 4px; border: 1px solid #cbd7d0; border-radius: 18px; padding: 10px 10px 10px 15px; background: #fff; box-shadow: 0 8px 30px rgba(28,52,43,.08); }
.composer textarea { min-height: 44px; max-height: 150px; border: 0; padding: 10px 0; box-shadow: none; resize: none; }
.composer-actions { display: flex; align-items: flex-end; gap: 3px; }
.composer-button, .send-button { display: grid; place-items: center; width: 39px; height: 39px; border: 0; border-radius: 12px; background: transparent; }
.composer-button:hover { background: #edf2ef; }
.composer-button input { display: none; }
.send-button { color: #fff; background: var(--green); }
.send-button:disabled { opacity: .5; cursor: wait; }
.recording-status { align-self: center; color: #b74335; font-size: 11px; font-weight: 800; }
.composer-hint { grid-row: 6; margin: 4px 24px 13px; color: #5e6a64; text-align: center; font-size: 11px; }
.proposal-panel { overflow: auto; border-left: 1px solid var(--line); }
.proposal-empty { display: grid; place-items: center; align-content: center; min-height: 100%; padding: 40px; color: var(--muted); text-align: center; }
.proposal-empty h3 { margin: 12px 0 6px; color: var(--ink); }
.document-icon { font-size: 34px; color: var(--green); }
#proposal-content { padding: 21px; }
.proposal-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.proposal-heading-actions { display: flex; align-items: center; gap: 6px; }
.mobile-only { display: none; }
.mobile-logout-button { display: none; }
.overlay-toggle { display: none; }
.proposal-heading h2 { margin: 0; font-size: 20px; }
.proposal-section { margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); }
.proposal-section h3 { margin: 0 0 12px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.compact-grid { gap: 9px; }
.span-two { grid-column: 1 / -1; }
.check { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 7px; }
.check input { width: auto; }
.line-item { margin-bottom: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.line-main { display: grid; grid-template-columns: 1fr 64px 94px 26px; gap: 6px; }
.line-item input { padding: 8px; font-size: 12px; }
.line-supplier { display: grid; grid-template-columns: 1.3fr .7fr; gap: 6px; margin-top: 6px; }
.line-tax-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 7px; }
.line-tax-facts label { gap: 3px; color: var(--muted); font-size: 11px; }
.line-tax-facts select { padding: 7px; font-size: 12px; }
.line-tax-info { margin-top: 7px; }
.line-tax-result { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; color: #725b34; font-size: 11px; }
.tax-chip { display: inline-flex; align-items: center; flex: 0 0 auto; border-radius: 999px; padding: 3px 9px; font-size: 10px; font-weight: 800; letter-spacing: .02em; }
.tax-chip.rate-21 { color: #fff; background: var(--green); }
.tax-chip.rate-10 { color: var(--green-dark); background: var(--green-soft); border: 1px solid #a9cdc1; }
.tax-chip.exempt { color: var(--green-dark); background: #fff; border: 1px solid var(--green); }
.tax-chip.reav { color: #fff; background: var(--green-dark); }
.tax-chip.review { color: #7a4d0d; background: var(--amber-soft); border: 1px solid #efd7a9; }
.line-tax-label { flex: 1 1 140px; min-width: 0; color: var(--muted); }
.line-tax-details { width: 100%; font-size: 11px; }
.line-tax-details summary { color: var(--green); font-weight: 750; cursor: pointer; }
.line-tax-details p { margin: 6px 0 0; color: #4c5a53; }
.line-tax-mention { border-left: 3px solid var(--amber); padding-left: 8px; }
.line-tax-sources-title { font-weight: 750; }
.line-tax-sources { margin: 4px 0 0; padding-left: 16px; }
.line-tax-sources a { color: var(--green); }
.line-highlight { border-color: var(--amber); animation: line-flash 1.6s ease-out; }
@keyframes line-flash { 0% { background: var(--amber-soft); } 100% { background: #fff; } }
.remove-line { border: 0; color: #a74639; background: transparent; }
.fiscal-breakdown .section-heading span { color: var(--green); font-size: 11px; font-weight: 800; }
.breakdown-scroll { overflow-x: auto; }
.breakdown-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.breakdown-table th, .breakdown-table td { padding: 6px 5px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.breakdown-table .breakdown-label { text-align: left; white-space: normal; }
.breakdown-table thead th { color: var(--muted); font-size: 10px; letter-spacing: .05em; text-transform: uppercase; }
.breakdown-table tfoot th { border-bottom: 0; border-top: 2px solid var(--green); color: var(--green-dark); }
.breakdown-note { margin: 8px 0 0; border-left: 3px solid var(--green); padding-left: 8px; color: var(--muted); font-size: 11px; }
.fiscal-card-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.status-pill.green { color: var(--green-dark); background: var(--green-soft); }
.fiscal-completeness { margin: 8px 0 0; color: #4c5a53; font-size: 12px; }
.fiscal-risks { margin: 6px 0 0; border-left: 3px solid var(--amber); padding-left: 8px; color: #725b34; font-size: 11px; }
#fiscal-review-note { margin: 8px 0 0; color: #725b34; font-size: 12px; }
.question-link { border: 0; padding: 0; color: inherit; background: transparent; font: inherit; text-align: left; text-decoration: underline; cursor: pointer; }
.audio-transcript { margin: 6px 0 0; font-size: 11px; font-style: italic; opacity: .85; }
.invoice-total { display: flex; justify-content: space-between; margin-top: 12px; padding: 11px 0 0; border-top: 1px dashed var(--line); }
.fiscal-card { padding: 14px; border: 1px solid #efd7a9; border-radius: 13px; background: var(--amber-soft); }
.fiscal-card .section-heading span { color: #8b641f; font-size: 11px; font-weight: 800; }
.fiscal-card p { margin: 6px 0 0; color: #725b34; font-size: 12px; }
.question-box { margin-top: 14px; border-radius: 12px; padding: 12px; color: #72531c; background: var(--amber-soft); font-size: 12px; }
.question-box ul { margin: 6px 0 0; padding-left: 18px; }
.knowledge-usage { border: 1px solid #bedbd2; border-radius: 13px; padding: 13px; background: #f3faf7; }
.knowledge-usage .section-heading span { color: var(--green); font-size: 11px; font-weight: 800; }
.knowledge-usage > p { margin: 9px 0 0; color: var(--muted); font-size: 11px; }
.knowledge-match { margin-top: 8px; border-left: 3px solid var(--green); padding: 7px 9px; background: #fff; border-radius: 0 9px 9px 0; }
.knowledge-match strong, .knowledge-match span { display: block; }
.knowledge-match span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.case-actions { padding: 16px 21px 21px; }
.case-actions-heading { margin-bottom: 12px; }
.case-actions-heading h2 { margin: 0; font-size: 20px; }
#proposal-content:not(.hidden) ~ #case-actions .case-actions-heading { display: none; }
.draft-preview { margin-top: 13px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #f8faf8; font-size: 12px; }
.draft-preview ul { margin: 8px 0; padding-left: 18px; }
.draft-preview-head, .draft-artifact-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.draft-preview-head span { color: var(--muted); font-size: 11px; font-weight: 750; }
.draft-preview-total { display: flex; justify-content: space-between; margin: 10px 0; padding-top: 9px; border-top: 1px dashed var(--line); font-size: 12px; }
.draft-next-step { margin: 10px 0 0; border-radius: 9px; padding: 9px; color: #72531c; background: var(--amber-soft); }
.draft-artifact-actions { justify-content: flex-start; margin-top: 10px; }
.draft-artifact-actions .button { padding: 8px 11px; font-size: 11px; }
.dialog { width: min(700px, calc(100% - 28px)); border: 0; border-radius: 20px; padding: 0; box-shadow: 0 30px 80px rgba(12,30,23,.28); }
.dialog::backdrop { background: rgba(19,34,27,.45); backdrop-filter: blur(3px); }
.dialog form { padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; }
.dialog-heading h2 { margin: 0 0 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.form-warning { border-radius: 10px; padding: 10px; color: #72531c; background: var(--amber-soft); }
.compact-dialog { width: min(450px, calc(100% - 28px)); }
.pdf-dialog { width: min(1040px, calc(100% - 24px)); height: min(92vh, 920px); overflow: hidden; }
.pdf-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.pdf-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; padding: 16px 18px 12px; }
.pdf-dialog-heading h2 { margin: 0; font-size: 18px; }
.pdf-dialog iframe { width: 100%; height: 100%; min-height: 0; border: 0; background: #e8ece9; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 30; max-width: min(430px, calc(100% - 44px)); padding: 12px 15px; color: #fff; background: #23362e; border-radius: 11px; box-shadow: var(--shadow); }
.toast.error { background: #9a3f34; }
.muted { color: var(--muted); }

.knowledge-view { grid-column: 2 / -1; min-width: 0; overflow: auto; background: #f7f8f6; }
.knowledge-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 25px; padding: 30px 34px 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); }
.knowledge-header h1 { margin: 0 0 7px; font-size: 28px; letter-spacing: -.035em; }
.knowledge-header p:not(.eyebrow) { max-width: 760px; margin: 0; color: var(--muted); }
.knowledge-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); min-height: calc(100vh - 122px); }
.knowledge-rail { padding: 22px; border-right: 1px solid var(--line); background: #fbfcfb; }
.upload-card { padding: 20px; border: 1px solid #cfe0d8; border-radius: 18px; background: #fff; box-shadow: 0 8px 24px rgba(28,52,43,.05); }
.upload-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 13px; border-radius: 13px; color: var(--green); background: var(--green-soft); font-size: 22px; font-weight: 800; }
.upload-card h2, .source-section h2, .vault-toolbar h2 { margin: 0; font-size: 16px; }
.upload-card > p { margin: 6px 0 14px; color: var(--muted); font-size: 12px; }
.upload-drop { display: block; border: 1px dashed #87b7a8; border-radius: 12px; padding: 12px; color: var(--green); background: #f5fbf8; text-align: center; cursor: pointer; }
.upload-drop input { display: none; }
.history-file-list { max-height: 100px; overflow: auto; margin: 9px 0; font-size: 11px; }
.history-file-list span { display: block; overflow: hidden; padding: 3px 0; text-overflow: ellipsis; white-space: nowrap; }
.safety-check { margin-top: 12px; color: #6e5527; font-size: 11px; }
.upload-status { min-height: 16px; margin: 9px 0 0 !important; }
.source-section { margin-top: 24px; }
.source-section .section-heading { margin-bottom: 9px; }
.source-section .section-heading span { color: var(--muted); font-size: 11px; }
.source-list { display: grid; gap: 7px; }
.source-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.source-card > span:first-child { font-size: 18px; }
.source-card div { min-width: 0; }
.source-card strong, .source-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-card strong { font-size: 12px; }
.source-card small { color: var(--muted); font-size: 11px; }
.source-status { width: 8px; height: 8px; border-radius: 50%; background: #a7b0ab; }
.source-status.processed { background: var(--green); }
.source-status.failed { background: #b44b3f; }
.vault-main { min-width: 0; padding: 25px 28px 50px; }
.vault-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.vault-toolbar p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.vault-filters { display: grid; grid-template-columns: minmax(160px, 1.4fr) 1fr 1fr; gap: 8px; width: min(650px, 65%); }
.vault-filters input, .vault-filters select { padding: 9px 10px; font-size: 11px; }
.vault-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 17px 0; color: var(--muted); font-size: 11px; }
.vault-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.legend-dot.confirmed { background: var(--green); }
.legend-dot.discarded { background: #9da6a1; }
.knowledge-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); align-items: start; gap: 13px; }
.vault-card { position: relative; display: grid; gap: 10px; min-height: 168px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: #fff; text-align: left; box-shadow: 0 5px 18px rgba(28,52,43,.04); }
.vault-card::before { content: ""; position: absolute; top: 14px; bottom: 14px; left: 0; width: 3px; border-radius: 3px; background: var(--amber); }
.vault-card.confirmed::before { background: var(--green); }
.vault-card.discarded { opacity: .62; }
.vault-card.discarded::before { background: #9da6a1; }
.vault-card:hover { transform: translateY(-1px); border-color: #a9c9bf; box-shadow: 0 9px 25px rgba(28,52,43,.08); }
.vault-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kind-chip, .status-chip { border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 800; }
.kind-chip { color: var(--green); background: var(--green-soft); }
.status-chip { color: #775718; background: var(--amber-soft); }
.vault-card.confirmed .status-chip { color: var(--green-dark); background: var(--green-soft); }
.vault-card.discarded .status-chip { color: var(--muted); background: #eef0ef; }
.vault-card h3 { margin: 0; font-size: 15px; }
.vault-card dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 7px; margin: 0; color: var(--muted); font-size: 11px; }
.vault-card dt { font-weight: 750; }
.vault-card dd { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vault-card-foot { align-self: end; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.vault-empty { grid-column: 1 / -1; padding: 50px 20px; border: 1px dashed #cbd5cf; border-radius: 16px; color: var(--muted); text-align: center; }

.knowledge-dialog { width: min(980px, calc(100% - 28px)); }
.knowledge-review-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: 26px; }
.knowledge-review-grid h3 { margin: 15px 0 9px; font-size: 13px; }
.review-fields-heading { margin-top: 16px; }
.knowledge-fields { display: grid; gap: 7px; }
.knowledge-field { display: grid; grid-template-columns: minmax(110px, .7fr) minmax(150px, 1.3fr) 30px; gap: 6px; }
.knowledge-field input { padding: 8px; font-size: 12px; }
.knowledge-field button { border: 0; color: #a74639; background: transparent; }
.evidence-list, .knowledge-link-list { display: grid; gap: 8px; }
.evidence-card { padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: #f8faf8; }
.evidence-card button { display: block; margin-bottom: 5px; }
.evidence-card p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.evidence-card small { color: var(--green); font-size: 11px; font-weight: 750; }
.linked-card { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 9px; color: var(--ink); background: var(--green-soft); font-size: 11px; }
.linked-card span { color: var(--green); font-weight: 800; }
.knowledge-actions { flex-wrap: wrap; }
@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 230px minmax(320px, 1fr) minmax(300px, 380px); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 220px 1fr; }
  .proposal-panel { position: fixed; right: 0; top: 0; bottom: 0; z-index: 10; width: min(430px, 92vw); box-shadow: -15px 0 50px rgba(25,45,37,.15); }
  .proposal-panel:not(.has-proposal) { display: none; }
  .mobile-only { display: grid; }
  .overlay-toggle { display: inline-flex; }
  .knowledge-view { grid-column: 2; }
  .knowledge-layout { grid-template-columns: 280px minmax(0, 1fr); }
  .vault-toolbar { align-items: stretch; flex-direction: column; }
  .vault-filters { width: 100%; }
}
@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { max-height: 38vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px 4px; }
  .section-tabs { padding: 2px 12px 8px; }
  .thread-list { flex: 0 0 auto; display: flex; gap: 8px; overflow: auto hidden; padding: 0 12px 10px; }
  .thread-card { flex: 0 0 auto; width: 200px; }
  .sidebar-foot { display: none; }
  .chat-main, .knowledge-view { grid-row: 2; }
  .chat-header { align-items: flex-start; gap: 10px; padding: 12px 15px; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .mobile-logout-button { display: inline-block; align-self: center; }
  .message-feed { padding: 20px 14px; }
  .composer { margin-inline: 12px; }
  .composer-hint { margin-inline: 12px; }
  .starter-grid { grid-template-columns: 1fr; }
  .empty-chat { padding: 22px; }
  .knowledge-view { grid-column: 1; grid-row: 2; }
  .knowledge-header { flex-direction: column; padding: 22px 17px; }
  .knowledge-layout { grid-template-columns: 1fr; }
  .knowledge-rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .vault-main { padding: 20px 16px 40px; }
  .vault-filters { grid-template-columns: 1fr; }
  .knowledge-review-grid { grid-template-columns: 1fr; }
}
