:root {
  --bg: #0d1014;
  --bg-2: #111720;
  --surface: #141a22;
  --surface-2: #18212a;
  --surface-3: #171813;
  --text: #ecf4ef;
  --muted: #9aa9ad;
  --muted-strong: #c0ccc8;
  --accent: #43d6c5;
  --accent-2: #f0c96a;
  --accent-3: #9b8cff;
  --accent-4: #ff7d8f;
  --ok: #57d68d;
  --warn: #f0c96a;
  --bad: #ff7d8f;
  --border: #2a3640;
  --border-soft: #202a32;
  --border-hover: #4fd6c2;
  --shadow: rgba(0, 0, 0, 0.36);
  --shadow-strong: rgba(0, 0, 0, 0.52);
  --radius: 8px;
  --radius-sm: 6px;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
  margin: 0;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  background: linear-gradient(120deg, var(--bg) 0%, #111419 48%, #101711 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

.app-header {
  align-items: center;
  backdrop-filter: blur(14px);
  background: rgba(13, 16, 20, 0.94);
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(190px, auto) minmax(0, 1fr) auto;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 999;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    conic-gradient(from 35deg, var(--accent), var(--accent-3), var(--accent-2), var(--accent)) border-box;
  border: 2px solid transparent;
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(67, 214, 197, 0.18);
  flex: 0 0 34px;
  height: 34px;
  position: relative;
  width: 34px;
}

.brand {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.research-notice {
  border: 1px solid rgba(240, 201, 106, 0.34);
  border-radius: var(--radius-sm);
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 700;
  padding: 7px 9px;
  text-transform: uppercase;
  white-space: nowrap;
}

.header-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.header-link,
.demo-mode-notice a {
  align-items: center;
  border: 1px solid rgba(67, 214, 197, 0.36);
  border-radius: var(--radius-sm);
  color: var(--accent);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  justify-content: center;
  min-height: 32px;
  padding: 6px 9px;
  text-decoration: none;
  white-space: nowrap;
}

.header-link[href^="https://doi.org"] {
  border-color: rgba(240, 201, 106, 0.42);
  color: var(--accent-2);
}

.demo-mode-notice {
  align-items: center;
  background: #101813;
  border-bottom: 1px solid rgba(87, 214, 141, 0.28);
  color: var(--muted-strong);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  padding: 9px 16px;
  position: static;
  z-index: 998;
}

.demo-mode-notice strong {
  color: var(--ok);
}

.demo-mode-notice[hidden] {
  display: none;
}

.mobile-review-mode-bar {
  display: none;
}

.kpis {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}

.kpi {
  background: rgba(20, 26, 34, 0.86);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  color: var(--muted-strong);
  min-width: 126px;
  padding: 7px 9px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  white-space: nowrap;
}

.kpi:hover {
  border-color: rgba(67, 214, 197, 0.45);
  box-shadow: 0 8px 18px var(--shadow);
  transform: translateY(-2px);
}

.research-shell {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-areas:
    "rail main inspector"
    "rail drawer inspector";
  grid-template-columns: 134px minmax(0, 1fr) minmax(300px, 360px);
  margin: 0 auto;
  max-width: 1920px;
  padding: 14px;
}

.workflow-rail {
  background: rgba(16, 23, 29, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 36px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  grid-area: rail;
  min-height: calc(100vh - 92px);
  padding: 8px;
  position: sticky;
  top: 76px;
}

.workflow-link {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted-strong);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
  grid-template-columns: 28px minmax(0, 1fr);
  min-height: 44px;
  padding: 7px 8px;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}

.workflow-link span:last-child {
  white-space: nowrap;
}

.workflow-link:hover,
.workflow-link:focus-visible,
.workflow-link.active {
  background: rgba(67, 214, 197, 0.1);
  border-color: rgba(67, 214, 197, 0.42);
  color: var(--accent);
  transform: translateX(2px);
}

.rail-icon {
  align-items: center;
  background: rgba(236, 244, 239, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.workspace-main {
  grid-area: main;
  min-width: 0;
}

.research-inspector {
  display: grid;
  gap: 12px;
  grid-area: inspector;
  max-height: calc(100vh - 92px);
  min-width: 0;
  overflow: auto;
  position: sticky;
  top: 76px;
}

.evidence-drawer {
  grid-area: drawer;
  min-width: 0;
}

.card {
  background: rgba(20, 26, 34, 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 36px var(--shadow);
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.card:hover {
  border-color: rgba(67, 214, 197, 0.28);
  box-shadow: 0 20px 46px var(--shadow-strong);
}

.panel-header {
  align-items: center;
  background: linear-gradient(90deg, rgba(24, 33, 42, 0.96), rgba(23, 24, 19, 0.9));
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 13px 14px;
}

.panel-header.compact {
  padding: 10px 12px;
}

h1,
h2,
h3 {
  color: var(--text);
  font-weight: 760;
  line-height: 1.2;
}

h1 {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-size: 16px;
  gap: 8px;
}

h2 {
  font-size: 14px;
}

.panel-status {
  background: rgba(236, 244, 239, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 7px;
  text-transform: uppercase;
}

.panel-status.warning {
  color: var(--accent-2);
}

.viewer {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(560px, min(54vw, 860px)) minmax(320px, 1fr);
  padding: 14px;
}

body.calibration-active .viewer {
  grid-template-columns: minmax(420px, min(42vw, 820px)) minmax(380px, 1fr);
}

.viewer:fullscreen {
  align-items: start;
  background: var(--bg);
  box-sizing: border-box;
  min-height: 100vh;
  overflow: auto;
}

.tile-stage {
  align-self: start;
  background:
    linear-gradient(145deg, rgba(67, 214, 197, 0.14), rgba(155, 140, 255, 0.08)) padding-box,
    linear-gradient(145deg, rgba(67, 214, 197, 0.34), rgba(240, 201, 106, 0.18)) border-box;
  border: 1px solid transparent;
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  max-width: 880px;
  min-width: 0;
  padding: 9px;
  position: relative;
  width: 100%;
}

.tile-canvas-wrap {
  aspect-ratio: 1 / 1;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  width: 100%;
}

.tile-transform-layer {
  inset: 0;
  position: absolute;
  transform-origin: 0 0;
  will-change: transform;
}

canvas.tile {
  aspect-ratio: 1 / 1;
  background: #000;
  border: 1px solid rgba(236, 244, 239, 0.08);
  border-radius: var(--radius-sm);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
  cursor: crosshair;
  display: block;
  height: auto;
  image-rendering: pixelated;
  transition: transform 0.2s, box-shadow 0.2s;
  width: 100%;
}

canvas.tile:hover {
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.48);
}

.tile-observation-overlay {
  border-radius: var(--radius-sm);
  cursor: crosshair;
  display: grid;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.tile-observation-overlay:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.zone-map {
  border: 1px solid rgba(236, 244, 239, 0.08);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.zone-map span {
  align-items: flex-start;
  border-bottom: 1px solid rgba(236, 244, 239, 0.16);
  border-right: 1px solid rgba(236, 244, 239, 0.16);
  color: rgba(236, 244, 239, 0.72);
  display: flex;
  font-size: 10px;
  justify-content: flex-start;
  line-height: 1;
  padding: 6px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.88);
}

.zone-map span:nth-child(3n) {
  border-right: 0;
}

.zone-map span:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.tile-observation-markers {
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 3;
}

.observation-marker {
  background: rgba(240, 201, 106, 0.92);
  border: 2px solid rgba(9, 13, 16, 0.94);
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(240, 201, 106, 0.28), 0 10px 22px rgba(0, 0, 0, 0.42);
  height: 14px;
  left: calc(var(--x) * 100%);
  position: absolute;
  top: calc(var(--y) * 100%);
  transform: translate(-50%, -50%);
  width: 14px;
}

.observation-marker.pending {
  background: rgba(67, 214, 197, 0.96);
  box-shadow: 0 0 0 3px rgba(67, 214, 197, 0.24), 0 0 0 10px rgba(67, 214, 197, 0.08);
}

.observation-marker.selected {
  background: var(--accent);
  border-color: #06100f;
  height: 18px;
  width: 18px;
  z-index: 4;
  box-shadow: 0 0 0 3px rgba(67, 214, 197, 0.42), 0 0 0 12px rgba(67, 214, 197, 0.12);
}

.tile-observation-toolbar {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding-top: 8px;
}

.calibration-tile-banner {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(10, 16, 32, 0.9), rgba(13, 20, 34, 0.86)) padding-box,
    linear-gradient(135deg, rgba(67, 214, 197, 0.48), rgba(240, 201, 106, 0.28)) border-box;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
  color: var(--muted-strong);
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px;
  left: 18px;
  padding: 8px 10px;
  pointer-events: none;
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 4;
}

.calibration-tile-banner strong {
  color: var(--accent);
}

.calibration-tile-banner[hidden] {
  display: none;
}

.visual-sidecar-toolbar {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}

.sidecar-select-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sidecar-select-control {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.viewer-tools {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 132px), 1fr));
}

.transform-control,
.rotation-control {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.control-label-row {
  align-items: center;
  color: var(--muted-strong);
  display: flex;
  font-size: 12px;
  font-weight: 750;
  gap: 8px;
  justify-content: space-between;
  min-width: 0;
}

.control-label-row output {
  color: var(--accent);
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

input[type="range"] {
  accent-color: var(--accent);
  cursor: pointer;
  min-height: 32px;
  padding: 0;
}

.rotation-control {
  border: 0;
  grid-column: 1 / -1;
  margin: 0;
  padding: 0;
}

.rotation-control legend {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 750;
  padding: 0;
}

.rotation-options {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.segmented-option {
  min-width: 0;
  position: relative;
}

.segmented-option input {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

.segmented-option span {
  align-items: center;
  background: rgba(13, 16, 20, 0.9);
  border: 1px solid #33414a;
  border-radius: var(--radius-sm);
  color: var(--muted-strong);
  display: flex;
  font-size: 12px;
  font-weight: 800;
  justify-content: center;
  min-height: 32px;
  padding: 6px 7px;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
}

.segmented-option input:checked + span {
  background: rgba(67, 214, 197, 0.12);
  border-color: rgba(67, 214, 197, 0.58);
  color: var(--accent);
}

.segmented-option input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.viewer-tools .caption {
  align-self: center;
  grid-column: 1 / -1;
}

.compact-pill {
  min-height: 34px;
  padding: 6px 9px;
}

.controls {
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(860px, calc(100vh - 184px));
  min-width: 0;
  overflow: auto;
  padding-right: 2px;
  scrollbar-gutter: stable;
}

body.calibration-active .controls {
  max-height: min(760px, calc(100vh - 156px));
}

body.calibration-active .label-workflow,
body.calibration-active .guided-calibration-workspace {
  gap: 6px;
  padding: 8px;
}

body.calibration-active .label-workflow .command-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.calibration-active .label-workflow .primary-action {
  grid-column: auto;
}

body.calibration-active .note-tips {
  font-size: 11px;
  line-height: 1.2;
  max-height: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.calibration-active .guided-calibration-header p {
  display: none;
}

.control-group {
  background: rgba(13, 16, 20, 0.46);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  display: grid;
  gap: 9px;
  padding: 11px;
}

.group-title {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
}

button,
select,
input[type="text"],
textarea {
  background: rgba(13, 16, 20, 0.9);
  border: 1px solid #33414a;
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  min-height: 36px;
  min-width: 0;
  padding: 8px 10px;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s, transform 0.2s;
}

select,
input[type="text"],
input[type="range"],
textarea {
  width: 100%;
}

.row select,
.row input[type="text"] {
  flex: 1 1 150px;
  width: auto;
}

.row #tileSelect {
  flex-basis: 170px;
}

.row #rateSel {
  flex: 0 0 86px;
}

button {
  cursor: pointer;
  font-weight: 750;
  white-space: nowrap;
}

button:hover:not(:disabled) {
  background: rgba(24, 33, 42, 0.98);
  border-color: var(--border-hover);
  box-shadow: 0 8px 18px rgba(67, 214, 197, 0.12);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

select:hover,
input:hover,
textarea:hover {
  border-color: var(--border-hover);
}

.pill {
  border-radius: var(--radius-sm);
  font-size: 12px;
  min-height: 34px;
  padding: 7px 10px;
}

.primary-action {
  background: rgba(67, 214, 197, 0.1);
  border-color: rgba(67, 214, 197, 0.62);
  color: var(--accent);
  grid-column: 1 / -1;
}

.workbench-citation-strip {
  background: rgba(13, 16, 20, 0.58);
  border: 1px solid rgba(67, 214, 197, 0.24);
  border-left: 3px solid var(--accent-2);
  border-radius: var(--radius-sm);
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 5px;
  line-height: 1.35;
  padding: 9px 10px;
}

.workbench-citation-strip span {
  color: var(--muted-strong);
  font-weight: 800;
}

.workbench-citation-strip a {
  color: var(--accent);
  font-weight: 820;
  overflow-wrap: anywhere;
}

.command-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.note-tips {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

.guided-calibration-workspace {
  background:
    linear-gradient(140deg, rgba(67, 214, 197, 0.08), rgba(155, 140, 255, 0.1)) padding-box,
    linear-gradient(140deg, rgba(67, 214, 197, 0.42), rgba(155, 140, 255, 0.28)) border-box;
  border-color: transparent;
  scroll-margin: 16px;
}

.guided-calibration-workspace:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.guided-calibration-header {
  align-items: start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.guided-calibration-header p {
  margin: 4px 0 0;
}

.calibration-step-badge {
  min-width: 48px;
  text-align: center;
}

.calibration-config-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}

.calibration-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.calibration-active .calibration-config-grid,
body.calibration-active .calibration-actions {
  gap: 6px;
}

body.calibration-active .guided-calibration-workspace {
  box-shadow: inset 0 0 0 1px rgba(67, 214, 197, 0.22), 0 14px 28px rgba(0, 0, 0, 0.24);
}

body.calibration-active .guided-calibration-workspace .callout,
body.calibration-active .guided-calibration-workspace .explain {
  margin: 0;
}

.observation-review-workspace {
  gap: 10px;
  margin: 0 14px 14px;
}

.review-boundary-note,
.review-handoff-panel {
  background: rgba(13, 16, 20, 0.58);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}

.review-boundary-note {
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.45;
  padding: 9px 10px;
}

.observation-review-list {
  display: grid;
  gap: 7px;
  max-height: 220px;
  min-height: 42px;
  overflow: auto;
}

.observation-review-row {
  align-items: start;
  display: grid;
  gap: 3px;
  justify-items: start;
  min-height: 58px;
  text-align: left;
  white-space: normal;
}

.observation-review-row.active {
  border-color: rgba(67, 214, 197, 0.72);
  box-shadow: 0 0 0 1px rgba(67, 214, 197, 0.2), 0 12px 24px rgba(67, 214, 197, 0.1);
}

.observation-review-row strong,
.observation-review-row span {
  display: block;
}

.observation-review-editor {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.review-note-field {
  grid-column: 1 / -1;
}

#reviewConfidenceValue {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  padding-left: 4px;
}

#reviewNote {
  min-height: 74px;
  resize: vertical;
  width: 100%;
}

.observation-review-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.adjudication-queue-panel {
  border-top: 1px solid var(--border-soft);
  display: grid;
  gap: 9px;
  padding-top: 10px;
}

.adjudication-queue-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.adjudication-detail-panel {
  display: grid;
  gap: 8px;
}

#adjudicationNote {
  min-height: 72px;
  resize: vertical;
  width: 100%;
}

.compact-reference-list {
  max-height: 170px;
  overflow: auto;
}

.cmd-icon {
  display: inline-block;
  font-size: 0.95em;
  line-height: 1;
  min-width: 1em;
  text-align: center;
}

.checkbox-label {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  min-height: 34px;
}

.progress {
  background: rgba(13, 16, 20, 0.9);
  border: 1px solid #33414a;
  border-radius: 999px;
  height: 8px;
  min-width: 120px;
  overflow: hidden;
  width: 160px;
}

.bar {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  height: 100%;
  transition: width 0.2s ease-out;
  width: 0;
}

.kbd {
  background: rgba(13, 16, 20, 0.92);
  border: 1px solid #33414a;
  border-radius: 5px;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  padding: 2px 6px;
}

.badge,
.tag {
  background: rgba(13, 16, 20, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
}

.tag {
  color: var(--accent-2);
}

.hl {
  color: var(--accent);
  font-weight: 800;
}

.ok {
  color: var(--ok);
}

.bad {
  color: var(--bad);
}

.warn {
  color: var(--warn);
}

.small,
.caption {
  color: var(--muted);
  font-size: 12px;
}

.status-caption {
  border-left: 2px solid rgba(67, 214, 197, 0.55);
  padding-left: 9px;
}

.next-step-trail {
  background: rgba(67, 214, 197, 0.08);
  border: 1px solid rgba(67, 214, 197, 0.28);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--muted-strong);
  display: grid;
  gap: 8px;
  font-size: 12px;
  margin-top: 10px;
  padding: 10px;
}

.next-step-trail[hidden] {
  display: none;
}

.next-step-trail strong {
  color: var(--text);
}

.next-step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.next-step-actions a {
  align-items: center;
  border: 1px solid rgba(170, 183, 183, 0.24);
  border-radius: var(--radius-sm);
  color: var(--accent);
  display: inline-flex;
  font-weight: 800;
  min-height: 30px;
  padding: 5px 8px;
  text-decoration: none;
}

.next-step-actions a:focus-visible,
.next-step-actions a:hover {
  background: rgba(67, 214, 197, 0.12);
  border-color: rgba(67, 214, 197, 0.52);
  outline: none;
}

.audio-safety-note {
  border-left: 2px solid rgba(240, 201, 106, 0.68);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
  padding-left: 9px;
}

.audio-safety-note a {
  color: var(--accent);
  font-weight: 800;
}

#workspace-tiles,
#workspace-labels,
#observationReviewWorkspace,
#workspace-core-pack,
#workspace-diagnostics,
#workspace-provenance,
#workspace-reports {
  scroll-margin-top: 92px;
}

.metadata-panel {
  min-width: 0;
}

.metadata-panel.divided {
  border-top: 1px solid var(--border-soft);
}

.metadata-grid {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.metadata-grid div {
  border-bottom: 1px solid var(--border-soft);
  display: grid;
  gap: 8px;
  grid-template-columns: 120px minmax(0, 1fr);
  padding-bottom: 8px;
}

.metadata-grid div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.metadata-grid dt {
  color: var(--muted);
  font-size: 12px;
}

.metadata-grid dd {
  color: var(--text);
  font-size: 12px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.explorer-panel {
  border-top: 1px solid var(--border-soft);
  display: grid;
  gap: 10px;
  padding: 10px 12px 12px;
}

.explorer-title {
  margin-bottom: 7px;
}

.empty-state {
  background: rgba(13, 16, 20, 0.42);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.error-state {
  border-color: rgba(255, 125, 143, 0.46);
  color: var(--bad);
}

.tile-passport-list,
.reference-list {
  display: grid;
  gap: 7px;
}

.tile-passport-button {
  text-align: left;
  white-space: normal;
}

.tile-passport-button.active {
  background: rgba(67, 214, 197, 0.12);
  border-color: rgba(67, 214, 197, 0.62);
  color: var(--accent);
}

.reference-item {
  background: rgba(13, 16, 20, 0.42);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 4px;
  overflow-wrap: anywhere;
  padding: 8px;
}

.reference-item strong {
  color: var(--muted-strong);
  font-size: 12px;
}

.observation-evidence-map {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 8px;
}

.observation-zone-cell {
  background: rgba(13, 16, 20, 0.48);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 4px;
  min-height: 54px;
  padding: 7px;
}

.observation-zone-cell.active {
  background: rgba(67, 214, 197, 0.1);
  border-color: rgba(67, 214, 197, 0.52);
}

.observation-zone-cell strong {
  color: var(--muted-strong);
  font-size: 10px;
  line-height: 1.1;
}

.observation-zone-cell span {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.inspector-panel > p,
.contract-line,
.license-note,
.provenance-list {
  padding: 10px 12px 0;
}

.contract-line {
  overflow-wrap: anywhere;
}

code {
  color: #d6e4ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95em;
}

.feed-stack,
.report-actions {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
}

.report-viewer,
.evidence-workspace {
  border-top: 1px solid var(--border-soft);
  display: grid;
  gap: 10px;
  padding: 10px 12px 12px;
}

.evidence-workspace {
  grid-template-columns: 1fr;
}

.feed-url {
  min-width: 0;
}

.file-pill {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  min-height: 34px;
}

.file-pill input {
  display: none;
}

.inspector-status {
  border-top: 1px solid var(--border-soft);
  min-height: 34px;
  padding: 9px 12px 12px;
}

.provenance-list {
  display: grid;
  gap: 7px;
  list-style: none;
  padding-bottom: 12px;
}

.provenance-list li {
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 7px;
}

.provenance-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.drawer-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 12px;
}

details {
  background: rgba(13, 16, 20, 0.42);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  min-width: 0;
  padding: 10px;
}

details summary {
  cursor: pointer;
  padding: 2px 0 8px;
  transition: color 0.2s;
  user-select: none;
}

details summary:hover {
  color: var(--accent);
}

details[open] summary {
  color: var(--text);
  font-weight: 700;
}

.inspector-disclosure {
  padding: 0;
}

.inspector-disclosure > summary.panel-header {
  list-style: none;
  padding: 10px 12px;
}

.inspector-disclosure > summary.panel-header::-webkit-details-marker {
  display: none;
}

.inspector-disclosure > summary.panel-header::after {
  align-items: center;
  background: rgba(236, 244, 239, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  content: "-";
  display: none;
  flex: 0 0 28px;
  font-size: 14px;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  line-height: 1;
  width: 28px;
}

.inspector-disclosure:not([open]) > summary.panel-header::after {
  content: "+";
}

.panel-row {
  margin-top: 6px;
}

.callout {
  color: var(--muted);
  margin: 6px 0;
}

.explain {
  margin: 6px 0;
  white-space: pre-wrap;
}

.chartbox {
  padding-top: 8px;
}

.chartbox canvas {
  max-width: 100%;
}

.export {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
}

.review-handoff-panel {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
}

.review-handoff-panel > p {
  margin: 0;
  padding: 0;
}

.review-handoff-panel .export {
  padding-top: 0;
}

.review-handoff-panel .inspector-status {
  border-top: 1px solid var(--border-soft);
  padding: 9px 0 0;
}

.test-log {
  background: rgba(8, 11, 14, 0.96);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  white-space: pre-wrap;
}

.expert-pane {
  padding-top: 8px;
}

.diagnostic-list {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
}

.diagnostic-card {
  background: rgba(13, 16, 20, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.warn-text {
  color: var(--accent-2);
}

.hotkey-toggle {
  bottom: 14px;
  box-shadow: 0 12px 28px var(--shadow);
  font-size: 12px;
  left: 14px;
  padding: 7px 10px;
  position: fixed;
  z-index: 9999;
}

.sr-only {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.sr-only:focus,
.sr-only:focus-visible {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  clip: auto;
  color: var(--text);
  height: auto;
  left: 12px;
  padding: 8px 10px;
  position: fixed;
  top: 12px;
  width: auto;
  z-index: 10000;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 1440px) {
  .app-header {
    grid-template-columns: minmax(190px, auto) minmax(0, 1fr);
  }

  .header-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .kpis {
    justify-content: flex-start;
  }

  .research-shell {
    grid-template-areas:
      "rail main"
      "rail inspector"
      "rail drawer";
    grid-template-columns: 134px minmax(0, 1fr);
  }

  .research-inspector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
    position: static;
  }
}

@media (max-width: 1100px) {
  .app-header {
    grid-template-columns: 1fr;
  }

  .kpis {
    justify-content: flex-start;
  }

  .research-notice {
    justify-self: start;
  }

  .viewer {
    display: flex;
    flex-direction: column;
  }

  body.calibration-active .viewer {
    display: flex;
  }

  .tile-stage,
  .controls {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .controls,
  body.calibration-active .controls {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .app-header {
    gap: 8px;
    padding: 10px 12px;
    position: static;
  }

  .kpis,
  .header-actions {
    display: none;
  }

  .demo-mode-notice {
    font-size: 12px;
    padding: 7px 12px;
  }

  .mobile-review-mode-bar {
    background: rgba(13, 16, 20, 0.96);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 7px 10px;
    position: sticky;
    top: 0;
    z-index: 998;
  }

  .mobile-review-mode-bar a {
    align-items: center;
    border: 1px solid rgba(67, 214, 197, 0.28);
    border-radius: var(--radius-sm);
    color: var(--accent);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 800;
    justify-content: center;
    min-height: 32px;
    min-width: 72px;
    padding: 5px 8px;
    text-decoration: none;
  }

  .research-shell {
    grid-template-areas:
      "rail"
      "main"
      "inspector"
      "drawer";
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .workflow-rail {
    flex-direction: row;
    min-height: 0;
    overflow-x: auto;
    padding: 6px;
    position: static;
  }

  .workflow-link {
    flex: 0 0 auto;
    grid-template-columns: 28px auto;
    min-height: 38px;
    min-width: 100px;
    padding: 5px 7px;
    transform: none;
  }

  .workflow-link span:last-child {
    white-space: normal;
  }

  .research-inspector,
  .drawer-grid {
    grid-template-columns: 1fr;
  }

  .research-inspector {
    gap: 8px;
    max-height: none;
    overflow: visible;
    position: static;
    top: auto;
  }

  .panel-header,
  .inspector-disclosure > summary.panel-header {
    align-items: center;
    flex-direction: row;
    padding: 10px;
  }

  .panel-header h1,
  .panel-header h2,
  .inspector-disclosure > summary.panel-header h2 {
    min-width: 0;
  }

  .inspector-disclosure > summary.panel-header {
    cursor: pointer;
  }

  .inspector-disclosure > summary.panel-header::after {
    display: inline-flex;
  }

  .inspector-disclosure:not([open]) {
    box-shadow: none;
  }

  .inspector-disclosure:not([open]) > summary.panel-header {
    border-bottom: 0;
  }

  .viewer {
    gap: 12px;
    padding: 10px;
  }

  .visual-sidecar-toolbar,
  .sidecar-select-grid,
  .viewer-tools {
    grid-template-columns: 1fr;
  }

  .viewer-actions {
    justify-content: flex-start;
  }

  .tile-stage {
    padding: 8px;
  }

  .grid,
  .calibration-config-grid,
  .adjudication-queue-grid,
  .observation-review-editor,
  .command-grid,
  body.calibration-active .label-workflow .command-grid {
    grid-template-columns: 1fr;
  }

  .primary-action {
    grid-column: auto;
  }

  .metadata-grid div {
    grid-template-columns: 1fr;
  }

  .contract-line code,
  .reference-item,
  .metadata-grid dd,
  .feed-url {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .drawer-grid details:not([open]) {
    padding-bottom: 8px;
  }

  .progress {
    width: 100%;
  }

  .hotkey-toggle {
    bottom: auto;
    display: block;
    left: auto;
    margin: 0 12px 12px;
    position: static;
    width: calc(100% - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
