:root {
  color-scheme: light;
  --surface: #f7f9fe;
  --surface-low: #f1f4f9;
  --surface-lowest: #ffffff;
  --surface-high: #e5e8ed;
  --surface-highest: #dfe3e8;
  --text: #181c20;
  --muted: #667084;
  --muted-strong: #475467;
  --primary: #00488d;
  --primary-strong: #005fb8;
  --primary-soft: #d6e3ff;
  --tertiary: #7b3200;
  --success: #1a7f48;
  --warning: #8f4d00;
  --ghost-border: rgba(194, 198, 212, 0.22);
  --ambient: 0 24px 48px rgba(24, 28, 32, 0.08);
  --glass-surface: rgba(255, 255, 255, 0.92);
  --glass-surface-soft: rgba(247, 249, 254, 0.9);
  --hover-surface: rgba(214, 227, 255, 0.55);
  --active-surface: rgba(214, 227, 255, 0.8);
  --chip-surface: rgba(214, 227, 255, 0.4);
  --panel-border: #eef2f8;
  --card-surface: #ffffff;
  --canvas-surface: #eef2f7;
  --toast-surface: rgba(24, 28, 32, 0.88);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

:root[data-theme='dark'],
.app-shell[data-theme='dark'] {
  color-scheme: dark;
  --surface: #0b1220;
  --surface-low: #0f172a;
  --surface-lowest: #111b30;
  --surface-high: #22314d;
  --surface-highest: #30415f;
  --text: #e6edf8;
  --muted: #8ea0bd;
  --muted-strong: #c3d0e5;
  --primary: #5aa2ff;
  --primary-strong: #8bc0ff;
  --primary-soft: rgba(90, 162, 255, 0.16);
  --tertiary: #ffb56b;
  --success: #33c273;
  --warning: #e3a449;
  --ghost-border: rgba(148, 163, 184, 0.18);
  --ambient: 0 24px 48px rgba(0, 0, 0, 0.42);
  --glass-surface: rgba(10, 18, 32, 0.84);
  --glass-surface-soft: rgba(17, 27, 48, 0.9);
  --hover-surface: rgba(90, 162, 255, 0.14);
  --active-surface: rgba(90, 162, 255, 0.22);
  --chip-surface: rgba(90, 162, 255, 0.14);
  --panel-border: #22314d;
  --card-surface: #152238;
  --canvas-surface: #172133;
  --toast-surface: rgba(5, 10, 18, 0.96);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--surface);
  color: var(--text);
  font-family: Inter, Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

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

img {
  max-width: 100%;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  height: 100dvh;
  background: var(--surface);
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--panel-border);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  flex: 1;
}

.topbar-left {
  gap: 14px;
}

.topbar-right {
  justify-content: flex-end;
  gap: 10px;
}

.topbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 4px 12px;
  background: var(--surface-low);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  height: 44px;
}

.tool-cluster {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tool-text-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--muted-strong);
  transition: all 140ms ease;
}

.tool-text-btn:hover {
  background: var(--hover-surface);
  color: var(--text);
}

.tool-text-btn.active {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.cluster-divider {
  width: 1px;
  height: 20px;
  background: var(--panel-border);
}

.header-links {
  display: flex;
}

.brand-block {
  flex: 0 0 auto;
}
.topbar .primary-button,
.topbar .ghost-button,
.topbar .secondary-button {
  min-height: 34px;
  padding: 0 14px;
  font-size: 0.76rem;
}

.topbar .icon-button {
  width: 34px;
  height: 34px;
}

.header-overlay-tools {
  position: relative;
}

.overlay-tools-popover {
  right: 0;
  min-width: 292px;
  padding: 14px;
  gap: 12px;
}

.overlay-tools-popover h3,
.overlay-tools-popover p {
  margin: 0;
}

.overlay-tools-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.overlay-tools-popover h3 {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.overlay-tool-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
}

.overlay-tool-label {
  min-width: 64px;
  color: var(--muted-strong);
  font-size: 0.74rem;
  font-weight: 600;
}

.overlay-tool-row strong {
  min-width: 42px;
  text-align: right;
  font-size: 0.73rem;
  font-weight: 600;
}

.overlay-tool-row input[type="range"] {
  flex: 1;
}

.overlay-tool-row input[type="color"] {
  width: 36px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--surface-lowest);
}

.overlay-tools-popover .micro-copy {
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted-strong);
}

.overlay-tools-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}

.overlay-tools-actions .secondary-button,
.overlay-tools-actions .ghost-button {
  flex: 1;
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
}

.overlay-tools-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 10px 0;
}

.overlay-tools-section {
  padding-top: 4px;
}

.overlay-tools-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 8px 0;
}

.tier-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-bottom: 8px;
}

.tier-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  cursor: pointer;
  user-select: none;
}

.tier-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
  cursor: pointer;
}

.tier-actions {
  display: flex;
  gap: 8px;
}

.tier-actions .ghost-button {
  flex: 1;
  min-height: 26px;
  padding: 0 8px;
  font-size: 0.68rem;
}

.topbar .case-chip {
  min-height: 30px;
  padding: 0 12px;
  font-size: 0.7rem;
}
.hero-actions,
.workspace-meta-strip,
.workspace-command-strip,
.command-cluster,
.workspace-body,
.panel-header-row,
.trace-actions,
.footer-left,
.footer-right,
.left-rail-top,
.left-rail-bottom,
.left-tools,
.left-nav,
.setup-actions,
.setup-grid,
.info-grid,
.export-grid,
.compact-actions,
.modal-header,
.modal-body,
.recent-list,
.analysis-formulas,
.measurements-block,
.floating-toolbox,
.floating-card,
.zoom-pill,
.popover,
.layers-popover,
.meta-cluster,
.precision-panel,
.workflow-panel,
.workflow-meta-grid,
.workflow-sequence,
.magnifier-meta {
  display: flex;
  gap: 12px;
}

.topbar-left,
.topbar-right,
.panel-header-row,
.footer-left,
.footer-right,
.workspace-command-strip,
.workspace-meta-strip,
.meta-cluster {
  align-items: center;
}

.header-links {
  align-items: center;
  gap: 8px;
}

.case-chip {
  flex: 0 0 auto;
}

.brand-title {
  font-family: Manrope, Inter, Arial, sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--primary-strong);
}

.header-link,
.ghost-button,
.secondary-button,
.control-button,
.next-target-button,
.trace-toggle-button,
.popover-item,
.rail-nav-button,
.rail-tool-button,
.floating-tool-button,
.right-tab,
.recent-item,
.export-card,
.next-landmark-card,
.ghost,
.icon-button {
  border-radius: var(--radius-md);
  transition: background-color 140ms ease, color 140ms ease, opacity 140ms ease, transform 140ms ease;
}

.header-link {
  padding: 10px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted-strong);
}

.header-link:hover,
.header-link.active,
.ghost-button:hover,
.secondary-button:hover,
.control-button:hover,
.trace-toggle-button:hover,
.popover-item:hover,
.recent-item:hover {
  background: var(--hover-surface);
}

.case-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--chip-surface);
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.case-chip.editing {
  gap: 8px;
  padding-right: 8px;
}

.case-chip-input {
  min-width: 180px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.case-chip-input:focus {
  outline: none;
}

.case-chip-edit {
  width: 28px;
  height: 28px;
}

.case-chip-dot,
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(194, 198, 212, 0.6);
}

.status-dot.placed {
  background: var(--success);
}

.status-dot.target {
  background: var(--primary);
  animation: targetPulse 1.2s ease-in-out infinite;
}

.status-dot.skipped {
  background: var(--muted);
}

.status-dot.pending {
  background: rgba(194, 198, 212, 0.6);
}

@keyframes targetPulse {
  0% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0.5; transform: scale(1); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 72, 141, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(0, 72, 141, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 72, 141, 0); }
}

.ghost-button,
.secondary-button,
.control-button,
.next-target-button,
.trace-toggle-button,
.popover-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  background: var(--surface-low);
  color: var(--text);
  font-size: 0.79rem;
  font-weight: 700;
}

.primary-button {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 12px;
  background: linear-gradient(45deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 18px rgba(0, 72, 141, 0.18);
}

.primary-button:hover {
  opacity: 0.94;
}

.primary-button.compact,
.secondary-button.compact {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.72rem;
}

.pulse {
  animation: pulse 1.5s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

.primary-button:hover,
.secondary-button:hover,
.control-button:hover,
.ghost-button:hover {
  transform: scale(1.02);
}

.primary-button:active,
.secondary-button:active,
.control-button:active,
.ghost-button:active {
  transform: scale(0.98);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--muted-strong);
}

.icon-button:hover,
.ghost:hover {
  background: var(--hover-surface);
}

.popover {
  position: absolute;
  top: 52px;
  right: 18px;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--glass-surface-soft);
  backdrop-filter: blur(24px);
  box-shadow: var(--ambient);
}

.popover-item {
  justify-content: flex-start;
  text-align: left;
}

.main-layout {
  display: grid;
  grid-template-columns: 72px 1fr;
  min-height: 0;
}

.main-layout:fullscreen {
  width: 100%;
  height: 100%;
  background: var(--surface);
}

.left-rail {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 18px 8px;
  background: var(--surface-low);
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 220ms ease, padding 220ms ease, opacity 220ms ease;
}

.left-rail-top,
.left-rail-bottom,
.left-tools,
.left-nav {
  flex-direction: column;
  align-items: center;
}

.left-rail-top {
  gap: 8px;
}

.left-rail-bottom {
  gap: 6px;
  margin-top: auto;
}

.left-tools {
  gap: 4px;
}

.profile-badge {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(180deg, #1f93d6, #2870bd);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
}

.rail-nav-button,
.rail-tool-button,
.floating-tool-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #7f8da5;
}

.rail-nav-button:hover,
.rail-tool-button:hover,
.floating-tool-button:hover {
  background: var(--glass-surface);
  color: var(--primary);
}

.rail-nav-button.active,
.rail-tool-button.active,
.floating-tool-button.active,
.right-tab.active,
.control-button.active,
.trace-toggle-button.active {
  background: var(--active-surface);
  color: var(--primary);
}

.rail-divider {
  width: 28px;
  height: 1px;
  background: rgba(114, 119, 131, 0.22);
}

.app-shell.nav-collapsed .main-layout {
  grid-template-columns: 0 1fr;
}

.app-shell.nav-collapsed .left-rail {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
}

.screen-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.panel-screen,
.workspace-screen {
  display: none;
  width: 100%;
  min-height: 0;
  height: 100%;
}

.panel-screen.active,
.workspace-screen.active {
  display: flex;
}

.panel-screen {
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow: auto;
}

.panel-screen[data-screen="welcome"],
.panel-screen[data-screen="setup"] {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  overflow: hidden;
}

.overlay-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
  border-radius: 28px;
  background: var(--surface-lowest);
  box-shadow: var(--ambient);
}

.home-surface,
.setup-surface {
  width: 100%;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  justify-content: center;
  border-radius: 0;
  box-shadow: none;
  border: 0;
  padding: 36px 42px;
}

.home-surface {
  background: linear-gradient(180deg, var(--surface-lowest) 0%, var(--surface-low) 100%);
}

.setup-surface {
  background: var(--surface-lowest);
}

.overlay-panel.large {
  width: 100%;
}

.overlay-panel.medium {
  width: 100%;
}

.section-kicker,
.micro-label,
.analysis-kicker,
.measurements-block h3,
.panel-header-row h2,
.footer-bar,
.pill-badge {
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.section-kicker,
.analysis-kicker,
.micro-label,
.overlay-copy,
.readonly-field span,
.form-field span,
.hint-strip,
.measurements-block h3,
.footer-bar,
.workflow-copy,
.magnifier-meta {
  color: var(--muted);
}

.overlay-panel h1,
.workflow-title {
  margin: 0;
  font-family: Manrope, Inter, Arial, sans-serif;
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  line-height: 1.03;
  letter-spacing: -0.04em;
}

.overlay-copy {
  max-width: 720px;
  font-size: 0.96rem;
  line-height: 1.7;
}

.info-grid,
.setup-grid,
.export-grid {
  display: grid;
  gap: 18px;
}

.info-grid {
  grid-template-columns: 1.2fr 1fr;
}

.setup-grid {
  grid-template-columns: 1.1fr 1fr;
}

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

.info-card,
.setup-card,
.export-card,
.analysis-card,
.trace-item,
.landmark-card,
.measurement-row,
.empty-card,
.dropzone,
.readonly-field,
.next-landmark-card {
  border-radius: var(--radius-lg);
  background: var(--surface-low);
}

.info-card,
.setup-card,
.analysis-card,
.export-card {
  padding: 18px;
  border: 1px solid var(--panel-border);
}

.export-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 6px;
  cursor: pointer;
}

.export-card:hover {
  background: var(--hover-surface);
  border-color: var(--primary-soft);
}

.export-card span {
  font-size: 0.78rem;
  color: var(--muted);
}

.setup-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-radius: var(--radius-lg);
  background: var(--surface-low);
}

.setup-card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.setup-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.analysis-selector {
  display: grid;
  gap: 10px;
}
.analysis-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: var(--surface-lowest);
}
  text-align: left;
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.analysis-option:hover {
  border-color: var(--primary-soft);
  background: var(--hover-surface);
}

.analysis-option.active {
  border-color: var(--primary);
  background: var(--active-surface);
  box-shadow: inset 0 0 0 1px var(--primary-soft);
}

.analysis-option-title {
  display: block;
  font-size: 0.92rem;
  color: var(--text);
}

.analysis-option-copy {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.info-card h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 700;
}

.info-card ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted-strong);
  line-height: 1.9;
}

.recent-list {
  flex-direction: column;
  gap: 10px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 0 14px;
  background: var(--surface-lowest);
  font-size: 0.83rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: background-color 140ms ease;
}

.recent-item:hover {
  background: var(--hover-surface);
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 260px;
  padding: 26px;
  border: 2px dashed var(--ghost-border);
  text-align: center;
  color: var(--muted-strong);
  background: linear-gradient(180deg, var(--surface-lowest), var(--surface-low));
}

.import-zone {
  min-height: 240px;
}

.import-zone-kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--primary);
}

.import-zone-title {
  font-family: Manrope, Inter, Arial, sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.import-zone-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.dropzone.drag-over {
  background: var(--active-surface);
  border-color: var(--primary);
}

.setup-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup-name-field {
  max-width: 360px;
}

.form-field input,
.workspace-meta-strip input,
#zoom-slider {
  accent-color: var(--primary);
}

.form-field input,
.workspace-meta-strip input {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 0;
  background: var(--surface-high);
  color: var(--text);
}

.readonly-field {
  padding: 12px 14px;
}

.readonly-field div {
  margin-top: 8px;
  color: var(--text);
  font-weight: 600;
}

.workspace-screen {
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
}

.workspace-calibration-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  min-height: 52px;
  padding: 0 18px;
  background: var(--glass-surface-soft);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--surface-high);
}

.workspace-meta-strip,
.workspace-command-strip {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  gap: 10px 12px;
}

.workspace-meta-strip {
  flex: 0 1 auto;
}

.workspace-command-strip {
  flex: 1 1 auto;
  justify-content: flex-end;
}

.command-cluster,
.meta-cluster {
  min-width: 0;
  flex-wrap: wrap;
}

.meta-cluster {
  gap: 8px;
}

.command-cluster {
  gap: 8px;
  align-items: center;
}

.sensitivity-cluster {
  min-width: 140px;
}

.manual-scale-cluster {
  min-width: 190px;
}

.scale-input {
  width: 72px !important;
}

.sensitivity-cluster input[type="range"] {
  width: 72px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--ghost-border);
  border-radius: 2px;
  outline: none;
}

.sensitivity-cluster input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

.sensitivity-cluster input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

.workspace-meta-strip input {
  width: 48px;
  text-align: center;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0 4px;
  background: var(--surface-lowest);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
}

.workspace-meta-strip input[type="number"] {
  min-height: 28px;
  -moz-appearance: textfield;
}

.workspace-meta-strip input[type="number"]::-webkit-outer-spin-button,
.workspace-meta-strip input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.workspace-calibration-bar .micro-label {
  font-size: 0.64rem;
  letter-spacing: 0.12em;
}

.workspace-calibration-bar .micro-label.unit {
  letter-spacing: 0.08em;
}

.metric-value {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--primary);
}

.cluster-divider {
  width: 1px;
  height: 20px;
  background: rgba(114, 119, 131, 0.22);
}

.next-target-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(214, 227, 255, 0.64);
  color: var(--primary);
}

.next-target-button strong {
  font-size: 0.78rem;
  color: var(--primary-strong);
}

.calibration-action-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.primary-button.compact.ready-action {
  background: linear-gradient(45deg, #c76b00 0%, #f59e0b 100%);
  box-shadow: 0 10px 18px rgba(180, 83, 9, 0.24);
}

.workspace-command-strip .control-button,
.workspace-command-strip .primary-button.compact,
.workspace-command-strip .secondary-button.compact {
  min-height: 34px;
  padding: 0 11px;
  font-size: 0.72rem;
}

.workspace-command-strip .control-button {
  font-weight: 800;
}

.workspace-command-strip .material-symbols-outlined {
  font-size: 19px;
}

.workspace-calibration-bar .cluster-divider {
  height: 16px;
}

.workspace-body {
  min-height: 0;
  flex: 1;
  gap: 0;
}

.canvas-column {
  flex: 1;
  min-width: 0;
  padding: 18px;
}

.workspace-splitter {
  position: relative;
  flex: 0 0 10px;
  min-width: 10px;
  z-index: 12;
  cursor: col-resize;
  pointer-events: auto;
  background: transparent;
}

.workspace-splitter::before {
  content: '';
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(114, 119, 131, 0.22);
  transition: background-color 120ms ease, width 120ms ease;
}

.workspace-splitter:hover::before,
.workspace-splitter.dragging::before {
  width: 4px;
  background: rgba(0, 72, 141, 0.34);
}

.canvas-surface {
  position: relative;
  height: 100%;
  min-height: clamp(320px, 52vh, 540px);
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: var(--canvas-surface);
}

.canvas-surface[data-tool="point"],
.canvas-surface[data-tool="line"],
.canvas-surface[data-tool="angle"],
.canvas-surface[data-tool="calibration"] {
  cursor: crosshair;
}

.canvas-surface[data-tool="pan"] {
  cursor: grab;
}

.empty-stage {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  color: var(--muted-strong);
}

.empty-stage .material-symbols-outlined {
  font-size: 42px;
  color: var(--primary);
}

.empty-stage h3,
.empty-stage p,
.panel-header-row h2,
.measurements-block h3,
.analysis-card strong,
.landmark-card h3,
.trace-item h4 {
  margin: 0;
}

.viewport {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
}

.workspace-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  box-shadow: 0 28px 42px rgba(24, 28, 32, 0.12);
}

.overlay-svg {
  position: absolute;
  inset: 0;
  overflow: visible;
}

.floating-toolbox {
  position: absolute;
  top: 76px;
  right: 18px;
  z-index: 8;
  flex-direction: column;
}

.floating-card {
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 18px;
  background: var(--glass-surface-soft);
  backdrop-filter: blur(24px);
  box-shadow: var(--ambient);
}

.layers-popover {
  position: absolute;
  top: 160px;
  right: 76px;
  z-index: 10;
  flex-direction: column;
  gap: 10px;
  min-width: 200px;
  padding: 14px;
  border-radius: 18px;
  background: var(--glass-surface-soft);
  backdrop-filter: blur(24px);
  box-shadow: var(--ambient);
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-strong);
  font-size: 0.82rem;
  font-weight: 600;
}

.zoom-pill {
  position: absolute;
  bottom: 22px;
  left: 50%;
  z-index: 8;
  align-items: center;
  min-height: 56px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--glass-surface-soft);
  backdrop-filter: blur(24px);
  box-shadow: var(--ambient);
  transform: translateX(-50%);
}

.zoom-pill input {
  width: 180px;
}

.zoom-pill span {
  min-width: 52px;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 800;
}

.right-panel {
  display: flex;
  flex-direction: column;
  width: 340px;
  min-width: 340px;
  min-height: 0;
  background: var(--surface-lowest);
}

.precision-panel {
  display: none;
}

.compact-row {
  gap: 8px;
}

.panel-header-row.compact-row h2 {
  font-size: 0.78rem;
}

.loupe-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.loupe-zoom-button {
  min-width: 38px;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted-strong);
  font-size: 0.7rem;
  font-weight: 800;
}

.loupe-zoom-button.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.magnifier-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  background: #eff3f8;
}

.magnifier-stage::before,
.magnifier-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.magnifier-stage::before {
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: rgba(0, 72, 141, 0.42);
}

.magnifier-stage::after {
  top: 50%;
  height: 1px;
  transform: translateY(-50%);
  background: rgba(0, 72, 141, 0.42);
}

#magnifier-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.magnifier-meta {
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
}

.canvas-loupe {
  position: absolute;
  top: 90px;
  left: 28px;
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 320px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(247, 249, 254, 0.92);
  backdrop-filter: blur(20px);
  box-shadow: var(--ambient);
  pointer-events: none;
}

.canvas-loupe.hidden {
  display: none !important;
}

.canvas-loupe-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: move;
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 800;
  pointer-events: auto;
}

.canvas-loupe-stage {
  width: 100%;
}

.canvas-loupe-meta {
  color: var(--muted-strong);
  pointer-events: none;
}

.canvas-loupe .loupe-zoom-controls,
.canvas-loupe .loupe-zoom-button {
  pointer-events: auto;
}

.canvas-loupe-stage,
.canvas-loupe-stage canvas {
  pointer-events: none;
}

.landmark-table-card {
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  background: var(--surface-lowest);
}

.landmark-table-head,
.landmark-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) 64px;
  gap: 6px;
  align-items: center;
}

.landmark-table-head {
  padding: 8px 12px;
  border-bottom: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

#landmark-table-rows {
  display: flex;
  flex-direction: column;
}

.landmark-table-row {
  min-height: 38px;
  padding: 0 12px;
  border-bottom: 1px solid var(--ghost-border);
  background: transparent;
}

.landmark-table-row:last-child {
  border-bottom: 0;
}

.landmark-table-row.active {
  background: var(--active-surface);
}

.landmark-table-row.skipped {
  opacity: 0.72;
}

.landmark-name-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 800;
  color: #3a529b;
  font-size: 0.76rem;
}

.landmark-row-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3b82f6;
  flex: 0 0 auto;
}

.landmark-row-dot.active {
  background: #fb923c;
}

.landmark-coord-cell {
  color: #c1cad7;
  font-size: 0.66rem;
  font-weight: 700;
}

.landmark-coord-cell.active {
  color: #3a529b;
  font-style: italic;
}

.landmark-action-cell {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}

.row-edit-button,
.row-place-button {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 10px;
  color: #c1cad7;
  font-size: 0.76rem;
}

.row-edit-button:hover,
.row-place-button:hover {
  background: rgba(214, 227, 255, 0.55);
  color: #3a529b;
}

.placing-pill {
  display: inline-flex;
  align-items: center;
  min-height: 16px;
  padding: 0 5px;
  border-radius: 6px;
  background: #ceddfd;
  color: #3a529b;
  font-size: 0.5rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.analysis-table {
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  background: var(--card-surface);
}

.analysis-norm-switcher,
.analysis-footer-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: var(--card-surface);
}

.analysis-norm-switcher-copy,
.analysis-footer-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.analysis-norm-switcher-copy strong {
  font-size: 0.82rem;
}

.analysis-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.analysis-footer-card {
  gap: 12px;
}

.analysis-footer-card .micro-copy {
  margin: 0;
  line-height: 1.45;
}

.analysis-table-head,
.analysis-table-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}

.analysis-table-head {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.analysis-table-head span:not(:first-child) {
  text-align: center;
}

.analysis-table-body {
  display: flex;
  flex-direction: column;
}

.analysis-table-row {
  min-height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--panel-border) 72%, transparent);
  cursor: pointer;
}

.analysis-table-row:hover {
  background: var(--hover-surface);
}

.analysis-table-row.selected {
  background: var(--active-surface);
  box-shadow: inset 2px 0 0 var(--primary);
}

.analysis-table-row.overlay-active {
  background: var(--active-surface);
  box-shadow: inset 3px 0 0 var(--primary);
}

.analysis-table-row:last-child {
  border-bottom: 0;
}

.diagnostic-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: var(--card-surface);
  border: 1px solid var(--panel-border);
}

.diagnostic-item-head,
.diagnostic-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.diagnostic-item-head strong {
  font-size: 0.8rem;
}

.diagnostic-item-head span {
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 700;
}

.diagnostic-item-actions button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--surface-low);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.diagnostic-sublist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.diagnostic-subitem {
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-low);
  color: var(--muted-strong);
  font-size: 0.66rem;
  font-weight: 700;
}

.diagnostic-subitem.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.diagnostic-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-low);
  border: 1px solid var(--panel-border);
}

.diagnostic-detail-line {
  color: var(--muted-strong);
  font-size: 0.68rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.analysis-name-cell {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
}

.analysis-norm-cell,
.analysis-value-cell {
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
}

.analysis-norm-cell {
  color: var(--muted);
}

.analysis-value-cell {
  color: var(--primary);
}

.analysis-value-cell.pending {
  color: #c1cad7;
  font-style: italic;
}

.analysis-value-cell.norm-ok {
  color: #15803d;
}

.analysis-value-cell.norm-warn {
  color: #b45309;
}

.analysis-value-cell.norm-bad {
  color: #dc2626;
}

#confirm-calibration-button.calibration-ready {
  animation: confirmPulse 1s ease-in-out infinite;
  outline: 2px solid rgba(18, 57, 172, 0.22);
}

@keyframes confirmPulse {
  0% { box-shadow: 0 10px 18px rgba(0, 72, 141, 0.18); filter: brightness(1); }
  50% { box-shadow: 0 14px 28px rgba(0, 72, 141, 0.28); filter: brightness(1.08); }
  100% { box-shadow: 0 10px 18px rgba(0, 72, 141, 0.18); filter: brightness(1); }
}

.instruction-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 0;
  background: var(--surface-low);
  color: var(--text);
  margin: auto -16px -16px;
  border-top: 1px solid var(--panel-border);
}

.stable-instruction-card {
  margin: 0;
  flex: 0 0 auto;
}

.instruction-header-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.instruction-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.instruction-config-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 8px;
  padding: 8px 10px;
  background: var(--surface-lowest);
  border-radius: 10px;
  border: 1px solid var(--panel-border);
}

.compact-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.compact-input-group input {
  width: 54px;
  height: 26px;
  text-align: center;
  font-weight: 700;
  font-size: 0.8rem;
  background: var(--surface-low);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text);
}

.instruction-header-row h2 {
  margin: 0;
  color: var(--text);
  font-family: Manrope, Inter, Arial, sans-serif;
  font-size: 1.1rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.instruction-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.instruction-title-verb {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(226, 236, 255, 0.82);
}

.instruction-title-target {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: linear-gradient(45deg, #ffe08a 0%, #f59e0b 100%);
  color: #592800;
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  box-shadow: 0 10px 18px rgba(180, 83, 9, 0.18);
}

.instruction-title-target.actionable {
  animation: pulse 1.5s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

.instruction-title-target.confirm {
  background: linear-gradient(45deg, #ffe08a 0%, #f59e0b 100%);
  color: #592800;
  box-shadow: 0 10px 18px rgba(180, 83, 9, 0.28);
}

.instruction-title.ready .instruction-title-verb {
  color: rgba(255, 237, 183, 0.9);
}

.instruction-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-highest);
  color: var(--text);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.instruction-badge.accent {
  background: var(--warning);
  color: #ffffff;
}

.instruction-copy {
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.8rem;
  line-height: 1.4;
}

.reference-card {
  gap: 12px;
}

.reference-title {
  font-size: 1rem;
}

.reference-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reference-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reference-block.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.reference-block strong {
  font-size: 0.82rem;
  color: #ffffff;
  line-height: 1.35;
}

.instruction-actions {
  display: flex;
  gap: 8px;
}

.instruction-button {
  flex: 1;
  min-height: 28px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.instruction-button.light {
  background: var(--surface-lowest);
  color: var(--primary);
  border: 1px solid var(--panel-border);
}

.instruction-button.dark {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.compact-field {
  gap: 6px;
}

.compact-field span {
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.sensitivity-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sensitivity-row input {
  flex: 1;
}

.sensitivity-row strong {
  min-width: 42px;
  text-align: right;
  font-size: 0.76rem;
}

.right-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px 10px 0;
}

.right-tab {
  min-height: 52px;
  border-radius: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.right-tab.active {
  background: none;
  box-shadow: inset 0 -2px 0 var(--primary);
}

.right-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 16px 16px;
}

.right-tab-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.right-tab-panel.active {
  display: flex;
}

.panel-header-row h2 {
  font-size: 0.94rem;
  font-weight: 800;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.62rem;
  font-weight: 800;
}

#landmark-cards,
#measurement-list,
#analysis-list,
#trace-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.landmark-card,
.trace-item,
.measurement-row,
.analysis-card,
.empty-card {
  padding: 14px;
}

.landmark-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.landmark-card.selected {
  background: var(--hover-surface);
}

.landmark-card-head,
.trace-item-head,
.measurement-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.landmark-card-head strong,
.trace-item-head strong,
.measurement-row strong {
  font-size: 0.84rem;
}

.landmark-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  flex: 0 0 auto;
}

.landmark-card-actions,
.trace-item-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.landmark-card-actions button,
.trace-item-actions button {
  min-height: 34px;
  border-radius: 10px;
  background: var(--surface-low);
  color: var(--text);
  border: 1px solid var(--panel-border);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.next-landmark-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 96px;
  border: 1px dashed var(--ghost-border);
  color: var(--muted-strong);
}

.measurements-block {
  flex-direction: column;
}

.measurements-block h3 {
  font-size: 0.66rem;
  font-weight: 800;
}

.measurement-row {
  min-height: 42px;
  border-radius: 14px;
  background: var(--surface-low);
}

.analysis-card {
  flex-direction: column;
  gap: 10px;
}

.analysis-formulas {
  flex-direction: column;
  gap: 8px;
  color: var(--muted-strong);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.78rem;
}

.trace-actions {
  flex-wrap: wrap;
}

.trace-toggle-button {
  min-width: auto;
  min-height: 28px;
  padding: 0 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hint-strip {
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(45deg, #0c4597 0%, #0d5fb8 100%);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.5;
}

.main-layout:fullscreen .workspace-calibration-bar {
  min-height: 46px;
  padding: 0 12px;
}

.main-layout:fullscreen .workspace-meta-strip,
.main-layout:fullscreen .workspace-command-strip,
.main-layout:fullscreen .command-cluster {
  gap: 10px;
}

.main-layout:fullscreen .control-button,
.main-layout:fullscreen .next-target-button,
.main-layout:fullscreen .primary-button.compact {
  min-height: 32px;
  padding-inline: 10px;
  font-size: 0.7rem;
}

.main-layout:fullscreen .canvas-column {
  padding: 10px;
}

.main-layout:fullscreen .workspace-splitter {
  flex-basis: 12px;
  min-width: 12px;
}

.main-layout:fullscreen .right-panel {
  display: flex;
  flex-direction: column;
  width: 420px;
  min-width: 420px;
}

.main-layout:fullscreen .precision-panel {
  display: none;
}

.main-layout:fullscreen .magnifier-stage,
.main-layout:fullscreen #magnifier-canvas {
  max-height: 280px;
}

.main-layout:fullscreen .magnifier-stage {
  width: 100%;
}

.main-layout:fullscreen .canvas-loupe {
  width: 340px;
}

.main-layout:fullscreen .magnifier-meta,
.main-layout:fullscreen .hint-strip,
.main-layout:fullscreen .measurement-row,
.main-layout:fullscreen .landmark-card-head strong,
.main-layout:fullscreen .trace-item-head strong,
.main-layout:fullscreen .landmark-card-head span,
.main-layout:fullscreen .trace-item-head span {
  font-size: 0.7rem;
}

.main-layout:fullscreen .right-tabs {
  padding: 6px 8px 0;
}

.main-layout:fullscreen .right-tab {
  min-height: 40px;
  font-size: 0.62rem;
}

.main-layout:fullscreen .right-panel-body {
  padding: 10px;
}

.main-layout:fullscreen .right-tab-panel {
  gap: 10px;
}

.main-layout:fullscreen #landmark-table-rows,
.main-layout:fullscreen #measurement-list,
.main-layout:fullscreen #analysis-list,
.main-layout:fullscreen #trace-list,
.main-layout:fullscreen .measurements-block,
.main-layout:fullscreen .analysis-formulas,
.main-layout:fullscreen .trace-actions {
  gap: 8px;
}

.main-layout:fullscreen .landmark-table-row,
.main-layout:fullscreen .analysis-table-row,
.main-layout:fullscreen .trace-item,
.main-layout:fullscreen .measurement-row,
.main-layout:fullscreen .analysis-card,
.main-layout:fullscreen .empty-card {
  padding: 10px 12px;
}

.main-layout:fullscreen .trace-item-actions {
  gap: 6px;
}

.main-layout:fullscreen .trace-item-actions button,
.main-layout:fullscreen .loupe-zoom-button {
  min-height: 28px;
  font-size: 0.66rem;
}

.main-layout:fullscreen .analysis-table-head,
.main-layout:fullscreen .analysis-table-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.main-layout:fullscreen .analysis-name-cell,
.main-layout:fullscreen .analysis-norm-cell,
.main-layout:fullscreen .analysis-value-cell {
  font-size: 0.68rem;
}

.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.63rem;
  font-weight: 800;
  color: #8892a5;
}

.footer-left,
.footer-right {
  gap: 18px;
}

.footer-version {
  color: #c5cdd9;
}

@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-fade-in {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  animation: screenFadeIn 300ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.right-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.right-tab-panel.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 28, 32, 0.32);
  animation: modalBackdropIn 250ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: min(420px, 100%);
  border-radius: 24px;
  background: var(--glass-surface-soft);
  backdrop-filter: blur(24px);
  box-shadow: var(--ambient);
  animation: modalCardIn 250ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-header,
.modal-body {
  padding: 18px 20px;
}

.modal-header {
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-family: Manrope, Inter, Arial, sans-serif;
  font-size: 1.1rem;
}

.modal-body {
  flex-direction: column;
  gap: 14px;
}

.help-copy p {
  margin: 0;
  color: var(--muted-strong);
  line-height: 1.6;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 44px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-10px); opacity: 0; }
}

.toast {
  min-width: 220px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--toast-surface);
  color: #fff;
  font-size: 0.82rem;
  box-shadow: var(--ambient);
  animation: toastIn 300ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.exiting {
  animation: toastOut 200ms ease forwards;
}

.overlay-line {
  stroke: var(--overlay-line-color, rgba(0, 72, 141, 0.72));
  stroke-width: var(--overlay-line-width, 7.5px);
}

.overlay-construction {
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-opacity: 0.82;
}

.overlay-construction-baseline {
  stroke: var(--overlay-line-color, rgba(0, 72, 141, 0.48));
  stroke-width: calc(var(--overlay-line-width, 7.5px) * 1.06);
}

.overlay-group-hovered .overlay-construction-baseline,
.overlay-group-hovered .overlay-construction-measurement,
.overlay-group-hovered .overlay-construction-projection,
.overlay-group-hovered .overlay-landmark-dot {
  stroke: #ff3b30 !important;
  stroke-width: calc(var(--overlay-line-width, 7.5px) * 2.4) !important;
}
.overlay-group-hovered .overlay-angle-arc {
  stroke: #ff3b30 !important;
}
.overlay-group-hovered .overlay-measurement {
  fill: #ff3b30 !important;
  stroke: rgba(255, 255, 255, 0.95) !important;
}

.overlay-construction-projection {
  stroke: var(--overlay-line-color, rgba(18, 57, 172, 0.92));
  stroke-width: var(--overlay-line-width, 7.5px);
  stroke-dasharray: 10px 6px;
  stroke-linecap: round;
}

.overlay-construction-measurement {
  stroke: var(--overlay-line-color, rgba(18, 57, 172, 0.92));
  stroke-width: calc(var(--overlay-line-width, 7.5px) * 1.14);
}

.overlay-construction-point {
  fill: #ffffff;
  stroke: rgba(18, 57, 172, 0.92);
  stroke-width: 1.2;
}

.overlay-construction-softtissue {
  stroke: rgba(180, 83, 9, 0.82);
  stroke-width: 1.9;
  stroke-opacity: 0.96;
}

.overlay-angle-leg {
  stroke: var(--overlay-line-color, rgba(123, 50, 0, 0.72));
  stroke-width: var(--overlay-line-width, 7.5px);
}

.overlay-calibration-line {
  stroke: var(--overlay-line-color, rgba(0, 95, 184, 0.92));
  stroke-width: var(--overlay-line-width, 7.5px);
}

.overlay-ruler-line {
  stroke: rgba(0, 72, 141, 0.32);
  stroke-width: 1;
}

.overlay-ruler-tick {
  stroke: rgba(0, 72, 141, 0.36);
  stroke-width: 0.9;
}

.overlay-landmark {
  fill: var(--overlay-landmark-color, var(--primary));
  stroke: #fff;
  stroke-width: 1.2;
}

.overlay-landmark.selected {
  fill: var(--tertiary);
}

.overlay-landmark.just-placed {
  animation: landmarkPop 350ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes selectedRing {
  0% { r: 5; opacity: 0.7; }
  100% { r: 14; opacity: 0; }
}

.overlay-landmark-ring {
  animation: selectedRing 1.4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  fill: none;
  stroke: var(--overlay-landmark-color, var(--primary));
  stroke-width: 1.5;
}

@keyframes measurementFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.overlay-measurement {
  animation: measurementFadeIn 250ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.landmark-table-row.skipped {
  opacity: 0.45;
  transition: opacity 300ms ease;
}

@keyframes calibrationSuccess {
  0% { fill: var(--success); filter: drop-shadow(0 0 6px var(--success)); }
  100% { fill: var(--overlay-landmark-color, var(--primary)); filter: none; }
}

.calibration-success {
  animation: calibrationSuccess 800ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes calibrationSuccessText {
  0% { fill: var(--success); }
  100% { fill: var(--overlay-landmark-color, var(--primary)); }
}

.calibration-success-text {
  animation: calibrationSuccessText 800ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.overlay-label,
.overlay-calibration-text,
.overlay-ruler-text {
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-size: var(--overlay-label-size, 16px);
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.98);
  stroke-width: var(--overlay-label-stroke-width, 5px);
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}

.overlay-label-leader {
  stroke: var(--muted-strong);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  opacity: 0.6;
  pointer-events: none;
}

.overlay-label {
  fill: var(--overlay-label-color, #ff2d55);
  font-weight: 900;
}

.overlay-measurement {
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-size: var(--overlay-label-size, 16px);
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.98);
  stroke-width: calc(var(--overlay-label-stroke-width, 4.5px) * 0.95);
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.12));
}

.diagnostic-overlay-group {
  transition: opacity 150ms ease-out;
}

.overlay-angle-arc {
  fill: none;
  stroke: var(--overlay-line-color, rgba(123, 50, 0, 0.72));
  stroke-width: calc(var(--overlay-line-width, 7.5px) * 1.06);
  stroke-linecap: round;
  opacity: 0.92;
  transition: opacity 150ms ease-out;
}

.overlay-construction {
  transition: opacity 150ms ease-out;
}

.overlay-reference-line {
  stroke: var(--overlay-line-color, rgba(0, 95, 184, 0.92));
  stroke-width: calc(var(--overlay-line-width, 7.5px) * 0.72);
  stroke-linecap: round;
  opacity: 0.88;
}

.overlay-reference-line-surrogate {
  stroke-dasharray: 18 10;
  opacity: 0.78;
}

.overlay-reference-line-n-perp {
  stroke: #7c3aed;
  stroke-dasharray: 14 8;
  opacity: 0.84;
}

.overlay-reference-angle {
  fill: none;
  stroke: rgba(0, 95, 184, 0.9);
  stroke-width: calc(var(--overlay-line-width, 7.5px) * 0.42);
  stroke-linecap: round;
}

.overlay-reference-angle-label,
.overlay-reference-right-angle-label {
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-size: calc(var(--overlay-label-size, 16px) * 0.85);
  font-weight: 800;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: calc(var(--overlay-label-stroke-width, 4px) * 0.80);
  stroke-linejoin: round;
}

.overlay-reference-angle-label {
  fill: rgba(0, 95, 184, 0.94);
}

.overlay-reference-right-angle {
  fill: none;
  stroke: #7c3aed;
  stroke-width: calc(var(--overlay-line-width, 7.5px) * 0.42);
  stroke-linecap: round;
}

.overlay-reference-right-angle-label {
  fill: #7c3aed;
}

.overlay-construction-label {
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-size: calc(var(--overlay-label-size, 16px) * 0.90);
  font-weight: 800;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: calc(var(--overlay-label-stroke-width, 4px) * 0.85);
  stroke-linejoin: round;
  fill: rgba(13, 22, 40, 0.92);
}

.overlay-measurement,
.overlay-ruler-text {
  fill: #0d1628;
}

.overlay-calibration-text {
  fill: #0a4e86;
}

.border-ruler-line {
  stroke: #1a3a5c;
  stroke-width: 1.5;
}

.border-ruler-tick-major {
  stroke: #1a3a5c;
  stroke-width: 1.2;
}

.border-ruler-tick-minor {
  stroke: #1a3a5c;
  stroke-width: 0.8;
}

.border-ruler-text {
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-size: calc(var(--overlay-label-size, 16px) * 0.6);
  fill: #1a3a5c;
}

.empty-card {
  color: var(--muted-strong);
}

@media (max-width: 1180px) {
  .right-panel {
    width: 300px;
    min-width: 300px;
  }

  .header-links {
    display: none;
  }
}

@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 0 1fr;
  }

  .left-rail {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
  }

  .app-shell.nav-collapsed .left-rail {
    width: 0;
  }

  .workspace-body,
  .setup-grid,
  .info-grid,
  .export-grid {
    grid-template-columns: 1fr;
  }

  .workspace-body {
    flex-direction: column;
    overflow-y: auto;
  }

  .workspace-splitter {
    display: none;
  }

  .right-panel {
    width: 100%;
    min-width: 0;
    min-height: 280px;
  }

  .canvas-column {
    padding-bottom: 0;
  }

  .workspace-calibration-bar {
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0 10px;
  }

  .case-chip {
    display: none;
  }

  .panel-screen,
  .canvas-column {
    padding: 12px;
  }

  .workspace-calibration-bar,
  .footer-bar {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 12px;
  }

  .canvas-message-card {
    max-width: calc(100% - 24px);
  }

  .zoom-pill {
    width: calc(100% - 24px);
    justify-content: space-between;
  }

  .zoom-pill input {
    width: 110px;
  }
}

@keyframes drawIn {
  to { stroke-dashoffset: 0; }
}

.overlay-line.draw-in,
.overlay-angle-leg.draw-in {
  animation: drawIn 400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(247, 249, 254, 0.6);
  backdrop-filter: blur(4px);
  animation: modalBackdropIn 200ms ease forwards;
}

@keyframes spinnerRotate {
  to { transform: rotate(360deg); }
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(0, 72, 141, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinnerRotate 700ms linear infinite;
}


/* Reference Info Panel Styles */
.reference-info-panel {
  background: var(--surface-high);
  border-top: 1px solid var(--panel-border);
  padding: 12px 16px;
  font-size: 13px;
  max-height: 200px;
  overflow-y: auto;
}

.reference-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.reference-info-title {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.reference-info-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.reference-info-btn {
  background: var(--surface);
  border: 1px solid var(--ghost-border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.reference-info-btn:hover {
  background: var(--hover-surface);
  color: var(--text);
}

.reference-info-btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.reference-info-btn.primary:hover {
  background: var(--primary-strong);
}

.reference-info-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reference-info-row {
  display: flex;
  gap: 8px;
  line-height: 1.4;
}

.reference-info-row.norms-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 8px;
  background: var(--surface);
  border-radius: 6px;
}

.norm-comparison {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reference-info-label {
  color: var(--muted);
  font-weight: 500;
  flex-shrink: 0;
  min-width: 70px;
}

.reference-info-value {
  color: var(--text);
}

.reference-info-norm {
  color: var(--text);
  font-weight: 500;
}

.reference-info-norm.original {
  color: var(--success);
}

.reference-info-citation {
  color: var(--muted-strong);
  font-style: italic;
  font-size: 12px;
}


/* Analysis Table Reference Row - Expandable */
.analysis-reference-row {
  grid-column: 1 / -1;
  background: var(--surface-high);
  border-left: 3px solid var(--primary);
  padding: 12px 16px;
  margin: 0;
  font-size: 12px;
}

.analysis-reference-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analysis-reference-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.analysis-reference-title {
  font-weight: 600;
  color: var(--primary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.analysis-reference-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  line-height: 1;
}

.analysis-reference-close:hover {
  color: var(--text);
}

.analysis-reference-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.analysis-reference-text {
  color: var(--text);
  margin: 0;
  line-height: 1.4;
}

.analysis-reference-norms {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.norm-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--ghost-border);
}

.norm-tag.pgimer {
  color: var(--text);
}

.norm-tag.original {
  color: var(--success);
  border-color: var(--success);
  background: rgba(26, 127, 72, 0.1);
}

.analysis-reference-citation {
  color: var(--muted);
  font-style: italic;
  margin: 0;
  line-height: 1.4;
  font-size: 11px;
}

.analysis-reference-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 11px;
  margin-top: 4px;
}

.analysis-reference-link:hover {
  text-decoration: underline;
}

.visibility-filters {
  padding: 8px 12px;
  background: var(--card);
  border-radius: 6px;
  margin-bottom: 8px;
}

.visibility-filters-header {
  margin-bottom: 6px;
}

.visibility-filters-tiers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.visibility-filters-tiers .trace-toggle-button {
  font-size: 0.68rem;
  padding: 4px 8px;
  min-height: 26px;
}

.visibility-filters-actions {
  display: flex;
  gap: 8px;
}

.visibility-filters-actions .ghost-button {
  flex: 1;
  font-size: 0.68rem;
}

.visibility-filters-reference {
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 6px;
}


/* Compact buttons for right panel */
.right-panel .trace-toggle-button {
  min-height: 26px;
  padding: 0 10px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 6px;
}

.right-panel .instruction-button {
  min-height: 26px;
  font-size: 0.7rem;
  font-weight: 600;
}


/* Right panel typeface consistency */
.right-panel {
  font-family: Inter, Arial, Helvetica, sans-serif;
}

.right-panel h2,
.right-panel h3 {
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.right-panel .micro-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
}

.right-panel .analysis-table {
  font-size: 0.78rem;
}

.right-panel .landmark-table {
  font-size: 0.78rem;
}

.right-panel .right-tabs {
  padding: 4px 10px 0;
}

.right-panel .right-tab {
  min-height: 40px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.right-panel .right-panel-body {
  padding: 8px 14px 12px;
}

.right-panel .right-tab-panel {
  gap: 12px;
}

.right-panel .instruction-header-row h2 {
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.right-panel .instruction-title {
  gap: 6px;
}

.right-panel .instruction-title-verb {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.right-panel .instruction-title-target {
  min-height: 28px;
  padding: 0 10px;
  font-size: 0.94rem;
  font-weight: 800;
  box-shadow: 0 6px 12px rgba(180, 83, 9, 0.14);
}

.right-panel .instruction-copy {
  font-size: 0.76rem;
  line-height: 1.35;
}

.right-panel .instruction-card {
  gap: 10px;
}

.right-panel .analysis-norm-switcher,
.right-panel .analysis-footer-card,
.right-panel .diagnostic-item,
.right-panel .trace-item,
.right-panel .empty-card {
  border-radius: 12px;
}

.right-panel .analysis-norm-switcher,
.right-panel .analysis-footer-card {
  padding: 10px 12px;
  gap: 8px;
}

.right-panel .analysis-header h3 {
  font-size: 0.96rem;
  line-height: 1.15;
}

.right-panel .micro-copy {
  font-size: 0.74rem;
  line-height: 1.35;
}

.right-panel .analysis-table-head {
  padding: 8px 12px;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
}

.right-panel .analysis-table-row {
  min-height: 36px;
  padding: 0 12px;
}

.right-panel .analysis-name-cell,
.right-panel .analysis-norm-cell,
.right-panel .analysis-value-cell {
  font-size: 0.74rem;
}

.right-panel .analysis-reference-row {
  padding: 10px 12px;
  font-size: 11px;
}

.right-panel .analysis-reference-text,
.right-panel .analysis-reference-citation {
  font-size: 0.7rem;
}

.right-panel .landmark-table-head {
  padding: 7px 10px;
  font-size: 0.56rem;
  letter-spacing: 0.12em;
}

.right-panel .landmark-table-row {
  min-height: 34px;
  padding: 0 10px;
}

.right-panel .landmark-short {
  font-size: 0.74rem;
  font-weight: 600;
}

.right-panel .landmark-full {
  font-size: 0.66rem;
}

.right-panel .landmark-action-btn,
.right-panel .trace-item-actions button,
.right-panel .diagnostic-item-actions button {
  min-height: 26px;
  min-width: 26px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

.right-panel .diagnostic-item {
  gap: 8px;
  padding: 10px;
}

.right-panel .diagnostic-item-head strong,
.right-panel .trace-item-head strong {
  font-size: 0.74rem;
}

.right-panel .diagnostic-item-head span,
.right-panel .trace-item-head span {
  font-size: 0.68rem;
}
