:root {
  font-family:
    Inter,
    Segoe UI,
    Arial,
    sans-serif;
  color: #0d1f35;
  background: #f4f7fb;
  font-synthesis: none;
  --navy: #0d2b4e;
  --blue: #1a6bb5;
  --border: #c8d8ec;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  outline-offset: 4px;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.45;
  cursor: wait;
}
header {
  min-height: 96px;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  gap: 32px;
  background: #081c33;
  color: white;
  border-bottom: 3px solid #2580d4;
}
.brand img {
  width: 145px;
  max-height: 58px;
  object-fit: contain;
}
.head-title {
  border-left: 1px solid #3e5269;
  padding-left: 28px;
}
.head-title span,
.eyebrow {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.12em;
}
.head-title span {
  color: #9ec5e7;
}
h1 {
  font-size: 26px;
  letter-spacing: -0.03em;
  margin: 5px 0 0;
}
.back {
  margin-left: auto;
  color: #d9edff;
  font-size: 14px;
  text-decoration: none;
}
.tabs {
  display: flex;
  gap: 8px;
  padding: 15px 28px;
  overflow: auto;
  background: white;
  border-bottom: 1px solid var(--border);
}
.tabs button {
  border: 0;
  background: none;
  white-space: nowrap;
  padding: 11px 17px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 650;
  color: #516579;
}
.tabs button[aria-current] {
  background: #e8f3fb;
  color: #0d2b4e;
}
.workspace {
  display: grid;
  grid-template-columns: 312px 1fr;
  max-width: 1800px;
  margin: auto;
}
.controls {
  background: white;
  padding: 28px 24px;
  border-right: 1px solid var(--border);
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.eyebrow {
  color: #59758d;
}
h2 {
  font-size: 25px;
  margin: 8px 0 12px;
  letter-spacing: -0.035em;
}
.icon {
  background: #f4f7fb;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 26px;
  color: var(--navy);
}
.subtle {
  font-size: 14px;
  line-height: 1.6;
  color: #526a80;
  margin: 0 0 20px;
}
.presets {
  border-top: 1px solid #e3ebf3;
  padding-top: 18px;
  margin-bottom: 22px;
}
.presets label {
  display: block;
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 9px;
}
select {
  width: 100%;
  padding: 11px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: #0d2b4e;
  font-size: 14px;
}
.input-group {
  padding: 17px 0 5px;
  border-top: 1px solid #e3ebf3;
}
.input-group h3 {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 16px;
  display: flex;
  gap: 9px;
  align-items: center;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  background: #1d9e75;
}
.dot.safety {
  background: #2580d4;
}
.field {
  margin: 0 0 15px;
}
.field label {
  font-size: 14px;
  display: block;
  margin-bottom: 8px;
}
.stepper {
  display: flex;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  align-items: center;
  background: #f9fbfd;
}
.stepper button {
  width: 36px;
  align-self: stretch;
  border: 0;
  background: #eef4fa;
  color: var(--navy);
  font-size: 21px;
}
.stepper input {
  width: calc(100% - 102px);
  min-width: 35px;
  border: 0;
  background: transparent;
  text-align: center;
  appearance: textfield;
  font-family: Consolas, monospace;
  color: var(--navy);
}
.stepper input::-webkit-inner-spin-button {
  appearance: none;
}
.unit {
  font-size: 12px;
  color: #526a80;
  width: 30px;
}
.assumptions {
  padding: 14px;
  border-radius: 7px;
  background: #f2f6fa;
  color: #516579;
  font-size: 12px;
  line-height: 1.65;
  margin-top: 12px;
}
.drop-instruction {
  margin: 8px 0 16px;
  color: #526a80;
  font-size: 13px;
  line-height: 1.6;
}
.assumptions strong {
  color: #234360;
}
.assumptions p {
  margin: 4px 0;
}
.visual-column {
  padding: 20px 24px;
  min-width: 0;
}
#viewer {
  height: clamp(490px, 62vh, 760px);
  background: #dce6f0;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 1px solid #c2d3e3;
}
#canvas {
  position: absolute;
  inset: 0;
}
#canvas canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.view-top,
.view-bottom {
  position: absolute;
  z-index: 3;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}
.view-top {
  top: 18px;
}
.view-top > *,
.view-bottom > * {
  pointer-events: auto;
}
.scene-caption {
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 750;
  color: #37516a;
  display: flex;
  align-items: center;
  gap: 9px;
}
.scene-caption i {
  height: 6px;
  width: 6px;
  background: #1d9e75;
  border-radius: 50%;
}
.camera {
  display: flex;
  background: #ffffffeb;
  padding: 4px;
  border-radius: 7px;
  box-shadow: 0 4px 18px #163a6214;
}
.camera button {
  border: 0;
  background: none;
  padding: 9px 12px;
  border-radius: 5px;
  font-size: 13px;
  color: #50677c;
}
.camera button[aria-pressed="true"] {
  background: #0d2b4e;
  color: white;
}
.view-bottom {
  bottom: 41px;
  justify-content: flex-start;
}
.toggle {
  padding: 9px;
  background: #ffffffeb;
  border: 1px solid #c8d8ec;
  border-radius: 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.toggle input {
  accent-color: #1a6bb5;
}
#play {
  margin-left: auto;
  background: #0d2b4e;
  color: white;
  padding: 11px 14px;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
}
.gesture {
  position: absolute;
  bottom: 13px;
  left: 0;
  right: 0;
  text-align: center;
  color: #465f75;
  font-size: 12px;
  pointer-events: none;
}
.drop-handle {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  min-height: 40px;
  padding: 9px 13px;
  border: 2px solid white;
  border-radius: 20px;
  background: #0d2b4e;
  color: white;
  box-shadow: 0 3px 12px #081c3340;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: grab;
  touch-action: none;
  user-select: none;
  pointer-events: auto;
}
.drop-handle:active,
.drop-handle.dragging {
  cursor: grabbing;
  background: #1a6bb5;
}
.drop-handle:focus-visible {
  outline: 3px solid #1a6bb5;
  outline-offset: 3px;
  box-shadow: 0 0 0 7px white;
}
.drop-handle:disabled {
  visibility: hidden;
  pointer-events: none;
}
.coverage-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.coverage-controls button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: #234360;
  font-size: 12px;
  font-weight: 650;
}
#select-main[aria-pressed="true"] {
  border-color: #176b52;
  background: #176b52;
  color: white;
}
#select-safety[aria-pressed="true"] {
  border-color: #1a6bb5;
  background: #1a6bb5;
  color: white;
}
.coverage-controls button:focus-visible {
  outline: 2px solid #1a6bb5;
}
#clear-coverage:disabled {
  cursor: default;
}
#coverage-note {
  flex: 1 1 240px;
  color: #526a80;
  font-size: 12px;
  line-height: 1.5;
}
#loading {
  position: absolute;
  inset: 70px 20px 90px;
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1.7;
  background: #dce6f0e8;
  font-size: 16px;
  color: #0d2b4e;
}
#loading[hidden] {
  display: none;
}
#labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.label {
  position: absolute;
  left: 0;
  top: 0;
  padding: 7px 9px;
  border-radius: 5px;
  background: #fffef5ed;
  border: 1px solid #b7cad8;
  color: #163a62;
  white-space: nowrap;
  font-family: Consolas, monospace;
  font-size: 12px;
  box-shadow: 0 2px 8px #0d2b4e0e;
  pointer-events: auto;
}
.label.anchor {
  border-left: 3px solid #1d9e75;
  cursor: pointer;
}
.label.anchor:focus-visible {
  outline: 3px solid #1a6bb5;
  outline-offset: 3px;
}
.label.safety {
  border-left-color: #2580d4;
}
.label.small {
  padding: 4px 6px;
  font-size: 11px;
}
.label.editable {
  cursor: pointer;
}
.label .secondary {
  display: block;
  font-size: 10px;
  color: #50677c;
  margin-top: 2px;
}
.system-links{display:flex;gap:6px;padding:12px 28px;background:#eff4f8;border-bottom:1px solid #d9e4ec}.system-links a{color:#25475e;text-decoration:none;font-weight:650;font-size:14px;padding:9px 14px;border-radius:7px}.system-links a[aria-current]{background:#0b2a46;color:white}
.label.pair-warning,
.dimension-label.pair-warning {
  pointer-events: none;
  border-color: #a52129;
  background: #ba2932;
  color: white;
  font-weight: 750;
}
.label.pair-warning .secondary,
.dimension-label.pair-warning .secondary {
  color: white;
}
.label.selected-anchor,
.dimension-label.selected-anchor {
  border: 2px solid #1a6bb5;
  box-shadow: 0 0 0 3px #3d9ae830;
  font-weight: 700;
}
#status {
  background: #ecf6f1;
  color: #175a42;
  border: 1px solid #bfdfcf;
  border-radius: 8px;
  font-size: 14px;
  padding: 14px 17px;
  margin-top: 15px;
  line-height: 1.6;
}
#status.warn {
  background: #fff1ef;
  border-color: #e9c3c0;
  color: #973c36;
}
#status strong {
  font-weight: 700;
}
.status-detail {
  display: block;
  font-size: 12px;
  margin-top: 3px;
}
.results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.result {
  border: 1px solid #d3dfeb;
  background: white;
  border-radius: 8px;
  padding: 15px;
}
.result span {
  display: block;
  font-size: 12px;
  color: #61788e;
}
.result strong {
  display: block;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.04em;
  margin: 6px 0;
}
.result small {
  font-size: 11px;
  color: #536d82;
}
.result.bad strong {
  color: #b63b3b;
}
.actions {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin-top: 15px;
}
.actions > span {
  font-size: 12px;
  line-height: 1.6;
  color: #486379;
}
.actions > div {
  display: flex;
  gap: 8px;
}
.actions button {
  background: white;
  border: 1px solid var(--border);
  color: #264b6e;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
}
.geometry-note {
  font-size: 12px;
  line-height: 1.65;
  color: #61778b;
}
.reading {
  padding: 42px 32px;
  max-width: 1200px;
  margin: auto;
  min-height: 70vh;
}
.reading > p {
  max-width: 850px;
  font-size: 16px;
  line-height: 1.75;
  color: #4d6378;
}
.reference-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  margin-top: 25px;
}
.reference-grid article {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 25px;
}
.reference-grid h3 {
  font-size: 19px;
  margin: 0 0 12px;
}
.reference-grid p {
  font-size: 15px;
  line-height: 1.7;
  color: #4d6378;
}
.reference-grid a {
  font-size: 14px;
  color: var(--blue);
}
.table-wrap {
  overflow: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 26px 0;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
td,
th {
  text-align: left;
  padding: 14px 17px;
  border-bottom: 1px solid #dae5ee;
}
th {
  background: #e8f3fb;
  color: #163a62;
}
footer {
  padding: 22px 28px;
  background: #eaf0f6;
  border-top: 1px solid var(--border);
  color: #576e83;
  font-size: 12px;
  text-align: center;
  line-height: 1.7;
}
[hidden] {
  display: none !important;
}
@media (min-width: 1450px) {
  .workspace {
    grid-template-columns: 345px 1fr;
  }
  .controls {
    padding: 30px;
  }
  .results {
    grid-template-columns: repeat(6, 1fr);
  }
  .result {
    padding: 14px 11px;
  }
}
@media (max-width: 1000px) {
  .workspace {
    grid-template-columns: 265px 1fr;
  }
  .controls {
    padding: 22px 18px;
  }
  .visual-column {
    padding: 15px;
  }
  .view-top {
    flex-wrap: wrap;
  }
  .scene-caption {
    display: none;
  }
  .view-bottom {
    gap: 6px;
    left: 10px;
    right: 10px;
  }
  .toggle {
    font-size: 11px;
  }
  .actions {
    align-items: flex-start;
    flex-direction: column;
  }
  .camera {
    margin-left: auto;
  }
  .results {
    gap: 7px;
  }
  .result {
    padding: 12px 9px;
  }
  .result strong {
    font-size: 21px;
  }
  .head-title span {
    font-size: 10px;
  }
}
@media (max-width: 700px) {
  header {
    padding: 16px;
    gap: 15px;
    min-height: 80px;
  }
  .brand img {
    width: 85px;
  }
  .head-title {
    padding-left: 15px;
  }
  .head-title h1 {
    font-size: 20px;
  }
  .head-title span {
    font-size: 9px;
  }
  .back {
    display: none;
  }
  .tabs {
    padding: 10px;
    gap: 0;
  }
  .tabs button {
    padding: 10px;
    font-size: 13px;
  }
  .workspace {
    display: flex;
    flex-direction: column;
  }
  .visual-column {
    order: -1;
    padding: 10px;
  }
  .controls {
    border-right: 0;
    border-top: 1px solid var(--border);
    padding: 24px;
  }
  .controls .input-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .input-group h3 {
    grid-column: 1/-1;
    margin-bottom: 8px;
  }
  .field {
    margin-bottom: 10px;
  }
  #viewer {
    height: 65vh;
    min-height: 470px;
  }
  .view-bottom {
    flex-wrap: wrap;
    bottom: 45px;
  }
  #play {
    margin-left: 0;
    padding: 10px;
  }
  .toggle {
    font-size: 10px;
    padding: 6px;
  }
  .gesture {
    font-size: 10px;
    padding: 0 12px;
    line-height: 1.4;
  }
  .coverage-controls button {
    flex: 1 1 auto;
  }
  #coverage-note {
    flex-basis: 100%;
  }
  .drop-handle {
    min-height: 44px;
    padding: 10px 13px;
  }
  .results {
    grid-template-columns: repeat(3, 1fr);
  }
  .result span {
    font-size: 11px;
  }
  .result strong {
    font-size: 22px;
  }
  .actions {
    gap: 10px;
  }
  .actions > div {
    width: 100%;
  }
  .actions button {
    flex: 1;
  }
  .reading {
    padding: 30px 20px;
  }
  .reference-grid {
    grid-template-columns: 1fr;
  }
  .label {
    font-size: 11px;
    padding: 5px;
  }
  #status {
    font-size: 13px;
  }
}
@media print {
  body {
    background: white;
  }
  header {
    background: white;
    color: #0d2b4e;
    padding: 10px;
  }
  .brand {
    display: none;
  }
  .head-title {
    border: 0;
    padding: 0;
  }
  .head-title span {
    color: #0d2b4e;
  }
  nav,
  .workspace,
  .reading,
  .back {
    display: none !important;
  }
  #print-summary {
    display: block !important;
    padding: 20px;
  }
  #print-image {
    width: 100%;
    max-height: 450px;
    object-fit: contain;
  }
  #print-values {
    columns: 2;
    font-size: 13px;
    line-height: 1.8;
  }
  #print-status {
    font-size: 13px;
  }
  footer {
    background: white;
    font-size: 11px;
  }
}
.embedded > header {
  display: none;
}
