/* The E57 viewer's one stylesheet, for both faces: the clean customer viewer and the local review viewer.
   Colours, fonts and radii are the website's own tokens (site/a11y.css, made from code_website's main.css):
   the viewer is DefiniLine's, and the accessibility panel's light and high-contrast themes, text size and
   readable font reach every control here without rules of their own. Design note:
   .claude/context/viewer-modern-ui.md */

* {
  box-sizing: border-box;
}

/* Hidden means hidden, whatever display a component's rule gives it (the scripts hide sections and controls). */
[hidden] {
  display: none !important;
}

:root {
  --sidebar-width: 400px;
  --sidebar-half-width: 200px;
  /* Overlay controls and panels follow the screen, within readable limits; never under a fingertip (44 px). */
  --control-size: clamp(44px, 5.4vmin, 52px);
  --panel-width: clamp(176px, 16vw, 220px);
  --pip-width: clamp(240px, 24vw, 360px);

  /* Type scale, in rem so the accessibility panel's text size scales it. */
  --fs-xs: 0.75rem;     /* 12: captions, overlines, chips */
  --fs-sm: 0.8125rem;   /* 13: labels, readouts */
  --fs-md: 0.875rem;    /* 14: controls and body */
  --fs-lg: 1.0625rem;   /* 17: the title */
  /* Spacing on a 4 px grid. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  /* Radii: the website's 6 and 10 px, and a larger one for cards that float over the view. */
  --r-sm: var(--radius-sm, 6px);
  --r-md: var(--radius, 10px);
  --r-lg: 14px;
  --r-pill: 999px;
  /* Hit targets: 44 px wherever a finger is the pointer; 40 / 32 px with a mouse. */
  --hit: 40px;
  --hit-sm: 32px;
  /* Elevation: 1 resting, 2 floating controls, 3 cards and the drawer. */
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --elev-2: 0 6px 20px rgba(0, 0, 0, 0.4);
  --elev-3: 0 16px 44px rgba(0, 0, 0, 0.55);
  /* A drawer's edge: a short shadow (a 44 px one along the whole height made it slide in late on slow phones). */
  --drawer-shadow: 6px 0 18px rgba(0, 0, 0, 0.35);
  /* Over a panorama or the points: frosted glass of the page's own surface colour (light in the light theme). */
  --glass: color-mix(in srgb, var(--surface) 80%, transparent);
  --glass-strong: color-mix(in srgb, var(--surface) 92%, transparent);
  --glass-line: color-mix(in srgb, var(--text) 18%, transparent);
  --hover: color-mix(in srgb, var(--text) 9%, transparent);
  --press: color-mix(in srgb, var(--text) 16%, transparent);
  /* Straight on a photo with nothing behind (the stepper): light, with a shadow, in every theme. */
  --on-image: #fff8f0;
  --on-image-accent: #f2b67e;
  --on-image-shadow: 0 1px 2px rgba(0, 0, 0, 0.95), 0 0 10px rgba(0, 0, 0, 0.6);
  --ease: 160ms cubic-bezier(0.2, 0, 0, 1);
  /* Line icons drawn by CSS (masks, so they take the text colour). */
  --icon-menu: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M4 7h16M4 12h16M4 17h16'/%3E%3C/svg%3E");
  --icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E");
  --icon-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='9' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
  --icon-out: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6h9v9M18 6 7 17'/%3E%3C/svg%3E");
  /* The ruler's pointer (user, 2026-11-26): a small square, a tick from the middle of each side towards the centre,
     the ticks stopping short of each other so the point being picked stays free; white on a dark halo, seen on
     any photo. Its hotspot is the centre. */
  --cursor-measure: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32' fill='none'%3E%3Cpath d='M8.5 8.5h15v15h-15zM16 8.5v4M16 23.5v-4M8.5 16h4M23.5 16h-4' stroke='%23000' stroke-opacity='.7' stroke-width='3.5'/%3E%3Cpath d='M8.5 8.5h15v15h-15zM16 8.5v4M16 23.5v-4M8.5 16h4M23.5 16h-4' stroke='%23fff' stroke-width='1.5'/%3E%3C/svg%3E") 16 16, crosshair;
}

@media (pointer: coarse) {
  :root {
    --hit: 44px;
    --hit-sm: 44px;
  }
}

/* Asked for less transparency: solid cards instead of glass. */
@media (prefers-reduced-transparency: reduce) {
  :root {
    --glass: var(--surface);
    --glass-strong: var(--surface);
  }
}

/* ---------- element defaults (a layer: every rule outside it wins, whatever its selector) ----------
   They stay off the website's accessibility panel (.siteA11y), which its own classes style. */
@layer base {
  html,
  body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
  }

  body {
    font-size: var(--fs-md);
    line-height: 1.45;
  }

  h1:where(:not(.siteA11y *)) {
    margin: 0;
    font-size: var(--fs-lg);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
  }

  /* Section headings: a small overline, so the controls carry the weight. */
  h2:where(:not(.siteA11y *)) {
    margin: 0;
    font-size: var(--fs-xs);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  /* A label sits close to its control and further from the control before it. */
  label:where(:not(.siteA11y *)) {
    display: block;
    margin: var(--sp-2) 0 calc(-1 * var(--sp-1));
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text);
  }

  h2:where(:not(.siteA11y *)) + label {
    margin-top: 0;
  }

  select:where(:not(.siteA11y *)),
  input:where(:not(.siteA11y *)):where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"])) {
    width: 100%;
    min-width: 0;
    min-height: var(--hit);
    padding: 0 var(--sp-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text);
    background-color: var(--bg-alt);
    font: inherit;
    font-size: var(--fs-md);
    transition: border-color var(--ease), background-color var(--ease);
  }

  select:where(:not(.siteA11y *)):hover:not(:disabled),
  input:where(:not(.siteA11y *)):where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"])):hover:not(:disabled) {
    border-color: var(--text-muted);
  }

  select:where(:not(.siteA11y *)) {
    cursor: pointer;
  }

  input[type="checkbox"]:where(:not(.siteA11y *)),
  input[type="radio"]:where(:not(.siteA11y *)) {
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
  }

  input[type="range"]:where(:not(.siteA11y *)) {
    width: 100%;
    min-height: 24px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
  }

  /* Choosing a file: a dashed drop area with a real button in it (dropping a file on it works too). */
  input[type="file"]:where(:not(.siteA11y *)) {
    width: 100%;
    min-width: 0;
    padding: var(--sp-1);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text-muted);
    background: var(--bg-alt);
    font: inherit;
    font-size: var(--fs-sm);
    cursor: pointer;
  }

  input[type="file"]:where(:not(.siteA11y *))::file-selector-button {
    min-height: calc(var(--hit) - 10px);
    margin-inline-end: var(--sp-3);
    padding: 0 var(--sp-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text);
    background: var(--surface-alt);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--ease), border-color var(--ease);
  }

  input[type="file"]:where(:not(.siteA11y *)):hover::file-selector-button {
    border-color: var(--text-muted);
    background: color-mix(in srgb, var(--text) 10%, var(--surface-alt));
  }

  /* Buttons. Default: a quiet secondary button; .primary is the one main action of a place; aria-pressed is
     a switch that is on; .danger ends something. */
  button:where(:not(.siteA11y *)) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    width: 100%;
    min-width: 0;
    min-height: var(--hit);
    margin: 0;
    padding: 0 var(--sp-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text);
    background: var(--surface-alt);
    font: inherit;
    font-size: var(--fs-md);
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: background-color var(--ease), border-color var(--ease), color var(--ease), transform 80ms ease;
  }

  button:where(:not(.siteA11y *)):hover:not(:disabled) {
    border-color: var(--text-muted);
    background: color-mix(in srgb, var(--text) 10%, var(--surface-alt));
  }

  button:where(:not(.siteA11y *)):active:not(:disabled) {
    transform: translateY(1px);
    background: color-mix(in srgb, var(--text) 16%, var(--surface-alt));
  }

  button:where(:not(.siteA11y *)):disabled {
    cursor: not-allowed;
    opacity: 0.45;
  }

  :where(button, select, input, a, canvas, [tabindex]):where(:not(.siteA11y *)):focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
  }

  small:where(:not(.siteA11y *)) {
    font-size: var(--fs-xs);
    color: var(--text-muted);
  }
}

/* ---------- page grid and the sidebar ---------- */

body {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.sidebar > header {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
}

.sidebar > section {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-5) var(--sp-4);
  border-top: 1px solid var(--border);
}

/* The title: DefiniLine's mark, the viewer's name and which face this is. */
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.brandMark {
  flex: none;
  width: 34px;
  height: 34px;
  color: var(--primary);
}

.brandText {
  display: grid;
  gap: 1px;
}

.brandName {
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

/* The main action of a place. */
button.primary {
  border-color: var(--primary);
  color: var(--primary-contrast);
  background: var(--primary);
}

button.primary:hover:not(:disabled) {
  border-color: var(--primary-strong);
  background: var(--primary-strong);
}

button.primary:active:not(:disabled) {
  background: var(--primary);
}

/* A switch that is on: the accent, never a second meaning of colour (green was "go"). */
button[aria-pressed="true"] {
  border-color: var(--primary);
  color: var(--primary-strong);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}

button[aria-pressed="true"]:hover:not(:disabled) {
  border-color: var(--primary-strong);
  background: color-mix(in srgb, var(--primary) 18%, var(--accent-soft));
}

button.danger {
  border-color: var(--danger);
  color: var(--danger);
  background: transparent;
}

button.danger:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger-soft);
}

button.busy {
  cursor: progress;
  opacity: 1;
}

button.busy::before {
  content: '';
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: buttonBusySpin 0.8s linear infinite;
}

@keyframes buttonBusySpin {
  to { transform: rotate(360deg); }
}

/* Buttons side by side: equal columns. */
.segmented {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: var(--sp-2);
}

/* A choice of one (Points | Panoramas, RGB | Signal): one track, the chosen side raised in it. */
.segmented:has(> button[aria-pressed]) {
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--r-sm) + 3px);
  background: var(--bg-alt);
}

.segmented > button[aria-pressed] {
  border-color: transparent;
  color: var(--text-muted);
  background: transparent;
  box-shadow: none;
}

.segmented > button[aria-pressed]:hover:not(:disabled) {
  border-color: transparent;
  color: var(--text);
  background: var(--hover);
}

.segmented > button[aria-pressed="true"],
.segmented > button[aria-pressed="true"]:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-strong);
  background: var(--surface-alt);
  box-shadow: var(--elev-1);
}

.row {
  display: grid;
  gap: var(--sp-2);
}

.row > label {
  margin: 0;
}

/* A check box and its words: the whole row is the target. */
.checkRow,
.sidebar label:has(> input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--hit-sm);
  margin: 0;
  font-weight: 400;
  cursor: pointer;
}

.uploadLabel {
  margin-top: var(--sp-2);
}

.rangeGrid {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: var(--sp-2);
  align-items: center;
}

.rangeGrid label {
  margin: 0;
}

.rangeGrid input {
  min-height: var(--hit-sm);
}

.toggleGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--sp-3);
}

.toggleGrid .checkRow {
  font-size: var(--fs-sm);
}

.signalHistogram,
.distributionHistogram {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: #050505;
}

.signalHistogram {
  height: 96px;
  cursor: crosshair;
}

.distributionHistogram {
  height: 112px;
  cursor: pointer;
}

.axisBlock {
  display: grid;
  gap: var(--sp-1);
  margin-bottom: var(--sp-2);
}

.axisTitle {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
}

/* Readouts: what the viewer says back. Fixed heights, so the controls below never jump while it talks. */
.readout,
.status,
.measureOutput,
.metadata {
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--text-muted);
}

.panelLabel {
  margin: var(--sp-2) 0 0;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.status,
.measureOutput,
#cloudInfo {
  width: 100%;
  overflow: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-alt);
  padding: var(--sp-2) var(--sp-3);
  scrollbar-width: thin;
}

.measureOutput strong,
#cloudInfo strong {
  color: var(--text);
}

/* The status line: the viewer's voice, marked by the accent. */
.status {
  color: var(--text);
  border-inline-start: 3px solid var(--primary);
}

.compactInfo {
  height: 92px;
}

#status {
  height: 72px;
}

/* What the view relies on (the review viewer only): tagged, so it is never read as a status message. */
#viewPlanLabel {
  border-style: dashed;
  border-color: var(--border-strong);
}

#viewPlanLabel::before {
  content: "Relies on";
  display: block;
  margin-bottom: 2px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

#signalFilterInfo {
  height: 76px;
}

#signalInfo {
  height: 126px;
}

#hoverOutput {
  height: 220px;
}

#valueDistributionInfo {
  height: 174px;
}

#runInfo {
  height: 124px;
}

#debugStatus {
  height: 86px;
}

#debugTimeline {
  height: 180px;
}

#debugParameterInfo {
  height: 150px;
}

#focusOutput {
  height: 116px;
}

#panoramaInfo {
  height: 150px;
}

.panoramaLinks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--sp-2);
}

.linkButton {
  flex: 0 1 auto;
  width: auto;
  min-height: var(--hit-sm);
  padding: 0 var(--sp-2);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  line-height: 1.2;
}

#selectedItemInfo {
  height: 260px;
}

#reconstructionInfo,
#cloudInfo {
  height: 240px;
}

#closeOutput {
  height: 76px;
}

/* ---------- the view ---------- */

#viewer {
  position: relative;
  width: 100%;
  height: 100vh;
  min-width: 0;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;   /* drags turn the panorama instead of scrolling the page */
}

/* A ruler on: the measuring pointer. A drag still turns the view (app.js: a press that moves under 5 px picks). */
body:has(#panoramaOverlayControls:not([hidden]) #panoramaMeasureBtn[aria-pressed="true"]) #canvas,
body:has(#measureBtn[aria-pressed="true"]) #canvas {
  cursor: var(--cursor-measure);
}

/* The storey's floor plan: a frosted card over the view. */
#tourPip {
  position: absolute;
  top: var(--pip-top, 16px);
  left: 16px;
  z-index: 12;
  width: var(--pip-width);
  padding: var(--sp-2);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  color: var(--text);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: var(--elev-3);
}

#tourPip[hidden] {
  display: none;
}

.tourPipHeader {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 0 var(--sp-2) var(--sp-1);
  font-size: var(--fs-sm);
}

/* Six dots: the header is the handle that moves the card. */
.tourPipHeader::before {
  content: "";
  flex: none;
  width: 8px;
  height: 14px;
  background-image: radial-gradient(circle, currentColor 1.2px, transparent 1.5px);
  background-size: 4px 4.67px;
  opacity: 0.5;
}

.tourPipTitle {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}

#tourPipTitle {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tourPipActions {
  display: flex;
  gap: 5px;
}

.tourPipActions select {
  width: auto;
  min-width: max(64px, var(--hit-sm));   /* a short floor name is still a full target */
  max-width: 132px;
  min-height: var(--hit-sm);
  margin: 0;
  padding: 0 var(--sp-2);
  border-color: var(--glass-line);
  font-size: var(--fs-xs);
  font-weight: 600;
  background-color: var(--glass);
}

#tourMapCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 32 / 21;
  cursor: grab;
  touch-action: none;
  border: 1px solid var(--glass-line);
  border-radius: var(--r-md);
  background: #07111f;
}

#tourMapCanvas.isPanning {
  cursor: grabbing;
}

#tourPipInfo {
  margin: var(--sp-2) var(--sp-1) 0;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.4;
}

/* ---------- the tool rail, top right: one frosted column (the panorama's or the points' tools, Reset view) ---------- */

.toolRail {
  position: absolute;
  top: var(--rail-top, 16px);
  right: 16px;
  z-index: 13;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px;
}

/* The glass is drawn behind, so the pop-outs' own glass still blurs the picture. */
.toolRail::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: var(--elev-2);
}

#panoramaOverlayControls,
.railPoints {
  display: grid;
  justify-items: center;
  gap: 2px;
}

#panoramaOverlayControls[hidden] {
  display: none;
}

/* A panorama on screen: its tools; the points' zoom and ruler step aside (customer page). Nothing open: no rail. */
body.customerMode .toolRail:has(#panoramaOverlayControls:not([hidden])) .railPoints {
  display: none;
}

body.customerMode:not(.hasScan) .toolRail {
  display: none;
}

.toolRail button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: var(--text);
  background: transparent;
  box-shadow: none;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}

.toolRail button:hover:not(:disabled) {
  border-color: transparent;
  color: var(--text);
  background: var(--hover);
}

.toolRail button:active:not(:disabled) {
  transform: scale(0.94);
  background: var(--press);
}

/* On: a ruler measuring, a tool held open. */
.toolRail button[aria-pressed="true"],
.toolRail .panoramaTool.open > .toolIcon {
  color: var(--primary-contrast);
  background: var(--primary);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--primary) 40%, transparent);
}

.toolRail button[aria-pressed="true"]:hover:not(:disabled),
.toolRail .panoramaTool.open > .toolIcon:hover:not(:disabled) {
  color: var(--primary-contrast);
  background: var(--primary-strong);
}

/* A switch that cannot be used for this scan: greyed out, never hidden (its title says why). */
.topBar .modeSwitch > button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* The open scan has no panoramas for this customer: why, and the add-on that draws them from its points. */
.panoramaNote {
  position: absolute;
  top: 84px;
  inset-inline-start: 16px;
  z-index: 41;
  max-width: min(380px, calc(100% - 104px));
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--elev-3);
  font-size: var(--fs-sm);
}

.panoramaNote a {
  color: var(--primary);
  font-weight: 600;
}

.scanRowBadge {
  justify-self: start;
  margin-top: 2px;
  padding: 0 var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

.scanRowBadge[data-kind="drawn"] {
  border-color: var(--primary);
  color: var(--primary);
}

/* The ruler waits for the measurements: dimmed, and the pointer says it is coming. */
.toolRail button:disabled {
  opacity: 0.45;
  cursor: progress;
}

.toolRail button span {
  position: absolute;
  right: 18%;
  bottom: 10%;
  font-size: 15px;
  font-weight: 700;
}

.toolRail button svg {
  flex: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toolRail button svg .fill {
  fill: currentColor;
  stroke: none;
}

/* Reset view, set apart by a line. */
.toolRail > .railReset {
  margin-top: 5px;
}

.toolRail > .railReset::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 8px;
  right: 8px;
  height: 1px;
  background: var(--glass-line);
}

.panoramaTool {
  position: relative;
}

/* Zoom and brightness/contrast pop out beside their icon: on hover with a mouse, pinned by a click or tap. */
.panoramaToolPop {
  position: absolute;
  top: 50%;
  right: 100%;
  z-index: 2;
  padding-inline-end: 16px;     /* clears the rail and bridges the gap, so hover is not lost on the way */
  opacity: 0;
  pointer-events: none;
  transform: translate(8px, -50%);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

@media (hover: hover) {
  .panoramaTool:hover .panoramaToolPop {
    opacity: 1;
    pointer-events: auto;
    transform: translate(0, -50%);
  }
}

.panoramaTool.open .panoramaToolPop {
  opacity: 1;
  pointer-events: auto;
  transform: translate(0, -50%);
}

.zoomPop {
  display: flex;
  gap: var(--sp-2);
}

.toolRail .zoomPop button {
  border: 1px solid var(--glass-line);
  border-radius: 50%;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: var(--elev-2);
}

.toolRail .zoomPop button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-strong);
  background: var(--glass-strong);
}

/* Brightness and contrast: a frosted card (drawn behind, so its right edge stays a hover bridge). */
.panoramaImageAdjustments {
  color: var(--text);
  font-size: var(--fs-xs);
}

.panoramaImageAdjustments.panoramaToolPop {
  display: grid;
  justify-items: stretch;
}

.panoramaImageAdjustments::before {
  content: "";
  position: absolute;
  inset: -12px 16px -12px -16px;
  z-index: -1;
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--elev-3);
}

.adjustRow {
  position: relative;
  display: grid;
  grid-template-columns: 20px clamp(120px, 14vw, 168px) 48px;
  align-items: center;
  gap: var(--sp-3);
  min-height: 32px;
}

.adjustIcon svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  stroke-linecap: round;
}

.adjustIcon svg .fill {
  fill: var(--primary);
  stroke: none;
}

.adjustRow output {
  padding: 3px 0;
  border-radius: var(--r-pill);
  color: var(--primary-strong);
  background: var(--accent-soft);
  font: 600 var(--fs-xs)/1.3 var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.toolRail .adjustReset {
  position: relative;
  display: inline-flex;
  justify-self: end;
  width: auto;
  height: auto;
  min-height: var(--hit-sm);
  margin: 2px 0 0;
  padding: 0 var(--sp-2);
  border-radius: var(--r-sm);
  color: var(--primary-strong);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.toolRail .adjustReset:hover:not(:disabled) {
  color: var(--primary-strong);
  text-decoration: underline;
}

/* ---------- measuring: a card at the bottom while a ruler is on ---------- */

.measureCard {
  position: absolute;
  left: 50%;
  bottom: 94px;
  z-index: 14;
  display: none;
  align-items: center;
  gap: var(--sp-4);
  width: max-content;
  max-width: calc(100% - 32px);
  padding-block: 10px;
  padding-inline: 12px 10px;
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  color: var(--text);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: var(--elev-3);
  transform: translateX(-50%);
}

body:has(#panoramaOverlayControls:not([hidden]) #panoramaMeasureBtn[aria-pressed="true"]) #panoramaMeasureCard,
body:has(#measureBtn[aria-pressed="true"]) #pointsMeasureCard {
  display: flex;
}

/* No navigator under it (points): the card sits low. */
body:has(#panoramaStepper[hidden]) .measureCard {
  bottom: 24px;
}

.measureIcon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--primary-contrast);
  background: var(--primary);
}

.measureIcon svg,
.measureDone svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.panoramaMeasurePanel {
  display: grid;
  gap: 2px;
  min-width: 180px;
  max-width: 340px;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.4;
}

.panoramaMeasurePanel > div:empty {
  display: none;
}

#panoramaMeasureOutput {
  color: var(--text);
  font-size: var(--fs-sm);
}

/* The distance itself, large. */
#panoramaMeasureOutput strong,
#measureOutput > div:first-child {
  display: block;
  color: var(--text);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.unitSwitch {
  flex: none;
}

.unitSwitch > button[aria-pressed] {
  min-width: 44px;
  min-height: var(--hit-sm);
  padding: 0 var(--sp-3);
  font-size: var(--fs-sm);
}

/* The select the viewer reads stays in the page for scripts and tests, out of sight and out of the tab order. */
.unitSelect {
  position: absolute !important;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.measureCard .measureDone,
.measureCard #clearMeasureBtn {
  width: auto;
  min-height: var(--hit);
  padding: 0 var(--sp-3);
}

.measureCard .measureDone {
  border-color: transparent;
  color: var(--text-muted);
  background: transparent;
}

.measureCard .measureDone:hover:not(:disabled) {
  border-color: transparent;
  color: var(--text);
  background: var(--hover);
}

#pointsMeasureCard .measureBody {
  display: grid;
  gap: var(--sp-1);
  min-width: 170px;
}

#pointsMeasureCard #measureOutput {
  height: auto;
  padding: 0;
  overflow: visible;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

#pointsMeasureCard .checkRow {
  min-height: 28px;
  font-size: var(--fs-xs);
}

/* "View as" (M27's colour switch, review viewer only): a frosted card hanging under the panorama's tool rail, there as
   soon as a station opens (it is inside #panoramaOverlayControls, so it hides with the panorama's tools). */
.toolRail .panoramaViewAs {
  position: absolute;
  top: calc(100% + var(--sp-2));
  inset-inline-end: 0;
  display: grid;
  gap: var(--sp-1);
  width: var(--panel-width);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--elev-2);
  color: var(--text);
  font-size: var(--fs-xs);
}

.toolRail .panoramaViewAs[hidden] {
  display: none;
}

.toolRail .panoramaViewAs select {
  width: 100%;
}

/* The viewer's one progress loader (panorama_loader.mjs), on every page (user, 2026-11-09/10). Work beside
   what is on screen (measurements, floor map, fixtures): low in the view's bottom-left corner, one quiet row
   per operation - a small round lens with an unrolled room turning through it and an amber ring, then its
   percentage and what it is doing - with no backdrop: a soft shadow keeps them legible on any panorama or point
   cloud. The rows stack upwards, the newest on top; one that ends leaves no gap. They end before the panorama
   stepper in the middle begins. Opening points or panoramas: the large lens over the middle (.isCentre). */
.progressLoaders {
  --lens-size: 38px;
  --strip-inset: 4px;
  position: absolute;
  left: 20px;
  bottom: 10px;
  z-index: 14;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 12px;
  max-width: calc(50% - 100px);
  pointer-events: none;
}

.progressLoader {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  color: #fef3c7;
  animation: progressLoaderIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.progressLoader[hidden] {
  display: none !important;   /* over the centre lens's display: grid too */
}

.progressLoader.isDone {
  opacity: 0;
  transform: translateY(4px);
}

@keyframes progressLoaderIn {
  from { opacity: 0; transform: translateY(6px); }
}

.progressLoaderLens {
  position: relative;
  flex: none;
  width: var(--lens-size);
  height: var(--lens-size);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.progressLoaderStrip {
  position: absolute;
  inset: var(--strip-inset);
  border-radius: 50%;
  background-repeat: repeat-x;
  background-size: auto 100%;
  opacity: 0.9;
  animation: progressLoaderTurn 4s linear infinite;
}

/* Spherical shading so the flat strip reads as a turning sphere. */
.progressLoaderStrip::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, transparent 38%, rgba(12, 10, 9, 0.8) 74%);
}

.progressLoaderRing {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.progressLoaderRing circle {
  fill: none;
  stroke-width: 6;
}

.progressLoaderRing .track {
  stroke: rgba(254, 243, 199, 0.18);
}

.progressLoaderRing .value {
  stroke: #fbbf24;
  stroke-linecap: round;
  stroke-dasharray: 0 100;
  transition: stroke-dasharray 0.3s ease-out;
}

.progressLoaderText {
  display: grid;
  gap: 3px;
  min-width: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 12px rgba(0, 0, 0, 0.55);
}

.progressLoaderPercent {
  color: #fcd34d;
  font: 600 13px/1 ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.progressLoaderCaption {
  max-width: 230px;
  overflow: hidden;
  color: rgba(254, 243, 199, 0.86);
  font: 400 12px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes progressLoaderTurn {
  from { background-position-x: 0; }
  /* One strip width: the strip is 240 x 80 drawn at the lens's inner height. */
  to { background-position-x: calc((var(--lens-size) - 2 * var(--strip-inset)) * -3); }
}

/* Opening points or panoramas: the lens as it always was - large over the middle of the view, on its half-round
   backdrop, its percentage only (two opening at once: side by side, each named). */
.progressLoaders.isCentre {
  --lens-size: clamp(84px, 15vmin, 120px);
  --strip-inset: 8px;
  top: 50%;
  left: 50%;
  bottom: auto;
  flex-direction: row;
  gap: 18px;
  max-width: none;
  transform: translate(-50%, -50%);
}

.progressLoaders.isCentre .progressLoader {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 16px 18px 12px;
  border-radius: 999px 999px 22px 22px;
  background: rgba(28, 25, 23, 0.62);
  backdrop-filter: blur(6px);
  animation: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.progressLoaders.isCentre .progressLoader.isDone {
  opacity: 0;
  transform: scale(1.08);
}

.progressLoaders.isCentre .progressLoaderLens {
  filter: none;
}

.progressLoaders.isCentre .progressLoaderStrip {
  opacity: 1;
  animation-duration: 3.2s;
}

.progressLoaders.isCentre .progressLoaderStrip::after {
  background: radial-gradient(circle at 50% 50%, transparent 38%, rgba(12, 10, 9, 0.85) 72%);
}

.progressLoaders.isCentre .progressLoaderRing circle {
  stroke-width: 5;
}

.progressLoaders.isCentre .progressLoaderRing .track {
  stroke: rgba(254, 243, 199, 0.16);
}

.progressLoaders.isCentre .progressLoaderRing .value {
  transition: stroke-dasharray 0.2s linear;
}

.progressLoaders.isCentre .progressLoaderText {
  justify-items: center;
  text-shadow: none;
}

.progressLoaders.isCentre .progressLoaderPercent {
  color: #fef3c7;
  font: 700 20px/1 ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.progressLoaders.isCentre .progressLoaderCaption {
  display: none;
}

.progressLoaders.isCentre:has(.progressLoader:not([hidden]) ~ .progressLoader:not([hidden])) .progressLoaderCaption {
  display: block;
  max-width: 150px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .progressLoaderStrip { animation-duration: 12s; }
  .progressLoaders.isCentre .progressLoaderStrip { animation-duration: 12s; }
  .progressLoader { animation: none; transition: opacity 0.3s ease; }
  .progressLoader.isDone { transform: none; }
}

/* ---------- the station navigator, bottom centre: a frosted pill, the arrows bare inside it ----------
   The pill keeps the arrows and "5 / 31" readable on white walls, where the bare light arrows faded. */

#panoramaStepper {
  position: absolute;
  bottom: 20px;
  left: 50%;
  z-index: 13;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--glass-line);
  border-radius: var(--r-pill);
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: var(--elev-2);
  transform: translateX(-50%);
}

#panoramaStepper[hidden] {
  display: none;
}

#panoramaStepper button {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: none;
  box-shadow: none;
  color: var(--text);
  cursor: pointer;
}

#panoramaStepper svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.12s ease;
}

/* Hover: the accent and a nudge the way it goes (no fill: the arrow stays bare). */
#panoramaStepper button:hover:not(:disabled) {
  border-color: transparent;
  color: var(--primary-strong);
  background: none;
}

#panoramaPrevBtn:hover svg { transform: translateX(-2px); }
#panoramaNextBtn:hover svg { transform: translateX(2px); }

#panoramaStepper button:active:not(:disabled) {
  background: none;
  transform: scale(0.94);
}

/* Which station, of how many. */
.stepWhere {
  display: grid;
  justify-items: center;
  min-width: 7.5em;
  padding: 0 var(--sp-2);
  line-height: 1.2;
}

.stationName {
  max-width: 14em;
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stationName:empty {
  display: none;
}

#panoramaStepLabel {
  color: var(--text-muted);
  font: 500 12px/1.3 var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.stationName:empty + #panoramaStepLabel {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

/* ---------- screen sizes ---------- */

html,
body {
  height: 100dvh;   /* the visible height on phones, without the browser bars */
}

.sidebar {
  height: 100dvh;
}

/* The drawer's switch: a frosted button; open, it sits on the drawer's top-right corner as a close icon. */
#sidebarToggle {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 30;
  display: none;
  place-items: center;
  width: var(--control-size);
  height: var(--control-size);
  min-height: 0;
  padding: 0;
  border: 1px solid var(--glass-line);
  border-radius: var(--r-md);
  color: var(--text);
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: var(--elev-2);
  font-size: 0;   /* the ☰ / ✕ the script writes stay for the accessible text; the icon is drawn */
}

#sidebarToggle::before {
  content: "";
  width: 22px;
  height: 22px;
  background: currentColor;
  -webkit-mask: var(--icon-menu) center / contain no-repeat;
  mask: var(--icon-menu) center / contain no-repeat;
}

#sidebarToggle[aria-expanded="true"]::before {
  -webkit-mask-image: var(--icon-close);
  mask-image: var(--icon-close);
}

#sidebarToggle:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

#sidebarBackdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: none;
  background: var(--scrim);   /* no blur: a full-screen blur makes the drawer lag on slow phones */
}

/* Under the open drawer's scrim the glass needs no blur: none of it shows, and it would slow the slide. */
body.sidebarOpen .toolRail::before,
body.sidebarOpen #panoramaStepper,
body.sidebarOpen #tourPip,
body.sidebarOpen .topBar,
body.sidebarOpen .measureCard {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* Floor-plan PIP: drag it by its header; zoom pops out on hover or tap. */
#tourPip .tourPipHeader {
  cursor: move;
  touch-action: none;
  user-select: none;
}

#tourPip.isDragging {
  opacity: 0.94;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.6);
}

.tourPipZoom {
  position: absolute;
  z-index: 1;
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-2);          /* also bridges the gap, so hover is not lost */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.tourPipZoom button {
  width: max(var(--hit-sm), calc(var(--control-size) * 0.8));
  height: max(var(--hit-sm), calc(var(--control-size) * 0.8));
  min-height: 0;
  padding: 0;
  border: 1px solid var(--glass-line);
  border-radius: 50%;
  color: var(--text);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: var(--elev-2);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.tourPipZoom button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-strong);
  background: var(--glass-strong);
}

@media (hover: hover) {
  #tourPip:hover .tourPipZoom {
    opacity: 1;
    pointer-events: auto;
  }
}

#tourPip.showZoom .tourPipZoom {
  opacity: 1;
  pointer-events: auto;
}

#tourPip.zoom-right .tourPipZoom { left: 100%; top: 50%; flex-direction: column; transform: translateY(-50%); }
#tourPip.zoom-left .tourPipZoom { right: 100%; top: 50%; flex-direction: column; transform: translateY(-50%); }
#tourPip.zoom-up .tourPipZoom { bottom: 100%; left: 50%; transform: translateX(-50%); }
#tourPip.zoom-down .tourPipZoom { top: 100%; left: 50%; transform: translateX(-50%); }

/* Tablets and phones: the review page's controls become a drawer over a full-width view. */
@media (max-width: 900px) {
  :root {
    --sidebar-half-width: 0px;
  }

  body {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: min(85vw, 400px);
    min-width: 0;
    max-width: none;
    border-right: 1px solid var(--border);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: var(--drawer-shadow);
  }

  body.sidebarOpen .sidebar {
    transform: none;
  }

  #sidebarToggle {
    display: grid;
  }

  body.sidebarOpen #sidebarToggle {
    left: calc(min(85vw, 400px) - var(--control-size) - 12px);
    z-index: 45;
    border-color: var(--border-strong);
    background: var(--surface-alt);
    box-shadow: none;
  }

  .sidebar header {
    padding-right: calc(var(--control-size) + 20px);
  }

  #sidebarBackdrop:not([hidden]) {
    display: block;
  }

  /* Clear of the menu button until the user moves it. */
  #tourPip {
    top: auto;
    bottom: 12px;
    left: 12px;
  }

  /* The PIP has the bottom-left corner here: the corner's lenses sit just right of it, still clear of the
     stepper in the middle. */
  .progressLoaders:not(.isCentre) {
    left: 12px;
  }

  body:has(#tourPip:not([hidden])) .progressLoaders:not(.isCentre) {
    left: calc(var(--pip-width) + 24px);
    max-width: max(56px, calc(50% - var(--pip-width) - 124px));
  }

  /* Between the plan and the navigator there is no room for a lens: still beside the plan, over the navigator's
     height (tablet, phone on its side). */
  body:has(#panoramaStepper:not([hidden])) .progressLoaders:not(.isCentre) {
    bottom: 80px;
    max-width: max(56px, calc(100% - var(--pip-width) - 120px));   /* its caption ends before the tools */
  }

  /* A ruler on: over the measuring card (phones: below, where the plan steps aside). */
  body:has(#panoramaOverlayControls:not([hidden]) #panoramaMeasureBtn[aria-pressed="true"]) .progressLoaders:not(.isCentre),
  body:has(#measureBtn[aria-pressed="true"]) .progressLoaders:not(.isCentre) {
    bottom: 260px;
  }
}

/* Phones: smaller PIP. */
@media (max-width: 600px), (max-height: 500px) {
  :root {
    --pip-width: min(62vw, 250px);
    --panel-width: min(56vw, 210px);
  }

  #tourPip {
    padding: 6px;
    border-radius: var(--r-md);
  }

  #tourPip .tourPipHeader {
    padding-bottom: 6px;
  }

  #tourPip .tourPipHeader strong {
    font-size: var(--fs-xs);
  }

  .tourPipActions select {
    max-width: 108px;
  }

  .toolRail {
    right: 10px;
  }

  #tourPipInfo {
    display: none;   /* station/plan detail stays in the drawer */
  }
}

/* Phones: the navigator is a bar along the bottom; the plan, the corner's lenses and the accessibility button
   (it covered "next") sit above it, the measuring card too. Moved by hand, the accessibility button stays put. */
@media (max-width: 600px) {
  #panoramaStepper {
    right: 10px;
    bottom: 10px;
    left: 10px;
    justify-content: space-between;
    border-radius: 18px;
    transform: none;
  }

  body:has(#panoramaStepper:not([hidden])) #tourPip {
    bottom: 80px;
  }

  /* Beside the plan, over the accessibility button's row (the two share it on a phone under 390 px). */
  body:has(#panoramaStepper:not([hidden])) .progressLoaders:not(.isCentre) {
    bottom: 142px;
    max-width: max(56px, calc(100% - var(--pip-width) - 48px));
  }

  body:has(#panoramaStepper:not([hidden])) .a11y-float:not(.is-placed) {
    inset-block-end: calc(max(10px, env(safe-area-inset-bottom)) + 70px);
  }

  .measureCard {
    left: 10px;
    right: 10px;
    bottom: 80px;
    flex-wrap: wrap;
    gap: var(--sp-3);
    width: auto;
    max-width: none;
    padding: var(--sp-3);
    transform: none;
  }

  /* First row: the icon and what the ruler says; second row: units and Done. */
  .panoramaMeasurePanel,
  #pointsMeasureCard .measureBody {
    flex: 1 1 calc(100% - 56px);
    min-width: 0;
    max-width: none;
  }

  .unitSwitch,
  #pointsMeasureCard #clearMeasureBtn {
    margin-inline-start: auto;
  }

  body:has(#panoramaStepper[hidden]) .measureCard {
    bottom: 10px;
  }

  /* Measuring: the plan steps aside, the accessibility button waits above the card. */
  body:has(#panoramaOverlayControls:not([hidden]) #panoramaMeasureBtn[aria-pressed="true"]) #tourPip,
  body:has(#measureBtn[aria-pressed="true"]) #tourPip {
    visibility: hidden;
  }

  body:has(#panoramaOverlayControls:not([hidden]) #panoramaMeasureBtn[aria-pressed="true"]) .a11y-float:not(.is-placed),
  body:has(#measureBtn[aria-pressed="true"]) .a11y-float:not(.is-placed) {
    inset-block-end: 300px;
  }

  /* So do the corner's lenses, on the other side (the plan they sat beside has stepped aside). */
  body:has(#panoramaOverlayControls:not([hidden]) #panoramaMeasureBtn[aria-pressed="true"]) .progressLoaders:not(.isCentre),
  body:has(#measureBtn[aria-pressed="true"]) .progressLoaders:not(.isCentre) {
    left: 12px;
    bottom: 300px;
    max-width: calc(100% - 100px);
  }
}

@media (forced-colors: active) {
  #sidebarToggle {
    font-size: 20px;
  }

  #sidebarToggle::before {
    display: none;
  }
}

/* ---------- the customer page's shell (viewer_shell.mjs): a full-width view, a top bar, and the scans as a card
   (nothing open) or a panel that slides in from the left (a scan open) ---------- */

body:not(.reviewMode) {
  grid-template-columns: minmax(0, 1fr);
}

body.customerMode {
  --pip-top: 92px;
  --rail-top: 92px;
}

.topBar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: 60px;
  padding: 0 8px;
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  color: var(--text);
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: var(--elev-2);
}

/* The open scan: its name; pressing it shows your scans. */
.scanButton {
  flex: 0 1 auto;
  justify-content: flex-start;
  gap: var(--sp-3);
  width: auto;
  max-width: 42%;
  height: 46px;
  min-height: 0;
  padding-block: 0;
  padding-inline: 6px var(--sp-3);
  border: 0;
  border-radius: 12px;
  color: var(--text);
  background: none;
  font-weight: 400;
  text-align: start;
}

.scanButton:hover:not(:disabled),
.scanButton[aria-expanded="true"] {
  border-color: transparent;
  background: var(--hover);
}

.scanButton .brandMark {
  width: 32px;
  height: 32px;
}

.scanText {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

#scanName,
.scanSub {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#scanName {
  font-size: 0.9375rem;
  font-weight: 600;
}

.scanSub {
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

.scanButton .chevron {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.7;
  transition: transform var(--ease);
}

.scanButton[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

/* Panoramas | Points: a pill, the chosen side filled with the accent. */
.topBar .segmented.modeSwitch {
  flex: none;
  margin-inline: auto;
  gap: 2px;
  padding: 4px;
  border-color: var(--glass-line);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--bg) 40%, transparent);
}

.topBar .modeSwitch > button[aria-pressed] {
  gap: var(--sp-2);
  width: auto;
  min-height: max(36px, var(--hit-sm));   /* 44 px on touch */
  padding: 0 var(--sp-4);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
}

.topBar .modeSwitch > button[aria-pressed="true"],
.topBar .modeSwitch > button[aria-pressed="true"]:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-contrast);
  background: var(--primary);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 35%, transparent);
}

.modeSwitch svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modeSwitch svg .fill {
  fill: currentColor;
  stroke: none;
}

/* The other features, as quiet links on the right (this page's own is the page). */
.topBar .featureBar ul {
  display: flex;
  gap: 2px;
}

.topBar .featureBar li:has(.feature-current) {
  display: none;
}

.topBar .featureBar .feature {
  width: auto;
  min-height: 40px;
  padding: 0 var(--sp-3);
  border-color: transparent;
  border-radius: 12px;
  background: none;
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.topBar .featureBar a.feature:hover,
.topBar .featureBar button.feature-here:hover {
  border-color: transparent;
  color: var(--text);
  background: var(--hover);
}

.topBar .featureBar .feature-locked {
  border: 1px dashed var(--glass-line);
  color: var(--text-muted);
}

.topBar .viewSwitch {
  flex: none;
}

/* A locked feature's note: under the top bar, over the view and the panel. */
#featureNote {
  position: absolute;
  top: 84px;
  right: 16px;
  z-index: 41;
  width: min(380px, calc(100% - 32px));
  box-shadow: var(--elev-3);
}

/* A long wait that stopped moving (stall_notice.mjs): under the top bar, in the middle; the view stays in use. */
.stallNotice {
  position: absolute;
  top: 84px;
  left: 50%;
  z-index: 45;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--warning);
  border-radius: var(--r-lg);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--elev-3);
  transform: translateX(-50%);
}

.stallText {
  margin: 0;
  font-size: var(--fs-md);
}

.stallActions {
  display: flex;
  gap: var(--sp-2);
  margin-inline-start: auto;
}

.stallActions button {
  white-space: nowrap;
}

body.reviewMode .stallNotice {
  top: 16px;
}

:root[dir="rtl"] .stallNotice {
  transform: translateX(50%);
  left: auto;
  right: 50%;
}

/* The scans: a card or a panel of the page's frosted surface. */
body.customerMode .sidebar {
  position: fixed;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
  max-width: none;
  padding: var(--sp-5);
  overflow-y: auto;
  border: 1px solid var(--glass-line);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: var(--elev-3);
}

body.customerMode .sidebar > header {
  display: contents;
}

/* The page's heading stays for screen readers; the top bar shows the name. */
body.customerMode .sidebar .brand {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

body.customerMode .sidebar > section {
  display: grid;
  gap: var(--sp-3);
  padding: 0;
  border: 0;
}

body.customerMode .sidebar > section + section {
  padding-top: var(--sp-5);
  border-top: 1px solid var(--glass-line);
}

body.customerMode #customerNotice {
  order: -2;
}

/* Narrow screens: the feature links, after your scans. */
.featureSlot {
  order: 5;
}

.featureSlot:empty {
  display: none;
}

/* What the viewer says: a quiet line at the foot. */
body.customerMode #status {
  order: 10;
  height: auto;
  min-height: 0;
  padding: 0;
  padding-inline-start: var(--sp-3);
  border: 0;
  border-inline-start: 2px solid var(--primary);
  border-radius: 0;
  color: var(--text-muted);
  background: none;
  font-size: var(--fs-xs);
}

body.customerMode #fileSelect,
body.customerMode #loadBtn {
  display: none;
}

body.customerMode .uploadLabel {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

body.customerMode #openSection h2 {
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-transform: none;
}

.sectionHint {
  margin: -6px 0 2px;
  color: var(--text-muted);
  font-size: var(--fs-md);
}

/* Nothing open: the card in the middle of an empty, quiet view. */
body.customerMode:not(.hasScan) .sidebar {
  top: 50%;
  left: 50%;
  bottom: auto;
  width: min(560px, calc(100vw - 24px));
  height: auto;
  max-height: calc(100dvh - 176px);   /* centred, it stays clear of the top bar and the screen's foot */
  padding: 28px;
  border-radius: 24px;
  transform: translate(-50%, -50%);
  transition: none;
}

body.customerMode:not(.hasScan) .sidebar > section:not(#openSection) {
  display: none;
}

/* Opening: the card gives way to the loader in the middle. */
body:has(.progressLoaders.isCentre .progressLoader:not([hidden]):not(.isDone)).customerMode:not(.hasScan) .sidebar {
  display: none;
}

body.customerMode:not(.hasScan) #canvas {
  visibility: hidden;
}

body.customerMode:not(.hasScan) #viewer {
  background: radial-gradient(1200px 640px at 50% 32%, color-mix(in srgb, var(--primary) 9%, var(--bg-alt)) 0%, var(--bg-alt) 55%, var(--bg) 100%);
}

body.customerMode:not(.hasScan) #viewer::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image: radial-gradient(color-mix(in srgb, var(--primary) 45%, transparent) 1px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(820px 440px at 50% 46%, #000 0%, transparent 75%);
  mask-image: radial-gradient(820px 440px at 50% 46%, #000 0%, transparent 75%);
}

/* A scan open: the panel slides in from the left over the view. */
body.customerMode.hasScan .sidebar {
  top: 0;
  bottom: 0;
  left: 0;
  width: min(400px, 88vw);
  height: 100dvh;
  border-width: 0 1px 0 0;
  border-radius: 0 20px 20px 0;
  -webkit-backdrop-filter: none;   /* nearly opaque: a blur would not show, and it costs every frame on phones */
  backdrop-filter: none;
  box-shadow: var(--drawer-shadow);
  visibility: hidden;   /* closed: out of the tab order too, once it has slid away */
  transform: translateX(-105%);
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
}

body.customerMode.hasScan.sidebarOpen .sidebar {
  visibility: visible;
  transform: none;
  transition: transform 0.25s ease;
}

body.customerMode.hasScan #openSection h2,
body.customerMode.hasScan #openSection .sectionHint {
  padding-inline-end: calc(var(--control-size) + 8px);   /* clear of the close button */
}

body.customerMode #sidebarToggle {
  display: none;
}

body.customerMode.hasScan.sidebarOpen #sidebarToggle {
  top: 16px;
  left: calc(min(400px, 88vw) - var(--control-size) - 16px);
  z-index: 45;
  display: grid;
  border-color: var(--border-strong);
  background: var(--surface-alt);
  box-shadow: none;
}

body.customerMode.hasScan #sidebarBackdrop:not([hidden]) {
  display: block;
}

/* Your scans: one row each, one press opens it. */
.scanList {
  display: grid;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.scanList .scanRow {
  justify-content: flex-start;
  gap: var(--sp-3);
  min-height: 64px;
  padding-block: var(--sp-3);
  padding-inline: var(--sp-3) var(--sp-4);
  border: 1px solid var(--glass-line);
  border-radius: 14px;
  color: var(--text);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  font-weight: 400;
  text-align: start;
}

.scanList .scanRow:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--primary) 60%, transparent);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.scanList .scanRow[aria-current="true"] {
  border-color: var(--primary);
  background: var(--accent-soft);
}

/* The one on screen says so. */
.scanList .scanRow[aria-current="true"]::after {
  content: "On screen";
  flex: none;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  color: var(--primary-contrast);
  background: var(--primary);
  font-size: 11px;
  font-weight: 700;
}

.scanList .scanRow[aria-current="true"] .scanGo {
  display: none;
}

.scanIcon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: var(--primary-strong);
  background: color-mix(in srgb, var(--primary) 16%, transparent);
}

.scanIcon svg,
.scanGo,
.dropText svg {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scanMeta {
  flex: 1;
  min-width: 0;
  display: grid;
  line-height: 1.3;
}

/* Name and size sit at the page's start (right in Hebrew) whatever their own direction: a Latin name and a size
   ("32.6 MB", kept left to right) on a Hebrew page. */
.scanMeta > * {
  justify-self: start;
  max-width: 100%;
}

.scanRowName {
  overflow: hidden;
  font-size: var(--fs-md);
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.scanRowSize {
  direction: ltr;
  unicode-bidi: isolate;
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

.scanGo {
  color: var(--text-muted);
}

.scanEmpty {
  padding: var(--sp-4);
  border: 1px dashed var(--glass-line);
  border-radius: 14px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  text-align: center;
}

/* Upload: a dashed area; the file chooser covers it, so a click browses and a dropped file is taken. */
body.customerMode .dropZone {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: var(--sp-3);
  border: 1.5px dashed var(--border-strong);
  border-radius: 14px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  text-align: center;
  transition: border-color var(--ease), background-color var(--ease), color var(--ease);
}

body.customerMode .dropZone:hover,
body.customerMode .dropZone:focus-within {
  border-color: var(--primary);
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

body.customerMode .dropZone:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.dropText {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

.dropText b {
  color: var(--primary-strong);
  font-weight: 600;
}

body.customerMode .dropZone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

body.customerMode .dropZone input[type="file"]:focus-visible {
  outline: none;
}

/* A file dragged over the page: the drop area glows; over the area itself, it lights up. */
body.customerMode.draggingFile .dropZone {
  border-color: var(--primary);
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

body.customerMode .dropZone.isDragOver {
  border-style: solid;
  border-color: var(--primary);
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 20%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 25%, transparent);
}

body.customerMode .dropZone.isDragOver .dropText svg {
  color: var(--primary-strong);
  transform: translateY(-2px);
}

/* A job without the viewer (its notice says why): nothing to open or drop. */
body.customerMode .dropZone:has(input:disabled) {
  opacity: 0.45;
  pointer-events: none;
}

#openSection:has(#uploadFile:disabled) .scanEmpty {
  display: none;
}

/* Middle widths: the feature links as icons. */
@media (max-width: 1180px) {
  .topBar .featureBar .featureLabel {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .topBar .featureBar .feature {
    padding: 0 10px;
  }

  .topBar .featureBar .feature::after {
    display: none;
  }
}

/* Phones: a compact bar, the view's names as icons; the feature links live in the panel. */
@media (max-width: 600px) {
  body.customerMode {
    --rail-top: 76px;
  }

  .topBar {
    top: 10px;
    left: 10px;
    right: 10px;
    height: 56px;
    gap: 6px;
    padding: 0 6px;
    border-radius: 16px;
  }

  .scanButton {
    flex: 1;
    max-width: none;
    gap: var(--sp-2);
  }

  .topBar .segmented.modeSwitch {
    margin: 0;
  }

  .topBar .modeSwitch > button[aria-pressed] {
    padding: 0 12px;
  }

  .modeLabel {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /* Your own computer's preview link: an icon. */
  .topBar .viewSwitch {
    justify-content: center;
    width: 44px;
    min-height: 44px;
    padding: 0;
    font-size: 0;
  }

  #featureNote {
    top: 74px;
    left: 10px;
    right: 10px;
    width: auto;
  }

  body.customerMode:not(.hasScan) .sidebar {
    max-height: calc(100dvh - 148px);
    padding: 20px;
    border-radius: 20px;
  }

  body.customerMode #openSection h2 {
    font-size: 1.3rem;
  }
}

/* ---------- page modes (session.mjs, /api/session) ----------
   review: the full debug and review viewer, on your own computer only. customer: the clean viewer. Until the
   server has answered, neither: the debug parts stay hidden, so a customer never sees them flash by. */
body:not(.reviewMode) .debugOnly,
body:not(.reviewMode) .reviewOnly,
body:not(.customerMode) .customerOnly {
  display: none !important;
}

body:not(.reviewMode):not(.customerMode) .sidebar > section {
  visibility: hidden;
}

/* Your own computer only: the link between the review viewer and the customer preview (?view=). */
.viewSwitch {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--hit-sm);
  padding: 0 var(--sp-3);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-pill);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-decoration: none;
}

.viewSwitch::after {
  content: "";
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: var(--icon-out) center / contain no-repeat;
  mask: var(--icon-out) center / contain no-repeat;
}

.viewSwitch:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

.viewSwitch[hidden] {
  display: none;
}

/* ---------- the feature bar (customer_ui.mjs): the four features, two by two ---------- */
.featureBar ul {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.featureBar .feature {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  min-height: var(--hit);
  margin: 0;
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text);
  background: var(--surface-alt);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.25;
  text-align: start;
  text-decoration: none;
}

.featureBar .feature svg {
  flex: none;
  width: 20px;
  height: 20px;
}

.featureBar .featureLabel {
  flex: 1;
  min-width: 0;
}

.featureBar a.feature:hover,
.featureBar button.feature-here:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
  background: color-mix(in srgb, var(--text) 8%, var(--surface-alt));
}

/* The website's job page: a small arrow says it leaves this page. */
.featureBar a.feature::after {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  background: currentColor;
  opacity: 0.6;
  -webkit-mask: var(--icon-out) center / contain no-repeat;
  mask: var(--icon-out) center / contain no-repeat;
}

/* This page. */
.featureBar .feature-current {
  border-color: var(--primary);
  color: var(--primary-strong);
  background: var(--accent-soft);
}

/* A feature the job lacks: grayed out with a lock, not a working control (its note says how to unlock it). */
.featureBar .feature-locked {
  color: var(--text-muted);
  background: transparent;
  border-style: dashed;
  cursor: help;
}

.featureBar .feature-locked svg {
  opacity: 0.6;
}

.featureBar .feature-locked::after {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: var(--icon-lock) center / contain no-repeat;
  mask: var(--icon-lock) center / contain no-repeat;
}

.featureBar .feature-locked:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.featureNote,
.customerNotice {
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--primary);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--text);
  background: var(--bg-alt);
}

.customerNotice {
  border-inline-start-color: var(--warning);
  background: var(--warning-soft);
}

.featureNote a,
.customerNotice a {
  color: var(--primary-strong);
  font-weight: 600;
}

.visuallyHidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- the website's accessibility panel on the viewer page (site/a11y.css styles it) ---------- */
.siteA11y {
  display: contents;
}

/* The website's focus ring (its main.css has it for every page; site/a11y.css carries only the panel's rules). */
.siteA11y :focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.siteA11y .a11y-panel {
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--line);
}

.siteA11y .a11y-panel input[type="checkbox"],
.siteA11y .a11y-panel input[type="radio"] {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: .2rem;
  accent-color: var(--primary);
}

/* The panel's other settings on the viewer's own controls: text size and readable font follow from the rem
   type scale and --font-body; the light and high-contrast themes from the tokens. Wider spacing: */
:root[data-spacing] .sidebar {
  line-height: 2;
  letter-spacing: .09em;
  word-spacing: .18em;
}

/* ---------- a DWG / DXF drawing's layers (review page, app.js renderDrawingLayers) ---------- */
.drawingLayers {
  display: grid;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
  font-size: var(--fs-xs);
}

.drawingLayers .checkRow {
  min-height: 28px;
}

.drawingSwatch {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  margin: 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 2px;
}

/* ---------- Hebrew: the customer page right to left (user, 2026-11-26; viewer_i18n.mjs sets dir and lang) ----------
   Text, the top bar, cards and the panel mirror; the panorama, the floor plan's drawing and the arrow keys keep their
   geometry. The tools take the left, the floor plan and the corner's lenses the right (the accessibility button
   keeps the page's inline end: the left). Arrow-like icons point the reading way. */
:root[dir="rtl"] .toolRail {
  right: auto;
  left: 16px;
}

:root[dir="rtl"] .panoramaToolPop {
  right: auto;
  left: 100%;
  transform: translate(-8px, -50%);
}

@media (hover: hover) {
  :root[dir="rtl"] .panoramaTool:hover .panoramaToolPop {
    transform: translate(0, -50%);
  }
}

:root[dir="rtl"] .panoramaTool.open .panoramaToolPop {
  transform: translate(0, -50%);
}

:root[dir="rtl"] .panoramaImageAdjustments::before {
  inset: -12px -16px -12px 16px;
}

:root[dir="rtl"] #tourPip {
  left: auto;
  right: 16px;
}

:root[dir="rtl"] #featureNote {
  right: auto;
  left: 16px;
}

:root[dir="rtl"] .progressLoaders:not(.isCentre) {
  left: auto;
  right: 20px;
  align-items: flex-end;
}

/* The scans panel slides in from the right; its close button on its left corner. */
:root[dir="rtl"] body.customerMode.hasScan .sidebar {
  left: auto;
  right: 0;
  border-width: 0 0 0 1px;
  border-radius: 20px 0 0 20px;
  transform: translateX(105%);
}

:root[dir="rtl"] body.customerMode.hasScan.sidebarOpen .sidebar {
  transform: none;
}

:root[dir="rtl"] body.customerMode.hasScan.sidebarOpen #sidebarToggle {
  left: auto;
  right: calc(min(400px, 88vw) - var(--control-size) - 16px);
}

:root[dir="rtl"] .scanGo,
:root[dir="rtl"] #panoramaStepper svg {
  scale: -1 1;
}

:root[dir="rtl"] .featureBar a.feature::after,
:root[dir="rtl"] .viewSwitch::after {
  scale: -1 1;
}

/* Hebrew has no capitals: no letter spacing on the overlines. The row on screen says so in Hebrew. */
:root[lang="he"] :is(h2, .panelLabel, .brandName, #panoramaStepLabel) {
  letter-spacing: normal;
}

:root[lang="he"] .scanList .scanRow[aria-current="true"]::after {
  content: "מוצגת";
}

@media (max-width: 900px) {
  :root[dir="rtl"] #tourPip {
    left: auto;
    right: 12px;
  }

  :root[dir="rtl"] .progressLoaders:not(.isCentre) {
    left: auto;
    right: 12px;
  }

  :root[dir="rtl"] body:has(#tourPip:not([hidden])) .progressLoaders:not(.isCentre) {
    left: auto;
    right: calc(var(--pip-width) + 24px);
  }
}

@media (max-width: 600px), (max-height: 500px) {
  :root[dir="rtl"] .toolRail {
    right: auto;
    left: 10px;
  }
}

@media (max-width: 600px) {
  :root[dir="rtl"] body:has(#panoramaOverlayControls:not([hidden]) #panoramaMeasureBtn[aria-pressed="true"]) .progressLoaders:not(.isCentre),
  :root[dir="rtl"] body:has(#measureBtn[aria-pressed="true"]) .progressLoaders:not(.isCentre) {
    left: auto;
    right: 12px;
  }
}

@media (max-width: 600px) {
  :root[dir="rtl"] #featureNote {
    left: 10px;
    right: 10px;
  }
}

/* A staff-only server opened without its private link (session.mjs showLocked): one plain line. */
.lockedNotice {
  display: grid;
  place-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 16px;
  color: var(--text);
  background: var(--surface);
  font: 500 1rem/1.5 system-ui, sans-serif;
  text-align: center;
}
