:root {
  --ink: #172622;
  --muted: #687671;
  --line: #dfe6e2;
  --paper: #f7f8f5;
  --white: #ffffff;
  --forest: #123d32;
  --green: #1d725a;
  --mint: #dff2e9;
  --lime: #b8e36b;
  --amber: #e7a845;
  --red: #ba4b45;
  --shadow: 0 18px 50px rgba(19, 48, 39, .12);
  --modal-layer-base: 60;
  --modal-layer-child: 70;
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; min-width: 320px; min-height: 100vh; overflow: hidden; background: var(--paper); }
body.modal-scroll-locked { overflow: hidden; }
button, textarea, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
.hidden { display: none !important; }
.eyebrow { display: block; margin-bottom: 5px; color: #87918e; font: 700 10px/1.2 "Manrope", sans-serif; letter-spacing: .15em; text-transform: uppercase; }
.eyebrow.accent { color: var(--green); }
.app-shell { display: grid; grid-template-columns: 280px minmax(480px, 1fr) 310px; height: 100vh; overflow: hidden; }

.sidebar { position: relative; display: flex; flex-direction: column; min-height: 0; padding: 28px 20px 20px; color: #e9f1ed; background: var(--forest); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 7px 27px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--lime); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.brand-mark svg { width: 25px; fill: var(--forest); }
.brand span, .brand strong { display: block; }
.brand span { color: #9db3ab; font-size: 11px; line-height: 1; }
.brand strong { max-width: 165px; margin-top: 4px; color: #fff; font: 600 13px/1.15 "Manrope", sans-serif; letter-spacing: -.02em; }
.nav { display: grid; gap: 5px; padding: 22px 0; }
.nav-item { width: 100%; padding: 11px 12px; border: 0; border-radius: 9px; color: #a9bbb5; background: transparent; text-align: left; font-size: 13px; }
.nav-item.active { color: white; background: rgba(255,255,255,.09); }
.nav-icon { display: inline-block; width: 25px; color: var(--lime); font-size: 18px; vertical-align: -1px; }
.library-panel { display: flex; flex: 1; flex-direction: column; min-height: 0; padding-top: 4px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 5px 12px; }
.section-heading h2, .trace-header h2, .modal-header h2 { margin: 0; font: 600 16px/1.2 "Manrope", sans-serif; }
.sidebar .eyebrow { color: #79958b; }
.icon-button { display: grid; place-items: center; width: 31px; height: 31px; padding: 0; border: 1px solid rgba(255,255,255,.15); border-radius: 8px; color: white; background: rgba(255,255,255,.06); font-size: 20px; }
.document-list { display: grid; flex: 1; min-height: 0; gap: 7px; overflow-x: hidden; overflow-y: auto; scrollbar-color: rgba(184,227,107,.45) transparent; scrollbar-width: thin; }
.document-item { display: grid; min-width: 0; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 9px; border: 1px solid transparent; border-radius: 9px; background: rgba(255,255,255,.055); }
.document-item:hover { border-color: rgba(184,227,107,.24); }
.file-type { display: grid; place-items: center; width: 32px; height: 36px; border-radius: 6px; color: var(--forest); background: #dbe7e2; font-size: 8px; font-weight: 800; }
.document-name { overflow: hidden; color: #f2f6f4; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.document-meta { display: block; margin-top: 3px; color: #88a096; font-size: 10px; }
.document-actions { display: flex; align-items: center; gap: 1px; }
.document-actions button { display: grid; place-items: center; width: 21px; height: 24px; padding: 0; border: 0; border-radius: 5px; color: #9db1aa; background: transparent; opacity: .65; }
.document-actions button:hover { color: var(--lime); background: rgba(255,255,255,.08); opacity: 1; }
.empty-library { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; padding: 24px; color: #8da098; text-align: center; }
.empty-library .empty-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 12px; border: 1px dashed #547067; border-radius: 50%; color: var(--lime); font-size: 20px; }
.empty-library strong { color: #d5dfdb; font-size: 12px; }
.empty-library span { max-width: 180px; margin-top: 5px; font-size: 11px; line-height: 1.5; }
.sidebar-footer { padding-top: 15px; border-top: 1px solid rgba(255,255,255,.1); }
.usage-row { display: flex; justify-content: space-between; color: #849d94; font-size: 10px; }
.usage-row strong { color: #c8d5d0; }
.status-pill { display: flex; align-items: center; gap: 7px; margin-top: 12px; color: #9cb0a9; font-size: 10px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px rgba(231,168,69,.13); }
.status-dot.ready { background: var(--lime); box-shadow: 0 0 0 3px rgba(184,227,107,.13); }

.workspace { position: relative; display: grid; min-width: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto; background: #fbfcfa; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 92px; padding: 22px 34px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.82); }
.topbar-identity { display: flex; min-width: 0; align-items: center; gap: 16px; }
.topbar-logo { display: block; width: 150px; height: auto; flex: none; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.auth-controls { display: flex; align-items: center; gap: 5px; margin-left: 3px; padding-left: 9px; border-left: 1px solid var(--line); }
.auth-controls > span:first-child { color: #7c8984; font-size: 9px; font-weight: 700; white-space: nowrap; }
.auth-user { display: inline-flex; align-items: center; gap: 3px; }
.auth-user > span { color: #52635b; font-size: 9px; font-weight: 700; white-space: nowrap; }
.auth-controls .button { padding: 8px 10px; font-size: 10px; }
.mobile-panel-button { display: none; padding: 8px 10px; border: 1px solid #cad7d1; border-radius: 8px; color: var(--forest); background: white; font-size: 10px; font-weight: 700; }
.topbar h1 { margin: 0; font: 600 21px/1.2 "Manrope", sans-serif; letter-spacing: -.035em; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 16px; border: 0; border-radius: 9px; font-size: 12px; font-weight: 700; }
.button.primary { color: white; background: var(--green); box-shadow: 0 8px 22px rgba(29,114,90,.2); }
.button.primary:hover { background: #165f4a; }
.button.secondary { border: 1px solid #cad7d1; color: var(--forest); background: white; }
.button.ghost { color: var(--muted); background: transparent; }
.config-banner { display: flex; align-items: center; gap: 10px; margin: 16px 34px 0; padding: 10px 14px; border: 1px solid #efd29f; border-radius: 9px; background: #fff8e9; }
.config-banner > span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: white; background: var(--amber); font-weight: 800; }
.config-banner p { margin: 0; color: #68583e; font-size: 11px; }
.config-banner code { padding: 2px 4px; border-radius: 3px; background: #f0e6d2; }
.workspace-main { display: flex; min-height: 0; flex-direction: column; overflow: hidden; }
.welcome-state { display: flex; min-height: 0; flex: 1; flex-direction: column; align-items: center; justify-content: center; padding: 35px 50px; text-align: center; }
.orb { position: relative; width: 80px; height: 80px; margin-bottom: 24px; border: 1px solid #bad6cc; border-radius: 50%; background: radial-gradient(circle at 50% 50%, #fafff7 0 20%, #e8f5ed 21% 47%, transparent 48%); box-shadow: 0 12px 30px rgba(22,78,61,.11); }
.orb span { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--green); transform-origin: 0 0; }
.orb span:nth-child(1) { transform: rotate(10deg) translateX(27px); }
.orb span:nth-child(2) { transform: rotate(130deg) translateX(27px); }
.orb span:nth-child(3) { transform: rotate(250deg) translateX(27px); }
.welcome-state h2 { margin: 7px 0 14px; color: #14352c; font: 600 37px/1.14 "Manrope", sans-serif; letter-spacing: -.055em; }
.welcome-state > p { max-width: 570px; margin: 0 0 24px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.welcome-actions { display: flex; align-items: center; justify-content: center; gap: 9px; flex-wrap: wrap; }
.initialization-status { margin: 10px 0 0 !important; color: var(--green) !important; font-size: 10px !important; font-weight: 700; }
.capability-strip { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 750px; margin-top: 38px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.capability-strip > div { display: flex; gap: 11px; padding: 18px; text-align: left; }
.capability-strip > div + div { border-left: 1px solid var(--line); }
.capability-strip b { color: var(--green); font: 700 10px/1.4 "Manrope", sans-serif; }
.capability-strip span, .capability-strip strong { display: block; }
.capability-strip strong { margin-bottom: 4px; color: var(--ink); font-size: 11px; }
.capability-strip span { color: #7e8985; font-size: 9px; line-height: 1.4; }
.conversation { position: relative; flex: 1; min-height: 0; overflow-y: auto; scrollbar-color: #b7cbc3 transparent; scrollbar-width: thin; }
.messages { max-width: 850px; margin: 0 auto; padding: 34px 35px 86px; }
.message { margin-bottom: 29px; }
.user-message { display: flex; justify-content: flex-end; }
.user-bubble { max-width: 75%; padding: 13px 16px; border-radius: 14px 14px 3px 14px; color: white; background: var(--forest); font-size: 13px; line-height: 1.55; }
.assistant-message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; }
.assistant-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--forest); background: var(--lime); font-weight: 800; }
.answer-card { min-width: 0; }
.answer-source-context { margin: -3px 0 10px; color: #6f7e77; font-size: 10px; font-weight: 700; }
.image-answer { display: grid; width: 100%; min-width: 0; max-width: 100%; gap: 14px; overflow-wrap: anywhere; color: #263732; }
.image-answer-heading { display: grid; min-width: 0; grid-template-columns: minmax(160px, 180px) minmax(0, 1fr); gap: 17px; align-items: start; }
.image-answer-thumbnail { display: block; width: min(180px, 100%); height: 180px; border: 1px solid #dce8e2; border-radius: 10px; object-fit: contain; background: #edf3ef; }
.image-answer-heading-copy { min-width: 0; }
.image-answer-kicker { display: block; margin-bottom: 3px; color: #718079; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.image-answer h3 { margin: 0 0 5px; color: var(--forest); font: 700 17px/1.2 "Manrope", sans-serif; }
.image-answer-heading-copy p { margin: 0; color: #52635b; font-size: 12px; line-height: 1.5; }
.image-answer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 9px; }
.image-answer-actions .inline-validation-link { margin-top: 0; }
.image-answer-facts { display: grid; min-width: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.image-answer-facts > div { min-width: 0; padding: 8px 9px; border: 1px solid #e0e9e4; border-radius: 8px; background: #f8fbf9; }
.image-answer-facts span, .provenance-grid span { display: block; color: #7f8b86; font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.image-answer-facts strong, .provenance-grid strong { display: block; min-width: 0; margin-top: 5px; overflow-wrap: anywhere; color: var(--forest); font-size: 10px; line-height: 1.45; }
.image-answer-group { padding-top: 2px; }
.image-answer-group > strong { color: var(--forest); font-size: 10px; }
.image-answer-group ul { margin: 6px 0 0; padding-left: 17px; color: #5e6d67; font-size: 10px; line-height: 1.5; }
.image-answer-group li + li { margin-top: 3px; }
.image-answer-group p { margin: 5px 0 0; color: #5e6d67; font-size: 10px; line-height: 1.45; }
.image-answer-uncertain { padding: 9px 10px; border: 1px solid #efdbad; border-radius: 8px; background: #fffaf0; }
.image-uncertainty-list { display: grid; gap: 7px; margin-top: 6px; }
.image-uncertainty-item { min-width: 0; padding: 8px 9px; border: 1px solid #eadbb9; border-radius: 7px; background: rgba(255,255,255,.55); }
.image-uncertainty-item.compact { padding: 0; border: 0; background: transparent; }
.image-uncertainty-item p { margin: 0; color: #5e6d67; font-size: 10px; line-height: 1.45; }
.image-uncertainty-title { display: block; min-width: 0; margin-bottom: 5px; color: var(--forest); font-size: 10px; }
.image-uncertainty-reason { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px; margin-top: 5px !important; }
.image-uncertainty-reason span { color: #856a37; font-size: 9px; font-weight: 800; }
.image-uncertainty-meta { display: flex; min-width: 0; flex-wrap: wrap; gap: 6px; margin-top: 8px; color: #856a37; font-size: 9px; }
.image-uncertainty-badge { display: inline-flex; min-width: 0; padding: 4px 7px; border: 1px solid #eadbb9; border-radius: 999px; background: #fffaf0; overflow-wrap: anywhere; }
.image-unsupported-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.image-unsupported-chips span { padding: 4px 7px; border: 1px solid #dfe6e2; border-radius: 999px; color: #64736c; background: #f4f7f5; font-size: 9px; line-height: 1.2; }
.answer-unavailable { color: #8a4339; font-size: 9px; }
.error-card { display: grid; gap: 8px; max-width: 520px; padding: 14px 16px; border: 1px solid #ecc8c0; border-radius: 12px; background: #fff8f6; color: #71372d; }
.error-card span { color: #8b5a50; font-size: .86rem; line-height: 1.45; }
.error-card .button { justify-self: start; }
.answer-header { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.answer-header strong { font: 600 12px/1 "Manrope", sans-serif; }
.validation-badge { padding: 4px 7px; border-radius: 20px; color: #22624f; background: var(--mint); font-size: 8px; font-weight: 800; letter-spacing: .07em; }
.validation-badge.caution { color: #7a5c23; background: #fbefcf; }
.validation-badge.fail { color: #8c332e; background: #f8dcd9; }
.answer-text { color: #263732; font-size: 13px; line-height: 1.75; white-space: pre-wrap; }
.answer-meta { display: flex; flex-wrap: wrap; gap: 5px 14px; min-width: 0; margin-top: 13px; color: #87908d; font-size: 9px; }
.hydraulic-answer { display: grid; min-width: 0; gap: 12px; color: #263732; }
.hydraulic-hero { display: grid; min-width: 0; grid-template-columns: minmax(160px, 220px) minmax(0, 1fr); gap: 17px; align-items: start; }
.hydraulic-source-thumbnail { display: block; width: min(220px, 100%); height: 180px; border: 1px solid #dce8e2; border-radius: 10px; object-fit: contain; background: #edf3ef; }
.hydraulic-hero-copy { min-width: 0; }
.hydraulic-hero-copy h3 { margin: 0 0 5px; color: var(--forest); font: 700 17px/1.2 "Manrope", sans-serif; }
.hydraulic-hero-copy p { margin: 0; color: #52635b; font-size: 12px; line-height: 1.5; }
.hydraulic-facts { display: grid; min-width: 0; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 8px; }
.hydraulic-facts > div { min-width: 0; padding: 8px 9px; border: 1px solid #e0e9e4; border-radius: 8px; background: #f8fbf9; }
.hydraulic-facts span { display: block; color: #7f8b86; font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.hydraulic-facts strong { display: block; min-width: 0; margin-top: 5px; overflow-wrap: anywhere; color: var(--forest); font-size: 10px; line-height: 1.45; }
.hydraulic-callout { display: flex; min-width: 0; flex-direction: column; gap: 4px; padding: 10px 11px; border: 1px solid #dce8e2; border-radius: 8px; background: #f5faf7; }
.hydraulic-callout strong { color: #315f51; font-size: 10px; }
.hydraulic-callout span { color: #62736b; font-size: 10px; line-height: 1.45; }
.hydraulic-callout.caution { border-color: #efd9af; background: #fff9ec; }
.hydraulic-callout.caution strong { color: #795f2d; }
.hydraulic-table-wrap { max-width: 100%; min-width: 0; overflow-x: auto; }
.hydraulic-response-table { min-width: 720px; margin: 0; }
.hydraulic-response-table td { line-height: 1.4; }
.hydraulic-response-table small { color: #6f7d76; font-size: 8px; }
.hydraulic-answer > h4 { margin: 5px 0 0; color: var(--forest); font: 700 11px/1.2 "Manrope", sans-serif; }
.hydraulic-class-badge { display: inline-flex; padding: 3px 6px; border-radius: 8px; color: #315f51; background: #e7f1ec; font-size: 8px; font-weight: 700; white-space: nowrap; }
.hydraulic-finding-card { display: grid; min-width: 0; gap: 9px; padding: 12px; border: 1px solid #efd9af; border-radius: 10px; background: #fffaf0; }
.hydraulic-finding-header { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; }
.hydraulic-finding-header strong { min-width: 0; overflow-wrap: anywhere; color: #795f2d; font: 700 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.hydraulic-finding-card p { margin: 0; color: #6d6250; font-size: 10px; line-height: 1.5; }
.hydraulic-review-reason { padding-top: 7px; border-top: 1px solid #f0dfbf; }
.hydraulic-review-reason strong { color: #795f2d; }
.hydraulic-diagnostics-table { min-width: 620px; }
.hydraulic-audit .hydraulic-callout { margin-top: 12px; }
.hydraulic-provenance { margin-top: 0; }
.source-list { display: grid; gap: 7px; margin-top: 18px; }
.source-card { padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.source-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.source-top strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.source-top span { flex: none; color: var(--green); font-size: 9px; font-weight: 700; }
.source-card p { display: none; margin: 9px 0 0; color: #6f7b77; font-size: 10px; line-height: 1.55; }
.source-card.open p { display: block; }
.thinking-card { padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.thinking-line { width: 70%; height: 8px; margin: 7px 0; border-radius: 4px; background: linear-gradient(90deg, #edf1ef 20%, #dce7e2 45%, #edf1ef 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.thinking-line.short { width: 45%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.jump-latest { position: absolute; z-index: 3; right: 18px; bottom: 16px; display: block; margin: 0; padding: 8px 11px; border: 1px solid #cbdad4; border-radius: 18px; color: var(--forest); background: rgba(255,255,255,.97); box-shadow: 0 8px 24px rgba(25,55,46,.13); font-size: 10px; font-weight: 700; }
.jump-latest span { margin-left: 3px; color: var(--green); font-size: 13px; }
.composer { z-index: 5; margin: 14px 34px 24px; padding: 12px 15px 9px; border: 1px solid #d6dfdb; border-radius: 14px; background: rgba(255,255,255,.97); box-shadow: 0 14px 42px rgba(25,55,46,.13); }
.scope-row { position: relative; display: flex; align-items: center; gap: 7px; padding-bottom: 8px; }
.scope-label { color: #89938f; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.scope-button { padding: 4px 7px; border: 0; border-radius: 5px; color: #376557; background: #edf5f1; font-size: 9px; font-weight: 700; }
.scope-menu { position: absolute; bottom: 30px; left: 0; width: 280px; max-height: 230px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: var(--shadow); }
.scope-option { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px; border: 0; border-radius: 6px; background: transparent; text-align: left; font-size: 10px; }
.scope-option:hover { background: #f1f5f3; }
.input-row { display: flex; align-items: flex-end; gap: 10px; }
.input-row textarea { flex: 1; min-height: 36px; max-height: 120px; resize: none; padding: 8px 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; line-height: 1.5; }
.input-row textarea::placeholder { color: #a0a9a6; }
.ask-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 9px; color: white; background: var(--green); }
.ask-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.latest-validation-link { display: inline-flex; margin: 4px 0 7px; padding: 0; border: 0; color: var(--green); background: transparent; font-size: 10px; font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.latest-validation-link:hover { color: var(--forest); }
.composer-meta { display: flex; justify-content: space-between; padding-top: 6px; border-top: 1px solid #edf0ee; color: #9aa29f; font-size: 8px; }

.trace-panel { display: flex; min-height: 0; flex-direction: column; padding: 29px 24px 22px; border-left: 1px solid var(--line); background: #f5f7f4; }
.trace-header { display: flex; justify-content: space-between; }
.live-badge { display: flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px; border: 1px solid #dbe7e2; border-radius: 15px; color: #577067; background: white; font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.live-badge i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.trace-intro { margin: 15px 0 21px; color: #7c8783; font-size: 10px; line-height: 1.55; }
.agent-timeline { flex: 1; min-height: 0; overflow-y: auto; }
.timeline-placeholder { display: flex; height: 100%; flex-direction: column; align-items: center; justify-content: center; color: #9da7a3; text-align: center; }
.timeline-placeholder > span { font-size: 28px; }
.timeline-placeholder p { max-width: 170px; font-size: 10px; line-height: 1.5; }
.timeline-step { position: relative; display: grid; grid-template-columns: 29px 1fr; gap: 10px; padding-bottom: 22px; }
.timeline-step:not(:last-child)::after { position: absolute; top: 30px; bottom: 0; left: 14px; width: 1px; background: #ccd9d4; content: ""; }
.step-icon { z-index: 1; display: grid; place-items: center; width: 29px; height: 29px; border: 1px solid #cfe0da; border-radius: 50%; color: var(--green); background: #ecf5f1; font-size: 10px; font-weight: 800; }
.timeline-step.active .step-icon { color: var(--forest); background: var(--lime); }
.step-body strong { display: block; margin: 3px 0 4px; font: 600 10px/1.2 "Manrope", sans-serif; }
.step-body p { margin: 0; color: #7a8782; font-size: 9px; line-height: 1.45; }
.guardrail-card { padding: 14px; border: 1px solid #dce5e1; border-radius: 10px; background: white; }
.guardrail-title { display: flex; align-items: center; gap: 7px; color: #315f51; font-size: 10px; }
.guardrail-title > span { display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; color: white; background: var(--green); font-size: 9px; }
.guardrail-card p { margin: 8px 0 0; color: #86908c; font-size: 9px; line-height: 1.5; }

.modal-layer-base { z-index: var(--modal-layer-base); }
.modal-layer-child { z-index: var(--modal-layer-child); }
.modal-backdrop { position: fixed; z-index: var(--modal-layer-base); inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(12,32,27,.66); backdrop-filter: blur(4px); }
.modal { width: min(610px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 25px; border-radius: 17px; background: white; box-shadow: var(--shadow); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.modal-header .icon-button { border-color: var(--line); color: #76817d; background: white; }
.drop-zone { display: flex; min-height: 150px; flex-direction: column; align-items: center; justify-content: center; border: 1.5px dashed #abc4ba; border-radius: 12px; background: #f4f9f6; cursor: pointer; transition: .2s; }
.drop-zone.dragover { border-color: var(--green); background: #edf8f2; transform: scale(1.005); }
.drop-zone input { display: none; }
.upload-glyph { display: grid; place-items: center; width: 43px; height: 43px; margin-bottom: 13px; border-radius: 50%; color: white; background: var(--green); font-size: 21px; }
.drop-zone strong { font-size: 12px; }
.drop-zone > span:last-child { margin-top: 6px; color: #8b9591; font-size: 9px; }
.selected-files { display: grid; gap: 6px; max-height: 150px; margin-top: 12px; overflow-y: auto; }
.selected-file { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 7px; background: #f3f5f4; font-size: 10px; }
.selected-file span:last-child { color: #84908c; }
.analysis-option { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfa; cursor: pointer; }
.analysis-option input { margin-top: 3px; accent-color: var(--green); }
.analysis-option span, .analysis-option strong, .analysis-option small { display: block; }
.analysis-option strong { color: #315f51; font-size: 11px; }
.analysis-option small { margin-top: 3px; color: #84908c; font-size: 9px; line-height: 1.4; }
.upload-progress { display: grid; gap: 7px; margin-top: 14px; }
.upload-step { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 7px; color: #87938e; font-size: 10px; }
.upload-step-icon { display: grid; place-items: center; width: 19px; height: 19px; border: 1px solid #d7e2dd; border-radius: 50%; color: #84918c; font-size: 9px; font-weight: 800; }
.upload-step.active { color: var(--green); background: #eef8f2; font-weight: 700; }
.upload-step.active .upload-step-icon { border-color: var(--green); color: white; background: var(--green); }
.upload-step.completed { color: #315f51; }
.upload-step.completed .upload-step-icon { border-color: var(--green); color: white; background: var(--green); }
.upload-step.skipped { color: #a0aaa6; }
.upload-step.skipped .upload-step-icon { border-color: #dde5e1; color: #9ca6a2; background: #f4f6f5; }
.upload-step.failed { color: var(--red); background: #fff0ef; font-weight: 700; }
.upload-step.failed .upload-step-icon { border-color: var(--red); color: white; background: var(--red); }
.upload-total { display: inline-block; margin-top: 4px; color: #87938e; }
.drop-zone.disabled { cursor: not-allowed; opacity: .55; pointer-events: none; }
.modal-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.modal-footer > div { display: flex; gap: 6px; }
.upload-status { color: #75817d; font-size: 9px; }
.toast { position: fixed; z-index: 30; right: 25px; bottom: 25px; max-width: 370px; padding: 12px 16px; border-radius: 9px; color: white; background: var(--forest); box-shadow: var(--shadow); font-size: 11px; }
.toast.error { background: #8c3f3a; }
.history-backdrop { position: fixed; z-index: 40; inset: 0; background: rgba(12,32,27,.22); }
.history-drawer { position: absolute; top: 0; right: 0; display: flex; width: min(390px, 92vw); height: 100%; flex-direction: column; padding: 28px 22px; border-left: 1px solid #d7e2dd; background: #fbfcfa; box-shadow: -18px 0 50px rgba(19,48,39,.14); animation: drawer-in .2s ease-out; }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.history-header { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.history-header h2 { margin: 0; font: 600 17px/1.2 "Manrope", sans-serif; }
.drawer-close { display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 8px; color: #76817d; background: white; font-size: 20px; }
.query-history-list { display: grid; min-height: 0; gap: 8px; overflow-y: auto; padding-top: 16px; scrollbar-color: #b7cbc3 transparent; scrollbar-width: thin; }
.history-empty { padding: 28px 10px; color: #84908b; font-size: 11px; line-height: 1.5; text-align: center; }
.history-item { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: white; text-align: left; }
.history-item:hover, .history-item.active { border-color: #9bc4b4; background: #f0f8f3; }
.history-question { display: block; overflow: hidden; font-size: 12px; font-weight: 700; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.history-details { display: flex; flex-wrap: wrap; gap: 5px 9px; margin-top: 7px; color: #7c8984; font-size: 9px; }
.history-verdict { color: var(--green); font-weight: 700; }
.engineering-backdrop { position: fixed; z-index: 40; inset: 0; display: flex; justify-content: flex-end; overflow: hidden; background: rgba(12,32,27,.28); }
.engineering-drawer { display: grid; width: min(920px, 100vw); max-width: 100%; height: 100dvh; max-height: 100dvh; min-width: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto auto; border-left: 1px solid #d7e2dd; background: #f7f9f6; box-shadow: -18px 0 50px rgba(19,48,39,.16); animation: drawer-in .2s ease-out; }
.engineering-drawer-header { position: sticky; z-index: 3; top: 0; flex: none; min-width: 0; padding: 28px 22px 18px; background: #f7f9f6; }
.engineering-drawer-body { display: flex; min-width: 0; min-height: 0; flex-direction: column; overflow: hidden; padding: 0 22px; }
.engineering-guardrail { display: flex; flex: none; min-width: 0; flex-direction: column; gap: 4px; margin: 14px 0; padding: 11px 13px; border: 1px solid #efd29f; border-radius: 9px; color: #71582b; background: #fff8e9; }
.engineering-guardrail strong { font-size: 11px; }
.engineering-guardrail span { font-size: 9px; line-height: 1.45; }
.engineering-intake-list { display: grid; min-width: 0; min-height: 0; gap: 12px; overflow-x: hidden; overflow-y: auto; padding: 2px 2px 20px; scrollbar-color: #b7cbc3 transparent; scrollbar-width: thin; }
.intake-card { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 7px 24px rgba(19,48,39,.05); }
.intake-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.intake-card-header > div { display: grid; min-width: 0; grid-template-columns: 36px minmax(0,1fr); column-gap: 9px; align-items: center; }
.intake-card-header .file-type { grid-row: 1 / 3; }
.intake-card-header strong { overflow: hidden; font: 700 12px/1.3 "Manrope", sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.intake-card-header small { overflow: hidden; color: #83908b; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.confidence-pill { flex: none; padding: 5px 8px; border-radius: 14px; color: #215b49; background: var(--mint); font-size: 9px; font-weight: 800; }
.intake-summary { margin: 12px 0; color: #52625d; font-size: 11px; line-height: 1.55; }
.intake-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; margin: 0; }
.intake-grid div { min-width: 0; padding: 8px; border-radius: 7px; background: #f3f6f4; }
.intake-grid dt { color: #84908c; font-size: 8px; text-transform: uppercase; letter-spacing: .06em; }
.intake-grid dd { overflow-wrap: anywhere; margin: 3px 0 0; color: #263732; font-size: 10px; font-weight: 700; }
.intake-section, .intake-warning { margin-top: 11px; padding: 10px 11px; border-radius: 8px; background: #f7f9f7; }
.intake-section > strong, .intake-warning > strong { color: #315f51; font-size: 10px; }
.intake-section ul, .intake-warning ul { margin: 6px 0 0; padding-left: 17px; color: #596863; font-size: 9px; line-height: 1.55; }
.intake-warning { border: 1px solid #efd9af; background: #fff9ec; }
.intake-warning > strong { color: #795f2d; }
.traceability-section { min-width: 0; padding-bottom: 3px; }
.audit-summary { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 7px; color: #718079; font-size: 8px; }
.audit-summary strong { color: #315f51; font-size: 10px; }
.table-scroll { max-width: 100%; min-width: 0; margin-top: 8px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.table-scroll::-webkit-scrollbar { height: 0; }
.engineering-table-scroller { flex: 0 0 auto; min-width: 0; height: 15px; margin: 0 22px; overflow-x: auto; overflow-y: hidden; border-top: 1px solid #d7e2dd; scrollbar-color: #9bb9ad #eef4f0; scrollbar-width: auto; }
.engineering-table-scroller > div { height: 1px; }
.traceability-table, .response-table { width: 100%; border-collapse: collapse; color: #52625d; font-size: 9px; }
.traceability-table { min-width: 1160px; table-layout: fixed; }
.traceability-table th:nth-child(1), .traceability-table td:nth-child(1) { width: 100px; }
.traceability-table th:nth-child(2), .traceability-table td:nth-child(2) { width: 105px; }
.traceability-table th:nth-child(3), .traceability-table td:nth-child(3) { width: 105px; }
.traceability-table th:nth-child(4), .traceability-table td:nth-child(4) { width: 70px; }
.traceability-table th:nth-child(5), .traceability-table td:nth-child(5) { width: 105px; }
.traceability-table th:nth-child(6), .traceability-table td:nth-child(6) { width: 175px; }
.traceability-table th:nth-child(7), .traceability-table td:nth-child(7) { width: 130px; }
.traceability-table th:nth-child(8), .traceability-table td:nth-child(8) { width: 78px; }
.traceability-table th:nth-child(9), .traceability-table td:nth-child(9) { width: 105px; }
.traceability-table th:nth-child(10), .traceability-table td:nth-child(10) { width: 165px; }
.traceability-table th:nth-child(11), .traceability-table td:nth-child(11) { width: 92px; }
.traceability-table th, .traceability-table td, .response-table th, .response-table td { padding: 7px 8px; border: 1px solid #dfe8e3; text-align: left; vertical-align: top; }
.traceability-table th, .response-table th { color: #315f51; background: #eef5f1; font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.traceability-table td { line-height: 1.4; }
.verification-status { display: inline-block; padding: 3px 5px; border-radius: 8px; font-size: 8px; font-weight: 800; }
.verification-status.verified { color: #22624f; background: #dff2e9; }
.verification-status.ambiguous { color: #7a5c23; background: #fbefcf; }
.verification-status.rejected { color: #8c3f3f; background: #f8e1df; }
.resolution-actions { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.resolution-actions button, .evidence-button { padding: 3px 5px; border: 1px solid #c8d9d1; border-radius: 5px; color: #315f51; background: white; font-size: 8px; font-weight: 700; }
.resolution-actions button:hover, .evidence-button:hover { border-color: #79aa97; background: #eef8f2; }
.resolution-actions button:disabled { cursor: wait; opacity: .5; }
.resolution-state { display: block; margin-top: 4px; color: #6c8278; font-size: 8px; text-transform: capitalize; }
.response-table { margin: 8px 0; }
.dimension-class { margin-left: 4px; padding: 2px 5px; border-radius: 8px; color: #53665f; background: #e7eeeb; font-size: 8px; }
.review-status { margin-top: 11px; color: #7f8b87; font-size: 9px; text-transform: capitalize; }
.review-status.approved { color: var(--green); font-weight: 700; }
.review-status.needs_review { color: #8a662b; font-weight: 700; }
.engineering-drawer-footer { position: sticky; z-index: 2; bottom: 0; display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 22px 18px; border-top: 1px solid #d7e2dd; background: rgba(247,249,246,.98); box-shadow: 0 -8px 20px rgba(19,48,39,.06); }
.engineering-action-status { min-width: 0; overflow: hidden; color: #7b8983; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.engineering-footer-actions { display: grid; min-width: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.engineering-footer-actions .button { min-width: 0; white-space: nowrap; }
.button.compact { padding: 8px 10px; font-size: 9px; }
.preview-backdrop { position: fixed; z-index: var(--modal-layer-child); inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(8,25,21,.72); backdrop-filter: blur(3px); }
.preview-modal { display: grid; width: min(1100px, 96vw); height: min(820px, 94vh); grid-template-rows: auto minmax(0,1fr); padding: 18px; border-radius: 14px; background: white; box-shadow: var(--shadow); }
.preview-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 0 0 13px; }
.preview-header h2 { margin: 0; font: 600 16px/1.2 "Manrope", sans-serif; }
.preview-body { display: grid; min-height: 0; place-items: center; overflow: auto; border: 1px solid var(--line); border-radius: 9px; background: #edf1ef; }
.preview-body iframe { width: 100%; height: 100%; border: 0; background: white; }
.preview-body img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.evidence-load-state { display: grid; gap: 8px; place-items: center; max-width: 420px; padding: 28px; color: #5f7069; font-size: 11px; text-align: center; }
.evidence-load-state p { margin: 0; line-height: 1.5; }
.evidence-load-state small { color: #89958f; font-size: 9px; }
.evidence-load-failed { border: 1px solid #e8c8c1; border-radius: 10px; background: #fff8f6; color: #8a4339; }
.evidence-load-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; }
.evidence-image { max-width: 100%; max-height: 100%; object-fit: contain; }
.validation-details-backdrop { position: fixed; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(8,25,21,.72); backdrop-filter: blur(3px); }
.validation-details-modal { display: grid; width: min(1120px, 96vw); height: min(860px, 94vh); grid-template-rows: auto minmax(0, 1fr); overflow: hidden; border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.validation-details-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.validation-details-header h2 { margin: 0; font: 600 18px/1.2 "Manrope", sans-serif; }
.validation-details-body { min-height: 0; overflow: auto; padding: 18px 22px 26px; color: var(--ink); }
.validation-section { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #e8efeb; }
.validation-section:last-child { border-bottom: 0; }
.validation-section h3 { margin: 0 0 9px; color: var(--forest); font: 700 12px/1.2 "Manrope", sans-serif; }
.validation-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.validation-stat { padding: 10px; border: 1px solid #dfe8e3; border-radius: 8px; background: #f8fbf9; }
.validation-stat span { display: block; color: #7f8b86; font-size: 9px; }
.validation-stat strong { display: block; margin-top: 4px; color: var(--forest); font-size: 12px; }
.validation-summary { margin: 0; color: #52635b; font-size: 11px; line-height: 1.55; }
.validation-details-body .response-table { width: 100%; margin: 8px 0; border-collapse: collapse; font-size: 9px; }
.validation-details-body .q3-structured-answer, .validation-details-body .q4-structured-answer, .validation-details-body .q5-structured-answer { overflow-x: auto; }
.validation-details-body .q5-structured-answer > h4 { margin: 16px 0 7px; color: var(--forest); font: 700 11px/1.2 "Manrope", sans-serif; }
.validation-list { display: grid; gap: 7px; padding: 0; margin: 0; list-style: none; }
.validation-list li { padding: 9px 10px; border: 1px solid #e0e9e4; border-radius: 8px; background: #fbfcfb; color: #5e6d67; font-size: 10px; line-height: 1.45; }
.validation-evidence-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.validation-evidence-card { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px; border: 1px solid #dfe8e3; border-radius: 8px; background: white; text-align: left; }
.validation-evidence-card span { overflow: hidden; color: #607069; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.validation-empty { margin: 0; color: #84908b; font-size: 10px; }
.validation-json { margin: 0; padding: 10px; overflow: auto; border-radius: 8px; color: #496158; background: #f4f8f5; font: 9px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.validation-audit { display: grid; gap: 12px; }
.image-validation-overview { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.image-classification-table th:first-child { width: 17%; }
.image-classification-table td { line-height: 1.4; }
.validation-provenance { padding: 10px 11px; border: 1px solid #dfe8e3; border-radius: 8px; background: #f8fbf9; }
.validation-provenance summary { color: var(--forest); cursor: pointer; font-size: 11px; font-weight: 800; }
.provenance-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 10px; }
.provenance-grid > div { display: grid; min-width: 0; gap: 5px; padding: 8px; border: 1px solid #e0e9e4; border-radius: 7px; background: white; }
.provenance-grid .provenance-value { min-width: 0; margin-top: 0; color: #29483d; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; line-height: 1.45; overflow-wrap: anywhere; }
.audit-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.audit-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 8px; }
.audit-row { display: grid; gap: 3px; min-width: 0; padding: 8px 9px; border: 1px solid #dfe8e3; border-radius: 7px; background: #fbfcfb; }
.audit-row span { color: #7f8b86; font-size: 9px; }
.audit-row strong { overflow-wrap: anywhere; color: var(--forest); font-size: 10px; line-height: 1.35; }
.audit-block { display: grid; gap: 6px; }
.audit-block h4 { margin: 0; color: var(--forest); font: 700 11px/1.2 "Manrope", sans-serif; }
.audit-unavailable { padding: 12px; border: 1px solid #e3c4a4; border-radius: 8px; color: #76502f; background: #fff8ee; font-size: 10px; line-height: 1.5; }
.audit-unavailable strong { display: block; color: #8b4f1f; font-size: 11px; }
.audit-unavailable p { margin: 5px 0 0; }
.inline-validation-link { margin-top: 11px; padding: 0; border: 0; color: var(--green); background: transparent; font-size: 10px; font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.inline-validation-link:hover { color: var(--forest); }
.mobile-panel-backdrop { position: fixed; z-index: 25; inset: 0; background: rgba(12,32,27,.38); }
.mobile-panel-backdrop.open { display: block !important; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .trace-panel { position: fixed; z-index: 30; top: 0; bottom: 0; display: none; width: min(320px, 88vw); }
  .sidebar { left: 0; }
  .trace-panel { right: 0; border-left: 1px solid var(--line); }
  .sidebar.mobile-open, .trace-panel.mobile-open { display: flex; }
  .mobile-panel-button { display: inline-flex; }
  .engineering-drawer { width: min(90vw, 900px); }
}
@media (max-width: 760px) {
  .workspace { min-height: 0; }
  .topbar { min-height: 76px; padding: 18px; }
  .topbar .eyebrow { display: none; }
  .topbar-identity { gap: 7px; }
  .topbar-logo { width: 58px; }
  .topbar-identity > div { min-width: 0; }
  .topbar h1 { max-width: 108px; font-size: 14px; line-height: 1.15; }
  .button.secondary { padding: 9px 11px; font-size: 10px; }
  .welcome-state { padding: 30px 24px; }
  .welcome-state h2 { font-size: 30px; }
  .capability-strip { display: none; }
  .composer { margin: 10px 14px 14px; }
  .composer-meta span:last-child { display: none; }
  .messages { padding: 28px 18px 35px; }
  .topbar-actions { gap: 4px; }
  .mobile-panel-button { padding: 7px 8px; font-size: 9px; }
  .topbar .button.secondary { width: 35px; padding: 9px; font-size: 0; }
  .topbar .button.secondary span { font-size: 16px; }
  .intake-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .engineering-drawer { width: 100vw; }
  .engineering-drawer-header { padding: 20px 14px 14px; }
  .engineering-drawer-body { padding: 0 14px; }
  .engineering-drawer-footer { display: block; padding: 10px 14px 14px; }
  .engineering-action-status { margin-bottom: 8px; }
  .engineering-footer-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .engineering-footer-actions .button { white-space: normal; }
  .validation-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .validation-details-body { padding: 16px 14px 24px; }
  .messages { padding-bottom: 86px; }
  .image-answer-heading { grid-template-columns: 1fr; gap: 11px; }
  .image-answer-thumbnail { width: min(180px, 100%); height: 180px; }
  .hydraulic-hero { grid-template-columns: 1fr; gap: 11px; }
  .hydraulic-source-thumbnail { width: min(100%, 320px); height: 180px; }
  .image-answer-facts, .provenance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .image-validation-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jump-latest { right: 12px; bottom: 12px; }
  .image-uncertainty-reason { grid-template-columns: 1fr; gap: 2px; }
  .provenance-grid { grid-template-columns: 1fr; }
}
