:root {
  color-scheme: light;
  --ink: #1c1c1e;
  --muted: #6e6e73;
  --subtle: #8e8e93;
  --line: #e5e5ea;
  --line-strong: #d1d1d6;
  --canvas: #f5f5f7;
  --paper: #fff;
  --soft: #f2f2f7;
  --green: #34a853;
  --green-dark: #287a42;
  --green-pale: #edf8f0;
  --orange: #ff9500;
  --orange-pale: #fff5e5;
  --blue: #007aff;
  --shadow: 0 8px 32px rgba(28, 28, 30, .065), 0 2px 8px rgba(28, 28, 30, .025);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans CJK SC", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button { color: inherit; }
button, input, select, label { touch-action: manipulation; }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex="0"]:focus-visible { outline: 2px solid rgba(0, 122, 255, .55); outline-offset: 3px; }
.assay-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: #f2f2f7; box-shadow: inset 0 1px 2px rgba(28,28,30,.035); }
.assay-switch button { height: 29px; min-width: 86px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.assay-switch button.selected { color: var(--ink); background: white; box-shadow: 0 2px 5px rgba(28,28,30,.1), inset 0 0 0 1px #ededf1; }
.privacy-state { display: inline-flex; align-items: center; gap: 7px; margin-right: 8px; color: var(--muted); font-size: 12px; }
.privacy-state i, .save-state i, .status-dot { width: 7px; height: 7px; border-radius: 50%; background: #64a77f; }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 10px; color: #5c6068; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.icon-button:hover { border-color: var(--line); background: var(--soft); }
.icon-button svg { width: 17px; height: 17px; fill: currentColor; }
.danger-quiet { color: #b75d54; }
.workflow { position: relative; z-index: 2; height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 20px; border-bottom: 1px solid var(--line); background: #f8f8fb; }
.workflow-steps { min-width: 0; display: flex; align-items: center; gap: 10px; }
.workflow-actions { display: flex; flex: none; align-items: center; gap: 5px; margin-left: auto; }
.workflow-step { position: relative; display: grid; grid-template-columns: 25px auto; grid-template-rows: 18px 15px; column-gap: 8px; align-items: center; min-width: 158px; padding: 6px 9px; border: 1px solid transparent; border-radius: 11px; text-align: left; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, border-color .15s; }
.workflow-step > span { grid-row: 1 / 3; width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: #7b847d; font-size: 12px; font-weight: 700; }
.workflow-step b { font-size: 12px; font-weight: 650; }
.workflow-step small { color: var(--subtle); font-size: 10px; }
.workflow-step.current { color: var(--ink); border-color: #ffe1ae; background: #fff4e1; box-shadow: inset 0 1px 0 #fff; }
.workflow-step.current > span { border-color: var(--orange); color: white; background: var(--orange); }
.workflow-step.complete > span { border-color: #ffc46b; color: #9b5a00; background: white; }
.workflow-steps > i { width: 24px; height: 1px; background: var(--line-strong); }
.mobile-workspace-nav { display: none; }
.save-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.save-state.saving i { background: var(--orange); }
.save-state.error i { background: #c85c50; }
.workbench { height: calc(100% - 64px); display: grid; grid-template-columns: 236px minmax(380px, 1fr) 286px; gap: 14px; padding: 14px; }
.sample-rail, .main-area, .inspector { min-width: 0; min-height: 0; border: 1px solid rgba(255,255,255,.92); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
.sample-rail { display: flex; flex-direction: column; overflow: hidden; }
.rail-heading { display: flex; align-items: center; justify-content: space-between; padding: 17px 15px 12px; }
.rail-controls { display: flex; align-items: center; gap: 6px; margin: 0 12px 9px; }
.rail-assay-switch { flex: none; margin: 0; }
.rail-assay-switch button { min-width: 58px; padding-inline: 8px; }
.rail-assay-switch button[data-assay="transwell"] { min-width: 74px; }
.rail-actions { display: flex; flex: none; align-items: center; gap: 2px; }
.rail-actions .icon-button { width: 31px; height: 31px; }
.eyebrow { display: block; color: #8b968d; font-size: 9px; font-weight: 700; letter-spacing: 0; }
.rail-heading h1 { margin-top: 3px; font-size: 16px; line-height: 1.2; }
.count { min-width: 29px; height: 27px; display: grid; place-items: center; padding: 0 8px; border: 1px solid #dff0e2; border-radius: 9px; color: var(--green-dark); background: var(--green-pale); font-size: 12px; font-weight: 700; }
.import-actions { display: flex; gap: 6px; padding: 0 12px 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 11px; color: var(--ink); background: white; font-size: 12px; font-weight: 600; line-height: 1.35; text-align: center; white-space: normal; overflow-wrap: anywhere; cursor: pointer; transition: background .15s, border-color .15s, transform .15s, box-shadow .15s; }
.button:hover { background: var(--soft); border-color: #b9c5bc; }
.button:active { transform: translateY(1px); }
.button-primary { color: white; border-color: var(--ink); background: var(--ink); box-shadow: 0 3px 8px #1c1c1e0d; }
.button-primary:hover { border-color: #343436; background: #343436; box-shadow: 0 6px 18px #1c1c1e16; }
.button-quiet { color: #48484e; background: var(--soft); }
.button-small { min-height: 28px; padding: 0 9px; font-size: 11px; }
.full-width { width: 100%; }
.import-actions .button-primary { flex: 1; }
.example-link { display: flex; align-items: center; gap: 8px; width: calc(100% - 24px); min-height: 45px; margin: 0 12px 8px; padding: 6px 8px; border: 1px solid #ffe0ad; border-radius: 11px; color: #76502e; background: var(--orange-pale); text-align: left; cursor: pointer; }
.example-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 6px; color: #bd6a2b; background: white; }
.example-link span:nth-child(2) { display: grid; flex: 1; }
.example-link b { font-size: 11px; }
.example-link small { color: #9b7959; font-size: 9px; }
.example-link > span:last-child { color: #ae7a4d; }
.drop-hint { margin: 0 12px 8px; padding: 8px; border: 1px dashed #d6ddd7; border-radius: 6px; color: var(--subtle); background: #fafbfa; text-align: center; font-size: 10px; }
.drop-hint.dragover { border-color: var(--green); color: var(--green-dark); background: var(--green-pale); }
.sample-list { flex: 1; min-height: 70px; overflow: auto; padding: 0 8px 8px; }
.sample-empty { display: grid; min-height: 120px; place-items: center; padding: 14px; color: var(--subtle); text-align: center; font-size: 11px; }
.sample-item { position: relative; display: grid; grid-template-columns: 49px minmax(0, 1fr) 18px; gap: 8px; align-items: center; width: 100%; margin: 3px 0; padding: 7px; border: 1px solid transparent; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.sample-item:hover { background: var(--soft); }
.sample-item.active { border-color: #ffd38f; background: #fff8ed; box-shadow: inset 0 1px 0 #fff; }
.sample-thumb { width: 49px; height: 36px; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: #e5e8e4; object-fit: cover; }
.sample-meta { min-width: 0; display: grid; gap: 2px; }
.sample-meta b { overflow: hidden; color: #414a43; font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.sample-meta small { color: var(--subtle); font-size: 9px; }
.sample-item .sample-check { width: 7px; height: 7px; border-radius: 50%; background: #c6ccc7; }
.sample-item.measured .sample-check { background: #69a47a; }
.sample-remove { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; display: none; border: 0; border-radius: 50%; color: #a25b52; background: #fff; font-size: 13px; cursor: pointer; }
.sample-item:hover .sample-remove { display: grid; place-items: center; }
.rail-footer { display: flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.rail-footer .text-button { margin-left: auto; }
.text-button { padding: 2px; border: 0; color: #758179; background: transparent; font-size: 10px; cursor: pointer; }
.main-area { position: relative; overflow: hidden; }
.step-panel { display: none; width: 100%; height: 100%; min-height: 0; flex-direction: column; }
.step-panel.active { display: flex; }
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 55px; padding: 8px 13px; border-bottom: 1px solid var(--line); }
.image-title { min-width: 0; }
.image-title h2 { overflow: hidden; margin-top: 2px; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.viewer-actions { display: flex; align-items: center; gap: 3px; }
.measure-status { margin-right: 4px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.measure-status.ready { color: var(--green); }
.zoom-label { width: 40px; color: #7b857d; text-align: center; font-size: 10px; }
.image-stage { position: relative; display: grid; flex: 1; min-height: 180px; place-items: center; overflow: auto; background-color: #f4f4f8; background-image: linear-gradient(rgba(255,255,255,.38) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.38) 1px, transparent 1px); background-size: 28px 28px; }
.stage-empty { display: grid; justify-items: center; gap: 7px; width: min(100% - 28px, 440px); padding: 28px 20px; border: 1px dashed #d4d4dc; border-radius: 15px; background: rgba(255,255,255,.94); text-align: center; }
.stage-empty b { font-size: 13px; }
.stage-empty small { max-width: 340px; color: var(--muted); font-size: 10px; }
.stage-empty .button { margin-top: 5px; }
.empty-art { position: relative; width: 94px; height: 46px; margin-bottom: 5px; overflow: hidden; border: 1px solid #dce4dd; border-radius: 6px; background: #ecf2ed; }
.empty-art i { position: absolute; width: 100%; height: 11px; left: 0; background: repeating-linear-gradient(0deg, #8fb69d 0 2px, transparent 2px 6px); }
.empty-art i:first-child { top: 0; }
.empty-art i:last-child { bottom: 0; }
.empty-art i:nth-child(2) { top: 18px; height: 3px; background: #d4a271; }
.empty-art span { position: absolute; inset: 11px 0; background: #f9faf8; }
.canvas-stack { position: relative; display: block; flex: none; max-width: none; line-height: 0; transform-origin: center; touch-action: none; }
.canvas-stack canvas { display: block; max-width: none; }
#sourceCanvas { position: relative; z-index: 0; }
#overlayCanvas { position: absolute; inset: 0; z-index: 1; cursor: crosshair; }
#overlayCanvas.inspect { cursor: default; }
.stage-caption { position: absolute; right: 9px; bottom: 8px; left: 9px; display: flex; justify-content: space-between; gap: 8px; color: #fff; font-size: 10px; text-shadow: 0 1px 3px #0009; pointer-events: none; }
.viewer-foot { display: flex; align-items: center; gap: 12px; min-height: 34px; padding: 0 12px; border-top: 1px solid var(--line); color: var(--subtle); font-size: 9px; }
.viewer-foot #imageNote { flex: 1; }
.metric-chip, .unit-pill, .export-badge { padding: 4px 7px; border: 1px solid #d8e7dc; border-radius: 5px; color: #337452; background: #f2f8f3; font-size: 9px; font-weight: 650; white-space: nowrap; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 66px; padding: 10px 15px; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin-top: 2px; font-size: 15px; }
.section-heading p { margin-top: 3px; color: var(--muted); font-size: 10px; }
.quant-image-slot { position: relative; display: grid; flex: 1; min-height: 120px; place-items: center; overflow: hidden; background: #f1f3f0; }
.quant-image-slot .canvas-stack { max-width: 100%; max-height: 100%; overflow: auto; }
.correction-bar { display: flex; align-items: center; gap: 5px; min-height: 47px; padding: 6px 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fbfcfb; }
.correction-label { margin-right: 3px; color: #778078; font-size: 10px; }
.tool-button { min-height: 28px; padding: 0 8px; border: 1px solid transparent; border-radius: 5px; color: #677169; background: transparent; font-size: 10px; cursor: pointer; }
.tool-button:hover { background: var(--soft); }
.tool-button.selected { border-color: #d6e6da; color: var(--green-dark); background: var(--green-pale); }
.brush-control { display: flex; align-items: center; gap: 5px; margin-left: auto; color: #788179; font-size: 9px; }
.brush-control input { width: 72px; accent-color: var(--green); }
.brush-control b { min-width: 32px; color: #57645b; }
.quant-results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 10px 12px; }
.quant-result { padding: 9px; border: 1px solid #e9e9ef; border-radius: 10px; background: #fafafd; box-shadow: inset 0 1px 0 #fff; }
.quant-result span { display: block; color: var(--muted); font-size: 9px; }
.quant-result b { display: block; margin-top: 3px; font-size: 14px; }
.chart-toolbar { display: flex; align-items: end; gap: 9px; min-height: 49px; padding: 7px 13px; }
.chart-toolbar label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.chart-toolbar select, .form-field select { height: 29px; padding: 0 24px 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: white; font-size: 10px; }
.chart-toolbar .button { margin-left: auto; }
.chart-frame { position: relative; display: grid; flex: 1; min-height: 170px; place-items: center; margin: 0 12px; overflow: hidden; border: 1px solid #e7e7ed; border-radius: 13px; background: #fff; box-shadow: inset 0 1px 3px rgba(28,28,30,.025); }
.chart-frame svg { width: 100%; height: 100%; min-height: 175px; }
.chart-empty { color: var(--subtle); text-align: center; font-size: 11px; }
.summary-strip { display: flex; align-items: center; gap: 7px; min-height: 51px; padding: 7px 12px; overflow-x: auto; }
.summary-chip { display: inline-grid; grid-template-columns: auto auto; gap: 2px 10px; min-width: 115px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfb; }
.summary-chip b { color: #4a554d; font-size: 10px; }
.summary-chip span { color: var(--muted); font-size: 9px; text-align: right; }
.summary-chip small { grid-column: 1 / 3; color: #8b948d; font-size: 8px; }
.data-table-wrap { max-height: 155px; overflow: auto; border-top: 1px solid var(--line); }
.result-table { width: 100%; border-collapse: collapse; font-size: 10px; white-space: nowrap; }
.result-table th { position: sticky; top: 0; z-index: 1; padding: 7px 9px; color: #737d75; background: #f7f8f6; text-align: left; font-size: 9px; font-weight: 650; }
.result-table td { padding: 6px 9px; border-top: 1px solid #eff1ef; color: #49534b; }
.result-table tr:hover td { background: #fbfcfb; }
.inspector { position: relative; overflow: hidden; background: linear-gradient(180deg, #fff 0%, #fdfdff 100%); }
.inspector-panel { display: none; height: 100%; min-height: 0; flex-direction: column; overflow: auto; padding: 14px; }
.inspector-panel.active { display: flex; }
.inspector-heading { padding: 1px 0 14px; border-bottom: 1px solid var(--line); }
.inspector-heading h2 { margin-top: 3px; font-size: 15px; }
.form-field { display: grid; gap: 5px; margin-top: 13px; }
.form-field > label { color: #59635b; font-size: 10px; font-weight: 650; }
.form-field input, .form-field select { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 10px; color: #303036; background: #fafafd; font-size: 11px; transition: border-color .15s, box-shadow .15s, background .15s; }
.form-field input:focus, .form-field select:focus { border-color: #ffbd59; outline: 0; background: #fff; box-shadow: 0 0 0 3px rgba(255,149,0,.12); }
.form-field small { color: var(--subtle); font-size: 9px; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.inspector-divider { height: 1px; margin: 14px 0; background: var(--line); }
.design-note { margin-top: 12px; padding: 9px; border: 1px solid #f0dfce; border-radius: 6px; background: #fffaf5; }
.design-note strong { color: #83582f; font-size: 10px; }
.design-note p { margin-top: 4px; color: #876c50; font-size: 9px; line-height: 1.55; }
.inspector-panel > .full-width:first-of-type { margin-top: auto; }
.inspector-panel > .full-width + .full-width { margin-top: 7px; }
.inspector-panel > .button.full-width { min-height: 36px; }
.inspector-panel > .button.full-width span { margin-left: auto; }
.settings-block { padding: 13px 0 4px; }
.setting-label { display: flex; justify-content: space-between; gap: 8px; color: #59635b; font-size: 10px; font-weight: 650; }
.setting-label small { color: var(--subtle); font-size: 8px; font-weight: 400; }
.setting-label b { color: var(--green-dark); font-size: 10px; }
.segmented { display: flex; gap: 3px; margin-top: 8px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); }
.segmented button { flex: 1; min-height: 29px; padding: 0 6px; border: 0; border-radius: 4px; color: #727c74; background: transparent; font-size: 9px; cursor: pointer; }
.segmented button.selected { color: var(--green-dark); background: white; box-shadow: 0 1px 3px #152a1918; font-weight: 650; }
.segmented-three button { padding: 0 4px; }
.switch-line { position: relative; display: flex; align-items: center; gap: 12px; min-height: 47px; margin-top: 7px; border-bottom: 1px solid #eef0ed; cursor: pointer; }
.switch-line > span { flex: 1; display: grid; gap: 1px; }
.switch-line b { font-size: 10px; }
.switch-line small { color: var(--subtle); font-size: 8px; }
.switch-line input { position: absolute; right: 0; width: 1px; height: 1px; opacity: 0; }
.switch-line i { position: relative; width: 32px; height: 18px; border-radius: 10px; background: #ccd2cd; transition: background .15s; }
.switch-line i::after { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: white; box-shadow: 0 1px 2px #0002; content: ""; transition: transform .15s; }
.switch-line input:checked + i { background: var(--green); }
.switch-line input:checked + i::after { transform: translateX(14px); }
.threshold-label { margin-top: 13px; }
.range-wide { width: 100%; height: 18px; margin: 5px 0 0; accent-color: var(--green); }
.range-wide:disabled { opacity: .45; }
.boundary-heading { margin-top: 14px; }
.compact-select { height: 28px; padding: 0 24px 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; color: #37413a; background: #fff; font-size: 10px; }
#boundaryMode { width: 100%; margin-top: 6px; }
.boundary-style-row { display: grid; grid-template-columns: 54px minmax(70px, 1fr) 62px; align-items: end; gap: 8px; margin-top: 9px; }
.boundary-color-field, .boundary-width-field, .boundary-dash-field { display: grid; gap: 5px; color: #6d776f; font-size: 9px; }
.boundary-color-field input { width: 32px; height: 25px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 5px; background: white; }
.boundary-width-field > span { display: flex; justify-content: space-between; gap: 3px; white-space: nowrap; }
.boundary-width-field b { color: var(--green-dark); font-weight: 650; }
.boundary-width-field .range-wide { height: 16px; margin: 0; }
.boundary-dash-field .compact-select { width: 100%; }
.boundary-instructions { margin-top: 8px; padding: 7px 8px; border-left: 2px solid #f2b31f; border-radius: 0 5px 5px 0; color: #765b30; background: #fff8e9; font-size: 9px; line-height: 1.45; }
#overlayCanvas.edit-boundaries { cursor: grab; }
#overlayCanvas.edit-boundaries:active { cursor: grabbing; }
.result-focus { display: grid; gap: 3px; margin: 13px 0; padding: 13px; border: 1px solid #ffe0ad; border-radius: 15px; background: linear-gradient(145deg, #fffaf2, #fff); box-shadow: 0 5px 16px rgba(255,149,0,.055), inset 0 1px 0 #fff; }
.result-focus strong { color: var(--green-dark); font-size: 22px; line-height: 1.1; }
.result-focus small { color: #708276; font-size: 9px; }
.mini-note { margin: 7px 0 10px; color: var(--subtle); font-size: 9px; line-height: 1.5; }
.test-result { display: grid; gap: 6px; margin-top: 14px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: #fafbfa; }
.test-result span { color: var(--muted); font-size: 9px; }
.test-result b { color: #465249; font-size: 11px; }
.test-result small { color: #78837a; font-size: 9px; }
.download-list { display: grid; gap: 5px; margin-top: 12px; }
.download-list button { display: flex; align-items: center; gap: 9px; min-height: 52px; padding: 7px; border: 1px solid var(--line); border-radius: 6px; background: white; text-align: left; cursor: pointer; }
.download-list button:hover { border-color: #c6d7ca; background: #fbfdfb; }
.download-type { width: 37px; height: 28px; display: grid; place-items: center; border-radius: 5px; color: var(--green-dark); background: var(--green-pale); font-size: 9px; font-weight: 750; }
.download-list button > span:nth-child(2) { flex: 1; display: grid; gap: 2px; }
.download-list b { font-size: 10px; }
.download-list small { color: var(--subtle); font-size: 8px; }
.download-list button > span:last-child { color: #7d8980; }
.export-warning { margin-top: auto; padding: 10px; border: 1px solid #f0dfce; border-radius: 6px; background: #fffaf5; }
.export-warning b { color: #895c33; font-size: 10px; }
.export-warning p { margin-top: 4px; color: #92765b; font-size: 9px; line-height: 1.55; }
.export-preview { display: flex; flex: 1; min-height: 150px; flex-direction: column; margin: 12px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; }
.export-preview-head { display: flex; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid var(--line); color: #647067; font-size: 10px; }
.export-preview-head span { color: var(--subtle); font-size: 9px; }
.export-preview-body { display: grid; flex: 1; place-items: center; min-height: 100px; color: var(--subtle); font-size: 10px; }
.export-preview-body svg { width: 100%; height: 100%; min-height: 140px; }
.export-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 13px; }
.export-card { display: flex; gap: 9px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.export-card > div { min-width: 0; }
.export-card h3 { font-size: 12px; }
.export-card p { min-height: 32px; margin: 4px 0 9px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.export-icon { width: 27px; height: 27px; flex: none; display: grid; place-items: center; border-radius: 6px; color: #3b7553; background: var(--green-pale); font-size: 15px; }
.figure-icon { color: #b36a31; background: var(--orange-pale); }
.button-row { display: flex; gap: 5px; }
.science-note { margin: 0 13px 12px; padding: 8px 10px; border-left: 3px solid #d9a36e; color: #806448; background: #fff9f2; font-size: 9px; line-height: 1.5; }
.help-dialog { width: min(570px, calc(100% - 28px)); max-height: min(90vh, 660px); padding: 22px; border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 20px 70px #10201635; }
.help-dialog::backdrop { background: #1b28218c; backdrop-filter: blur(2px); }
.dialog-close { position: absolute; top: 11px; right: 13px; width: 30px; height: 30px; border: 0; border-radius: 6px; color: #606a62; background: var(--soft); font-size: 19px; cursor: pointer; }
.help-dialog h2 { margin: 3px 0 14px; font-size: 19px; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.help-grid article { padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfb; }
.help-grid b { font-size: 11px; }
.help-grid p { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.help-caution { margin: 12px 0; padding: 9px; border: 1px solid #f0dfce; border-radius: 6px; color: #806448; background: #fff9f2; font-size: 9px; line-height: 1.6; }
.toast-region { position: fixed; right: 17px; bottom: 16px; z-index: 10; display: grid; gap: 6px; pointer-events: none; }
.toast { max-width: min(400px, calc(100vw - 34px)); padding: 10px 13px; border: 1px solid #e5e5ea; border-radius: 11px; color: #303036; background: white; box-shadow: 0 8px 28px #1c1c1e1c; font-size: 11px; pointer-events: none; animation: toast-in .18s ease-out; }
.toast.error { border-color: #f2c7c2; color: #a23d36; }
@keyframes toast-in { from { transform: translateY(5px); opacity: 0; } to { transform: none; opacity: 1; } }
.hidden { display: none !important; }

.workflow { background: rgba(255,255,255,.82); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 1px 8px rgba(28,28,30,.035); }
.workflow-step { border-radius: 12px; }
.workflow-step.current { border-color: #ffe1ae; background: #fff7ea; box-shadow: inset 0 1px 0 #fff, 0 2px 8px rgba(255,149,0,.06); }
.workbench { gap: 12px; padding: 12px; }
.sample-rail, .main-area, .inspector { border: 1px solid rgba(255,255,255,.95); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.rail-heading { padding-top: 15px; }
.count { border-color: #d9efdf; border-radius: 9px; background: #eff9f1; }
.assay-switch { border-color: #e7e7ed; border-radius: 12px; background: #f2f2f7; box-shadow: inset 0 1px 2px rgba(28,28,30,.04); }
.assay-switch button { border-radius: 8px; transition: color .16s, background .16s, box-shadow .16s; }
.assay-switch button.selected { box-shadow: 0 2px 7px rgba(28,28,30,.1), inset 0 0 0 1px #ededf1; }
.button { border-radius: 10px; transition: background .18s, border-color .18s, transform .18s, box-shadow .18s; }
.button-primary { box-shadow: 0 3px 9px rgba(28,28,30,.11); }
.button-primary:hover { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(28,28,30,.14); }
.button-quiet { border-color: #e7e7ed; background: #f5f5f8; }
.example-link { border-radius: 12px; border-color: #ffe4bd; background: #fff7ed; box-shadow: inset 0 1px 0 #fff; }
.example-icon { border-radius: 8px; }
.drop-hint { border-color: #dfe0e6; border-radius: 9px; background: #fafafd; }
.sample-item { border-radius: 11px; }
.sample-item.active { border-color: #ffd38f; background: #fff8ed; box-shadow: 0 2px 8px rgba(255,149,0,.06), inset 0 1px 0 #fff; }
.viewer-head, .section-heading { background: rgba(255,255,255,.92); }
.image-stage { background-color: #f3f3f7; background-image: linear-gradient(rgba(255,255,255,.48) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.48) 1px, transparent 1px); }
.metric-chip, .unit-pill, .export-badge { border-radius: 8px; border-color: #dceee0; background: #f1f8f2; }
.correction-bar { background: #fafafd; }
.tool-button { border-radius: 8px; }
.tool-button.selected { border-color: #d8ecdd; background: #eff8f1; }
.quant-result { border-color: #e9e9ef; border-radius: 11px; background: #fff; box-shadow: 0 2px 8px rgba(28,28,30,.035); }
.chart-frame { border-radius: 12px; box-shadow: 0 2px 9px rgba(28,28,30,.035); }
.summary-chip { border-radius: 8px; background: #fafafd; }
.inspector { background: #fff; }
.inspector-panel { padding: 15px; }
.inspector-heading h2 { font-size: 16px; }
.form-field { gap: 6px; }
.form-field > label, .setting-label { color: #4d4d52; font-size: 11px; }
.form-field input, .form-field select { border-color: #dedee5; border-radius: 9px; background: #fafafd; font-size: 12px; }
.form-field input:focus, .form-field select:focus { border-color: #ffb84d; box-shadow: 0 0 0 3px rgba(255,149,0,.13); }
.design-note { border-radius: 9px; border-color: #f3e3d1; background: #fffaf4; }
.segmented { border-radius: 9px; background: #f3f3f7; }
.segmented button { border-radius: 7px; font-size: 10px; }
.segmented button.selected { color: #226f3b; background: #fff; box-shadow: 0 1px 4px rgba(28,28,30,.1); }
.switch-line { min-height: 45px; border-bottom-color: #f0f0f4; }
.boundary-instructions { border-radius: 0 8px 8px 0; background: #fff8ea; }
.result-focus { border-radius: 13px; background: #fffaf2; box-shadow: 0 5px 18px rgba(255,149,0,.07), inset 0 1px 0 #fff; }
.result-focus strong { color: #287a42; }
.test-result { border-radius: 9px; background: #fafafd; }
.download-list button, .export-warning { border-radius: 9px; }
.download-list button:hover { border-color: #cfe4d4; background: #f8fcf9; }
.export-preview { border-radius: 10px; box-shadow: 0 2px 8px rgba(28,28,30,.035); }
.export-card { border-radius: 10px; box-shadow: 0 2px 8px rgba(28,28,30,.035); }
.export-icon { border-radius: 8px; }
.science-note { border-radius: 0 8px 8px 0; background: #fff9f1; }
.help-dialog { border-radius: 16px; box-shadow: 0 24px 80px rgba(28,28,30,.22); }
.help-grid article { border-radius: 9px; background: #fafafd; }
.help-caution { border-radius: 9px; background: #fff9f1; }
.toast { border-radius: 12px; box-shadow: 0 10px 34px rgba(28,28,30,.14); }

.workflow { height: 66px; background: rgba(255,255,255,.9); }
.workflow-step { grid-template-rows: 19px 16px; border-radius: 12px; }
.workflow-step b { font-size: 13px; }
.workflow-step small { font-size: 11px; }
.workbench { height: calc(100% - 66px); gap: 14px; padding: 14px; }
.sample-rail, .main-area, .inspector { border-color: rgba(255,255,255,.98); border-radius: 17px; box-shadow: 0 12px 30px rgba(28,28,30,.045), 0 2px 8px rgba(28,28,30,.025); }
.eyebrow { color: #82888a; font-size: 10px; }
.rail-heading h1 { font-size: 17px; }
.button { min-height: 38px; padding-inline: 14px; font-size: 13px; }
.example-link { min-height: 48px; border-color: #ffe3bc; border-radius: 12px; background: #fff8ee; box-shadow: inset 0 1px 0 #fff; }
.drop-hint { padding: 9px; border-radius: 9px; color: #747a82; background: #fafafd; font-size: 11px; }
.sample-meta b { color: #373a40; font-size: 11px; }
.sample-meta small { font-size: 10px; }
.image-stage { background-color: #f8f8fa; background-image: linear-gradient(rgba(122,128,137,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(122,128,137,.035) 1px, transparent 1px); background-size: 32px 32px; }
.stage-empty { width: min(100% - 28px, 380px); gap: 9px; padding: 24px 20px; border: 1px solid rgba(255,255,255,.96); border-radius: 16px; box-shadow: 0 14px 34px rgba(28,28,30,.055), 0 2px 8px rgba(28,28,30,.025); }
.stage-empty b { font-size: 15px; }
.stage-empty small { font-size: 11px; line-height: 1.55; }
.viewer-foot { min-height: 38px; padding-inline: 13px; font-size: 10px; }
.inspector { background: #fff; }
.inspector-panel > .full-width:first-of-type { margin-top: 14px; }
.form-field > label, .setting-label { color: #53565d; font-size: 12px; }
.form-field input, .form-field select { height: 40px; padding-inline: 11px; border-color: #dedee5; font-size: 13px; }
.form-field small { color: #7d8086; font-size: 10px; }
.design-note strong { font-size: 11px; }
.design-note p { color: #806c58; font-size: 10px; line-height: 1.6; }
.setting-label small { color: #7d8086; font-size: 10px; }
.segmented button { min-height: 34px; border-radius: 7px; font-size: 11px; }
.switch-line b { font-size: 11px; }
.switch-line small { font-size: 9px; }
.result-focus { border-color: #f3e4d1; border-radius: 14px; background: #fffaf4; box-shadow: 0 5px 18px rgba(120,82,38,.045), inset 0 1px 0 #fff; }

@media (max-width: 1120px) {
  .workbench { grid-template-columns: 205px minmax(320px, 1fr) 260px; gap: 8px; padding: 8px; }
  .workflow { padding-inline: 12px; gap: 8px; }
  .workflow-steps { gap: 7px; }
  .workflow-step { min-width: 134px; }
  .workflow-steps > i { width: 14px; }
  .rail-controls { gap: 4px; }
  .rail-assay-switch button { min-width: 48px; padding-inline: 5px; }
  .rail-assay-switch button[data-assay="transwell"] { min-width: 60px; }
  .rail-actions .icon-button { width: 27px; height: 29px; }
  .export-grid { grid-template-columns: 1fr; overflow: auto; }
  .export-card p { min-height: auto; }
}
@media (max-width: 820px) {
  html, body { overflow: auto; min-height: 100%; height: auto; }
  .workflow { height: 58px; gap: 0; padding: 0 7px; overflow: hidden; }
  .workflow-steps { display: grid; flex: 1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; overflow: visible; }
  .workflow-step { min-width: 0; min-height: 44px; display: grid; grid-template-columns: 19px minmax(0, 1fr); grid-template-rows: 1fr; column-gap: 5px; align-content: center; justify-content: center; padding: 4px 3px; text-align: left; }
  .workflow-step > span { width: 19px; height: 19px; flex: none; font-size: 10px; }
  .workflow-step b { max-width: 100%; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  .workflow-step small { display: none; }
  .workflow-steps > i, .workflow-actions { display: none; }
  .mobile-workspace-nav { position: sticky; top: 0; z-index: 3; display: block; padding: 7px 10px; border-bottom: 1px solid #e9e9ef; background: rgba(248,248,251,.94); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
  .mobile-view-switch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 3px; border: 1px solid #e5e5eb; border-radius: 12px; background: #ededf2; }
  .mobile-view-option { min-height: 36px; border: 1px solid transparent; border-radius: 9px; color: #77777e; background: transparent; font-size: 12px; font-weight: 600; cursor: pointer; transition: color .16s, background .16s, box-shadow .16s; }
  .mobile-view-option.selected { border-color: #fff; color: #1c1c1e; background: #fff; box-shadow: 0 2px 6px rgba(28,28,30,.1); }
  .workbench { height: auto; min-height: calc(100dvh - 116px); grid-template-columns: minmax(0, 1fr); gap: 0; padding: 8px; }
  .sample-rail, .main-area, .inspector { display: none; border-radius: 16px; }
  body[data-mobile-view="samples"] .sample-rail { display: flex; min-height: min(520px, calc(100dvh - 140px)); max-height: calc(100dvh - 140px); }
  body[data-mobile-view="image"] .main-area { display: flex; min-height: calc(100dvh - 140px); }
  body[data-mobile-view="settings"] .inspector { display: block; min-height: calc(100dvh - 140px); }
  body[data-mobile-view="settings"] .inspector-panel { height: auto; min-height: calc(100dvh - 140px); overflow: auto; padding-bottom: 18px; }
  .rail-controls { gap: 7px; }
  .rail-assay-switch button { height: 34px; min-width: 65px; padding: 0 10px; font-size: 11px; }
  .rail-assay-switch button[data-assay="transwell"] { min-width: 84px; }
  .rail-actions { gap: 3px; }
  .rail-actions .icon-button { width: 35px; height: 35px; }
  .rail-heading { padding: 12px 12px 8px; }
  .rail-assay-switch { margin-bottom: 6px; }
  .sample-list { min-height: 45px; }
  .sample-list { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; }
  .sample-empty { min-width: 100%; min-height: 60px; }
  .sample-item { min-width: 178px; align-content: start; }
  .viewer-head { flex-wrap: wrap; }
  .image-stage { min-height: min(410px, calc(100dvh - 260px)); }
  .quant-image-slot { min-height: 315px; }
  .section-heading { flex-wrap: wrap; }
  .chart-frame { min-height: 260px; }
  .export-grid { grid-template-columns: 1fr; }
  .export-preview { min-height: 270px; }
  .inspector-panel { padding: 13px; }
  .inspector-panel > .full-width:first-of-type { margin-top: 12px; }
}

/* Boundary controls use compact, tactile selectors and a local color palette. */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px !important;
  border-color: #dedee5 !important;
  border-radius: 10px !important;
  color: #303036;
  background-color: #fafafd !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3' fill='none' stroke='%23777A82' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 12px !important;
  cursor: pointer;
}
select:hover { border-color: #c7c7d0 !important; background-color: #fff !important; }
select:focus-visible { outline: 0; border-color: #ffb84d !important; box-shadow: 0 0 0 3px rgba(255,149,0,.13); }
.sr-only-control { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.boundary-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 7px; padding: 4px; border: 1px solid #e8e8ee; border-radius: 12px; background: #f3f3f7; }
.boundary-mode-switch button { min-height: 35px; border: 1px solid transparent; border-radius: 9px; color: #777780; background: transparent; font-size: 11px; font-weight: 600; transition: color .16s, background .16s, box-shadow .16s; }
.boundary-mode-switch button:hover { color: #303036; }
.boundary-mode-switch button.selected { border-color: #fff; color: #1c1c1e; background: #fff; box-shadow: 0 2px 6px rgba(28,28,30,.1); }
.boundary-style-row { grid-template-columns: 82px minmax(62px, 1fr) 94px; align-items: end; gap: 7px; margin-top: 12px; }
.boundary-color-field, .boundary-width-field, .boundary-dash-field { gap: 6px; color: #666970; font-size: 10px; }
.boundary-color-control { position: relative; }
.color-chip { width: 100%; min-height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 7px; border: 1px solid #e2e2e9; border-radius: 10px; color: #44464e; background: #fafafd; font-size: 9px; font-variant-numeric: tabular-nums; cursor: pointer; transition: border-color .16s, background .16s, box-shadow .16s; }
.color-chip:hover, .color-chip[aria-expanded="true"] { border-color: #c9c9d2; background: #fff; box-shadow: 0 2px 8px rgba(28,28,30,.06); }
.color-chip i { width: 17px; height: 17px; flex: none; border: 2px solid #fff; border-radius: 6px; background: #f2b31f; box-shadow: 0 0 0 1px rgba(28,28,30,.12); }
.color-chip span { flex: 1; text-align: left; }
.color-chip b { color: #85858d; font-size: 11px; font-weight: 500; }
.color-popover { position: absolute; top: calc(100% + 8px); left: -2px; z-index: 20; width: min(242px, calc(100vw - 44px)); padding: 13px; border: 1px solid rgba(255,255,255,.9); border-radius: 16px; background: rgba(255,255,255,.96); box-shadow: 0 16px 42px rgba(28,28,30,.2), 0 2px 8px rgba(28,28,30,.06); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); animation: toast-in .14s ease-out; }
.color-popover-title { display: grid; gap: 2px; margin-bottom: 11px; }
.color-popover-title b { color: #222226; font-size: 12px; }
.color-popover-title small { color: #85858d; font-size: 10px; }
.color-presets { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; }
.color-presets button { position: relative; width: 22px; height: 22px; justify-self: center; border: 2px solid #fff; border-radius: 8px; background: var(--swatch); box-shadow: 0 0 0 1px rgba(28,28,30,.12); cursor: pointer; transition: transform .14s, box-shadow .14s; }
.color-presets button:hover { z-index: 1; transform: scale(1.12); }
.color-presets button.selected { box-shadow: 0 0 0 2px #007aff; }
.color-hex-field { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 13px; color: #73737b; font-size: 10px; }
.color-hex-field input { width: 92px; height: 31px; padding: 0 8px; border: 1px solid #e0e0e7; border-radius: 9px; color: #303036; background: #fafafd; font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.color-hex-field input:focus { border-color: #ffb84d; outline: 0; background: #fff; box-shadow: 0 0 0 3px rgba(255,149,0,.12); }
.color-hex-field input[aria-invalid="true"] { border-color: #e8786d; box-shadow: 0 0 0 3px rgba(232,120,109,.12); }
.boundary-dash-field > span { display: block; }
.line-style-switch { display: flex; gap: 3px; min-height: 34px; padding: 3px; border: 1px solid #e5e5ec; border-radius: 10px; background: #f5f5f8; }
.line-style-switch button { flex: 1; min-width: 0; display: grid; place-items: center; padding: 0 3px; border: 1px solid transparent; border-radius: 7px; background: transparent; cursor: pointer; transition: background .15s, box-shadow .15s; }
.line-style-switch button:hover { background: rgba(255,255,255,.7); }
.line-style-switch button.selected { border-color: #fff; background: #fff; box-shadow: 0 1px 4px rgba(28,28,30,.12); }
.line-preview { width: 19px; height: 0; border-top: 2px solid #373941; }
.line-preview.dashed { border-top-style: dashed; }
.line-preview.dotted { border-top-style: dotted; }
.ppt-export-card { border-color: #d5e4e8; background: linear-gradient(145deg, #f3f8f9, #fff 72%); }
.ppt-icon { color: #fff; background: #397f91; font-size: 13px; font-weight: 750; }
.ppt-type { color: #fff; background: #397f91; }

@media (max-width: 460px) {
  .boundary-style-row { grid-template-columns: 86px minmax(82px, 1fr) 100px; gap: 9px; }
  .color-popover { width: min(252px, calc(100vw - 42px)); }
}
@media (max-width: 460px) {
  .workflow { padding-inline: 4px; }
  .workflow-steps { gap: 1px; }
  .workflow-step { min-height: 44px; grid-template-columns: 18px minmax(0, 1fr); column-gap: 3px; padding-inline: 2px; }
  .workflow-step > span { width: 18px; height: 18px; font-size: 9px; }
  .workflow-step b { font-size: 9px; }
  .rail-controls { gap: 5px; }
  .rail-assay-switch button { min-width: 58px; padding-inline: 8px; font-size: 10px; }
  .rail-assay-switch button[data-assay="transwell"] { min-width: 76px; }
  .rail-actions .icon-button { width: 33px; height: 34px; }
  .button, .tool-button { min-height: 40px; }
  .button-small { min-height: 36px; }
  .example-link { min-height: 50px; }
  .correction-bar { flex-wrap: wrap; min-height: 68px; }
  .brush-control { margin-left: 0; }
  .quant-results { gap: 4px; padding: 7px; }
  .quant-result { padding: 6px; }
  .quant-result b { font-size: 12px; }
  .help-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .workflow { height: 58px; }
  .workbench { height: auto; min-height: calc(100dvh - 116px); gap: 0; padding: 8px; }
  .sample-rail, .main-area, .inspector { border-radius: 16px; }
  .inspector-panel > .full-width:first-of-type { margin-top: 12px; }
  .sample-rail { min-height: calc(100dvh - 140px); max-height: calc(100dvh - 140px); }
  .viewer-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; min-height: 54px; height: auto; padding: 8px 12px; }
  .viewer-foot #imageDimensions { grid-column: 1; grid-row: 1; min-width: 0; }
  .viewer-foot #imageNote { grid-column: 1 / -1; grid-row: 2; min-width: 0; line-height: 1.4; }
  .viewer-foot .metric-chip { grid-column: 2; grid-row: 1; justify-self: end; }
}
