:root {
    --ink: #142621;
    --muted: #687873;
    --paper: #f5f7f2;
    --card: #ffffff;
    --line: #dbe3dc;
    --accent: #16775f;
    --accent-dark: #0d5946;
    --accent-soft: #dff1e9;
    --warning: #fff4d8;
    --shadow: 0 24px 70px rgba(25, 53, 44, .10);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 5% 0%, rgba(76, 169, 137, .13), transparent 32rem),
        var(--paper);
    color: var(--ink);
    font: 16px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 26px 0 70px; }
.brand { display: flex; align-items: center; justify-content: space-between; margin-bottom: 70px; }
.brand a { text-decoration: none; font: 700 21px/1 Inter, ui-sans-serif, system-ui, sans-serif; letter-spacing: -.04em; }
.brand a span { color: var(--accent); }
.beta, .job-ref { border: 1px solid var(--line); border-radius: 99px; padding: 6px 11px; color: var(--muted); font-size: 12px; font-weight: 600; }
.hero { max-width: 760px; margin: 0 auto 46px; text-align: center; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 12px; }
h1, h2 { font-family: Inter, ui-sans-serif, system-ui, sans-serif; letter-spacing: -.045em; }
h1 { margin: 0; font-size: clamp(40px, 6vw, 68px); line-height: 1.04; }
h2 { margin: 0 0 5px; font-size: 25px; line-height: 1.2; }
.lede { max-width: 650px; margin: 22px auto 0; color: var(--muted); font-size: 19px; }
.muted { margin: 0; color: var(--muted); }
.test-banner { max-width: 760px; margin: 0 auto 18px; border: 1px solid #e7c96f; border-radius: 14px; padding: 14px 17px; background: var(--warning); color: #6d592b; font-size: 13px; }
.test-banner strong { color: #57461f; }

.upload-card { max-width: 760px; margin: 0 auto; padding: 34px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); }
.step-number { display: inline-grid; place-items: center; width: 32px; height: 32px; margin-bottom: 18px; border-radius: 50%; background: var(--accent); color: white; font-weight: 700; }
.upload-form { margin-top: 25px; }
.drop-zone { display: grid; place-items: center; min-height: 215px; padding: 25px; border: 1.5px dashed #9db5aa; border-radius: 16px; background: #f8fbf8; cursor: pointer; text-align: center; transition: .2s ease; }
.drop-zone:hover, .drop-zone:focus-within { border-color: var(--accent); background: #f0f8f4; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone strong { margin: 11px 0 1px; color: var(--accent-dark); font-size: 18px; }
.drop-zone span:last-child { max-width: 90%; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.drop-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); font-size: 25px; }
.acknowledgement { display: grid; grid-template-columns: 20px 1fr; gap: 11px; margin: 16px 1px 4px; border-radius: 10px; padding: 12px; background: #f5f7f4; color: #4f605a; font-size: 12px; cursor: pointer; }
.acknowledgement input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--accent); }
.button { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 52px; border: 0; border-radius: 12px; padding: 0 20px; font: 700 15px/1 Inter, ui-sans-serif, system-ui, sans-serif; text-decoration: none; cursor: pointer; }
.button.primary { width: 100%; margin-top: 14px; background: var(--accent); color: white; box-shadow: 0 8px 20px rgba(22, 119, 95, .18); }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { margin-top: 8px; background: transparent; color: var(--muted); }
.button.disabled { opacity: .5; cursor: wait; }
.privacy-note { margin: 19px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.caveats { max-width: 980px; margin: 72px auto 0; }
.caveats > h2 { margin-bottom: 20px; font-size: 32px; }
.caveat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.caveat-grid article { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: rgba(255, 255, 255, .72); }
.caveat-grid strong { color: var(--ink); font-size: 14px; }
.caveat-grid p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.workspace .brand { margin-bottom: 35px; }
.trial-strip { margin: -16px 0 22px; border: 1px solid #e7c96f; border-radius: 12px; padding: 10px 13px; background: var(--warning); color: #6d592b; font-size: 12px; text-align: center; }
.selection-mode { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 0 0 18px; border: 0; padding: 0; }
.selection-mode legend { margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.selection-mode label { display: grid; grid-template-columns: 18px 1fr; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 13px; background: white; cursor: pointer; }
.selection-mode label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.selection-mode input { margin: 3px 0 0; accent-color: var(--accent); }
.selection-mode strong, .selection-mode small { display: block; }
.selection-mode small { color: var(--muted); font-size: 10px; }
.anatomy-panel { border: 1px solid var(--line); border-radius: 20px; padding: 30px; background: white; box-shadow: var(--shadow); }
.anatomy-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 22px 0; }
.anatomy-grid label { border: 1px solid var(--line); border-radius: 9px; padding: 10px; font-size: 12px; }
.steps { display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center; gap: 14px; max-width: 650px; margin: 0 auto 38px; color: #91a19c; font-size: 13px; }
.steps span { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.steps span::first-letter { border-radius: 50%; }
.steps i { height: 1px; background: var(--line); }
.steps .active { color: var(--accent); }
.steps .complete { color: var(--ink); }
.tool-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(330px, .72fr); overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); }
.preview-panel { min-width: 0; padding: 32px; background: #eff3ee; }
.preview-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.preview-heading h1 { font-size: clamp(28px, 3vw, 38px); }
.status { flex: 0 0 auto; border-radius: 99px; padding: 6px 10px; background: #e4e9e5; color: var(--muted); font-size: 12px; font-weight: 700; }
.status.ready { background: var(--accent-soft); color: var(--accent-dark); }
.status.failed { background: #fbe1de; color: #8b2921; }
.orientation-switch { display: inline-flex; gap: 4px; margin: 0 0 16px 70px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255, 255, 255, .65); }
.orientation-switch button { border: 0; border-radius: 8px; padding: 8px 14px; background: transparent; color: var(--muted); font: 700 12px Inter, ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.orientation-switch button.selected { background: white; color: var(--accent-dark); box-shadow: 0 2px 8px rgba(25, 53, 44, .09); }
.camera-control { margin: 0 0 16px 70px; border: 1px solid var(--line); border-radius: 13px; padding: 13px; background: rgba(255, 255, 255, .62); }
.camera-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.camera-heading strong { font-size: 12px; }
.camera-heading span { color: var(--muted); font-size: 10px; }
.camera-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.camera-grid button { min-height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: white; color: var(--muted); font: 600 10px/1.25 Inter, ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.camera-grid button:hover, .camera-grid button.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.depth-key { display: grid; grid-template-columns: auto minmax(80px, 1fr) auto; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.depth-key i { height: 8px; border-radius: 99px; background: linear-gradient(90deg, rgb(229, 246, 226), rgb(18, 172, 158), rgb(16, 31, 78)); }
.scan-workspace { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; }
.scan-workspace.is-iso { grid-template-columns: minmax(0, 1fr); }
.slice-control { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; justify-items: center; min-height: 500px; padding: 13px 0 5px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.slice-control output { width: 56px; min-height: 34px; margin-top: 8px; color: var(--accent-dark); font-size: 10px; line-height: 1.25; text-align: center; text-transform: none; letter-spacing: 0; }
.vertical-range { width: 5px !important; height: 100% !important; min-height: 330px; margin: 9px 0 !important; writing-mode: vertical-lr; direction: rtl; }
.scan-frame { position: relative; display: grid; place-items: center; min-height: 500px; overflow: hidden; border: 1px solid #d7dfd8; border-radius: 16px; background: white; }
.scan-frame img { max-width: 100%; max-height: 570px; object-fit: contain; image-rendering: auto; }
.slice-canvas { display: block; max-width: 100%; max-height: 620px; border-radius: 8px; cursor: zoom-in; touch-action: none; transform-origin: center; will-change: transform; }
.slice-canvas.zoomed { cursor: grab; }
.slice-canvas.dragging { cursor: grabbing; }
.zoom-controls { position: absolute; z-index: 5; top: 12px; right: 12px; display: flex; overflow: hidden; border: 1px solid #cbd7ce; border-radius: 9px; background: rgba(255,255,255,.94); box-shadow: 0 4px 14px rgba(31,55,40,.1); }
.zoom-controls button { min-width: 38px; height: 36px; padding: 0 10px; border: 0; border-right: 1px solid #dce4de; background: transparent; color: var(--ink); font: inherit; font-weight: 800; cursor: pointer; }
.zoom-controls button:last-child { border-right: 0; }
.zoom-controls button:hover { background: var(--accent-soft); }
.zoom-controls [data-zoom="reset"] { min-width: 62px; font-size: 12px; }
.vtk-viewer { width: 100%; height: 570px; min-height: 420px; cursor: grab; }
.vtk-viewer:active { cursor: grabbing; }
.loader { text-align: center; color: var(--muted); }
.loader span { display: inline-block; width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.loader p { max-width: 280px; margin: 12px auto 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.caption { margin: 13px 0 0; color: var(--muted); font-size: 12px; }
.controls-panel { padding: 38px 34px; }
.volume-summary { margin: 15px 0 -12px; border-radius: 9px; padding: 9px 10px; background: #f0f5f1; color: var(--muted); font-size: 10px; }
.threshold-readout { display: flex; align-items: end; justify-content: space-between; margin: 34px 0 7px; color: var(--muted); font-size: 13px; }
.threshold-readout.compact { margin-top: 18px; }
.threshold-readout output { color: var(--ink); font: 700 34px/1 Inter, ui-sans-serif, system-ui, sans-serif; }
input[type='range'] { width: 100%; height: 5px; accent-color: var(--accent); cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.range-labels span:last-child { text-align: right; }
.presets { margin-top: 30px; }
.presets p { margin: 0 0 10px; font-size: 13px; font-weight: 700; }
.presets button { width: 100%; display: flex; justify-content: space-between; margin-top: 7px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: white; color: var(--ink); font: 600 13px Inter, ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.presets button:hover, .presets button.selected { border-color: var(--accent); background: var(--accent-soft); }
.presets button small { color: var(--muted); }
.window-panel { margin-top: 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; }
.window-panel summary { cursor: pointer; font-size: 12px; font-weight: 700; }
.window-panel label { display: grid; grid-template-columns: 55px 1fr; gap: 8px; align-items: center; margin-top: 11px; color: var(--muted); font-size: 10px; }
.window-panel label input { grid-column: 1 / -1; }
.window-panel output { color: var(--ink); text-align: right; font-weight: 700; }
.scope-panel { margin-top: 24px; border: 1px solid var(--line); border-radius: 12px; padding: 0 13px; background: #f8faf8; }
.scope-panel summary { display: flex; justify-content: space-between; gap: 10px; padding: 13px 0; cursor: pointer; font-size: 13px; font-weight: 700; }
.scope-panel summary span { color: var(--accent); font-size: 10px; text-align: right; }
.scope-panel > p { margin: 0 0 11px; color: var(--muted); font-size: 10px; }
.scope-quick { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.scope-quick button, .scope-apply { border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; background: white; color: var(--ink); font: 600 10px Inter, sans-serif; cursor: pointer; }
.scope-quick button:hover, .scope-apply:hover { border-color: var(--accent); background: var(--accent-soft); }
.scope-axes { display: grid; gap: 6px; }
.scope-axis { display: grid; grid-template-columns: 58px 1fr 1fr; align-items: center; gap: 7px; font-size: 10px; }
.scope-axis label { color: var(--muted); white-space: nowrap; }
.scope-axis select { width: 52px; margin-left: 3px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 3px; background: white; }
.scope-error { color: #8b2921 !important; }
.scope-apply { width: 100%; margin: 2px 0 13px; color: var(--accent-dark); }
.component-option { display: grid; grid-template-columns: 18px 1fr; gap: 9px; margin-top: 16px; border-radius: 10px; padding: 11px; background: var(--accent-soft); cursor: pointer; }
.component-option input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); }
.component-option strong, .component-option small { display: block; }
.component-option strong { font-size: 11px; }
.component-option small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.mesh-scale-note { margin: 11px 2px 0; color: var(--muted); font-size: 9px; }
.help { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: #e6ebe7; color: var(--muted); font-size: 10px; }
.notice { margin: 30px 0 22px; border-left: 3px solid #d69b1f; border-radius: 4px 10px 10px 4px; padding: 12px 13px; background: var(--warning); color: #6d592b; font-size: 12px; }
.notice strong { display: block; color: #57461f; }

.admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.admin-heading h1 { font-size: clamp(38px, 5vw, 58px); }
.admin-heading .button { width: auto; min-width: 100px; }
.admin-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 25px 0; }
.admin-summary article { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: white; }
.admin-summary strong { font: 700 30px/1 Inter, sans-serif; }
.admin-summary span { margin-top: 6px; color: var(--muted); font-size: 12px; }
.job-list { display: grid; gap: 12px; }
.job-card { display: grid; grid-template-columns: 210px minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: white; }
.job-preview { display: grid; place-items: center; min-height: 190px; background: #eef3ef; color: var(--muted); font-size: 12px; }
.job-preview img { width: 100%; height: 100%; max-height: 240px; object-fit: contain; background: white; }
.job-details { padding: 18px; }
.job-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.job-title h2 { font-size: 20px; }
.job-title a { color: var(--accent); font-size: 12px; font-weight: 700; }
.job-details dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.job-details dl div { min-width: 0; }
.job-details dt { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.job-details dd { margin: 2px 0 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.export-links { display: flex; flex-wrap: wrap; gap: 6px; }
.export-links a { border-radius: 99px; padding: 5px 8px; background: var(--accent-soft); color: var(--accent-dark); font-size: 10px; text-decoration: none; }

[hidden] { display: none !important; }
@media (max-width: 850px) {
    .brand { margin-bottom: 48px; }
    .tool-layout { grid-template-columns: 1fr; }
    .scan-frame { min-height: 380px; }
    .slice-control { min-height: 380px; }
    .vertical-range { min-height: 240px; }
    .controls-panel { border-top: 1px solid var(--line); }
    .job-card { grid-template-columns: 150px minmax(0, 1fr); }
    .job-details dl { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
    .shell { width: min(100% - 24px, 1180px); padding-top: 18px; }
    .upload-card, .preview-panel, .controls-panel { padding: 24px 20px; }
    .steps b { display: none; }
    .preview-heading { display: block; }
    .status { display: inline-block; margin-top: 12px; }
    .orientation-switch { margin-left: 56px; }
    .camera-control { margin-left: 0; }
    .camera-grid { grid-template-columns: repeat(2, 1fr); }
    .scan-workspace { grid-template-columns: 44px minmax(0, 1fr); gap: 10px; }
    .scan-frame { min-height: 310px; }
    .slice-control { min-height: 310px; }
    .slice-control output { width: 44px; }
    .vertical-range { min-height: 175px; }
    .caveats { margin-top: 52px; }
    .caveat-grid { grid-template-columns: 1fr; }
    .admin-heading { display: block; }
    .admin-heading .button { margin-top: 14px; }
    .admin-summary { grid-template-columns: 1fr 1fr; }
    .job-card { grid-template-columns: 1fr; }
    .job-preview { min-height: 160px; }
    .selection-mode { grid-template-columns: 1fr; }
    .anatomy-grid { grid-template-columns: repeat(2, 1fr); }
    .vtk-viewer { height: 390px; min-height: 310px; }
}
