:root {
  --ink: #183f38;
  --muted: #5d766e;
  --green: #16855d;
  --deep: #154c40;
  --mint: #edf5ee;
  --line: #d8e5db;
  --amber: #b56826;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: #f4f7f1;
  color: var(--ink);
  font:
    14px/1.5 system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  min-height: 38px;
  transition: background 0.15s;
}
button:hover:enabled {
  background: #e6f3e8;
  border-color: #8ab59c;
}
button:disabled {
  opacity: 0.43;
  cursor: default;
}
button[aria-pressed='true'] {
  background: #e0f1e5;
  border-color: var(--green);
}
button.primary {
  background: var(--deep);
  color: #fff;
  border-color: var(--deep);
}
button.primary:hover:enabled {
  background: #21664d;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
svg:focus-visible {
  outline: 3px solid #1a9f70;
  outline-offset: 3px;
}
input,
select {
  min-width: 0;
  border: 1px solid #cbdad0;
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--ink);
  background: #fff;
  max-width: 100%;
}
input[type='range'] {
  padding: 0;
  accent-color: var(--green);
  width: 100%;
}
input[type='checkbox'] {
  accent-color: var(--green);
}
label {
  display: block;
  font-size: 12px;
  font-weight: 650;
}
label > input:not([type='checkbox']),
label > select {
  display: block;
  margin-top: 5px;
  width: 100%;
}
label.check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  white-space: nowrap;
}
.check input {
  margin: 0;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(21px, 2.3vw, 30px);
  font-weight: 650;
  letter-spacing: -1px;
}
h2 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.5px;
}
h3 {
  font-size: 14px;
  font-weight: 700;
}
.eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 1.6px;
}
.note {
  font-size: 12px;
  color: var(--muted);
}
#lab {
  max-width: 1680px;
  padding: 0 30px;
  margin: auto;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 34px;
  padding: 25px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}
.brand small {
  display: block;
  font-size: 8px;
  letter-spacing: 1.3px;
  font-weight: 700;
}
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--deep);
  color: #fff;
  font-size: 31px;
}
.brand-mark span {
  font-size: 10px;
  margin-top: 10px;
}
.heading {
  flex: 1;
}
.top-actions {
  display: flex;
  gap: 8px;
}
#lab:fullscreen {
  background: #f4f7f1;
  overflow: auto;
  max-width: none;
  width: 100%;
}
.key,
kbd {
  font-family: inherit;
  font-size: 10px;
  opacity: 0.7;
  margin-left: 4px;
}
kbd {
  background: var(--mint);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 4px;
  margin: 0;
}
.brief {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 17px 20px;
  background: #e8f0e5;
  border: 1px solid #d5e2d1;
  border-radius: 12px;
}
.brief select {
  margin-top: 5px;
  min-width: 235px;
  font-size: 15px;
  font-weight: 650;
  border: 0;
  padding-left: 0;
  background: transparent;
}
.brief p {
  max-width: 680px;
  color: #3d5b4e;
  font-size: 13px;
}
.tag {
  font-size: 9px;
  letter-spacing: 1.2px;
  font-weight: 750;
  white-space: nowrap;
  color: var(--muted);
}
.brief > .tag {
  margin-left: auto;
}
.transport {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 0;
  background: #f4f7f1f5;
  backdrop-filter: blur(10px);
}
.spacer {
  flex: 1;
}
.divider {
  border-left: 1px solid #c9d6cb;
  height: 25px;
  margin: 0 3px;
}
.status-pill {
  font-size: 10px;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--muted);
  margin-left: 6px;
}
.workstation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 295px;
  gap: 16px;
}
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.stage-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.station-tabs {
  display: flex;
  gap: 6px;
  margin-right: auto;
}
.station-tabs button {
  font-weight: 750;
  padding: 6px 10px;
}
.station-tabs span {
  font-size: 11px;
  font-weight: 500;
  margin-left: 6px;
}
.camera {
  position: absolute;
  top: 74px;
  left: 14px;
  z-index: 2;
  display: flex;
  gap: 5px;
}
.camera button {
  font-size: 10px;
  padding: 4px 9px;
  min-height: 30px;
  background: #fffffff0;
}
#workspace {
  display: block;
  width: 100%;
  min-height: 460px;
  flex: 1;
  max-height: 650px;
  background: #f7faf5;
  touch-action: none;
  user-select: none;
}
#workspace [data-action],
#workspace [data-hanger] {
  cursor: pointer;
}
.tray {
  display: flex;
  gap: 16px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 16px 20px;
  background: #fbfcf9;
}
.tray strong {
  font-size: 12px;
}
.tray small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 3px;
}
.weights {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}
.weights button {
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 12px;
  touch-action: none;
  user-select: none;
}
.weight-icon {
  width: 22px;
  height: 19px;
  border: 2px solid #496758;
  background: #dce7de;
  border-radius: 5px 5px 3px 3px;
  display: inline-block;
  box-shadow: inset 0 -4px 0 #a2b9ab;
}
.bench-hint {
  padding: 10px 18px;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--line);
  min-height: 38px;
}
.inspector {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.section-heading {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.section-heading h2 {
  font-size: 18px;
}
.section-heading .tag {
  font-size: 8px;
  letter-spacing: 0.8px;
}
.sample-status {
  font-size: 12px;
  min-height: 20px;
  color: var(--amber);
}
.readouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.readouts > div {
  background: #edf5ee;
  border: 1px solid #dbe8dc;
  border-radius: 9px;
  padding: 10px;
}
.readouts span {
  font-size: 10px;
  color: var(--muted);
  display: block;
}
.readouts output {
  font:
    600 25px/1.6 ui-monospace,
    monospace;
  letter-spacing: -1px;
}
.readouts small {
  display: block;
  font-size: 8px;
  color: var(--muted);
}
.row {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.row > label {
  flex: 1;
}
.row > button {
  font-size: 12px;
  flex: 1;
}
.load-control {
  display: grid;
  grid-template-columns: 1fr 85px;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.load-control label {
  font-size: 13px;
}
.load-control label span {
  color: var(--muted);
}
.load-control input[type='range'],
.load-control .row {
  grid-column: 1/-1;
}
.measurement-tools h3 {
  margin-bottom: 6px;
}
.measurement-tools button {
  width: 100%;
  text-align: left;
  font-size: 12px;
  margin-bottom: 5px;
}
.measurement-tools button span {
  float: right;
  font:
    11px ui-monospace,
    monospace;
  color: var(--muted);
  padding-top: 3px;
}
details {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 0;
}
details label,
details .row,
details .note {
  margin-top: 10px;
}
.model-values {
  padding: 10px;
  background: #f6eee1;
  border-radius: 7px;
  font-size: 12px;
}
.model-values p + p {
  margin-top: 4px;
}
.evidence {
  margin-top: 18px;
  padding: 22px;
}
.evidence-head {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
}
.evidence-head h2 {
  margin-top: 4px;
}
.graph-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 24px;
  margin-top: 20px;
}
#graph {
  width: 100%;
  display: block;
  min-height: 250px;
}
.analysis {
  border-left: 1px solid var(--line);
  padding-left: 22px;
  display: flex;
  gap: 11px;
  flex-direction: column;
}
#fit-result {
  font-size: 13px;
  font-weight: 650;
}
.analysis label {
  font-size: 11px;
}
.legend {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  padding: 3px 16px;
  font-size: 11px;
}
.legend span:before {
  content: '';
  display: inline-block;
  height: 3px;
  width: 15px;
  background: var(--curve);
  margin-right: 5px;
  vertical-align: middle;
}
#kept > div {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 5px 0;
}
#kept label {
  flex: 1;
  white-space: normal;
  overflow-wrap: anywhere;
}
#kept button {
  min-height: 27px;
  padding: 2px 7px;
}
.data-details {
  margin-top: 20px;
}
.table-wrap {
  overflow: auto;
  max-height: 300px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font:
    11px ui-monospace,
    monospace;
  white-space: nowrap;
}
th,
td {
  padding: 9px;
  text-align: right;
  border-bottom: 1px solid var(--line);
}
th {
  background: #edf5ee;
  position: sticky;
  top: 0;
  font-weight: 600;
}
.data-details > button {
  margin-top: 10px;
}
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 32px;
  gap: 12px;
}
footer > div {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
footer p {
  font-size: 11px;
  color: var(--muted);
}
footer button {
  font-size: 11px;
  background: transparent;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  width: min(650px, calc(100vw - 30px));
  padding: 24px;
  color: var(--ink);
  box-shadow: 0 18px 80px #173e3340;
  max-height: 85vh;
}
dialog::backdrop {
  background: #193b325c;
  backdrop-filter: blur(3px);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
dialog p {
  font-size: 13px;
  margin: 12px 0;
}
dialog li {
  padding: 6px 0;
  font-size: 14px;
}
dialog h3 {
  margin-top: 18px;
}
#micrometer-view {
  width: 100%;
}
#jaw-reading {
  display: block;
  text-align: center;
  font:
    600 28px ui-monospace,
    monospace;
  padding: 12px;
}
#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  padding: 12px 20px;
  border-radius: 10px;
  color: #fff;
  background: #163e35;
  box-shadow: 0 5px 30px #183f3833;
  max-width: calc(100vw - 30px);
  width: max-content;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  font-size: 13px;
}
#toast.show {
  opacity: 1;
}
#drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  pointer-events: none;
  border: 2px solid #177b58;
  color: #fff;
  background: #174d43;
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 5px 20px #163e3530;
}
.teacher .topbar .brand,
.teacher .brief > .tag {
  display: none;
}
.teacher .workstation {
  grid-template-columns: minmax(0, 1fr) 330px;
}
.teacher .readouts output {
  font-size: 32px;
}
.teacher #workspace {
  min-height: 570px;
}
.teacher .readouts span {
  font-size: 12px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
@media (max-width: 1100px) {
  #lab {
    padding: 0 16px;
  }
  .topbar {
    gap: 20px;
  }
  .brand small,
  .brief > .tag {
    display: none;
  }
  .brand {
    font-size: 14px;
  }
  .graph-layout {
    grid-template-columns: minmax(0, 1fr) 235px;
    gap: 10px;
  }
  .analysis {
    padding-left: 15px;
  }
  .tray {
    flex-wrap: wrap;
    gap: 8px;
  }
  .weights {
    justify-content: flex-start;
  }
}
@media (max-width: 800px) {
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 0;
  }
  .heading {
    order: 3;
    flex-basis: 100%;
  }
  .top-actions {
    margin-left: auto;
  }
  .brief {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 5px;
  }
  .brief p {
    font-size: 12px;
  }
  .workstation,
  .teacher .workstation {
    grid-template-columns: minmax(0, 1fr);
  }
  .inspector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
  }
  .section-heading,
  .sample-status,
  .model-values {
    grid-column: 1/-1;
  }
  .inspector > details {
    grid-column: 1/-1;
  }
  .inspector .load-control {
    grid-column: 2;
    grid-row: 3/5;
    border-top: 0;
    padding-top: 0;
  }
  .inspector .readouts {
    grid-column: 1;
  }
  .inspector > .row {
    grid-column: 1;
  }
  .measurement-tools {
    grid-column: 1/-1;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .measurement-tools h3 {
    display: none;
  }
  .graph-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .analysis {
    border-left: 0;
    padding: 15px 0 0;
    border-top: 1px solid var(--line);
  }
  .stage-head {
    gap: 10px;
  }
  #workspace {
    min-height: 430px;
  }
  .teacher #workspace {
    min-height: 500px;
  }
  .transport {
    flex-wrap: wrap;
    gap: 5px;
  }
  .transport button {
    font-size: 12px;
    padding: 6px 9px;
  }
  .status-pill {
    margin-left: auto;
  }
  .transport .spacer {
    display: none;
  }
  .transport #fullscreen {
    margin-left: auto;
  }
  footer {
    flex-wrap: wrap;
  }
}
@media (max-width: 460px) {
  #lab {
    padding: 0 9px;
  }
  .top-actions button {
    font-size: 11px;
    padding: 6px 8px;
  }
  .brand {
    font-size: 13px;
  }
  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 25px;
    border-radius: 9px;
  }
  .heading h1 {
    font-size: 27px;
  }
  .brief select {
    width: 100%;
  }
  .transport .key {
    display: none;
  }
  .transport .divider {
    display: none;
  }
  .status-pill {
    font-size: 9px;
  }
  .camera {
    top: 105px;
    gap: 4px;
    left: 9px;
  }
  .camera button {
    padding: 4px 7px;
  }
  .stage-head {
    min-height: 92px;
    padding: 10px;
  }
  .station-tabs {
    flex-basis: 100%;
  }
  .station-tabs span {
    font-size: 10px;
  }
  .stage-head .check {
    font-size: 11px;
  }
  #workspace {
    min-height: 420px;
    max-height: 500px;
  }
  .tray {
    padding: 12px;
  }
  .weights {
    gap: 5px;
  }
  .weights button {
    padding: 6px;
    font-size: 10px;
    min-height: 45px;
  }
  .weight-icon {
    width: 16px;
    height: 16px;
  }
  .inspector {
    padding: 13px;
    gap: 10px;
  }
  .readouts output {
    font-size: 23px;
  }
  .inspector > .row {
    flex-direction: column;
    align-items: stretch;
  }
  .readouts {
    grid-template-columns: 1fr;
  }
  .inspector .load-control {
    grid-row: 3/5;
  }
  .measurement-tools {
    flex-direction: column;
    gap: 0;
  }
  .evidence {
    padding: 15px 10px;
  }
  .evidence-head {
    flex-wrap: wrap;
  }
  .evidence-head > .row {
    width: 100%;
  }
  #graph {
    min-height: 210px;
  }
  .teacher .readouts output {
    font-size: 27px;
  }
  footer button {
    padding: 7px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
@media (max-width: 460px) {
  .inspector .load-control {
    grid-template-columns: minmax(0, 1fr) 65px;
  }
  .readouts small {
    font-size: 9px;
  }
}
