:root {
  color-scheme: dark;
  --bg:#0c0c0b; --panel:#101010; --surface:#1b1b19; --surface-2:#272725;
  --text:#f7f5ec; --muted:#aaa89e; --line:#3b3a31; --gold:#f1e384;
  --gold-deep:#b8a95e; --danger:#efb39b; --success:#85c9a2;
  font-family:Manrope,system-ui,-apple-system,"Segoe UI",sans-serif;
}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{width:100%;height:100%;overflow:hidden;background:var(--bg)}
body{margin:0;color:var(--text);font:14px/1.5 Manrope,system-ui,-apple-system,"Segoe UI",sans-serif;background:radial-gradient(ellipse at 50% 35%,#1b1b15 0%,var(--bg) 68%)}
button,input,textarea,select{font:inherit}
button{cursor:pointer}
button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,a:focus-visible{outline:2px solid var(--gold);outline-offset:3px}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.chat-app{width:100%;height:100dvh;border:0;border-radius:0;box-shadow:none;display:grid;grid-template-rows:62px minmax(0,1fr) auto;background:var(--panel);overflow:hidden}
.chat-header{display:flex;align-items:center;gap:12px;min-width:0;padding:9px 20px;border-bottom:1px solid var(--line);background:#121210}
.header-avatar{width:38px;height:38px;flex:0 0 auto}.svod-avatar{display:block;width:28px;height:28px;flex:0 0 auto}.header-avatar .svod-avatar{width:38px;height:38px}.svod-avatar svg{display:block;width:100%;height:100%}.avatar-mark{fill:#28271f;stroke:var(--gold-deep);stroke-width:1}.avatar-letter{fill:var(--gold)}.avatar-accent{fill:var(--gold)}
.assistant-id{min-width:0}.assistant-id h1{margin:0;font-size:16px;line-height:1.2;font-weight:700;letter-spacing:-.3px}.assistant-id p{margin:2px 0 0;color:var(--muted);font-size:11px}
.api-state{margin-left:auto;display:inline-flex;align-items:center;gap:7px;color:var(--muted);font-size:11px;white-space:nowrap}.api-state:before{content:"";width:7px;height:7px;border-radius:50%;background:#77766d}.api-state.ok:before{background:var(--success)}.api-state.bad:before{background:var(--danger)}
.chat-timeline{min-height:0;overflow:auto;overscroll-behavior:contain;padding:24px 20px;background:radial-gradient(ellipse at 50% 0,#1b1b17 0%,#121210 70%);scrollbar-color:#575341 transparent}
.message-stream{width:min(980px,100%);min-height:100%;margin:0 auto;display:flex;flex-direction:column;gap:13px}
.chat-message{display:flex;align-items:flex-end;gap:8px;max-width:min(760px,88%)}.chat-message.user{margin-left:auto}.chat-message.user .bubble{color:#222117;background:var(--gold);border-color:#eadd91;border-radius:16px 16px 4px 16px}.chat-message.assistant .bubble{border-radius:16px 16px 16px 4px}
.bubble{min-width:0;padding:11px 14px;border:1px solid var(--line);background:var(--surface-2);overflow-wrap:anywhere}.speaker{display:block;margin-bottom:4px;color:var(--muted);font-size:10px;font-weight:700;letter-spacing:.04em;text-transform:uppercase}.user .speaker{color:#5f5831}.message-text{white-space:pre-wrap}
.processing-message .bubble{color:#d9d4b6;background:#24231d;border-color:#5a5438}.processing-message .message-text{font-weight:600}
.question-message{align-items:flex-start}.question-bubble{border-color:#514c35;background:#25231b}.question-text{margin:0;font-size:15px}
.result-message{width:min(920px,96%);max-width:96%;align-items:flex-start}.analysis-result{width:100%;padding:20px;border:1px solid #514c35;border-radius:18px;background:#1c1c18}.result-label{display:block;margin-bottom:10px;color:var(--gold);font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.05em}.analysis-result h3{margin:20px 0 8px;font-size:14px}.analysis-result p{margin:9px 0}.analysis-result ul{margin:8px 0;padding-left:22px}.analysis-result li+li{margin-top:6px}.analysis-result a{color:var(--gold)}.analysis-result details{margin-top:15px;padding-top:12px;border-top:1px solid var(--line)}.review-notice{padding:11px 13px;border-left:2px solid var(--gold);background:#2a281d;color:#e4ddba}
[data-new-case],[data-retry-analysis]{align-self:flex-start;min-height:44px;padding:9px 14px;color:var(--gold);border:1px solid #5b5538;border-radius:11px;background:#25231b}
.chat-composer{border-top:1px solid var(--line);padding:10px 16px calc(10px + env(safe-area-inset-bottom));background:#151513}.chat-composer form,.composer-mode-switch,.voice-panel{width:min(980px,100%);margin-inline:auto}
.composer-mode-switch{display:flex;gap:4px;margin-bottom:8px;padding:3px;border:1px solid #34342d;border-radius:12px;background:#1c1c19}.mode-button{flex:1;min-height:36px;color:var(--muted);border:0;border-radius:9px;background:transparent;font-weight:700}.mode-button.active{color:#242315;background:var(--gold)}
.composer-options{display:flex;align-items:center;gap:8px;margin-bottom:8px}.topic-select{flex:1}.topic-select select,.attach-button{width:100%;min-height:38px;color:#d7d5ca;border:1px solid var(--line);border-radius:10px;background:#22221f}.topic-select select{padding:0 10px}.attach-button{width:auto;display:flex;align-items:center;gap:7px;padding:0 12px;cursor:pointer}.attach-button svg,.send-button svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7}.attach-button input{display:none}.documents-status{min-width:0;overflow:hidden;color:var(--muted);font-size:12px;text-overflow:ellipsis;white-space:nowrap}.documents-status.error{color:#ff9d9d}
.compose-row{display:flex;align-items:flex-end;gap:8px}.message-input{flex:1}.message-input textarea{display:block;width:100%;min-height:50px;max-height:120px;padding:13px 14px;resize:vertical;color:var(--text);border:1px solid #49473b;border-radius:13px;background:#22221f}.message-input textarea::placeholder{color:#8f8e84}.send-button{width:48px;height:48px;flex:0 0 auto;color:#242315;border:1px solid #fff0a0;border-radius:13px;background:var(--gold)}.consent{display:flex;align-items:flex-start;gap:8px;margin-top:8px;color:var(--muted);font-size:10px}.consent input{accent-color:var(--gold)}
.voice-panel{padding:12px 0 14px;text-align:center}.voice-orb{width:132px;height:132px;margin:0 auto;display:grid;place-items:center;border:1px solid #5b5538;border-radius:50%;background:radial-gradient(circle,#312e20 0%,#181815 70%);box-shadow:0 0 42px rgba(241,227,132,.08)}.mic-button{width:92px;height:92px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;color:#242315;border:1px solid #fff0a0;border-radius:50%;background:radial-gradient(circle at 35% 25%,#fff2b3,var(--gold) 55%,#c7b566);font-weight:800}.mic-button svg{width:28px;height:28px;fill:none;stroke:currentColor;stroke-width:1.7}.voice-panel.recording .voice-orb{animation:voice-pulse 1.6s ease-in-out infinite}.voice-panel.recording .mic-button{background:#f1c784}.voice-status,.voice-timer,.voice-error{margin:9px auto 0;max-width:560px}.voice-status{color:var(--muted)}.voice-timer{color:var(--gold);font-variant-numeric:tabular-nums}.voice-error{padding:9px;color:var(--danger);border:1px solid #69483e;border-radius:9px;background:#2b201c}.voice-panel audio{display:block;width:min(520px,100%);height:42px;margin:12px auto 0;color-scheme:dark}.voice-actions{display:flex;justify-content:center;gap:8px;margin-top:10px}.voice-actions button{min-height:42px;padding:8px 13px;color:var(--gold);border:1px solid #5b5538;border-radius:10px;background:#25231b}
@keyframes voice-pulse{50%{transform:scale(1.025);box-shadow:0 0 54px rgba(241,227,132,.17)}}
@media(max-width:640px){.chat-app{grid-template-rows:54px minmax(0,1fr) auto}.chat-header{padding:7px 11px}.header-avatar,.header-avatar .svod-avatar{width:34px;height:34px}.chat-timeline{padding:14px 10px}.chat-message,.result-message{max-width:97%}.result-message{width:100%}.chat-composer{padding:8px 10px calc(8px + env(safe-area-inset-bottom))}.composer-options{margin-bottom:6px}.mode-button{min-height:34px}.voice-orb{width:116px;height:116px}.mic-button{width:82px;height:82px}.message-input textarea{min-height:46px}.send-button{width:46px;height:46px}.assistant-id p{display:none}}
@media(prefers-reduced-motion:reduce){*{animation:none!important;scroll-behavior:auto!important}}
.analysis-summary,.analysis-result li{white-space:pre-wrap;overflow-wrap:anywhere}
.document-card{padding:16px;border:1px solid var(--gold-deep);border-radius:12px;background:#23221b}
.document-card h3{margin-top:0}.document-card>p{color:var(--muted);font-size:12px}
.document-body{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.7;padding:16px;background:#151513;border-radius:8px;user-select:text}
.document-tools{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:12px}
.document-tools button{min-height:44px;padding:8px 12px;background:#302d20;border:1px solid var(--gold-deep);border-radius:8px;color:var(--gold)}
.document-tools [role=status]{color:var(--muted);font-size:12px}
.new-case-button{margin-left:auto}button:disabled{opacity:.55;cursor:wait}
.analysis-result summary{cursor:pointer;color:var(--gold);min-height:30px}
.verification-gaps{border-left:2px solid var(--gold-deep);padding-left:12px}
/* Content must shrink inside the single grid column, including restored file names. */
.chat-app{grid-template-columns:minmax(0,1fr)}
.chat-timeline,.chat-composer,.chat-composer form,.message-stream,.result-message,.analysis-result,.message-input{min-width:0}
.analysis-result{flex:1;overflow-wrap:anywhere}
.mode-button{min-width:0;overflow-wrap:anywhere}
.attach-button{flex-shrink:0}
.documents-status{flex:1}
.voice-actions{flex-wrap:wrap}
@media(max-width:640px){
  .composer-options{flex-wrap:wrap}
  .documents-status:not(:empty){flex-basis:100%;white-space:normal;overflow-wrap:anywhere;max-height:4.5em;overflow:auto;text-overflow:clip}
}

/* Document composition and plain-text review, including narrow screens. */
.document-panel {padding:10px 0;display:grid;gap:8px;min-width:0}
.document-panel[hidden] {display:none}
.document-panel p,.document-storage-note {font-size:.83rem;color:#bbb;line-height:1.4;margin:0}
.document-panel select,.document-tools select {max-width:100%;min-width:0;background:#24241f;color:#eee;border:1px solid #555;border-radius:9px;padding:9px}
.document-editor {display:block;width:100%;max-width:100%;box-sizing:border-box;resize:vertical;min-height:230px;white-space:pre-wrap;overflow-wrap:anywhere;background:#171714;color:#eee;border:1px solid #686341;border-radius:9px;padding:12px;font:inherit;line-height:1.5}
.document-tools {display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.document-tools button {min-height:40px}
.document-tools [data-document-status] {flex-basis:100%;font-size:.85rem}
.composer-mode-switch {flex-wrap:wrap}
@media(max-width:600px){.document-panel{max-height:155px;overflow:auto}.document-card{max-width:100%;min-width:0}.document-tools select{flex:1 1 150px}.document-editor{font-size:16px}}

@media(max-width:600px){.mode-button{font-size:12px;line-height:1.35;overflow-wrap:normal;padding:8px 2px;min-height:42px}}

/* Keep document text readable without consuming the phone width in nested gutters. */
@media(max-width:600px){
  .result-message{max-width:100%;width:100%;gap:0}
  .result-message > .svod-avatar{display:none}
  .result-message .analysis-result{padding:10px;min-width:0}
  .result-message .document-card{padding:8px}
  .result-message .document-editor{padding:8px}
}

.close-case-button{color:#a22!important}.retention-note{font-size:11px;line-height:1.4;color:#777;margin:6px 0 10px}.composer-mode-switch{flex-wrap:wrap}

.attachment-hint{font-size:12px;line-height:1.4;color:#666;margin:6px 0}
.selected-documents{list-style:none;padding:0;margin:6px 0 10px;max-height:180px;overflow:auto}
.selected-documents li{display:flex;align-items:center;gap:10px;padding:6px 0;border-bottom:1px solid #e5e5e5}
.selected-documents li span{flex:1;min-width:0;overflow-wrap:anywhere;font-size:13px}
.selected-documents button{flex:0 0 auto;padding:6px 8px;font-size:12px;min-height:36px}
