:root {
  --bg: #e9edf1;
  --surface: #ffffff;
  --surface-soft: #f5f7f9;
  --surface-strong: #eef2f5;
  --ink: #1f2933;
  --ink-soft: #52606d;
  --muted: #7b8794;
  --line: #d8dee5;
  --line-strong: #bac4ce;
  --blue: #2864a7;
  --blue-dark: #1f4f84;
  --blue-soft: #eaf2fb;
  --green: #2d7a53;
  --green-soft: #e7f3ec;
  --amber: #9a6422;
  --amber-soft: #fff5e5;
  --red: #a63d3d;
  --red-soft: #fbeaea;
  --header: #202b35;
  --header-line: #34424f;
  --font-ui: "Segoe UI Variable", "Segoe UI", Tahoma, sans-serif;
  --font-heading: Bahnschrift, "Segoe UI Variable", "Segoe UI", sans-serif;
  --font-mono: "Cascadia Mono", Consolas, monospace;
  --radius: 5px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 13px/1.45 var(--font-ui); overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }
.hidden { display: none !important; }

/* Login */
.login-shell { min-height: 100%; display: grid; grid-template-columns: minmax(420px, 520px) 1fr; background: #f1f4f7; }
.login-card { display: flex; flex-direction: column; justify-content: center; padding: clamp(44px, 8vw, 96px); background: var(--surface); border-right: 1px solid var(--line); position: relative; z-index: 2; }
.product-label { color: var(--blue); font: 600 12px/1 var(--font-heading); letter-spacing: .04em; margin-bottom: 12px; }
.login-card h1 { margin: 0; font: 650 38px/1.15 var(--font-heading); letter-spacing: -.025em; }
.login-copy { max-width: 390px; margin: 15px 0 30px; color: var(--ink-soft); font-size: 15px; line-height: 1.55; }
.login-card form { display: grid; gap: 16px; max-width: 360px; }
.login-card label, .admin-grid label, .cloud-form label, .feedback-label { display: grid; gap: 6px; color: var(--ink-soft); font-size: 12px; font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 10px 11px; outline: none; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40, 100, 167, .13); }
.primary { border: 1px solid var(--blue); border-radius: var(--radius); background: var(--blue); color: #fff; min-height: 38px; padding: 8px 15px; font-weight: 600; transition: background .12s, border-color .12s; }
.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.wide { width: 100%; margin-top: 4px; }
.form-error { min-height: 20px; margin: 0; color: var(--red); font-size: 12px; }
.security-note { position: absolute; left: clamp(44px, 8vw, 96px); bottom: 28px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.security-note i, .system-state span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.login-drawing { min-width: 0; display: grid; place-items: center; padding: 7vw; background: #e4e9ee; }
.drawing-sheet { width: min(760px, 75vw); aspect-ratio: 1.414 / 1; position: relative; background: #fff; border: 1px solid #aab5c0; box-shadow: 0 14px 36px rgba(31, 41, 51, .14); overflow: hidden; }
.drawing-sheet::before { content: ""; position: absolute; inset: 12px; border: 1px solid #8794a0; }
.drawing-view { position: absolute; border: 2px solid #72808c; border-radius: 50%; }
.drawing-view::before, .drawing-view::after { content: ""; position: absolute; background: #b7c0c8; }
.drawing-view::before { width: 130%; height: 1px; left: -15%; top: 50%; }
.drawing-view::after { width: 1px; height: 130%; top: -15%; left: 50%; }
.drawing-view-a { width: 28%; aspect-ratio: 1; left: 14%; top: 20%; }
.drawing-view-b { width: 19%; aspect-ratio: 1; left: 54%; top: 27%; }
.dimension-line { position: absolute; left: 20%; top: 14%; width: 48%; height: 1px; background: #72808c; }
.dimension-line::before, .dimension-line::after { content: ""; position: absolute; top: -4px; width: 1px; height: 9px; background: #72808c; }
.dimension-line::after { right: 0; }
.dimension-line span { position: absolute; left: 50%; top: -10px; transform: translate(-50%, -100%); padding: 0 6px; background: #fff; color: #53616d; font: 12px var(--font-mono); }
.title-block { position: absolute; right: 12px; bottom: 12px; width: 36%; height: 18%; border: 1px solid #8794a0; display: grid; grid-template-rows: 1fr 1fr; }
.title-block b, .title-block span { padding: 6px 8px; font: 11px var(--font-mono); }
.title-block b { border-bottom: 1px solid #8794a0; }

/* Application frame */
.app-shell { height: 100%; display: grid; grid-template-rows: 58px 1fr; }
.topbar { min-width: 0; display: flex; align-items: center; gap: 20px; padding: 0 18px; background: var(--header); color: #f7f9fb; border-bottom: 1px solid #15202a; }
.brand { display: inline-flex; align-items: baseline; gap: 10px; text-decoration: none; font: 650 18px/1 var(--font-heading); letter-spacing: -.01em; }
.brand small { color: #aeb9c3; font: 400 11px var(--font-ui); }
.system-state { display: flex; align-items: center; gap: 8px; margin-right: auto; color: #bdc7d0; font-size: 12px; }
.system-state b { font-weight: 400; }
.top-actions { display: flex; align-items: center; gap: 7px; }
.ghost, .icon-button, .tool-button, .square-button, .secondary, .accept, .toggle-example { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.topbar .ghost, .topbar .icon-button { border-color: var(--header-line); background: transparent; color: #dce3e9; }
.ghost { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.ghost:hover, .topbar .icon-button:hover { background: rgba(255,255,255,.07); }
.top-actions .ghost span { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 5px; padding: 0 4px; border-radius: 3px; background: #3b4b59; color: #fff; font-size: 11px; }
.logout-button { color: #dbe3ea; }
.user-chip { display: flex; align-items: center; gap: 9px; margin-left: 5px; }
.user-chip > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 4px; background: #3a4956; font: 600 12px var(--font-heading); }
.user-chip b, .user-chip small { display: block; }
.user-chip b { font-size: 12px; font-weight: 600; }
.user-chip small { color: #aeb9c3; font-size: 10px; }
.icon-button { width: 32px; height: 32px; padding: 0; }
.workspace { min-height: 0; display: grid; grid-template-columns: 280px minmax(480px, 1fr) 410px; background: var(--bg); }
.history-panel, .result-panel { min-height: 0; background: var(--surface); }
.history-panel { display: grid; grid-template-rows: auto auto 1fr auto; padding: 16px 12px 12px; border-right: 1px solid var(--line); }
.result-panel { overflow: auto; padding: 0 18px 24px; border-left: 1px solid var(--line); }
.panel-heading { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-heading h2 { margin: 0; font: 620 17px/1.2 var(--font-heading); }
.square-button { min-height: 30px; padding: 4px 9px; color: var(--blue); border-color: #aebfd2; font-weight: 600; font-size: 12px; }
.square-button:hover { background: var(--blue-soft); }
.history-panel .panel-heading { flex-wrap: wrap; }
.upload-actions { width: 100%; display: flex; gap: 5px; }
.upload-actions .square-button { flex: 1; padding-inline: 6px; font-size: 11px; }
.upload-actions .square-button:first-child { color: var(--ink-soft); }
.search-box { display: block; margin-bottom: 12px; }
.search-box input { height: 34px; padding: 7px 9px; background: var(--surface-soft); }
.history-list { min-height: 0; overflow: auto; padding-right: 2px; }
.history-item { width: 100%; display: block; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--ink); padding: 10px; margin-bottom: 4px; text-align: left; }
.history-item:hover { background: var(--surface-soft); }
.history-item.active { background: var(--blue-soft); border-color: #b8cde4; }
.history-item b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.history-item small { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 11px; }
.history-item small span { display: flex; align-items: center; gap: 5px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status-dot.complete, .status-dot.ready { background: var(--green); }
.status-dot.analyzing, .status-dot.preprocessing { background: var(--blue); }
.status-dot.error { background: var(--red); }
.upload-zone { margin-top: 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 13px 10px; text-align: center; color: var(--ink-soft); background: var(--surface-soft); }
.upload-zone.drag { border-color: var(--blue); background: var(--blue-soft); }
.upload-zone b, .upload-zone span { display: block; }
.upload-zone b { font-size: 12px; }
.upload-zone span { margin-top: 3px; color: var(--muted); font-size: 11px; }

/* Drawing viewer */
.viewer-panel { min-width: 0; min-height: 0; position: relative; background: #dfe4e9; }
.empty-state { height: 100%; display: grid; place-content: center; justify-items: center; padding: 40px; text-align: center; color: var(--ink-soft); }
.empty-state h2 { margin: 18px 0 6px; color: var(--ink); font: 620 22px var(--font-heading); }
.empty-state p { max-width: 430px; margin: 0 0 20px; }
.document-placeholder { width: 72px; height: 90px; position: relative; border: 2px solid #9aa7b3; border-radius: 3px; background: #f7f9fb; }
.document-placeholder::before { content: ""; position: absolute; left: 13px; right: 13px; top: 19px; height: 1px; background: #b0bbc4; box-shadow: 0 13px #b0bbc4, 0 26px #b0bbc4, 0 39px #b0bbc4; }
.document-view { height: 100%; display: grid; grid-template-rows: 52px minmax(0, 1fr) auto 68px; }
.viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px; background: #f7f9fb; border-bottom: 1px solid var(--line); }
.document-title { display: flex; align-items: center; min-width: 0; gap: 9px; }
.document-title span { flex: 0 0 auto; padding: 3px 6px; border-radius: 3px; background: #dbe4ed; color: #425466; font-size: 10px; font-weight: 700; }
.document-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.viewer-controls { display: flex; align-items: center; gap: 6px; }
.switch { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 11px; }
.switch input { width: 15px; height: 15px; margin: 0; accent-color: var(--blue); box-shadow: none; }
.switch span { display: none; }
.tool-button { width: 30px; height: 30px; padding: 0; background: #fff; }
.tool-button:hover { background: var(--surface-strong); }
.viewer-controls output { width: 40px; text-align: center; color: var(--ink-soft); font-size: 10px; }
.viewer-controls select { width: auto; min-width: 92px; height: 30px; padding: 4px 7px; }
.canvas-wrap { min-height: 0; overflow: auto; display: grid; place-items: center; padding: 24px; }
.drawing-stack { width: 100%; max-width: 100%; max-height: 100%; position: relative; line-height: 0; background: #fff; border: 1px solid #aeb8c2; box-shadow: 0 8px 24px rgba(31, 41, 51, .16); transition: width .15s; overflow: hidden; }
.drawing-stack > img, .processed-layer img { display: block; width: 100%; height: auto; max-height: calc(100vh - 205px); object-fit: contain; background: #fff; }
.processed-layer { position: absolute; inset: 0 auto 0 0; width: 50%; overflow: hidden; }
.processed-layer img { width: var(--drawing-width, 100%); max-width: none; }
.compare-divider { position: absolute; z-index: 2; top: 0; bottom: 0; left: 50%; width: 2px; background: var(--blue); box-shadow: 0 0 0 1px rgba(255,255,255,.7); pointer-events: none; }
.compare-divider::before { content: ""; position: absolute; top: 50%; left: 50%; width: 28px; height: 28px; transform: translate(-50%,-50%); border-radius: 50%; background: var(--blue); border: 2px solid #fff; }
.compare-divider span { position: absolute; top: 9px; padding: 4px 6px; border-radius: 3px; background: rgba(32,43,53,.88); color: #fff; font: 600 10px/1 var(--font-ui); }
.compare-divider span:first-child { right: 8px; }
.compare-divider span:last-child { left: 8px; }
.compare-range { position: absolute; z-index: 3; inset: 0; width: 100%; height: 100%; padding: 0; opacity: 0; cursor: ew-resize; }
.drawing-stack:not(.comparing) .compare-divider, .drawing-stack:not(.comparing) .compare-range { display: none; }
.drawing-stack:not(.comparing) .processed-layer { width: 100%; }
.instruction-panel { border-top: 1px solid var(--line); background: #fff; }
.instruction-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 14px; cursor: pointer; list-style: none; }
.instruction-panel summary::-webkit-details-marker { display: none; }
.instruction-panel summary span { display: flex; align-items: baseline; gap: 8px; }
.instruction-panel summary b { color: var(--ink-soft); font-size: 11px; }
.instruction-panel summary small, .instruction-panel summary i { color: var(--muted); font-size: 10px; font-style: normal; }
.instruction-panel .when-open { display: none; }
.instruction-panel[open] .when-closed { display: none; }
.instruction-panel[open] .when-open { display: inline; }
.instruction-panel > div { padding: 0 14px 10px; }
.instruction-panel textarea { display: block; min-height: 96px; max-height: 220px; resize: vertical; overflow: auto; line-height: 1.5; background: var(--surface-soft); }
.instruction-panel p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.pipeline-strip { display: flex; align-items: center; gap: 18px; padding: 10px 12px; background: #f7f9fb; border-top: 1px solid var(--line); }
.pipeline-strip > div { min-width: 92px; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.pipeline-strip i { flex: 0 0 auto; width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: #fff; color: var(--ink-soft); font-style: normal; font-size: 10px; }
.pipeline-strip b, .pipeline-strip small { display: block; }
.pipeline-strip b { color: var(--ink-soft); font-size: 10px; }
.pipeline-strip small { font-size: 10px; white-space: nowrap; }
.pipeline-strip .done i { border-color: #79a98e; color: var(--green); background: var(--green-soft); }
.pipeline-strip .active-step i { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.pipeline-strip .primary { margin-left: auto; min-height: 34px; white-space: nowrap; font-size: 12px; }

/* Results */
.result-heading { position: sticky; top: 0; z-index: 3; min-height: 58px; margin: 0 -18px 12px; padding: 0 18px; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); }
.result-scores { display: flex; gap: 6px; }
.score-box { min-width: 70px; padding: 4px 7px; border: 1px solid var(--line-strong); border-radius: var(--radius); text-align: right; background: #fff; }
.score-box small, .score-box b { display: block; }
.score-box small { color: var(--muted); font-size: 9px; line-height: 1.1; }
.score-box b { margin-top: 2px; font: 700 13px/1 var(--font-heading); }
.result-empty { min-height: 60%; display: grid; place-content: center; text-align: center; color: var(--muted); }
.result-empty p { max-width: 240px; }
.summary-card { padding: 12px 0 14px; border-bottom: 1px solid var(--line); }
.summary-card small { color: var(--blue); font: 600 11px var(--font-mono); }
.summary-card h3 { margin: 5px 0 7px; font: 620 22px/1.25 var(--font-heading); }
.summary-card p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.summary-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.summary-meta span { padding: 3px 6px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface-soft); color: var(--ink-soft); font-size: 10px; }
.inference-note { display: grid; gap: 2px; margin: 12px 0; padding: 9px 10px; border: 1px solid #dfbf84; border-left: 3px solid var(--amber); border-radius: var(--radius); background: var(--amber-soft); }
.inference-note b { font-size: 11px; }
.inference-note span { color: var(--ink-soft); font-size: 10px; }
.tabs { position: sticky; top: 58px; z-index: 2; display: flex; margin: 0 0 15px; background: #fff; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ink-soft); padding: 11px 12px 9px; font-size: 12px; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.result-section { margin: 0 0 20px; }
.result-section h4 { display: flex; justify-content: space-between; align-items: center; margin: 0 0 8px; color: var(--ink-soft); font: 650 12px var(--font-heading); }
.result-section h4 span { color: var(--blue); }
.section-help { margin: -2px 0 9px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.fact-row { margin-bottom: 6px; padding: 10px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.fact-row.inferred { border-color: #dfbf84; background: var(--amber-soft); }
.fact-row.unreadable { border-color: #e1b0b0; background: var(--red-soft); }
.fact-top { display: flex; justify-content: space-between; gap: 12px; }
.fact-row b { font-size: 12px; font-weight: 600; }
.fact-row small { display: block; margin-top: 5px; color: var(--ink-soft); font-size: 11px; line-height: 1.4; }
.confidence-bar { width: 46px; height: 3px; margin-top: 7px; background: #dce2e7; }
.confidence-bar i { display: block; height: 100%; background: var(--green); }
.reading-badge { display: inline-flex; margin-left: 6px; padding: 2px 5px; border-radius: 3px; background: #eed9a9; color: #704814; font: 700 9px/1 var(--font-ui); text-transform: uppercase; }
.alternatives { color: var(--amber) !important; }
.execution-card { margin-bottom: 8px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.execution-head { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; background: #eaf0f5; }
.execution-head b { font-size: 11px; }
.execution-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
.execution-grid span { min-width: 0; padding: 6px 8px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); font: 10px/1.3 var(--font-mono); overflow-wrap: anywhere; }
.execution-grid span.inferred { background: var(--amber-soft); color: var(--amber); }
.assembly-row { display: grid; grid-template-columns: 32px 1fr auto; gap: 8px; align-items: center; padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 11px; }
.assembly-row .level { color: var(--muted); font-family: var(--font-mono); }
.assembly-row.missing { color: var(--red); background: var(--red-soft); }
.quality-card { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.quality-card div { padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.quality-card b, .quality-card small { display: block; }
.quality-card b { font: 650 13px var(--font-heading); }
.quality-card small { color: var(--muted); font-size: 10px; }
.empty-list { margin: 8px 0; color: var(--muted); font-size: 12px; }
.warning-card { margin-bottom: 7px; padding: 10px; border: 1px solid #ead1a8; border-left: 3px solid #c18637; border-radius: var(--radius); background: var(--amber-soft); font-size: 11px; }
.warning-card.critical { border-color: #e4b4b4; border-left-color: var(--red); background: var(--red-soft); }
.warning-card b { display: block; margin-bottom: 3px; }
.feedback-label textarea { min-height: 90px; resize: vertical; }
.learn-check { display: grid; grid-template-columns: 18px 1fr; column-gap: 9px; margin-top: 12px; padding: 11px; border: 1px solid #bad4c5; border-radius: var(--radius); background: var(--green-soft); cursor: pointer; }
.learn-check input { display: none; }
.learn-check > span { grid-row: 1/3; width: 17px; height: 17px; position: relative; border: 1px solid #6b9e80; border-radius: 3px; background: #fff; }
.learn-check input:checked + span::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--green); font-weight: 800; }
.learn-check b { font-size: 11px; }
.learn-check small { margin-top: 2px; color: var(--ink-soft); font-size: 10px; }
.json-editor { margin-top: 10px; padding: 9px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.json-editor summary { cursor: pointer; font-size: 11px; font-weight: 600; }
.json-editor textarea { margin-top: 9px; min-height: 220px; background: #202b35; color: #e8edf2; border-color: #202b35; font: 10px/1.5 var(--font-mono); resize: vertical; }
.json-editor p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.review-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.review-actions button { min-height: 38px; padding: 8px; font-weight: 600; font-size: 11px; }
.secondary:hover { background: var(--surface-strong); }
.accept { border-color: var(--green); background: var(--green); color: #fff; }
.accept:hover { background: #246443; }
.reference-meta { display: flex; flex-wrap: wrap; gap: 5px 8px; align-items: center; margin-top: 8px; color: var(--muted); font-size: 11px; }
.reference-meta a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.reference-status { padding: 2px 5px; border: 1px solid var(--line-strong); border-radius: 3px; font-size: 10px; }
.reference-status.exact { border-color: #87b69b; color: var(--green); background: var(--green-soft); }
.reference-status.replacement, .reference-status.needs_verification { border-color: #dbbb8a; color: var(--amber); background: var(--amber-soft); }

/* Dialogs and notifications */
dialog { width: min(780px, 92vw); max-height: 88vh; padding: 0; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(31,41,51,.22); }
dialog::backdrop { background: rgba(21, 31, 40, .48); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.dialog-head .eyebrow { margin: 0 0 3px; color: var(--muted); font-size: 11px; }
.dialog-head h2 { margin: 0; font: 620 21px var(--font-heading); }
.dialog-head .icon-button { font-size: 19px; }
#dialogContent { max-height: calc(88vh - 74px); overflow: auto; padding: 18px 20px 22px; }
.guide-dialog { width: min(860px, 94vw); }
.guide-content { max-height: calc(88vh - 74px); overflow: auto; padding: 20px 22px 24px; }
.guide-intro { display: grid; gap: 3px; padding: 13px 15px; border-left: 3px solid var(--blue); background: var(--blue-soft); }
.guide-intro b { font: 650 15px var(--font-heading); }
.guide-intro span { color: var(--ink-soft); font-size: 12px; }
.guide-steps { margin: 18px 0 20px; padding: 0; list-style: none; }
.guide-steps li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.guide-steps li > i { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid #aebfd2; border-radius: 50%; background: #fff; color: var(--blue); font: 650 11px var(--font-heading); font-style: normal; }
.guide-steps b { font: 650 13px var(--font-heading); }
.guide-steps p { margin: 4px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.guide-reference { padding-top: 2px; }
.guide-reference h3 { margin: 0 0 10px; font: 650 15px var(--font-heading); }
.guide-reference dl { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.guide-reference dl div { display: grid; grid-template-columns: minmax(150px, 210px) 1fr; gap: 14px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.guide-reference dl div:last-child { border-bottom: 0; }
.guide-reference dt { color: var(--ink); font-weight: 650; }
.guide-reference dd { margin: 0; color: var(--ink-soft); }
.guide-note { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 16px; padding: 11px 13px; border: 1px solid #dfbf84; border-left: 3px solid var(--amber); border-radius: var(--radius); background: var(--amber-soft); }
.guide-note b { color: var(--amber); }
.guide-note span { color: var(--ink-soft); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.admin-grid .primary { align-self: end; }
.admin-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 10px 2px; border-top: 1px solid var(--line); font-size: 11px; }
.admin-row small { color: var(--muted); }
.admin-row a { color: var(--blue); font-size: 11px; }
.learning-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 15px; }
.learning-stat { padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.learning-stat b { display: block; color: var(--blue); font: 650 24px var(--font-heading); }
.learning-stat small { color: var(--muted); font-size: 10px; }
.example-row { display: grid; grid-template-columns: 1fr 70px 90px; gap: 10px; align-items: center; padding: 11px 2px; border-top: 1px solid var(--line); }
.example-row b, .example-row small { display: block; }
.example-row small { margin-top: 2px; color: var(--muted); }
.score-pill { text-align: center; font: 600 17px var(--font-heading); }
.toggle-example { padding: 6px 8px; font-size: 10px; }
.toggle-example.active { border-color: var(--green); background: var(--green); color: #fff; }
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 30; display: grid; gap: 8px; }
.toast { min-width: 260px; max-width: 380px; padding: 11px 13px; border: 1px solid #435360; border-left: 3px solid #6ca2dc; border-radius: var(--radius); background: #27343f; color: #fff; box-shadow: 0 8px 24px rgba(31,41,51,.2); font-size: 12px; }
.toast.error { border-left-color: #d06a6a; }

@media (max-width: 1220px) {
  .workspace { grid-template-columns: 250px minmax(430px, 1fr) 360px; }
  .pipeline-strip { gap: 10px; }
  .pipeline-strip > div { min-width: 76px; }
  .top-actions .ghost { padding-inline: 7px; }
}
@media (max-width: 980px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100%; }
  .workspace { grid-template-columns: 240px 1fr; grid-template-rows: calc(100vh - 58px) auto; }
  .result-panel { grid-column: 1 / -1; max-height: none; border-left: 0; border-top: 1px solid var(--line); }
  .login-shell { grid-template-columns: 1fr; }
  .login-card { min-height: 100vh; align-items: center; border: 0; }
  .login-card > * { width: min(390px, 100%); }
  .login-drawing { display: none; }
  .security-note { position: static; margin-top: 28px; }
  .top-actions .ghost { display: none; }
}
@media (max-width: 680px) {
  .workspace { display: block; }
  .history-panel { height: 310px; border-right: 0; border-bottom: 1px solid var(--line); }
  .viewer-panel { height: 70vh; }
  .pipeline-strip > div:nth-child(-n+2) { display: none; }
  .user-chip div, .system-state { display: none; }
  .topbar { padding-inline: 10px; }
  .brand small { display: none; }
  .result-panel { padding-inline: 12px; }
  .admin-grid, .review-actions { grid-template-columns: 1fr; }
  .guide-reference dl div { grid-template-columns: 1fr; gap: 3px; }
}
.result-title.uncertain,
#resultTitle.uncertain{color:#8a4b18;text-decoration:underline dotted;text-underline-offset:5px}
