:root { color-scheme: dark; --bg:#0d1117; --panel:#151b23; --line:#2b3440; --text:#eef2f7; --muted:#9aa7b6; --accent:#ffb000; --danger:#ef5b5b; }
* { box-sizing: border-box; }
html { max-width:100%; }
body { margin:0; background:var(--bg); color:var(--text); font:15px/1.5 system-ui,-apple-system,sans-serif; }
.shell { width:min(1240px,calc(100% - 32px)); min-width:0; margin:0 auto; padding:28px 0 64px; }
.topbar,.section-title,.actions { display:flex; align-items:center; justify-content:space-between; gap:16px; }
h1,h2,h3,p { margin-top:0; } h1 { margin-bottom:0; font-size:clamp(1.6rem,4vw,2.4rem); } h2 { margin-bottom:14px; }
.eyebrow { color:var(--accent); font-size:.72rem; font-weight:800; letter-spacing:.14em; text-transform:uppercase; }
.card,.grid>*,.section-title>*,.runs,.run,.run>* { min-width:0; }
.card { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:20px; box-shadow:0 16px 40px #0003; }
.login { max-width:420px; margin:70px auto; }
label { display:grid; gap:7px; color:var(--muted); } input,select { width:100%; padding:12px; background:#0b0f14; border:1px solid var(--line); border-radius:8px; color:var(--text); }
form { display:grid; gap:14px; }
.button { border:1px solid #536071; color:var(--text); background:#263141; border-radius:8px; padding:10px 14px; font-weight:700; cursor:pointer; }
.button:hover { filter:brightness(1.12); } .button.primary { background:var(--accent); border-color:var(--accent); color:#19130a; } .button.ghost { background:transparent; } .button.danger { border-color:var(--danger); background:transparent; color:#ff8a8a; }
.button:disabled { cursor:not-allowed; opacity:.42; filter:none; }
.hidden { display:none !important; } .error { color:#ff8585; } .muted { color:var(--muted); }
.grid { display:grid; grid-template-columns:minmax(280px,.75fr) minmax(360px,1.25fr); gap:18px; min-width:0; margin-top:28px; }
.upload-zone { position:relative; display:flex; align-items:center; gap:16px; padding:22px; border:1.5px dashed #566273; border-radius:12px; background:linear-gradient(145deg,#10161e,#0c1117); cursor:pointer; transition:border-color .18s,background .18s,transform .18s; }
.upload-zone:hover,.upload-zone.dragging { border-color:var(--accent); background:#1b1912; transform:translateY(-1px); }
.upload-zone.disabled { cursor:not-allowed; opacity:.55; transform:none; }
.upload-zone.disabled:hover { border-color:#566273; background:linear-gradient(145deg,#10161e,#0c1117); }
.upload-zone input { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.upload-art { display:grid; place-items:center; flex:0 0 58px; height:58px; border-radius:16px; color:var(--accent); background:#ffb00018; border:1px solid #ffb00042; }
.upload-art svg { width:30px; height:30px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.upload-copy { display:grid; gap:4px; min-width:0; color:var(--muted); }
.upload-copy strong { color:var(--text); font-size:1.03rem; }
.upload-copy span,.upload-copy small { overflow-wrap:anywhere; }
.upload-copy small { margin-top:5px; color:#758395; }
.file-selection { border:1px solid var(--line); border-radius:10px; overflow:hidden; background:#0d1218; }
.file-selection-head { display:flex; justify-content:space-between; gap:12px; padding:10px 12px; border-bottom:1px solid var(--line); color:var(--muted); font-size:.86rem; }
.file-selection-head strong { color:var(--text); }
.file-selection ol { list-style:none; margin:0; padding:4px 10px; max-height:190px; overflow:auto; }
.file-selection li { display:grid; grid-template-columns:auto minmax(0,1fr) auto auto; align-items:center; gap:9px; padding:8px 2px; border-bottom:1px solid #202833; }
.file-selection li:last-child { border-bottom:0; }
.file-order { display:grid; place-items:center; width:24px; height:24px; border-radius:7px; background:#263141; color:var(--muted); font-size:.76rem; }
.file-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text); }
.file-size { color:var(--muted); font-size:.8rem; }
.file-remove { border:0; background:transparent; color:#ff8a8a; cursor:pointer; font-size:1.15rem; padding:2px 6px; }
.document-list { display:grid; gap:9px; min-width:0; max-height:310px; overflow:auto; }
.document-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 12px; width:100%; min-width:0; text-align:left; background:#0f141b; color:var(--text); border:1px solid var(--line); border-radius:9px; padding:12px; cursor:pointer; }
.document-title { display:flex; align-items:baseline; gap:8px; min-width:0; }
.document-title strong,.document-customer>span:last-child { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.document-label { flex:0 0 auto; color:var(--muted); font-size:.7rem; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
.document-customer { display:grid; grid-column:1/-1; grid-template-columns:auto minmax(0,1fr); gap:8px; min-width:0; }
.document-meta { display:flex; grid-column:1/-1; flex-wrap:wrap; gap:3px 12px; color:var(--muted); font-size:.8rem; }
.document-meta b { color:var(--muted); font-weight:700; }
.badge { font-size:.72rem; padding:3px 7px; border-radius:999px; background:#293442; align-self:start; white-space:nowrap; }
body.modal-open { overflow:hidden; }
.detail-modal { position:fixed; inset:0; z-index:1000; overflow-y:auto; background:var(--bg); padding:16px; }
.detail-panel { width:min(1240px,100%); min-height:calc(100dvh - 32px); margin:0 auto; }
.detail-toolbar { position:sticky; top:0; z-index:5; display:flex; align-items:center; justify-content:space-between; gap:12px; margin:-20px -20px 18px; padding:14px 20px; border-bottom:1px solid var(--line); background:#151b23f2; backdrop-filter:blur(10px); }
#detail-title,.detail-files { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.detail-files { margin:-8px 0 0; font-size:.86rem; }
.pages { display:flex; gap:12px; width:100%; min-width:0; overflow-x:auto; overflow-y:hidden; padding:10px 0 18px; scroll-snap-type:x proximity; }
.pages img { flex:0 0 auto; width:auto; max-height:460px; max-width:100%; border-radius:8px; border:1px solid var(--line); background:white; object-fit:contain; scroll-snap-align:start; }
.ai-selector { display:grid; grid-template-columns:minmax(180px,.7fr) minmax(240px,1.3fr); gap:12px; align-items:end; max-width:760px; }
.ai-selector p { grid-column:1/-1; margin:0; }
.actions { justify-content:flex-start; flex-wrap:wrap; padding:12px 0; }
.runs { display:grid; gap:12px; } .run { border:1px solid var(--line); border-radius:10px; padding:14px; background:#0f141b; }
.run-head { display:flex; flex-wrap:wrap; justify-content:space-between; gap:6px 12px; cursor:pointer; }
.run-head strong,.run-meta,.run summary,.run p { overflow-wrap:anywhere; }
.run pre { width:100%; max-width:100%; white-space:pre-wrap; overflow:auto; max-height:480px; padding:12px; background:#080b0f; border-radius:8px; color:#d9e2ed; overflow-wrap:anywhere; }
.run details { max-width:100%; }
.run-meta { color:var(--muted); font-size:.86rem; margin:12px 0; }
.user-run .run-head { cursor:default; }
.user-run .run-meta { margin-bottom:8px; }
.result-table { width:100%; table-layout:fixed; border-collapse:collapse; margin:10px 0; }
.result-table th,.result-table td { border-bottom:1px solid var(--line); text-align:left; padding:8px; vertical-align:top; overflow-wrap:anywhere; word-break:break-word; }
.result-table th:first-child,.result-table td:first-child { width:3.5rem; }
.result-table th:last-child,.result-table td:last-child { width:25%; }
@media (max-width:760px) {
  .shell { width:100%; padding:14px 12px 40px; }
  .grid,.ai-selector { grid-template-columns:minmax(0,1fr); }
  .grid { gap:12px; margin-top:18px; }
  .topbar,.section-title { align-items:flex-start; flex-wrap:wrap; }
  .section-title>div { flex:1 1 12rem; }
  .card { width:100%; padding:14px; border-radius:12px; }
  .detail-modal { padding:0; }
  .detail-panel { min-height:100dvh; border:0; border-radius:0; padding:12px; }
  .detail-toolbar { margin:-12px -12px 14px; padding:10px 12px; }
  .upload-zone { align-items:flex-start; gap:12px; padding:15px; }
  .upload-art { flex-basis:42px; height:42px; border-radius:12px; }
  .upload-art svg { width:25px; height:25px; }
  .file-selection-head { flex-wrap:wrap; }
  .file-selection li { grid-template-columns:auto minmax(0,1fr) auto; }
  .file-size { display:none; }
  .pages img { flex-basis:100%; width:100%; height:auto; max-height:70vh; }
  .run { padding:12px; }
  .result-table { font-size:.9rem; }
  .result-table th,.result-table td { padding:7px 5px; }
  .result-table th:first-child,.result-table td:first-child { width:2.5rem; }
  .result-table th:last-child,.result-table td:last-child { width:29%; }
}
@media (max-width:390px) {
  .shell { padding-inline:8px; }
  .card { padding:12px; }
  .upload-zone { padding:12px; }
  .button { padding:9px 11px; }
}
/* Delivery-note laboratory workspace */
.detail-panel{width:100%;max-width:1920px}.workspace-toolbar,.panel-toolbar,.matching-toolbar,.field-confirm{display:flex;gap:8px;align-items:center}.workspace-toolbar{justify-content:space-between;flex-wrap:wrap}.compact{padding:0}.panel-toolbar{min-height:48px;justify-content:space-between;flex-wrap:wrap}.panel-toolbar h3{margin:0}.panel-toolbar select{width:auto;max-width:150px}.comparison{display:grid;grid-template-columns:minmax(260px,.8fr) minmax(540px,1.5fr);gap:14px;margin-bottom:24px}.comparison.with-reference{grid-template-columns:minmax(240px,.7fr) minmax(520px,1.4fr) minmax(280px,.8fr)}.original-panel,.digital-panel,.reference-panel{min-width:0;border:1px solid var(--line);border-radius:10px;padding:10px;background:#0f141b}.original-panel{align-self:start;position:sticky;top:70px}.image-viewport{position:relative;width:100%;height:65vh;min-height:300px;overflow:hidden;background:#080b0f;touch-action:none;cursor:grab}.image-viewport:active{cursor:grabbing}.image-viewport img{position:absolute;left:0;top:0;max-width:none;max-height:none;transform-origin:0 0;user-select:none;pointer-events:none}.image-edge,.unpin{display:none}.note-header{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:12px 0}.customer-field{grid-column:1/-1}.field-confirm input{min-width:0}.field-confirm .button{padding:8px;flex-shrink:0}.customer-value{flex:1;text-align:left;overflow-wrap:anywhere}.matching-toolbar{justify-content:space-between;flex-wrap:wrap;margin:12px 0}.matching-toolbar label{display:flex;align-items:center}.matching-toolbar select{width:auto}.sheet-scroll{overflow:auto;max-height:65vh}.delivery-sheet{width:100%;min-width:640px;border-collapse:collapse;font-size:.85rem}.delivery-sheet th{position:sticky;top:0;background:#1a2430;z-index:1;text-align:left;padding:8px}.delivery-sheet td{padding:4px;border:1px solid var(--line);vertical-align:middle}.delivery-sheet input{border-radius:2px;padding:8px 5px;min-width:65px}.delivery-sheet th:nth-child(3){width:32%}.delivery-sheet th:nth-child(4){width:28%}.delivery-sheet th:nth-child(5){width:80px}.delivery-sheet th:first-child{width:96px}.article-cell{background:transparent;color:var(--text);border:0;text-align:left;width:100%;cursor:pointer;min-height:36px}.line-state{font-size:.75rem;min-width:90px}.line-state.unattempted{background:#343b46}.line-state.unmatched,.line-state.low{background:#61302c}.line-state.medium{background:#65501e}.line-state.high{background:#235547}.line-state.confirmed,.button.confirmed{background:#174d73;color:#d8f0ff}.line-actions{min-width:92px}.line-actions button{background:#263141;border:1px solid #536071;border-radius:3px;color:var(--text);padding:4px 7px;cursor:pointer;margin:2px}.reference-sheet{width:100%;border-collapse:collapse;font-size:.85rem}.reference-sheet td,.reference-sheet th{padding:7px;border-bottom:1px solid var(--line);text-align:left}.reference-panel form{margin:12px 0}.preferred-choice{display:flex;align-items:center;gap:8px;margin-bottom:8px;font-size:.85rem;color:var(--accent)}.preferred-choice input,.evaluation input[type=checkbox]{width:auto}.evaluation{border-top:1px solid var(--line);padding-top:12px;margin-top:10px}.evaluation label{display:flex;align-items:center;gap:8px;margin-bottom:10px;font-size:.85rem}.search-dialog{background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:12px;width:min(680px,95vw);max-height:85dvh;overflow:auto}.search-dialog::backdrop{background:#000b}.candidate{display:block;width:100%;text-align:left;padding:14px;margin:6px 0;background:#202c3b;border:1px solid #536071;border-radius:6px;color:var(--text);cursor:pointer}.candidate:hover{border-color:var(--accent)}#save-state,#company-scope{font-size:.8rem;color:var(--muted)}#workspace-message{min-height:1.5em}#transfer-result{font-size:.85rem;color:#9cddca}.empty-draft{padding:40px 10px;color:var(--muted)}
@media(max-width:1150px) and (min-width:761px){.comparison.with-reference{grid-template-columns:minmax(240px,.75fr) minmax(460px,1.25fr)}.reference-panel{grid-column:1/-1}}
@media(max-width:760px){.comparison,.comparison.with-reference{display:block}.digital-panel{padding:8px}.original-panel{position:fixed;inset:65px 0 0;z-index:1020;border-radius:0;transform:translateX(-102%);transition:transform .16s;visibility:hidden;background:var(--panel)}.original-panel.pinned,.original-panel.dragging{visibility:visible}.original-panel.pinned{transform:translateX(0)}.original-panel.dragging{transition:none}.image-viewport{height:calc(100dvh - 140px)}.unpin{display:inline-block}.image-edge{display:block;position:fixed;left:0;top:140px;bottom:70px;width:18px;z-index:1021;touch-action:none;border-left:4px solid #ffb00088}.note-header{grid-template-columns:1fr}.customer-field{grid-column:auto}.reference-panel{position:fixed;inset:65px 0 0;z-index:1015;overflow:auto;background:var(--panel);border-radius:0}.sheet-scroll{max-height:none}.matching-toolbar{justify-content:flex-start}.delivery-sheet{min-width:650px}.workspace-toolbar .actions{gap:6px}.workspace-toolbar .button{padding:8px;font-size:.8rem}.search-dialog{padding:14px}}

/* Persistent comparison of laboratory evaluation runs. */
.evaluation-comparison { width: 100%; min-width: 0; margin-top: 1rem; }
.evaluation-comparison summary { cursor: pointer; font-weight: 600; }
.evaluation-table { width: 100%; min-width: 720px; border-collapse: collapse; margin-top: .75rem; font-size: .85rem; }
.evaluation-table caption { text-align: left; padding: .5rem 0; }
.evaluation-table th, .evaluation-table td { padding: .6rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.evaluation-table small { display: block; margin-top: .25rem; }

.embeddings-panel { margin-top: 24px; }
#embedding-current { overflow-wrap: anywhere; }
#embedding-progress { width: 100%; height: 12px; accent-color: var(--accent); }
.embeddings-panel summary { cursor: pointer; font-weight: 600; margin-bottom: 12px; }
.embedding-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.embedding-jobs { width: 100%; border-collapse: collapse; font-size: .85rem; }
.embedding-jobs td,.embedding-jobs th { text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); padding: 8px; overflow-wrap: anywhere; }
.embedding-jobs small { display: block; color: var(--muted); }
@media(max-width:700px) { .embedding-jobs {min-width:540px;} }
.embedding-provider-choice { max-width: 320px; margin-bottom: 12px; }

/* Compact embeddings log, below the main panels. */
#embedding-jobs { max-height: 220px; overflow: auto; }
.embedding-jobs td, .embedding-jobs th { padding: 4px 6px; line-height: 1.3; }
.embedding-jobs thead th { position: sticky; top: 0; background: var(--panel); }

#semantic-jobs { max-height: 220px; overflow: auto; }
#semantic-panel .sheet-scroll { max-width: 100%; overflow: auto; }
#semantic-panel td, #semantic-panel th { padding: .45rem; text-align: left; }
.customer-observed { margin-block: .75rem; }
#customer-proposals .candidate small { display: block; }
#semantic-panel, #semantic-experiments { min-width: 0; max-width: 100%; }
#semantic-results { max-width: 100%; overflow-x: auto; }
#semantic-panel select { min-width: 0; max-width: 100%; }

.line-confirm-toggle{border:0;background:transparent;color:inherit;font:inherit;cursor:pointer;padding:8px 0;width:100%;text-align:left}
