:root { --ink:#17211b; --muted:#66736b; --surface:#ffffff; --line:#dce4df; --accent:#176b45; --accent2:#e7f4ed; --danger:#a73b36; }
* { box-sizing:border-box; }
body { margin:0; color:var(--ink); background:#f4f6f3; font:16px/1.5 Inter, ui-sans-serif, system-ui, sans-serif; }
button,input,textarea,select { font:inherit; }
.topbar { min-height:64px; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 28px; background:var(--surface); border-bottom:1px solid var(--line); }
.topbar>div,.operator,.form-row,.answer-header { display:flex; align-items:center; gap:12px; }
.operator { justify-content:flex-end; }
.badge { margin-left:12px; padding:3px 9px; border-radius:999px; background:var(--accent2); color:var(--accent); font-size:13px; }
.layout { display:grid; grid-template-columns:minmax(0, 1fr) 360px; gap:24px; max-width:1360px; margin:0 auto; padding:36px 28px; }
.workspace { min-width:0; }
.hero { margin-bottom:24px; }
.hero h1 { margin:4px 0 8px; font-size:clamp(28px,4vw,46px); letter-spacing:-.03em; }
.eyebrow { color:var(--accent); font-size:13px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; }
.muted { color:var(--muted); }
.question-card,.answer-card,.sources,.history-panel,.login-card { background:var(--surface); border:1px solid var(--line); border-radius:16px; box-shadow:0 8px 30px rgba(30,50,38,.05); }
.question-card,.answer-card,.sources { padding:22px; margin-bottom:18px; }
label { display:grid; gap:7px; font-weight:650; }
input,textarea,select { width:100%; border:1px solid #bfcac3; border-radius:10px; background:#fff; padding:12px 14px; color:var(--ink); }
textarea { resize:vertical; }
input:focus,textarea:focus,select:focus { outline:3px solid #cce7d8; border-color:var(--accent); }
.form-row,.answer-header { justify-content:space-between; margin-top:14px; }
button { border:0; border-radius:9px; padding:10px 15px; cursor:pointer; }
.link-button { text-decoration:none; display:inline-block; }
button:disabled { cursor:not-allowed; opacity:.6; }
.primary { color:#fff; background:var(--accent); font-weight:700; }
.ghost { color:var(--ink); background:#edf1ee; }
.danger-button { color:var(--danger); background:#fae9e8; }
.status { min-height:28px; color:var(--muted); }
.answer-text { white-space:pre-wrap; font-size:18px; }
.answer-text p { margin:0 0 12px; }.answer-text ul,.answer-text ol { margin:8px 0 4px; padding-left:25px; }.answer-text li { margin:5px 0; }
.feedback { display:flex; align-items:center; gap:8px; padding-top:14px; border-top:1px solid var(--line); }
.source { padding:0; margin-top:12px; border:1px solid var(--line); border-radius:12px; overflow:hidden; background:#fbfcfb; }
.source:first-child { border-top:0; }
.source-meta { color:var(--accent); background:var(--accent2); padding:10px 14px; font-size:13px; font-weight:700; }
.source .source-content { padding:14px; max-height:300px; overflow:auto; line-height:1.6; }.source .source-content p { margin:0 0 10px; }.source .source-content p:last-child { margin-bottom:0; }.source .source-content ul { margin:4px 0 0; padding-left:24px; }.source .source-content li { margin:4px 0; }
.source-link { display:block; padding:10px 14px; border-top:1px solid var(--line); color:var(--accent); font-weight:700; text-decoration:none; }
.source-link:hover { text-decoration:underline; }
.history-panel { align-self:start; position:sticky; top:24px; padding:20px; max-height:calc(100vh - 100px); overflow:auto; }
.history-item { padding:13px 0; border-top:1px solid var(--line); cursor:pointer; }
.history-item:first-child { border-top:0; }
.admin-layout,.library-layout { display:grid; grid-template-columns:minmax(320px,480px) minmax(0,1fr); gap:24px; max-width:1360px; margin:0 auto; padding:36px 28px; }
.library-layout { grid-template-columns:minmax(280px,360px) minmax(0,1fr); }
.library-layout .folder-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.folder-row { display:block; width:100%; text-align:left; border-radius:8px; margin:2px 0; }
.folder-row.selected { background:var(--accent2); color:var(--accent); font-weight:700; }
.selection-preview { margin:8px 0; padding-left:20px; max-height:170px; overflow:auto; font-size:13px; }
.error { color:var(--danger); }
dialog { border:1px solid var(--line); border-radius:16px; padding:24px; max-width:520px; width:calc(100% - 32px); }
.inherit-option { display:flex; align-items:center; font-weight:500; }.inherit-option input { width:auto; }
.library-layout .document-info { min-width:0; overflow-wrap:anywhere; }
.library-layout .answer-header,.library-layout .document-actions { flex-wrap:wrap; gap:8px; }
.library-layout progress { width:100%; }.library-layout .document-card { cursor:default; }
dialog::backdrop { background:rgba(23,33,27,.35); }
@media (max-width:900px) { .library-layout { grid-template-columns:1fr; padding:24px 16px; } }
.upload-panel { align-self:start; position:sticky; top:24px; }
.documents-panel { min-width:0; }
.drop-zone { padding:28px; border:2px dashed #bfcac3; border-radius:12px; text-align:center; cursor:pointer; background:#f8faf8; }
.drop-zone input { margin-top:12px; }
.document-card { background:#fff; border:1px solid var(--line); border-radius:14px; padding:18px; margin-bottom:12px; cursor:pointer; transition:border-color .15s,box-shadow .15s,opacity .15s; }
.document-card:hover,.document-card:focus { border-color:#9ab9a7; outline:none; box-shadow:0 6px 20px rgba(30,50,38,.08); }
.document-card.selected { border-color:var(--accent); box-shadow:0 0 0 3px #cce7d8; }
.document-card.archived { opacity:.68; cursor:default; }
.document-actions { display:flex; align-items:center; gap:8px; }
.status-pill { padding:4px 9px; border-radius:999px; background:#edf1ee; font-size:13px; }
.status-pill.ready { color:var(--accent); background:var(--accent2); }
.status-pill.failed { color:var(--danger); background:#fae9e8; }
.status-pill.archived { color:#6d6254; background:#eee9e2; }
.asset-list { margin-top:12px; }
.asset { padding:8px 0; border-top:1px solid var(--line); color:var(--muted); font-size:14px; }
.admin-page { max-width:1360px; margin:0 auto; padding:36px 28px; }
.admin-page h1 { font-size:clamp(28px,4vw,44px); margin:.2em 0 .8em; }
.metric-grid { display:grid; grid-template-columns:repeat(6,minmax(120px,1fr)); gap:12px; margin-bottom:28px; }
.metric-card { display:grid; gap:4px; background:#fff; border:1px solid var(--line); border-radius:14px; padding:18px; }
.metric-card strong { font-size:26px; }.metric-card span { color:var(--muted); font-size:13px; }
.review-grid { display:grid; grid-template-columns:1fr 1fr; gap:24px; }
.review-grid>section { background:#fff; border:1px solid var(--line); border-radius:16px; padding:20px; }
.review-item { padding:14px 0; border-top:1px solid var(--line); }.review-item:first-child { border-top:0; }.review-item p { white-space:pre-wrap; }
.feedback-reason { padding:9px; border-radius:8px; color:var(--danger); background:#fae9e8; }
.user-card { display:flex; justify-content:space-between; align-items:center; gap:16px; }
.history-item strong,.history-item span { display:block; }
.hidden { display:none !important; }
.login-body { min-height:100vh; display:grid; place-items:center; padding:24px; }
.login-card { width:min(430px,100%); padding:32px; }
.login-card h1 { margin:.2em 0; }
.stack { display:grid; gap:16px; }
.alert { padding:11px; border-radius:8px; margin:14px 0; }
.error { color:var(--danger); background:#fae9e8; }
dialog { border:0; border-radius:14px; width:min(460px,calc(100% - 32px)); padding:24px; }
dialog::backdrop { background:rgba(20,30,24,.45); }
.viewer-body { background:#e9eeea; }
.original-pdf-page { margin-bottom:24px; background:white; border:1px solid #cfd8d2; box-shadow:0 8px 25px rgba(30,50,38,.09); }
.original-page-label { padding:8px 16px; color:var(--muted); font-size:13px; border-bottom:1px solid var(--line); }
.original-pdf-image { display:block; width:100%; height:auto; aspect-ratio:210 / 297; object-fit:contain; }
.original-pdf-page[data-original-target="true"] { outline:2px solid #d4a900; scroll-margin-top:24px; }
.viewer-layout { display:grid; grid-template-columns:300px minmax(0,850px); gap:28px; justify-content:center; padding:30px 24px 64px; }
.viewer-meta { align-self:start; position:sticky; top:24px; background:#fff; border:1px solid var(--line); border-radius:16px; padding:22px; }
.viewer-meta h1 { margin:.2em 0 .8em; font-size:24px; line-height:1.2; }.viewer-meta dl { margin:0; }.viewer-meta dt { margin-top:12px; color:var(--muted); font-size:13px; }.viewer-meta dd { margin:2px 0 0; overflow-wrap:anywhere; }
.document-viewer { min-width:0; }.viewer-page { position:relative; background:#fff; border:1px solid #cfd8d2; border-radius:4px; padding:54px 64px; margin-bottom:22px; box-shadow:0 8px 25px rgba(30,50,38,.09); min-height:180px; }
.pdf-page { min-height:0; }.page-label { position:absolute; top:16px; right:20px; color:var(--muted); font-size:13px; }
.viewer-section { white-space:normal; line-height:1.55; padding:12px 14px; margin:0 -14px 10px; border-radius:8px; }
.viewer-section,.viewer-section p,.viewer-section li,.viewer-section td,.viewer-section th { font-weight:400; }
.viewer-section h1,.viewer-section h2,.viewer-section h3 { line-height:1.25; margin:0 0 14px; }
.viewer-section h1,.viewer-section h2,.viewer-section h3,.viewer-section strong { font-weight:700; }
.viewer-section p { margin:0 0 14px; }
.viewer-section ul,.viewer-section ol { margin:8px 0 16px; padding-left:26px; }
.viewer-section li { margin:4px 0; }
.viewer-section pre { margin:12px 0; padding:14px; overflow:auto; white-space:pre-wrap; border-radius:8px; background:#f1f4f1; font:14px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace; }
.viewer-section table { width:100%; border-collapse:collapse; margin:12px 0 16px; font-size:14px; }
.viewer-section th,.viewer-section td { border:1px solid var(--line); padding:8px 10px; text-align:left; vertical-align:top; }
.viewer-section th { background:#edf3ee; }
.viewer-section-target { box-shadow:inset 3px 0 #d4a900; }
.document-viewer .source-content { padding:0; max-height:none; overflow:visible; font-size:17px; line-height:1.8; color:#25312b; overflow-wrap:break-word; }
.document-viewer .source-content p { margin:0 0 1.1em; }
.document-viewer .source-content li { margin:.55em 0; }
.document-viewer .source-content mark { background:#fff0a8; color:inherit; border-radius:2px; }
.source-evidence summary { cursor:pointer; font-weight:600; padding:6px 0; }
.source-evidence[open] .source-evidence-markdown { margin-top:14px; }
.source-evidence { margin:20px 0 4px; padding:14px 16px; border:1px solid #e3c84a; border-radius:10px; background:#fff3b8; scroll-margin:25vh; font-weight:400; font-size:15px; line-height:1.55; }
.source-evidence strong { display:block; margin-bottom:7px; color:#6b5700; font-size:13px; text-transform:uppercase; letter-spacing:.04em; }.source-evidence p { margin:0; white-space:pre-wrap; }
.source-evidence-markdown { font-weight:400; line-height:1.55; }.source-evidence-markdown p { margin:0 0 10px; white-space:normal; }.source-evidence-markdown ul,.source-evidence-markdown ol { margin:6px 0 10px; padding-left:24px; }.source-evidence-markdown li { margin:3px 0; }.source-evidence-markdown table { width:100%; border-collapse:collapse; font-size:14px; }.source-evidence-markdown th,.source-evidence-markdown td { border:1px solid #dccd76; padding:7px 9px; text-align:left; }.source-evidence-markdown th { background:#fff8d8; }.source-evidence-markdown strong { display:inline; color:inherit; font-size:inherit; text-transform:none; letter-spacing:normal; }
.document-link { color:var(--muted); text-decoration:underline; }.blocked-image { color:var(--muted); font-style:italic; }
.source-target { background:#fff3b8; box-shadow:inset 4px 0 #d4a900; animation:source-highlight 1.4s ease-out; }
@keyframes source-highlight { from { background:#ffe066; } to { background:#fff3b8; } }
@media (max-width:900px) { .layout,.admin-layout,.review-grid,.viewer-layout { grid-template-columns:1fr; }.admin-layout,.admin-page,.viewer-layout { padding:24px 16px; }.metric-grid { grid-template-columns:repeat(2,1fr); }.history-panel,.upload-panel,.viewer-meta { position:static; max-height:none; }.viewer-page { padding:42px 22px; }.topbar { padding:12px 16px; } }
.health-banner { margin:16px 0 20px; padding:16px 20px; border-radius:14px; border:1px solid var(--line); background:var(--surface); }
.health-banner strong { font-size:18px; }.health-banner ul { margin:8px 0 0; padding-left:22px; }
.health-green { border-color:#9fd3b6; background:#eef8f2; }.health-yellow { border-color:#e5cf7a; background:#fffaeb; }.health-red { border-color:#e2a29e; background:#fdf0ef; }
.table-scroll { overflow-x:auto; }
.monitor-table { width:100%; border-collapse:collapse; font-size:14px; }.monitor-table th,.monitor-table td { padding:8px 10px; border-bottom:1px solid var(--line); text-align:right; white-space:nowrap; }.monitor-table th:first-child,.monitor-table td:first-child { text-align:left; }
.error-text { color:var(--danger); }
.follow-up { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; padding:8px 12px; border-radius:10px; background:var(--accent2); color:var(--accent); font-size:14px; }
.follow-up button { padding:6px 11px; font-size:14px; }
.understood { margin:0 0 12px; font-size:14px; }
