:root {
  color-scheme: light;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  --bg: #f3f6fa;
  --ink: #15243a;
  --muted: #53647a;
  --subtle: #66768a;
  --edge: #dfe7ef;
  --white: #fff;
  --navy: #11233a;
  --accent: #126e68;
  --accent-strong: #095953;
  --teal-bg: #e6f4f0;
  --blue-bg: #eaf1fd;
  --warn: #8a4a1c;
  --warn-bg: #fcf1e3;
  --danger: #aa3940;
  --shadow: 0 2px 4px #142e4a08, 0 10px 25px #142e4a06;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.46; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-strong); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid #2b9f8c; outline-offset: 3px;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(28px, 3vw, 39px); line-height: 1.12; font-weight: 735; letter-spacing: -.044em; }
h2 { font-size: 19px; font-weight: 710; letter-spacing: -.025em; }
h3 { font-size: 15px; font-weight: 690; letter-spacing: -.013em; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.mono { font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace; font-variant-numeric: tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }
.shell { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: linear-gradient(166deg, #142941 0, #11233a 52%, #102136 100%);
  color: #dbe8f5; display: flex; flex-direction: column; position: sticky; top: 0;
  align-self: start; height: 100dvh; min-height: 440px; padding: 26px 15px 16px;
}
.brand { display: flex; align-items: center; gap: 11px; margin: 1px 10px 42px; color: white; text-decoration: none; }
.brand img { flex: none; border-radius: 11px; }
.brand strong { display: block; font-size: 23px; letter-spacing: -.05em; line-height: 1.04; }
.brand small { display: block; margin-top: 4px; color: #a6b9cd; font-size: 11px; letter-spacing: .015em; }
.navigation { display: grid; gap: 5px; }
.nav-label { color: #9fb2c8; font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; margin: 0 11px 5px; }
.nav-item {
  display: flex; width: 100%; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid transparent;
  background: transparent; color: #bfd0e1; border-radius: 8px; text-align: left; font-size: 13px; font-weight: 590;
}
.nav-item:hover { background: #ffffff0d; color: white; }
.nav-item[aria-current="page"] { background: #25465a; color: #ecfbf8; border-color: #375b68; }
.nav-item[aria-current="page"] .icon { color: #8fe1d0; }
.nav-rule { height: 1px; background: #ffffff18; margin: 12px 10px 7px; }
.sidebar-footer { margin-top: auto; }
.local-card {
  display: flex; align-items: flex-start; gap: 9px; padding: 12px 10px; border-radius: 9px;
  background: #ffffff07; border: 1px solid #a5c6df23; color: #a6bccf; font-size: 11px;
}
.local-card .icon { color: #81cabe; width: 16px; height: 16px; margin-top: 1px; }
.local-card strong { display: block; color: #e2edf6; font-size: 12px; margin-bottom: 3px; }
.topbar {
  min-height: 57px; background: var(--white); border-bottom: 1px solid var(--edge);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 32px;
}
.topbar > div { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.study-name { font-size: 13px; font-weight: 690; }
.top-divider { background: #dce4ee; height: 13px; width: 1px; }
.institution { color: var(--muted); font-size: 12px; }
.research-label { display: inline-flex; align-items: center; gap: 7px; color: #46617a; font-size: 11px; white-space: nowrap; }
.research-label span { width: 7px; height: 7px; border-radius: 50%; background: #2c9e89; }
main { max-width: 1680px; margin: auto; padding: 27px 32px 12px; min-height: 70vh; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin: 0 0 20px; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 7px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 36px;
  border: 1px solid #d6e0ea; border-radius: 7px; padding: 7px 12px; background: var(--white);
  color: #2c445a; font-size: 12px; font-weight: 650; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f0f5fa; border-color: #bbcad9; }
.btn.primary { color: white; background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--accent-strong); }
.btn.quiet:hover { background: var(--teal-bg); }
.btn.danger { color: var(--danger); }
.btn.compact { min-height: 30px; padding: 4px 8px; font-size: 11px; }
.btn .icon { width: 16px; height: 16px; }
.icon { display: inline-block; flex: none; width: 18px; height: 18px; background: currentColor; mask: var(--symbol) center / contain no-repeat; }
.scan { --symbol: url("icons/scan.png"); } .chart { --symbol: url("icons/chart.png"); }
.layers { --symbol: url("icons/layers.png"); } .book { --symbol: url("icons/book.png"); }
.lock { --symbol: url("icons/lock.png"); } .upload { --symbol: url("icons/upload.png"); }
.download { --symbol: url("icons/download.png"); } .group { --symbol: url("icons/group.png"); }
.check { --symbol: url("icons/check.png"); } .image-icon { --symbol: url("icons/image.png"); }
.pan { --symbol: url("icons/pan.png"); } .box { --symbol: url("icons/box.png"); }
.plus { --symbol: url("icons/plus.png"); } .minus { --symbol: url("icons/minus.png"); }
.fit { --symbol: url("icons/fit.png"); } .expand { --symbol: url("icons/expand.png"); }
.reset { --symbol: url("icons/reset.png"); } .contrast { --symbol: url("icons/contrast.png"); }
.sun { --symbol: url("icons/sun.png"); } .arrow { --symbol: url("icons/arrow.png"); }
.info { --symbol: url("icons/info.png"); } .close { --symbol: url("icons/close.png"); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 17px; }
.metric, .card { min-width: 0; border: 1px solid var(--edge); background: var(--white); border-radius: 11px; box-shadow: var(--shadow); }
.metric { display: flex; align-items: center; gap: 12px; padding: 12px 15px; }
.metric-icon { color: #217c72; background: var(--teal-bg); border-radius: 9px; width: 37px; height: 37px; flex: none; display: grid; place-items: center; }
.metric-icon.blue { color: #406ba5; background: var(--blue-bg); }
.metric-icon.violet { color: #68569b; background: #f0ecf9; }
.metric-name { font-size: 11px; color: var(--muted); font-weight: 630; line-height: 1.2; }
.metric-value { margin-top: 2px; font-size: 23px; font-weight: 740; line-height: 1.1; letter-spacing: -.055em; }
.review-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(316px, 1fr); align-items: start; gap: 15px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--edge); }
.card-head p { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card-pad { padding: 16px; }
.pill { display: inline-flex; align-items: center; gap: 5px; min-height: 22px; border-radius: 20px; padding: 2px 8px; font-size: 10px; font-weight: 690; white-space: nowrap; background: #edf2f7; color: #41566e; }
.pill.ds { background: #eee9f9; color: #5f468f; }
.pill.control { background: #e9f1fc; color: #365e93; }
.pill.green { background: var(--teal-bg); color: var(--accent-strong); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.red { background: #fbeaec; color: #9e353c; }
.case-picker { display: flex; align-items: center; gap: 7px; }
.case-picker select { width: clamp(108px, 14vw, 180px); font-size: 11px; min-height: 31px; }
.viewer-card { overflow: hidden; }
.viewer-top { background: #101c2b; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; padding: 7px 10px; border-bottom: 1px solid #314155; }
.viewer-tools { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.tool-btn {
  display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 4px 7px; border-radius: 5px;
  background: #192939; color: #d2deeb; border: 1px solid #34475a; font-size: 11px; font-weight: 620;
}
.tool-btn .icon { width: 14px; height: 14px; }
.tool-btn:hover { background: #294159; color: white; }
.tool-btn[aria-pressed="true"] { color: #b5f0e2; background: #1f4147; border-color: #3b696b; }
.viewer-separator { height: 17px; width: 1px; background: #3c4c60; margin: 0 2px; }
.viewer-viewport { position: relative; min-height: 280px; height: clamp(300px, 35vw, 480px); background: #0d1724; overflow: hidden; }
.viewer-viewport canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.viewer-viewport canvas.is-drawing { cursor: crosshair; }
.viewer-viewport canvas:active { cursor: grabbing; }
.viewer-viewport canvas.is-drawing:active { cursor: crosshair; }
.viewer-badge { position: absolute; top: 10px; left: 12px; border: 1px solid #f0cb8f57; border-radius: 4px; padding: 3px 6px; color: #ffe2b2; background: #202232e8; font-size: 10px; font-weight: 650; pointer-events: none; }
.viewer-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; color: #cbd8e7; padding: 20px; }
.viewer-empty .icon { width: 29px; height: 29px; color: #8aacbd; }
.viewer-empty p { color: #a9bed1; }
.viewer-footer {
  min-height: 37px; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 11px;
  color: #acc0d4; background: #101c2b; border-top: 1px solid #304257; font-size: 10px;
}
.viewer-footer span { min-width: 0; }
.viewer-controls { display: flex; align-items: center; gap: 13px; padding: 9px 12px; flex-wrap: wrap; }
.viewer-controls label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.viewer-controls label .icon { width: 15px; height: 15px; }
.viewer-controls input[type=range] { width: 77px; height: 14px; padding: 0; accent-color: var(--accent); }
.viewer-controls .btn { margin-left: auto; }
.roi-list { border-top: 1px solid var(--edge); padding: 8px 12px; }
.roi-list summary { cursor: pointer; color: var(--muted); font-size: 11px; }
.roi-list .roi-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 7px; }
.viewer-card:fullscreen { border: 0; border-radius: 0; display: flex; flex-direction: column; background: #0d1724; }
.viewer-card:fullscreen .card-head, .viewer-card:fullscreen .viewer-controls { background: white; }
.viewer-card:fullscreen .viewer-viewport { flex: 1; height: auto; }
.viewer-card:fullscreen .roi-list { display: none; }
.assessment-head { align-items: flex-start; min-height: 59px; }
.assessment-head h2 { word-break: break-word; font-size: 17px; }
.assessment-tabs, .section-tabs {
  display: flex; align-items: stretch; gap: 2px; padding: 0 11px; border-bottom: 1px solid var(--edge); overflow-x: auto;
}
.tab {
  background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 9px 9px 8px;
  color: var(--muted); font-size: 12px; font-weight: 635; white-space: nowrap;
}
.tab:hover { color: var(--accent-strong); background: #f5faf8; }
.tab[aria-selected="true"] { color: var(--accent-strong); border-bottom-color: #2c9585; }
.assess-body { padding: 12px 13px; min-width: 0; }
.session-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.session-line label { color: var(--muted); font-size: 11px; }
.session-line select { min-height: 29px; padding: 3px 7px; margin-left: 5px; font-size: 11px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
th { background: #f5f8fb; color: #4e6379; font-size: 11px; font-weight: 700; }
td, th { padding: 8px 9px; border-bottom: 1px solid #e8edf3; vertical-align: middle; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom-color: transparent; }
.stage-table { font-size: 11px; }
.stage-table td, .stage-table th { padding: 4px 6px; }
.stage-table th { font-size: 10px; }
.stage-table th:first-child { border-radius: 5px 0 0 5px; }
.stage-table th:last-child { border-radius: 0 5px 5px 0; }
.tooth-code { display: inline-block; min-width: 22px; font-weight: 740; color: #273e59; }
.stage-select { width: 100%; min-width: 64px; min-height: 26px; padding: 2px 4px; font-size: 11px; }
.score-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; margin-top: 11px; }
.score-tile { min-height: 54px; border: 1px solid #dfebe8; border-radius: 7px; padding: 5px 7px; background: #f0f8f5; }
.score-tile span { display: block; font-size: 9px; color: #45665d; line-height: 1.25; }
.score-tile strong { font-size: 19px; letter-spacing: -.05em; line-height: 1.15; color: #20564e; white-space: nowrap; }
.score-note { color: var(--muted); font-size: 10px; margin-top: 6px; min-height: 15px; }
.assessment-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--edge); padding: 9px 12px; }
.assessment-foot span { color: var(--muted); font-size: 11px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 4px; color: #40566d; font-size: 11px; font-weight: 650; }
.field.wide { grid-column: 1 / -1; }
input, select, textarea { max-width: 100%; min-width: 0; border: 1px solid #cfdbe7; background: #fff; color: var(--ink); border-radius: 6px; padding: 6px 8px; min-height: 32px; }
textarea { resize: vertical; }
input[type=checkbox] { min-height: 0; accent-color: var(--accent); }
.form-hint { font-weight: 450; font-size: 11px; color: var(--muted); margin-top: 7px; }
.form-gap { margin-top: 9px; }
.checklist { max-height: 420px; overflow: auto; padding-right: 3px; }
.checklist details { border: 1px solid var(--edge); border-radius: 6px; margin-bottom: 6px; }
.checklist summary { cursor: pointer; padding: 7px 8px; font-size: 11px; font-weight: 700; color: #36536b; background: #f5f8fb; }
.finding-row { border-top: 1px solid var(--edge); padding: 7px 7px 8px; }
.finding-row > div:first-child { display: grid; grid-template-columns: minmax(0,1fr) minmax(100px,.85fr); align-items: center; gap: 6px; font-size: 11px; font-weight: 610; }
.finding-row select, .finding-row input { font-size: 11px; min-height: 26px; padding: 3px 5px; }
.finding-extra { display: grid; grid-template-columns: minmax(65px,.85fr) minmax(80px,1fr); gap: 6px; margin-top: 6px; }
.finding-extra .field:last-child { grid-column: 1/-1; }
.queue-card, .below { margin-top: 15px; }
.queue-card .card-head { flex-wrap: wrap; }
.queue-card .card-head input { width: 155px; }
.queue-card .card-head select { font-size: 12px; }
.queue-card td, .queue-card th { white-space: nowrap; }
.queue-card tbody tr.selected { background: #f1faf7; }
.case-link { background: transparent; border: 0; padding: 2px; color: var(--accent-strong); text-decoration: underline; font-weight: 690; }
.empty { color: var(--muted); text-align: center; padding: 24px 15px; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.empty p { font-size: 12px; }
.empty .btn { margin-top: 9px; }
.callout { display: flex; align-items: flex-start; gap: 8px; border: 1px solid #dce9ed; border-radius: 7px; background: #f1f7f9; padding: 9px 10px; color: #39546a; font-size: 12px; }
.callout .icon { width: 16px; height: 16px; margin-top: 1px; }
.callout.warn { background: var(--warn-bg); border-color: #f0d7b7; color: #77481f; }
.section-tabs { padding-left: 14px; }
.section-tabs .tab { padding: 10px 12px; font-size: 13px; }
.analysis-body { padding: 15px; }
.analysis-tools { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.analysis-tools p, .section-intro { color: var(--muted); font-size: 12px; margin-top: 3px; }
.analysis-table { min-width: 480px; }
.analysis-table caption { text-align: left; color: var(--muted); margin-bottom: 7px; font-size: 11px; }
.ratio { display: inline-flex; align-items: center; justify-content: end; gap: 6px; min-width: 124px; }
.ratio i { height: 5px; width: 44px; border-radius: 8px; background: #edf2f7; overflow: hidden; text-align: left; }
.ratio i span { display: block; height: 100%; background: #8267b5; border-radius: 8px; }
.ratio.control i span { background: #4e8eaa; }
.split-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: start; gap: 13px; }
.chart-card { padding: 12px; border: 1px solid var(--edge); border-radius: 8px; min-width: 0; }
.chart-card h3 { margin-bottom: 5px; }
.chart-card canvas { width: 100%; height: 244px; display: block; }
.chart-key { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; font-size: 11px; color: var(--muted); }
.chart-key span::before { content: ""; display: inline-block; height: 8px; width: 8px; border-radius: 50%; margin-right: 4px; background: var(--key); }
.model-grid { display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); gap: 14px; align-items: start; }
.model-stack { display: grid; gap: 13px; }
.model-controls { display: grid; gap: 12px; }
.model-progress { width: 100%; height: 12px; accent-color: var(--accent); }
.progress-caption { color: var(--muted); font-size: 12px; margin-top: 5px; }
.model-config { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 5px; }
.model-config span { display: flex; justify-content: space-between; gap: 4px; padding: 5px 7px; border: 1px solid var(--edge); border-radius: 6px; color: var(--muted); font-size: 11px; }
.model-config strong { color: var(--ink); }
.guide-grid { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); gap: 14px; align-items: start; }
.guide-list { padding-left: 20px; margin: 2px 0 0; }
.guide-list li { padding: 4px 0; }
.guide-list li p { color: var(--muted); margin-top: 2px; font-size: 12px; }
.guide-card p { font-size: 12px; color: var(--muted); margin: 0 0 9px; }
.main-footer { padding: 11px 32px 19px; font-size: 10px; color: var(--subtle); }
.main-footer span { margin: 0 3px; }
dialog { width: min(480px, calc(100vw - 28px)); max-height: calc(100dvh - 30px); padding: 0; border: 1px solid #d5e2ec; border-radius: 12px; box-shadow: 0 18px 75px #10233a50; color: var(--ink); }
dialog::backdrop { background: #0d1a2ba5; }
.dialog-head, .dialog-footer { padding: 12px 15px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--edge); }
.dialog-footer { border-bottom: 0; border-top: 1px solid var(--edge); justify-content: flex-end; flex-wrap: wrap; }
.dialog-body { padding: 14px 15px; }
.dialog-body > p { color: var(--muted); margin-bottom: 10px; }
.dialog-actions { display: grid; gap: 7px; }
.dialog-actions button { justify-content: space-between; text-align: left; white-space: normal; }
.dialog-actions button small { font-weight: 450; color: var(--muted); }
.toast { position: fixed; z-index: 8; right: 18px; bottom: 18px; max-width: min(440px, calc(100vw - 36px)); border-radius: 8px; background: #18324a; color: white; padding: 11px 14px; box-shadow: 0 5px 20px #1b2e4970; font-size: 13px; }
.toast.error { background: #842f3a; }
@media (max-width: 1200px) {
  .shell { grid-template-columns: 190px minmax(0,1fr); }
  .sidebar { padding-left: 11px; padding-right: 11px; }
  main, .topbar, .main-footer { padding-left: 21px; padding-right: 21px; }
  .review-grid { grid-template-columns: minmax(0,1.55fr) minmax(308px,1fr); }
}
@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; min-height: 0; display: block; padding: 10px 14px 8px; }
  .brand { margin: 0 0 10px; }
  .brand img { width: 31px; height: 31px; }
  .brand strong { font-size: 19px; }
  .brand small { display: none; }
  .navigation { display: flex; overflow: auto; gap: 5px; }
  .nav-item { width: auto; white-space: nowrap; padding: 7px 9px; font-size: 11px; gap: 5px; }
  .nav-item .icon { width: 14px; height: 14px; }
  .sidebar-footer, .nav-label, .nav-rule { display: none; }
  .topbar { min-height: 39px; padding-top: 5px; padding-bottom: 5px; }
  .viewer-viewport { height: clamp(275px, 47vw, 420px); }
}
@media (max-width: 690px) {
  main { padding: 17px 12px 7px; }
  .topbar, .main-footer { padding-left: 12px; padding-right: 12px; }
  .top-divider, .institution { display: none; }
  .page-head { margin-bottom: 13px; gap: 10px; }
  .page-head p { margin-top: 5px; font-size: 12px; }
  .metrics { gap: 6px; margin-bottom: 10px; }
  .metric { padding: 7px 7px; gap: 0; }
  .metric-icon { display: none; }
  .metric-name { font-size: 10px; }
  .metric-value { font-size: 20px; }
  .review-grid, .model-grid, .guide-grid, .split-layout { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .viewer-viewport { min-height: 220px; height: clamp(220px, 56vw, 355px); }
  .viewer-tools { gap: 4px; }
  .tool-btn { min-height: 33px; }
  .viewer-controls { gap: 8px; }
  .viewer-controls .btn { margin-left: 0; }
  .checklist { max-height: none; }
  .card-head { padding: 10px 12px; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .nav-item, .tab, .tool-btn { transition: background-color .13s, border-color .13s; }
}
.settings { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; border: 0; margin: 0; padding: 0; min-width: 0; }
