/* Medirion Design System (submodule DesignSystem/, pinned tag) is the only source of
   colours, type, radii and fonts. This file maps portal markup onto it. */
@import url("/static/design-system/tokens.css");
@import url("/static/design-system/components/bundle.css");
:root {
  --muted: var(--ink-muted);
  /* Shapes per BRAND.md §4: pills for controls/tags/nav, radius-sm for fields, radius-lg for cards. */
  --radius-control: var(--radius-pill);
  --radius-field: var(--radius-sm);
  --radius-inner: var(--radius-sm);
  --radius-tag: var(--radius-pill);
  --radius-card: var(--radius-lg);
  --radius-card-lg: var(--radius-lg);
  --paper: var(--bg);
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
body {
  /* bundle.css pads <body> for its preview pages; the portal lays out its own chrome. */
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: normal;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--ink);
  padding: 10px 13px;
  text-decoration: none;
  font-weight: 550;
}
button:hover,
.button:hover {
  border-color: var(--teal);
  background: var(--hover-bg);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.primary {
  background: var(--turquoise);
  color: var(--on-turquoise);
  border-color: transparent;
}
.primary:hover {
  background: var(--turquoise-pressed);
  color: var(--on-turquoise);
}
a {
  color: var(--teal);
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-control);
  background: var(--field);
  border-radius: var(--radius-field);
  min-height: 41px;
  padding: 9px;
  color: var(--ink);
}
label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 32px;
  letter-spacing: -1px;
  font-weight: 550;
}
h2 {
  font-size: 24px;
  font-weight: 550;
  letter-spacing: -0.5px;
}
h3 {
  font-size: 16px;
  margin: 0;
  font-weight: 600;
}
p {
  line-height: 1.6;
  color: var(--muted);
}
.eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 1.8px;
  color: var(--teal);
  margin-bottom: 12px;
}
.help {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
.logo {
  width: 145px;
  object-fit: contain;
}
.topbar {
  background: var(--chrome-bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 19px 3vw;
  gap: 20px;
}
.brand {
  display: flex;
  gap: 26px;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
}
.brand > span {
  border-left: 1px solid var(--line);
  padding-left: 24px;
  font-size: 15px;
  font-weight: 600;
}
.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 2px;
  margin-top: 6px;
  color: var(--muted);
}
nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 12px;
}
.role,
.tag {
  font-size: 11px;
  border-radius: 5px;
  padding: 7px 10px;
  background: var(--mint);
  color: var(--teal);
  white-space: nowrap;
}
.tag.warn {
  background: var(--cream);
  color: var(--ink);
}
.portal {
  max-width: 1560px;
  margin: auto;
  padding: 38px 3vw;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.page-heading h1 {
  margin-bottom: 10px;
}
.page-heading p {
  margin-bottom: 0;
}
.metric {
  font-size: 13px;
  color: var(--muted);
}
.filters {
  display: flex;
  gap: 16px;
  align-items: end;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.filters > label {
  flex: 1;
}
.filters .record-filter {
  flex: 1.8;
}
.record-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 28px 0 20px;
}
.record-heading h2 {
  margin: 5px 0 8px;
}
.record-heading p {
  font-size: 12px;
  margin: 0;
}
.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(340px, 1fr);
  gap: 24px;
}
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.panel-title .eyebrow {
  margin-bottom: 6px;
}
.segmented {
  display: flex;
  background: var(--paper);
  border-radius: 8px;
  padding: 3px;
}
.segmented button {
  border: 0;
  background: transparent;
  padding: 7px 12px;
  font-size: 12px;
}
.segmented .active {
  background: var(--turquoise);
  color: var(--on-turquoise);
}
.image-stage {
  position: relative;
  background: var(--stage-bg);
  aspect-ratio: 4/3;
  border-radius: 8px;
  overflow: hidden;
  touch-action: none;
}
.stage-content > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.marker {
  /* Plain white cross; the hit area stays finger-sized. */
  position: absolute;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  filter: drop-shadow(0 0 1px #000) drop-shadow(0 0 2px #000a);
}
.marker::before,
.marker::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}
.marker::before { width: 14px; height: 2px; }
.marker::after { width: 2px; height: 14px; }
.marker:hover, .marker:hover:not(:disabled) { background: transparent; color: #fff; }
.marker.selected, .marker.selected:hover:not(:disabled) { color: var(--turquoise); }
.marker.template { opacity: .7; }
.marker:active { cursor: grabbing; }
/* Labels on the thermal image use scrim-dark (BRAND.md §2: text on images only over a scrim). */
.marker span {
  position: absolute; left: 17px; top: 50%; transform: translateY(-50%);
  padding: 1px 4px; border-radius: 3px; background: var(--scrim-dark); color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: .3px; line-height: 1.3; white-space: nowrap; pointer-events: none;
}
.marker.selected span { color: var(--turquoise); }
.image-label,
.image-unit {
  position: absolute;
  top: 14px;
  background: var(--scrim-dark);
  color: #fff;
  padding: 6px 9px;
  border-radius: 5px;
  font-size: 10px;
  letter-spacing: 1px;
  pointer-events: none;
}
.image-label {
  left: 14px;
}
.image-unit {
  right: 14px;
}
.player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
}
.player input {
  padding: 0;
  min-height: 20px;
  accent-color: var(--teal);
}
.player select {
  width: 70px;
}
.frame-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  gap: 12px;
  margin: 12px 0 18px;
}
.temperature {
  display: flex;
  align-items: center;
  gap: 5px;
}
.temperature input {
  width: 56px;
  min-height: 28px;
  font-size: 11px;
  padding: 5px;
}
.gradient {
  width: 60px;
  height: 7px;
  border-radius: 5px;
  background: linear-gradient(
    90deg,
    #000004,
    #6a176e,
    #dc503b,
    #fca50a,
    #fcffa4
  );
}
.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.viewer-actions button {
  font-size: 12px;
}
.viewer-actions .help {
  flex-basis: 100%;
  margin-top: 5px;
}
.full-tools {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 16px;
}
.full-tools .button,
.full-tools button {
  font-size: 11px;
  padding: 7px;
  margin: 3px;
}
.rgb-panel img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: var(--surface);
  border-radius: 8px;
}
.rgb-panel select {
  width: auto;
}
.rgb-panel .help {
  margin: 12px 0 0;
}
.metadata summary {
  cursor: pointer;
  font-weight: 600;
}
.metadata pre,
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.6;
  max-height: 300px;
  overflow: auto;
}
.annotation-panel > p {
  margin-bottom: 20px;
}
.annotation-list {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
}
.annotation-item {
  text-align: left;
  justify-content: space-between;
  width: 100%;
  font-size: 12px;
}
.annotation-item.selected {
  background: var(--mint);
  border-color: var(--teal);
}
.annotation-item small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 4px;
}
.annotation-empty {
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 30px 20px;
  font-size: 13px;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
}
.annotation-panel form {
  display: grid;
  gap: 16px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.checkbox {
  flex-direction: row;
  align-items: center;
  font-size: 11px;
  font-weight: 400;
}
.checkbox input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--teal);
}
.editor-heading {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}
.editor-heading button {
  padding: 5px 8px;
  border: 0;
  font-size: 11px;
}
.score-box {
  background: var(--mint);
  padding: 13px;
  border-radius: 8px;
}
.score-box .eyebrow {
  font-size: 8px;
  letter-spacing: 1px;
}
.save-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.save-actions button {
  flex: 1;
  font-size: 11px;
}
.research-note {
  padding: 8px 20px;
  color: var(--muted);
}
.research-note p {
  font-size: 13px;
  margin: 0 0 10px;
}
.research-note small {
  font-size: 11px;
  line-height: 1.7;
  display: block;
}
.notice {
  padding: 12px 16px;
  margin: 16px 0;
  border: 1px solid var(--line-brand);
  background: var(--mint);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
}
.notice.error {
  background: var(--cream);
  border-color: var(--critical);
  color: var(--critical-text);
}
.empty {
  text-align: center;
  padding: 100px 20px;
}
.empty h2 {
  margin-top: 20px;
}
footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding-top: 22px;
  font-size: 11px;
  color: var(--muted);
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--login-bg);
  padding: 35px;
}
.login-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  max-width: 1100px;
  width: 100%;
  min-height: 670px;
  background: var(--panel-bg);
  border-radius: var(--radius-card-lg);
  overflow: hidden;
}
.login-story {
  padding: 50px;
  background: var(--mint);
  position: relative;
  overflow: hidden;
}
.login-story > .logo {
  margin-bottom: 80px;
  width: 170px;
}
.login-story h1 {
  font-size: 43px;
  line-height: 1.17;
  letter-spacing: -1.6px;
}
.login-story p {
  max-width: 350px;
  font-size: 15px;
}
.login-story > small {
  position: absolute;
  bottom: 30px;
  font-size: 11px;
  color: var(--muted);
}
.story-art {
  display: flex;
  gap: 30px;
  position: relative;
  padding-top: 105px;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--accent-text);
}
/* Recording → finding → insight as a turquoise rule (BRAND.md §4: no decorative gradients). */
.story-art div {
  position: absolute;
  top: 60px;
  left: 0;
  width: 280px;
  height: 3px;
  background: var(--line-brand);
}
.login-card {
  padding: 100px 55px 45px;
  align-self: center;
}
.login-card h2 {
  font-size: 28px;
}
.login-card > p {
  font-size: 13px;
  margin-bottom: 28px;
}
.login-card form {
  display: grid;
  gap: 20px;
}
.login-card input {
  min-height: 48px;
}
.login-card .primary {
  justify-content: space-between;
  padding: 14px;
}
.login-card .help {
  margin: 25px 0 45px;
  font-size: 11px;
}
.login-foot {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  color: var(--muted);
  font-size: 10px;
}
@media (max-width: 1050px) {
  .topbar {
    flex-wrap: wrap;
  }
  .review-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr);
  }
  .filters {
    flex-wrap: wrap;
  }
  .filters > label {
    min-width: 180px;
  }
  .login-story {
    padding: 35px;
  }
  .login-card {
    padding: 60px 30px;
  }
  .login-story h1 {
    font-size: 35px;
  }
  nav {
    gap: 10px;
  }
}
@media (max-width: 760px) {
  .review-grid {
    grid-template-columns: 1fr;
  }
  .portal {
    padding: 24px 16px;
  }
  .page-heading {
    align-items: start;
    gap: 15px;
  }
  .page-heading h1 {
    font-size: 26px;
  }
  .metric {
    white-space: nowrap;
    font-size: 10px;
  }
  .topbar {
    padding: 16px;
  }
  nav {
    flex-wrap: wrap;
  }
  .brand .logo {
    width: 115px;
  }
  .role {
    font-size: 9px;
  }
  .login-layout {
    grid-template-columns: 1fr;
  }
  .login-page {
    padding: 15px;
  }
  .login-story {
    padding: 28px;
  }
  .login-story > .logo {
    margin-bottom: 30px;
  }
  .login-story h1 {
    font-size: 30px;
  }
  .login-story small,
  .story-art {
    display: none;
  }
  .login-card {
    padding: 35px 28px;
  }
  .frame-details {
    flex-wrap: wrap;
  }
  footer {
    gap: 20px;
  }
  .record-heading {
    gap: 12px;
  }
  .panel {
    padding: 15px;
  }
}

.brand .logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}
.brand {
  gap: 12px;
}
.brand > span {
  margin-left: 12px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 70px;
}
.login-brand .logo {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}
.login-brand strong {
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -1px;
}
@media (max-width: 760px) {
  .login-brand {
    margin-bottom: 30px;
  }
  .brand > span {
    padding-left: 12px;
    margin-left: 0;
  }
}

.history-entry {
  border-left: 2px solid var(--line);
  padding: 8px 12px;
  margin: 10px 0;
  font-size: 12px;
}
.history-entry p {
  font-size: 11px;
  margin: 7px 0 0;
}

/* Component mapping to Medirion Design System web components (bundle.css md-btn, md-input,
   md-seg, md-card, md-nav). Values only via tokens; dense viewer controls keep smaller sizes. */
body { -webkit-font-smoothing: antialiased; }
button, .button { min-height: var(--control-height); padding: 0 var(--space-4); border: 2px solid var(--line-control); border-radius: var(--radius-control); background: transparent; color: var(--ink); font-weight: 700; }
button:hover, .button:hover { border-color: var(--turquoise); background: var(--hover-bg); }
.primary { background: var(--turquoise); color: var(--on-turquoise); border-color: transparent; }
.primary:hover { background: var(--turquoise-pressed); color: var(--on-turquoise); border-color: transparent; }
button:disabled, button:disabled:hover { background: var(--disabled-fill); color: var(--disabled-ink); opacity: 1; border-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: 2px; }
a, .eyebrow { color: var(--accent-text); }
label { color: var(--ink); }
input, select, textarea { min-height: var(--control-height); border-radius: var(--radius-field); background: var(--field); border-color: var(--line-control); }
input[type=range] { min-height: 20px; }
h1 { font-size: 40px; line-height: 1.2; font-weight: 400; letter-spacing: 0; }
h2 { font-size: 26px; line-height: 1.4; font-weight: 700; letter-spacing: 0; }
h3 { font-size: 20px; line-height: 1.4; font-weight: 700; }
.panel, .filters { border-radius: var(--radius-card); }
.panel { box-shadow: none; }
.filters, .score-box { background: var(--surface); }
.score-box { border-radius: var(--radius-sm); }
.role, .tag { background: var(--mint); color: var(--ink); border-radius: var(--radius-tag); font-size: 12px; line-height: 1.3; font-weight: 600; padding: 6px 12px; }
.tag.warn { background: var(--cream); color: var(--ink); border: 2px solid var(--warning); }
.segmented { background: var(--field); border: 1px solid var(--line-control); border-radius: var(--radius-sm); padding: var(--space-1); gap: var(--space-1); }
.segmented button { border: 0; border-radius: 7px; min-height: 34px; padding: 0 var(--space-3); }
.segmented .active, .segmented .active:hover { background: var(--turquoise); color: var(--on-turquoise); }
.annotation-item.selected { background: var(--mint); border-color: var(--line-brand); }
.annotation-item, .editor-heading button { border-radius: var(--radius-sm); }
.brand .logo, .login-brand .logo { border-radius: 0; }
/* Name next to the mark: "Medirion" in Montserrat 700 (BRAND.md §6); the spaced wordmark is for title slides only. */
.brand-name, .login-brand strong { font-family: var(--font-sans); font-weight: 700; letter-spacing: 0; }
.brand-name { font-size: 22px; }
.login-brand strong { font-size: 32px; }
.login-story h1 { font-weight: 300; letter-spacing: 0; }
.login-card h2 { font-weight: 700; }
.login-layout { border: 1px solid var(--line); }
.notice { border-radius: var(--radius-sm); }
.notice.error { border-width: 2px; background: var(--critical-soft); color: var(--ink); }
.research-note { border-top: 3px solid var(--turquoise); padding-top: var(--space-4); }
.time-label, .frame-details, .readout, .metric, .inspector-stats, .pixel-cell, .count { font-variant-numeric: tabular-nums; }
@media(max-width:760px) {
  h1, .page-heading h1 { font-size: 28px; }
  h3 { font-size: 17px; }
  .brand-name { font-size: 18px; }
  .brand { gap: 8px; }
  .brand>span { font-size: 12px; }
  .panel-title { flex-wrap: wrap; }
  .login-brand strong { font-size: 28px; }
}

/* Themes: the design system's navy "device" theme is the dark mode (user decision 2026-11-11:
   the near-black "dark" theme is too harsh for long review sessions), "light" the alternative.
   Portal aliases only; every value is a design-system token. */
:root, [data-theme="dark"], [data-theme="device"] {
  color-scheme: dark;
  --chrome-bg: var(--surface);
  --panel-bg: var(--surface);
  --control-bg: var(--field);
  --hover-bg: var(--surface-raised);
  --login-bg: var(--bg);
  /* Thermal images are shown light-on-dark in both themes (BRAND.md §8). */
  --stage-bg: var(--bg);
}
[data-theme="light"] {
  color-scheme: light;
  --chrome-bg: var(--surface-raised);
  --panel-bg: var(--surface-raised);
  --control-bg: var(--field);
  --hover-bg: var(--mint);
  --login-bg: var(--surface);
  --stage-bg: var(--ink);
}
:root:not([data-theme="light"]) .filters { background: var(--panel-bg); }
/* The device theme has no navy mint/cream; its tinted fills use the raised navy surface instead. */
[data-theme="device"] :is(.role, .tag, .notice, .annotation-item.open, .annotation-item.selected, .lang-options button[aria-current="true"]) { background: var(--surface-raised); }
[data-theme="device"] .notice.error { background: var(--critical-soft); }
:root:not([data-theme="light"]) .login-story { background: var(--bg); border-right: 1px solid var(--line); }

/* Logo: standard mark on light backgrounds, inverse mark on dark. */
.logo-on-light { display: none; }
[data-theme="light"] .logo-on-light { display: inline-block; }
[data-theme="light"] .logo-on-dark { display: none; }

/* Theme toggle: moon in light mode (switch to dark), sun in dark mode (switch to light). */
.theme-toggle {
  flex: none;
  width: var(--control-height);
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0;
  border-radius: var(--radius-control);
  background: var(--control-bg);
  color: var(--ink);
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: block; color: var(--turquoise); }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
.floating-controls {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 10;
  display: flex;
  gap: var(--space-2);
}

/* Language menu: same control as the theme toggle, current language shown. */
.lang-menu { position: relative; flex: none; }
.lang-menu summary {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  height: var(--control-height); min-width: calc(var(--control-height) + 12px); padding: 0 10px;
  border: 2px solid var(--line-control); border-radius: var(--radius-control); background: var(--control-bg); color: var(--ink);
  font-size: 12px; font-weight: 700; letter-spacing: 1px; cursor: pointer; list-style: none; user-select: none;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover { border-color: var(--turquoise); }
.lang-menu summary svg { display: block; flex: none; width: 10px !important; height: 6px !important; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.lang-menu[open] summary svg { transform: rotate(180deg); }
.lang-options {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: grid; min-width: 168px; padding: 4px; margin: 0;
  border: 1px solid var(--line-control); border-radius: var(--radius-sm); background: var(--panel-bg);
}
.lang-options button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 0; padding: 8px 10px;
  border: 0; border-radius: var(--radius-inner); background: transparent; color: var(--ink); font-size: 13px; text-align: left;
}
.lang-options button span { min-width: 22px; font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--muted); }
.lang-options button:hover { background: var(--hover-bg); color: var(--ink); }
.lang-options button[aria-current="true"] { background: var(--mint); }
.lang-options button[aria-current="true"] span { color: var(--accent-text); }
@media (max-width: 760px) {
  nav .lang-menu { margin-left: auto; }
  .login-page { padding-top: calc(var(--control-height) + var(--space-6)); }
}

/* ---------- Viewer (features carried over from the local ThermoCam data viewer) ---------- */
.viewer-title { flex-wrap: wrap; }
.viewer-switches { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: flex-end; }
.player-shell { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.player-shell .image-stage { border-radius: 0; }
.stage-content > img { user-select: none; -webkit-user-drag: none; }
.image-badge {
  position: absolute; top: 12px; z-index: 3;
  min-height: 0; padding: 6px 9px; border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--scrim-dark); color: #fff; font-size: 10px; font-weight: 600; letter-spacing: 1px; line-height: 1;
  pointer-events: none;
}
.image-label { left: 12px; }
/* Top-right badges share one flex row, so a wider label (Glatt, Graustufe) keeps an even gap. */
.image-badges { position: absolute; top: 12px; right: 12px; z-index: 3; display: flex; align-items: center; gap: 6px; pointer-events: none; }
.image-badges .image-badge { position: static; }
.image-auto { pointer-events: auto; cursor: pointer; font: inherit; font-size: 10px; font-weight: 700; letter-spacing: 1px; }
/* Display only: "pixel" shows each sensor value as a hard block; the default lets the browser smooth like the legacy canvas viewer. */
[data-rendering="pixel"] #thermalImage,
[data-rendering="pixel"] #baselineImage { image-rendering: pixelated; }
.image-auto:hover { background: var(--scrim-dark); border-color: var(--turquoise); color: var(--turquoise); }
.transport { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3) 0; background: var(--panel-bg); }
.transport select { width: auto; min-height: 34px; padding: 4px 8px; font-size: 12px; margin-left: auto; }
.icon-button { min-width: 38px; min-height: 34px; padding: 0 10px; font-size: 15px; }
.time-label { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.player-shell #timeline { display: block; width: 100%; margin: 0; padding: 10px var(--space-3) 12px; min-height: 0; border: 0; border-radius: 0; background: var(--panel-bg); accent-color: var(--turquoise); }
.frame-details { font-variant-numeric: tabular-nums; margin: 10px 0 14px; }
.scale { display: flex; align-items: center; gap: var(--space-3); }
.scale .gradient { flex: 1; width: auto; height: 10px; border-radius: 5px;
  background: linear-gradient(90deg,#000004,#160b39,#420a68,#6a176e,#932667,#bc3754,#dd513a,#f37819,#fca50a,#f6d746,#fcffa4); }
.scale-input { flex-direction: row; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); font-weight: 600; }
.scale-input input { width: 64px; min-height: 32px; padding: 4px 6px; font-size: 12px; }
.scale-caption { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); margin: 6px 0 16px; font-size: 10px; color: var(--muted); }
.text-button { min-height: 0; padding: 4px 0; border: 0; background: transparent; color: var(--accent-text); font-size: 11px; font-weight: 700; }
.text-button:hover { background: transparent; text-decoration: underline; }
.text-button:disabled { background: transparent; }
.readout { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.count { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--bg); border-radius: var(--radius-tag); padding: 2px 7px; margin-left: 4px; }
.count:empty { display: none; }
.subtitle { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 6px; }

/* Crosshair = the inspected box; POIs = coloured boxes with their mean. */
.poi-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.crosshair, .poi-marker {
  position: absolute; transform: translate(-50%, -50%); z-index: 2;
  min-width: 12px; min-height: 12px; padding: 0; border-radius: 2px; background: transparent;
  box-shadow: 0 0 0 1px #0009;
}
.crosshair { border: 1.5px solid var(--turquoise); pointer-events: none; }
.crosshair.pinned { pointer-events: auto; cursor: pointer; border-width: 2px; }
.crosshair:hover, .crosshair:hover:not(:disabled) { background: transparent; border-color: var(--turquoise); }
.crosshair span, .poi-marker span {
  position: absolute; left: 50%; bottom: calc(100% + 5px); transform: translateX(-50%);
  padding: 3px 5px; border-radius: 4px; background: var(--scrim-dark); color: var(--turquoise);
  font-size: 10px; font-weight: 600; line-height: 1; white-space: nowrap; pointer-events: none;
}
.poi-marker { border: 2px solid var(--poi-color); color: var(--poi-color); pointer-events: auto; cursor: pointer; }
.poi-marker:hover, .poi-marker:hover:not(:disabled) { background: transparent; border-color: var(--poi-color); }
.poi-marker[aria-pressed=true] { outline: 1px dashed #fff; outline-offset: 3px; }
.poi-marker span { color: var(--poi-color); }
.poi-summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-height: 46px; padding: 8px var(--space-3); background: var(--panel-bg); border-bottom: 1px solid var(--line); }
.poi-summary .help { margin: 0; font-size: 11px; }
.poi-chip { min-height: 30px; padding: 4px 10px; font-size: 11px; font-variant-numeric: tabular-nums; border-left: 3px solid var(--poi-color); }
.poi-chip[aria-pressed=true] { outline: 1px solid var(--poi-color); }
.image-menu { position: fixed; z-index: 1000; min-width: 220px; max-width: calc(100vw - 16px); padding: 6px; background: var(--panel-bg); border: 1px solid var(--line-control); border-radius: var(--radius-sm); }
.image-menu button { display: flex; justify-content: flex-start; width: 100%; min-height: 38px; border: 0; border-radius: var(--radius-sm); background: transparent; font-size: 13px; font-weight: 600; }
.image-menu button:hover, .image-menu button:focus-visible { background: var(--hover-bg); }

/* Fullscreen player */
#player:fullscreen { display: flex; flex-direction: column; justify-content: center; align-items: center; background: var(--bg); border: 0; border-radius: 0; }
#player:fullscreen .image-stage { width: min(100vw, calc((100vh - 110px) * 4 / 3)); }
#player:fullscreen:has(.poi-summary) .image-stage { width: min(100vw, calc((100vh - 170px) * 4 / 3)); }
#player:fullscreen .transport, #player:fullscreen .timeline-wrap, #player:fullscreen .poi-summary { width: min(100%, 1000px); }

/* Pixel inspector */
.inline-label { flex-direction: row; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.inline-label select { width: auto; min-height: 34px; padding: 4px 8px; }
.inspector-coordinate { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.inspector-coordinate span { flex: 1; min-width: 110px; }
.inspector-coordinate button { min-height: 32px; padding: 4px 10px; font-size: 11px; }
.pixel-grid { display: grid; gap: 1px; background: var(--line); border-radius: var(--radius-inner); overflow: hidden; }
.pixel-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 10px; font-variant-numeric: tabular-nums; }
.pixel-cell.center { outline: 2px solid var(--turquoise); outline-offset: -2px; font-weight: 700; }
.inspector-stats { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.inspector-stats small { display: block; font-size: 9px; letter-spacing: 1px; color: var(--muted); margin-bottom: 4px; }
.inspector-stats strong { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Baseline, details, RGB */
#baselineImage { display: block; width: 100%; border-radius: var(--radius-sm); background: var(--stage-bg); }
.baseline-controls { display: flex; justify-content: space-between; margin-top: 8px; }
.baseline-controls .help { margin: 0; }
#baselineScrubber { min-height: 0; padding: 0; border: 0; margin-top: 6px; accent-color: var(--turquoise); }
.details-panel dl { margin: 0; }
.details-panel dl > div { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.details-panel dt { color: var(--muted); }
.details-panel dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.details-panel .metadata { margin-top: 14px; font-size: 12px; }
.details-panel .notice { margin: 14px 0 0; }
.rgb-open { display: grid; place-items: center; width: 100%; padding: 0; border: 0; border-radius: var(--radius-sm); background: var(--bg); overflow: hidden; }
.rgb-open:hover { background: var(--bg); }
.rgb-panel .rgb-open img { max-height: 360px; border-radius: 0; background: transparent; }
.rgb-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.rgb-footer .help { margin: 0; text-align: center; }
.rgb-footer button { min-height: 34px; padding: 0 12px; }
.rgb-modal { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 24px; background: var(--scrim-dark); }
.rgb-modal button { display: grid; place-items: center; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; }
.rgb-modal button:hover { background: transparent; }
.rgb-modal img { max-width: 100%; max-height: calc(100vh - 48px); object-fit: contain; border-radius: var(--radius-sm); }
.full-tools .readout { margin: 0 0 10px; }
@media (max-width: 760px) {
  .viewer-switches { justify-content: flex-start; }
  .transport { flex-wrap: wrap; }
  .scale-caption { flex-direction: column; align-items: flex-start; }
  .pixel-cell { font-size: 9px; }
}

/* Measurement picker: clinic → measurement → search */
.filters > label:first-child { flex: 1; }
.filters .record-filter { flex: 2; }

/* Joint actions sit directly above the thermal image */
.viewer-panel > .viewer-actions { border-top: 0; padding: 0 0 12px; }
.viewer-panel > .viewer-actions .help { flex-basis: auto; flex: 1; min-width: 220px; margin: 0 0 0 4px; }
.viewer-panel > #placementHint { margin: 0 0 12px; }

/* Annotation accordion */
.annotation-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: stretch; gap: 4px;
  width: 100%; padding: 4px; text-align: left; font-size: 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--control-bg);
}
.annotation-item.open { border-color: var(--line-brand); background: var(--mint); }
.annotation-item.dragging { opacity: .85; border-color: var(--turquoise); }
.annotation-item > button { border: 0; background: transparent; border-radius: var(--radius-inner); }
.annotation-item > button:hover { background: var(--hover-bg); }
.drag-handle { padding: 6px 5px; color: var(--muted); cursor: grab; touch-action: none; letter-spacing: -2px; font-size: 13px; }
.annotation-item.dragging .drag-handle { cursor: grabbing; }
.annotation-toggle { justify-content: space-between; padding: 8px 10px; text-align: left; font-size: 12px; font-weight: 600; min-width: 0; }
.annotation-toggle small { display: block; color: var(--muted); font-size: 10px; font-weight: 400; margin-top: 4px; }
.annotation-toggle::after { content: "▾"; color: var(--muted); margin-left: 8px; transition: transform .15s; }
.annotation-toggle[aria-expanded="true"]::after { transform: rotate(180deg); }
.annotation-state { margin-left: auto; color: var(--muted); font-weight: 500; white-space: nowrap; }
.annotation-delete { padding: 6px 10px; font-size: 11px; color: var(--danger); }
.annotation-item > .annotation-delete:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.annotation-item > #annotationForm { grid-column: 1 / -1; margin: 4px 4px 6px; }
.annotation-item > #annotationForm .editor-heading { border-top: 1px solid var(--line); }

/* RGB overlay: the RGB camera sees a wider field; the server supplies where the
   thermal frame sits inside the RGB picture (scale/left/top as fractions). */
.rgb-overlay { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.rgb-overlay img { position: absolute; display: block; max-width: none; user-select: none; }
.overlay-controls {
  position: absolute; left: 12px; bottom: 12px; z-index: 3; display: flex; align-items: center; gap: 8px;
  padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--scrim-dark); color: #fff;
}
.overlay-controls button {
  min-height: 0; padding: 5px 8px; border: 0; border-radius: var(--radius-pill); background: transparent;
  color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 1px;
}
.overlay-controls button:hover { background: transparent; color: var(--turquoise); }
.overlay-controls button[aria-pressed="true"] { background: var(--turquoise); color: var(--on-turquoise); }
.overlay-controls button:disabled { opacity: .45; }
.overlay-controls input[type="range"] { width: 110px; margin: 0; accent-color: var(--turquoise); }
.overlay-controls output { min-width: 34px; padding-right: 6px; font-size: 10px; font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 520px) { .overlay-controls input[type="range"] { width: 80px; } }

/* Zoom while moving a joint marker: a corner loupe, or the stage itself zooms
   around the marker (markers counter-scale so the cross keeps its size). */
.stage-content { position: absolute; inset: 0; transform-origin: 0 0; transition: transform .15s ease-out; }
.image-stage.panning .stage-content { transition: none; }
.image-stage.zoomed .marker { transform: translate(-50%, -50%) scale(calc(1 / var(--zoom))); }
.image-stage.zoomed .poi-layer, .image-stage.zoomed .crosshair { visibility: hidden; }
.zoom-controls {
  position: absolute; right: 12px; bottom: 12px; z-index: 3; display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  pointer-events: none;
}
.loupe {
  width: 160px; height: 160px; border: 2px solid #fff; border-radius: var(--radius-sm); background: var(--stage-bg);
}
.zoom-controls.flip { right: auto; left: 12px; bottom: 52px; align-items: flex-start; }
.zoom-controls.flip .zoom-switch { visibility: hidden; }
.zoom-switch {
  display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--scrim-dark); color: #fff; pointer-events: auto;
}
.zoom-switch span { padding: 0 6px; font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; opacity: .75; }
.zoom-switch button {
  min-height: 0; padding: 5px 8px; border: 0; border-radius: var(--radius-pill); background: transparent;
  color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 1px;
}
.zoom-switch button:hover { background: transparent; color: var(--turquoise); }
.zoom-switch button[aria-pressed="true"] { background: var(--turquoise); color: var(--on-turquoise); }
@media (max-width: 520px) { .loupe { width: 110px; height: 110px; } .zoom-switch span { display: none; } }

/* RGB capture points on the measurement timeline. */
.timeline-wrap { position: relative; }
.rgb-ticks { position: absolute; inset: 0; pointer-events: none; }
.rgb-tick {
  position: absolute; top: 3px; bottom: 5px; width: 11px; min-height: 0; padding: 0; margin-left: -5.5px;
  border: 0; border-radius: 0; background: transparent; pointer-events: auto; cursor: pointer;
}
.rgb-tick::before {
  content: ""; position: absolute; left: 4.5px; top: 0; bottom: 0; width: 2px; border-radius: 1px;
  background: var(--ink); opacity: .55;
}
.rgb-tick.estimated::before { background: repeating-linear-gradient(to bottom, var(--ink) 0 3px, transparent 3px 5px); }
.rgb-tick:hover, .rgb-tick:hover:not(:disabled) { background: transparent; }
.rgb-tick:hover::before { opacity: 1; }
.rgb-tick.active::before { background: var(--turquoise); opacity: 1; width: 3px; left: 4px; }
.overlay-fit { padding-right: 6px; font-size: 9px; font-weight: 700; letter-spacing: .5px; color: var(--turquoise); text-transform: uppercase; }

.shared-view .topbar nav .role { display: none; }
/* Loupe / at-marker zoom only serves dragging Labeling markers. */
.readonly-view .zoom-controls { display: none; }
