:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --panel: #ffffff;
  --panel-muted: #f6f8fa;
  --text: #1f2933;
  --muted: #5d6b78;
  --subtle: #657480;
  --border: #dce3e8;
  --border-strong: #c4cfd7;
  --primary: #096dd9;
  --primary-hover: #075dbb;
  --primary-soft: #e9f2fd;
  --success: #13795b;
  --success-soft: #e9f7f0;
  --danger: #c82e3b;
  --danger-soft: #fff0f0;
  --warning: #936100;
  --measure: #e7bd55;
  --radius: 4px;
  --shadow: 0 1px 2px rgb(31 41 51 / 5%);
  --header-height: 56px;
  --footer-height: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, select, input { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; }
h1, h2, p, dl, dd { margin: 0; }
ul, ol { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--primary-soft); color: var(--primary-hover); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--text);
  color: #fff;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  display: grid;
  grid-template-rows: var(--header-height) minmax(0, 1fr) var(--footer-height);
  height: 100dvh;
  min-height: 540px;
}
.topbar {
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 0 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 43px; height: 35px; flex: 0 0 auto; color: #242b31; }
.brand h1 { font-size: 17px; line-height: 1.2; letter-spacing: .01em; white-space: nowrap; }
.brand h1 span { margin-left: 5px; font-size: 13px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.demo-badge {
  margin-right: 8px;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease;
}
.icon-button:hover { color: var(--primary); background: var(--primary-soft); border-color: #cfe2f8; }

.workspace {
  display: grid;
  grid-template-columns: 56px 184px minmax(340px, 1fr) 264px 60px;
  grid-template-areas: "nav log inspection data actions";
  gap: 6px;
  min-height: 0;
  padding: 6px;
  overflow: hidden;
}
.panel {
  min-width: 0;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.side-nav {
  grid-area: nav;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  padding: 4px;
  background: #f8fafb;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.nav-item {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 66px;
  padding: 6px 2px;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  transition: color 180ms ease, background-color 180ms ease;
}
.nav-item .icon { width: 19px; height: 19px; }
.nav-item:hover { color: var(--primary); background: var(--primary-soft); }
.nav-item.is-active { color: var(--primary); background: var(--primary-soft); border-left-color: var(--primary); font-weight: 600; }
.nav-spacer { flex: 1; }

.log-panel { grid-area: log; display: flex; flex-direction: column; overflow: hidden; }
.panel-heading { padding: 9px 10px; border-bottom: 1px solid var(--border); }
.log-heading { display: flex; align-items: center; justify-content: space-between; }
.log-heading h2 { font-size: 13px; }
.log-heading time { display: block; margin-top: 2px; color: var(--subtle); font-size: 10px; font-variant-numeric: tabular-nums; }
.heading-icon { width: 15px; height: 15px; color: var(--subtle); }
.log-tools { display: flex; align-items: center; gap: 5px; padding: 6px 8px; border-bottom: 1px solid var(--border); font-size: 11px; }
.log-tools label { color: var(--muted); white-space: nowrap; }
.log-tools select { width: 61px; height: 27px; padding: 0 3px; border: 1px solid var(--border); border-radius: 2px; background: var(--panel); color: var(--text); font-size: 11px; }
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 28px;
  padding: 3px 5px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  transition: color 180ms ease, background-color 180ms ease;
}
.text-button:hover { color: var(--primary); background: var(--primary-soft); }
.text-button .icon { width: 13px; height: 13px; }
.log-tools .text-button { margin-left: auto; }
.log-list { flex: 1; padding: 3px 8px 8px; overflow: auto; list-style: none; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.log-list li { padding: 6px 0 6px 6px; border-bottom: 1px dashed #e7ecef; border-left: 2px solid transparent; color: #44515c; font-size: 10.5px; line-height: 1.45; overflow-wrap: anywhere; }
.log-list li.is-success { border-left-color: var(--success); }
.log-list li.is-warning { border-left-color: var(--warning); }
.log-list li.is-error { border-left-color: var(--danger); }
.log-list time { margin-right: 3px; color: var(--subtle); font-variant-numeric: tabular-nums; }
.empty-log { padding: 24px 8px; color: var(--muted); font-size: 12px; text-align: center; }

.inspection-panel { grid-area: inspection; display: flex; flex-direction: column; overflow: hidden; }
.inspection-topline { display: flex; align-items: stretch; justify-content: space-between; min-height: 50px; border-bottom: 1px solid var(--border); }
.mode-tabs { display: flex; align-items: center; gap: 4px; padding: 6px; }
.mode-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}
.mode-tab .icon { width: 14px; height: 14px; }
.mode-tab:hover { color: var(--primary); background: var(--primary-soft); }
.mode-tab.is-active { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgb(9 109 217 / 20%); }
.job-summary { display: flex; align-items: center; justify-content: flex-end; gap: 17px; padding: 6px 10px; }
.job-summary > div { min-width: 56px; }
.job-summary dt { color: var(--subtle); font-size: 9px; white-space: nowrap; }
.job-summary dd { margin-top: 2px; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.viewer-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px 6px; }
.section-kicker { display: block; margin-bottom: 1px; color: var(--primary); font-size: 8px; font-weight: 700; letter-spacing: .14em; }
.viewer-heading h2 { font-size: 12px; font-weight: 600; }
.viewer-heading h2 span { margin-left: 5px; color: var(--muted); font-size: 10px; font-weight: 400; }
.scan-state { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.scan-state strong { margin-left: 2px; color: var(--text); font-variant-numeric: tabular-nums; }
.status-dot { display: inline-block; width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--subtle); }
.status-dot.is-success { background: #1a9c73; box-shadow: 0 0 0 2px rgb(26 156 115 / 10%); }
.status-dot.is-running { background: var(--primary); box-shadow: 0 0 0 3px rgb(9 109 217 / 12%); }
.status-dot.is-stopped { background: var(--danger); }
.progress-track { height: 2px; flex: 0 0 auto; overflow: hidden; background: #edf1f4; }
.progress-track span { display: block; height: 100%; background: var(--primary); transition: width 180ms linear; }

.inspection-stage { position: relative; isolation: isolate; flex: 1; min-height: 0; overflow: hidden; background: #778087; }
.workpiece-image { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; }
#post-image { filter: saturate(.3) brightness(1.06) contrast(.94); }
#pre-image { filter: saturate(.2) brightness(.67) contrast(1.16); }
.stage-vignette { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(180deg, rgb(20 29 35 / 14%), transparent 22%, transparent 75%, rgb(20 29 35 / 14%)); }
.camera-strip { position: absolute; top: 12px; left: 12px; z-index: 5; display: flex; align-items: stretch; min-height: 30px; overflow: hidden; border-left: 2px solid #7e97aa; background: rgb(22 30 36 / 78%); color: #fff; font-size: 10px; backdrop-filter: blur(3px); }
.camera-strip strong, .camera-strip span { display: flex; align-items: center; padding: 5px 9px; }
.camera-strip strong { background: rgb(0 0 0 / 22%); letter-spacing: .06em; }
.camera-strip span { border-left: 1px solid rgb(255 255 255 / 16%); white-space: nowrap; }
.scan-result-chip { position: absolute; top: 49px; left: 12px; z-index: 5; display: flex; align-items: center; gap: 6px; padding: 5px 9px; border-left: 2px solid var(--primary); background: rgb(22 30 36 / 76%); color: #fff; font-size: 10px; backdrop-filter: blur(3px); }
.scan-result-chip strong { font-size: 12px; }
.scan-result-chip span { padding-left: 6px; border-left: 1px solid rgb(255 255 255 / 22%); }
.scan-result-chip.is-ng { border-left-color: #ff6961; }
.scan-result-chip.is-ng strong { color: #ff8a80; }
.scan-result-chip.is-ok { border-left-color: #55d9b1; }
.scan-result-chip.is-ok strong { color: #79e5c3; }
.scan-line { position: absolute; top: 0; right: 0; left: 0; z-index: 6; height: 2px; background: #6de0ff; box-shadow: 0 0 10px 2px rgb(109 224 255 / 65%); animation: scanning 2.2s linear infinite; pointer-events: none; }
@keyframes scanning { from { transform: translateY(0); } to { transform: translateY(440px); } }
.mode-panel { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.measurement-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; fill: none; }
.measurement-layer path { vector-effect: non-scaling-stroke; }
.edge-line { stroke: #58ddb5; stroke-width: 1.2; stroke-dasharray: 5 4; }
.center-line { stroke: #ff6961; stroke-width: 1.3; stroke-dasharray: 7 5; }
.laser-glow { stroke: #ff4d47; stroke-width: 7; opacity: .24; }
.laser-line { stroke: #ff6961; stroke-width: 1.5; }
.dimension-line { stroke: var(--measure); stroke-width: 1.4; }
.guide-line { stroke: #58ddb5; stroke-width: 1; }
.measure-guide { stroke: var(--measure); stroke-width: 1.3; }
.annotation { position: absolute; z-index: 3; padding: 5px 8px; border-left: 2px solid #7e97aa; background: rgb(25 32 38 / 86%); color: #fff; font-size: 10px; line-height: 1.25; white-space: nowrap; box-shadow: 0 1px 3px rgb(0 0 0 / 14%); }
.annotation strong { font-weight: 600; }
.edge-label { border-left-color: #58ddb5; }
.left-edge { top: 32%; left: 27%; }
.right-edge { top: 32%; left: 57%; }
.center-label { top: 49%; left: 56%; border-left-color: #ff6961; }
.width-label { bottom: 6%; left: 36%; border-left-color: var(--measure); }
.scale-marker { position: absolute; bottom: 18px; left: 16px; z-index: 3; width: 74px; height: 30px; color: #fff; font-size: 9px; }
.scale-marker span { position: absolute; top: 0; right: 0; left: 0; border-top: 1px solid #fff; }
.scale-marker span::before, .scale-marker span::after { position: absolute; top: -4px; height: 8px; border-left: 1px solid #fff; content: ""; }
.scale-marker span::before { left: 0; }
.scale-marker span::after { right: 0; }
.scale-marker small { position: absolute; top: 7px; font-size: inherit; }
.scale-marker small:last-child { right: 0; }
.profile-card { position: absolute; right: 5%; bottom: 8%; z-index: 3; width: 35%; min-width: 160px; max-width: 225px; padding: 8px 9px; border: 1px solid rgb(111 145 160 / 45%); background: rgb(14 27 34 / 90%); color: #fff; box-shadow: 0 4px 14px rgb(0 0 0 / 18%); }
.profile-title { font-size: 10px; font-weight: 600; }
.profile-title span { color: #9cb3be; font-weight: 400; }
.profile-card svg { display: block; width: 100%; height: auto; max-height: 90px; margin: 5px 0 2px; }
.profile-grid { fill: none; stroke: #39505b; stroke-width: .6; }
.profile-path { fill: none; stroke: #58ddb5; stroke-width: 2; }
.profile-meta { display: flex; justify-content: space-between; gap: 6px; color: #a9bdc6; font-size: 8px; font-variant-numeric: tabular-nums; }

.defect-hotspot { position: absolute; z-index: 4; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; pointer-events: auto; transform: translate(-50%, -50%); }
.target-ring, .target-box { position: absolute; top: 50%; left: 50%; display: block; border: 2px solid #ff746c; box-shadow: 0 0 0 1px rgb(255 255 255 / 30%); transform: translate(-50%, -50%); transition: border-color 180ms ease, box-shadow 180ms ease; }
.target-ring { width: 34px; height: 34px; border-radius: 50%; }
.target-box { width: 28px; height: 58px; border-color: var(--measure); }
.defect-hotspot:hover .target-ring, .defect-hotspot:hover .target-box { box-shadow: 0 0 0 4px rgb(255 255 255 / 28%); }
.defect-hotspot.is-selected .target-ring, .defect-hotspot.is-selected .target-box { border-color: #fff; box-shadow: 0 0 0 4px var(--primary), 0 0 0 6px rgb(255 255 255 / 55%); }
.hotspot-porosity { top: 22%; left: 50%; }
.hotspot-undercut { top: 47%; left: 51%; }
.hotspot-overlap { top: 69%; left: 50%; }
.defect-label { top: 50%; transform: translateY(-50%); }
.defect-label b { margin-right: 4px; color: #ffb3ad; font-size: 9px; }
.hotspot-porosity .defect-label { right: calc(100% + 72px); border-left-color: #ff746c; }
.hotspot-porosity .defect-label::after, .hotspot-undercut .defect-label::before, .hotspot-overlap .defect-label::before { position: absolute; top: 50%; width: 72px; border-top: 1px solid #ff8f88; content: ""; }
.hotspot-porosity .defect-label::after { left: 100%; }
.hotspot-undercut .defect-label { left: calc(100% + 72px); border-left-color: var(--measure); }
.hotspot-undercut .defect-label::before { right: 100%; border-color: var(--measure); }
.hotspot-overlap .defect-label { left: calc(100% + 72px); border-left-color: #ff746c; }
.hotspot-overlap .defect-label::before { right: 100%; }
.defect-hotspot.is-selected .defect-label { background: var(--primary); border-left-color: #fff; }
.reinforcement-label { bottom: 17%; left: 58%; border-left-color: #58ddb5; }
.seam-width-label { bottom: 3%; left: 29%; border-left-color: var(--measure); }

.data-panel { grid-area: data; display: flex; flex-direction: column; overflow: hidden; }
.device-status { display: flex; flex: 0 0 33px; align-items: center; justify-content: flex-end; gap: 11px; padding: 0 9px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 10px; }
.device-status span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.device-status .status-dot { width: 5px; height: 5px; }
.data-mode { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; }
.post-data-mode { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.data-section { min-height: 0; border-bottom: 1px solid var(--border); }
.data-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 35px; padding: 7px 9px; }
.data-heading > div { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.data-heading h2 { font-size: 12px; white-space: nowrap; }
.data-heading span, .data-heading strong { color: var(--subtle); font-size: 9px; font-weight: 400; white-space: nowrap; }
.data-heading > .icon { width: 14px; height: 14px; color: var(--subtle); }
.table-scroll { min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.coordinate-section { display: flex; flex: 1; flex-direction: column; }
.coordinate-table-scroll { flex: 1; }
.defect-table-scroll { max-height: 115px; }
.data-table { width: 100%; border-collapse: collapse; color: #3e4a54; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { height: 27px; padding: 4px 6px; border-bottom: 1px solid #edf0f2; text-align: right; white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table thead th { position: sticky; top: 0; z-index: 2; background: var(--panel-muted); color: var(--muted); font-weight: 500; }
.data-table tbody th { color: var(--text); font-weight: 500; }
.coordinate-table { font-size: 10px; }
.coordinate-table th, .coordinate-table td { padding-right: 5px; padding-left: 5px; }
.coordinate-table tbody tr:nth-child(even), .measurement-table tbody tr:nth-child(even) { background: #fafbfc; }
.defect-table tbody tr { cursor: pointer; transition: background-color 160ms ease, box-shadow 160ms ease; }
.defect-table tbody tr:hover { background: #f3f7fb; }
.defect-table tbody tr.is-selected { background: var(--primary-soft); box-shadow: inset 2px 0 var(--primary); }
.defect-table tbody tr:focus-visible { outline-offset: -2px; }
.result-tag { display: inline-block; min-width: 23px; padding: 1px 3px; border: 1px solid currentColor; border-radius: 2px; font-size: 9px; line-height: 1.25; text-align: center; }
.result-tag.is-ok { color: var(--success); background: var(--success-soft); }
.result-tag.is-ng { color: var(--danger); background: var(--danger-soft); }
.result-tag.is-neutral { color: var(--subtle); border-color: transparent; }
.defect-stats { margin: 6px 9px 9px; border: 1px solid var(--border); font-size: 9px; }
.defect-stats > div { display: grid; grid-template-columns: 34px repeat(5, 1fr); }
.defect-stats > div:first-child { background: var(--panel-muted); }
.defect-stats dt, .defect-stats dd { padding: 3px 1px; text-align: center; }
.defect-stats dt { color: var(--muted); }
.defect-stats dd { border-left: 1px solid #edf0f2; }
.measurement-section { flex: 0 0 auto; }
.measurement-table th, .measurement-table td { height: 26px; }
.subtle-label { color: var(--subtle); }
.verdict-section { flex: 0 0 auto; padding: 8px 9px; border-bottom: 1px solid var(--border); }
.verdict-heading { display: flex; align-items: center; gap: 5px; font-size: 10px; }
.verdict-heading .icon { width: 13px; height: 13px; color: var(--danger); }
.verdict-heading strong { font-size: 10px; }
.verdict-heading span { margin-left: auto; color: var(--subtle); font-size: 9px; }
.verdict-section ul { margin: 5px 0 7px; padding-left: 15px; color: var(--muted); font-size: 9.5px; line-height: 1.5; }
.verdict-section li:first-child { color: var(--danger); }
.verdict-result { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border: 1px solid #f3c6c9; background: var(--danger-soft); }
.verdict-result > span { color: var(--danger); font-size: 21px; font-weight: 800; line-height: 1; }
.verdict-result p { color: var(--muted); font-size: 9px; }
.verdict-result strong { display: block; margin-bottom: 1px; color: var(--danger); font-size: 10px; }
.data-actions { position: sticky; bottom: 0; z-index: 3; display: grid; grid-template-columns: 1fr 1.15fr; gap: 6px; margin-top: auto; padding: 8px; background: var(--panel); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 35px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 3px; background: var(--panel); color: var(--text); font-size: 11px; font-weight: 500; transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 120ms ease; }
.button .icon { width: 14px; height: 14px; }
.button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { opacity: .5; }
.button-primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.button-primary:hover:not(:disabled) { border-color: var(--primary-hover); background: var(--primary-hover); color: #fff; }
.button-block { width: calc(100% - 18px); margin: 0 9px 9px; }
.compensation-section { flex: 0 0 auto; border-bottom: 0; }
.compensation-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 2px 9px 8px; }
.compensation-grid > div { padding: 6px 7px; background: var(--panel-muted); border: 1px solid #edf0f2; }
.compensation-grid dt { color: var(--muted); font-size: 9px; }
.compensation-grid dd { margin-top: 2px; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.value-danger { color: var(--danger); }
.inline-status { display: flex; align-items: flex-start; gap: 5px; margin: 0 9px 8px; padding: 7px; font-size: 10px; }
.inline-status .icon { width: 13px; height: 13px; margin-top: 1px; }
.inline-status.is-success { background: var(--success-soft); color: var(--success); }

.action-rail { grid-area: actions; display: flex; flex-direction: column; align-items: center; gap: 11px; min-height: 0; padding: 12px 2px 7px; }
.scan-action { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 100%; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 9px; }
.action-icon { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--panel); box-shadow: var(--shadow); transition: color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 120ms ease; }
.action-icon .icon { width: 17px; height: 17px; }
.scan-action:hover:not(:disabled) .action-icon { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.scan-action:active:not(:disabled) .action-icon { transform: scale(.96); }
.scan-action-primary { color: var(--primary); }
.scan-action-primary .action-icon { border-color: #9ec7ef; color: var(--primary); }
.scan-action-danger { color: var(--danger); }
.scan-action-danger .action-icon { border-color: #edb5b9; color: var(--danger); }
.scan-action-danger:hover:not(:disabled) .action-icon { border-color: var(--danger); color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.scan-action:disabled { opacity: .4; }
.rail-divider { width: 24px; border-top: 1px solid var(--border); }
.rail-status { display: flex; flex-direction: column; align-items: center; gap: 5px; margin-top: auto; color: var(--subtle); font-size: 9px; }

.statusbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 10px; border-top: 1px solid var(--border); background: var(--panel); color: var(--subtle); font-size: 9px; }
.statusbar-center { display: inline-flex; align-items: center; gap: 5px; }
.statusbar .status-dot { width: 5px; height: 5px; }
.toast-region { position: fixed; right: 16px; bottom: 36px; z-index: 50; display: grid; gap: 8px; max-width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 8px; padding: 10px 13px; border-left: 3px solid var(--primary); border-radius: var(--radius); background: #26333d; color: #fff; box-shadow: 0 8px 24px rgb(20 30 38 / 22%); font-size: 12px; animation: toast-in 200ms ease-out both; }
.toast .icon { width: 15px; height: 15px; margin-top: 1px; }
.toast.is-success { border-left-color: #58ddb5; }
.toast.is-warning { border-left-color: var(--measure); }
.toast.is-error { border-left-color: #ff746c; }
.toast.is-leaving { opacity: 0; transform: translateY(5px); transition: opacity 180ms ease, transform 180ms ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 1600px) {
  .workspace { grid-template-columns: 64px 210px minmax(480px, 1fr) 300px 68px; gap: 8px; padding: 8px; }
  .brand h1 { font-size: 18px; }
  .data-table { font-size: 11px; }
  .log-list li { font-size: 11px; }
}

@media (max-width: 1250px) {
  .workspace { grid-template-columns: 50px 150px minmax(330px, 1fr) 234px 52px; gap: 4px; padding: 4px; }
  .topbar { padding: 0 10px; }
  .brand h1 { font-size: 15px; }
  .brand h1 span { font-size: 11px; }
  .brand-mark { width: 38px; }
  .demo-badge { display: none; }
  .job-summary { gap: 9px; padding-right: 7px; padding-left: 7px; }
  .job-summary > div { min-width: 49px; }
  .mode-tab { padding: 0 8px; }
  .profile-card { min-width: 140px; }
  .device-status { gap: 7px; padding: 0 6px; }
  .annotation { font-size: 9px; }
}

@media (max-width: 980px) {
  body { overflow: auto; }
  .app-shell { grid-template-rows: var(--header-height) auto var(--footer-height); height: auto; min-height: 100dvh; }
  .workspace { grid-template-columns: 52px minmax(0, 1fr) 236px 56px; grid-template-areas: "nav inspection data actions" "nav log data actions"; overflow: visible; }
  .inspection-stage { min-height: 470px; }
  .log-panel { height: 260px; }
  .data-panel { max-height: none; }
  .statusbar { min-height: var(--footer-height); }
}

@media (max-width: 720px) {
  :root { --header-height: auto; --footer-height: 30px; }
  .topbar { flex-wrap: wrap; gap: 6px; min-height: 56px; padding: 7px 9px; }
  .brand h1 span { display: block; margin: 2px 0 0; font-size: 10px; }
  .topbar-actions { gap: 2px; }
  .icon-button { width: 32px; height: 32px; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-areas: "nav" "inspection" "actions" "data" "log"; gap: 6px; padding: 6px; }
  .side-nav { flex-direction: row; gap: 3px; padding: 4px; overflow-x: auto; }
  .nav-item { flex: 1 0 72px; min-height: 52px; border-bottom: 2px solid transparent; border-left: 0; }
  .nav-item.is-active { border-bottom-color: var(--primary); border-left-color: transparent; }
  .nav-spacer { display: none; }
  .inspection-topline { flex-wrap: wrap; }
  .mode-tabs { width: 100%; border-bottom: 1px solid var(--border); }
  .mode-tab { flex: 1; }
  .job-summary { width: 100%; justify-content: space-between; }
  .inspection-stage { flex: none; height: 430px; min-height: 0; }
  .action-rail { flex-direction: row; justify-content: center; gap: 14px; padding: 4px 6px; }
  .scan-action { width: auto; min-width: 60px; }
  .rail-divider { display: none; }
  .rail-status { margin: 0 0 0 auto; }
  .data-panel { overflow: visible; }
  .data-mode, .post-data-mode { overflow: visible; }
  .coordinate-table-scroll { max-height: 350px; }
  .defect-table-scroll { max-height: none; }
  .data-actions { position: static; }
  .log-panel { height: 270px; }
  .statusbar { padding: 6px 9px; }
  .statusbar-center { display: none; }
}

@media (max-width: 480px) {
  .brand-mark { width: 34px; height: 29px; }
  .brand h1 { font-size: 14px; }
  .topbar-actions { width: 100%; justify-content: flex-end; padding-top: 4px; border-top: 1px solid #edf0f2; }
  .viewer-heading h2 span { display: block; margin: 1px 0 0; }
  .section-kicker { display: none; }
  .job-summary { gap: 6px; }
  .job-summary dd { font-size: 10px; }
  .inspection-stage { height: 390px; }
  .camera-strip { top: 9px; left: 9px; }
  .camera-strip strong, .camera-strip span { padding: 5px 6px; }
  .camera-strip span:last-child { display: none; }
  .scan-result-chip { top: 44px; left: 9px; }
  .annotation { padding: 4px 6px; font-size: 9px; }
  .left-edge { left: 8%; }
  .right-edge { right: 7%; left: auto; }
  .center-label { left: 54%; }
  .width-label { left: 30%; }
  .profile-card { right: 4%; bottom: 8%; width: 46%; min-width: 0; padding: 6px; }
  .profile-card svg { max-height: 65px; }
  .profile-meta { display: block; font-size: 7px; }
  .profile-meta span { display: block; }
  .hotspot-porosity .defect-label, .hotspot-undercut .defect-label, .hotspot-overlap .defect-label { right: auto; left: calc(100% + 20px); }
  .hotspot-porosity .defect-label::after { display: none; }
  .hotspot-porosity .defect-label::before, .hotspot-undercut .defect-label::before, .hotspot-overlap .defect-label::before { right: 100%; width: 20px; }
  .hotspot-porosity .defect-label::before { position: absolute; top: 50%; border-top: 1px solid #ff8f88; content: ""; }
  .reinforcement-label { right: 5%; left: auto; }
  .seam-width-label { left: 12%; }
  .action-rail { gap: 8px; }
  .rail-status { display: none; }
  .toast-region { right: 12px; bottom: 12px; left: 12px; max-width: none; }
}

@media (pointer: coarse) {
  .text-button, .log-tools select { min-height: 40px; }
  .button { min-height: 44px; }
  .mode-tab { min-height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .scan-line { animation: none; }
}
