:root {
  color-scheme: light;
  --ink: #18211f;
  --muted: #66736f;
  --line: #d9ded8;
  --paper: #fbfbf7;
  --panel: #ffffff;
  --accent: #0d8b7c;
  --accent-dark: #08665b;
  --warm: #b85c38;
  --gold: #d4a72c;
  --soft: #edf5f2;
  --shadow: 0 18px 60px rgba(26, 36, 33, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
select,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.control-band {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 520px);
  gap: 24px;
  align-items: end;
  padding: 28px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #ffffff 0%, #f5faf8 55%, #fff8ed 100%);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.03;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

.selector-row {
  display: grid;
  gap: 8px;
}

.point-selector-row {
  display: none;
}

.app-mode-points .protocol-selector-row {
  display: none;
}

.app-mode-points .point-selector-row {
  display: grid;
  grid-column: 1 / -1;
}

.search-select {
  display: grid;
  grid-template-columns: minmax(180px, 0.62fr) minmax(240px, 1fr);
  gap: 10px;
}

.point-select-grid {
  display: grid;
  grid-template-columns: 86px repeat(4, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}

.point-select-grid label {
  display: grid;
  gap: 7px;
}

.point-link-toggle {
  min-height: 46px;
  padding: 0 4px 2px 0;
  align-content: end;
  white-space: nowrap;
}

.select-label-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.select-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(13, 139, 124, 0.12);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.selector-row label,
.speed-control {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

select,
input[type="search"],
input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 98px;
  padding: 12px 14px;
  resize: vertical;
}

input[type="search"]::placeholder,
input[type="text"]::placeholder,
textarea::placeholder {
  color: #8b9692;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 390px) 1fr;
  align-items: start;
  min-height: 0;
}

.sequence-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  min-height: 0;
}

.global-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 18px;
  max-width: 560px;
}

.global-tabs button {
  min-height: 38px;
  padding: 8px;
  border-radius: 7px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
}

.global-tabs button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.panel-page {
  display: none;
  min-height: 0;
}

.panel-page.active {
  display: grid;
  align-content: start;
  gap: 18px;
  min-height: 0;
}

.panel-heading,
.diagram-toolbar,
.source-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.step-counter {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.active-point {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 8;
  display: grid;
  gap: 4px;
  min-width: 116px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.92);
  box-shadow: 0 12px 28px rgba(24, 33, 31, 0.12);
  text-align: right;
  backdrop-filter: blur(6px);
}

.active-point span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.active-point strong {
  font-size: 34px;
  line-height: 1;
  color: var(--warm);
}

.active-point em {
  min-height: 18px;
  color: var(--accent-dark);
  font-size: 14px;
  font-style: normal;
  font-weight: 900;
}

.active-point em.flashing {
  animation: pointStatusFlash 900ms ease-in-out infinite;
}

.app-mode-protocols .active-point,
.app-mode-points .active-point {
  display: none;
}

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

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

button.primary,
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.danger {
  color: #a3312a;
}

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

.speed-control {
  display: grid;
  gap: 10px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.sequence-list {
  display: grid;
  align-content: start;
  gap: 5px;
  margin: 0;
  padding: 0 6px 0 0;
  overflow: auto;
  list-style: none;
}

.sequence-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  opacity: 1;
  transition: opacity 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.sequence-list li.done {
  border-color: #dfe5e1;
  background: #f8faf8;
  filter: grayscale(1);
  opacity: 0.44;
}

.sequence-list li.active {
  border-color: rgba(216, 32, 32, 0.28);
  background: #fff7f5;
  box-shadow: none;
  opacity: 1;
}

.sequence-list b {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 24px;
  padding: 0 6px;
  font-size: 15px;
}

.sequence-list span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.sequence-list li.active b {
  color: #d82020;
  font-size: 16px;
  font-weight: 900;
}

.manager-panel,
.point-manager {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.manager-panel h3,
.point-manager h3 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 16px;
}

.manager-form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.manager-panel h3 {
  padding: 14px 14px 0;
}

.manager-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.user-point-form {
  display: grid;
  gap: 12px;
  padding-top: 2px;
  border-top: 1px solid rgba(34, 72, 67, 0.12);
}

.user-point-form h4 {
  margin: 2px 0 0;
  color: var(--accent-dark);
  font-size: 14px;
}

.user-point-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.user-point-form input,
.user-point-form select {
  min-height: 44px;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 700;
}

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

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
  line-height: 1.35;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
}

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

.user-point-form .manager-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.manager-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.manager-status[data-type="success"] {
  color: var(--accent-dark);
}

.manager-status[data-type="warn"] {
  color: #9a6612;
}

.manager-status[data-type="error"] {
  color: #a3312a;
}

.point-manager {
  display: grid;
  gap: 12px;
  padding: 14px;
  min-height: 0;
}

.point-manager-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.point-manager-heading span,
.point-manager p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.point-manager p {
  margin: 0;
}

.point-manager-list {
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 280px);
  overflow: auto;
  padding-right: 4px;
}

.point-row {
  display: grid;
  grid-template-columns: 54px 68px 1fr;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px;
  border: 1px solid rgba(34, 72, 67, 0.14);
  border-radius: 7px;
  background: #fff;
  text-align: left;
  font-size: 12px;
}

.point-row.active {
  border-color: rgba(216, 32, 32, 0.54);
  box-shadow: 0 0 0 2px rgba(216, 32, 32, 0.1);
}

.point-row b {
  color: var(--warm);
  font-size: 16px;
}

.point-row strong {
  color: var(--accent-dark);
  font-size: 14px;
}

.point-row span {
  color: var(--muted);
  line-height: 1.35;
}

.point-manager-detail {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(13, 139, 124, 0.2);
  border-radius: 7px;
  background: #f5fbf9;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.point-manager-detail b {
  color: var(--accent-dark);
  font-size: 14px;
}

.app-mode-protocols .diagram-controls,
.app-mode-protocols .calibration-panel,
.app-mode-points .diagram-controls,
.app-mode-points .calibration-panel {
  display: none;
}

.diagram-area {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  min-width: 0;
  padding: 24px clamp(16px, 3vw, 36px);
}

.view-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.diagram-controls {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.photo-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.photo-tools input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.upload-button {
  display: inline-grid;
  place-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.upload-button.disabled {
  opacity: 0.42;
  pointer-events: none;
  cursor: default;
}

.tab {
  min-width: 72px;
}

.calibration-panel {
  display: grid;
  grid-template-columns: minmax(150px, 0.72fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #cfe0dc;
  border-radius: 8px;
  background: #f5fbf9;
  color: var(--muted);
  font-size: 13px;
}

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

.calibration-panel strong {
  color: var(--accent-dark);
}

.calibration-copy {
  display: grid;
  align-content: start;
  min-height: 42px;
  max-width: 220px;
  line-height: 1.35;
}

.rotation-control {
  display: grid;
  gap: 6px;
  min-width: 180px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.control-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 16px;
}

.control-label output {
  justify-self: end;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

.calibration-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  justify-self: start;
}

.diagram-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(13, 139, 124, 0.07), transparent 48%),
    #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.image-stage {
  position: relative;
  width: min(100%, 720px, calc((100vh - 270px) * 0.717));
  min-width: 300px;
}

.diagram-frame img {
  display: block;
  width: 100%;
  height: auto;
  transition: opacity 180ms ease, transform 220ms ease;
}

.diagram-frame .nostril-inset {
  position: absolute;
  right: clamp(12px, 2vw, 24px);
  bottom: clamp(12px, 2vw, 24px);
  width: clamp(96px, 13.5%, 138px);
  max-width: 138px;
  height: auto;
  z-index: 6;
  border: 1px solid rgba(66, 58, 86, 0.18);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(48, 40, 70, 0.12);
  pointer-events: none;
}

.nostril-inset img {
  display: block;
  width: 100%;
  height: auto;
}

.nostril-inset[hidden] {
  display: none;
}

.nostril-inset-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.diagram-frame img.updating {
  opacity: 0.55;
  transform: scale(0.992);
}

.point-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.axis-guide {
  position: absolute;
  inset: 0;
  z-index: 8;
  touch-action: none;
  pointer-events: none;
}

.axis-guide[hidden] {
  display: none;
}

.axis-guide:active {
  cursor: grabbing;
}

.image-stage.photo-mode img {
  transform: rotate(var(--photo-rotation, 0deg));
  transform-origin: center;
}

.image-stage.photo-mode img.updating {
  transform: rotate(var(--photo-rotation, 0deg)) scale(0.992);
}

.image-stage.awaiting-photo img {
  filter: grayscale(1) blur(1.2px);
  opacity: 0.34;
}

.axis-line,
.axis-row {
  position: absolute;
  display: block;
  pointer-events: auto;
}

.axis-line {
  top: 18%;
  bottom: 10%;
  width: 18px;
  transform: translateX(-50%);
  cursor: ew-resize;
}

.axis-line::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 50%;
  width: 0;
  border-left: 1px solid rgba(28, 82, 76, 0.72);
  transform: translateX(-50%);
  background: none;
}

.axis-o::before {
  border-left-color: rgba(180, 36, 32, 0.82);
}

.axis-row {
  height: 18px;
  transform: translateY(-50%);
  cursor: ns-resize;
}

.axis-row::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid rgba(28, 82, 76, 0.68);
  background: none;
}

.axis-row b {
  position: absolute;
  right: -30px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-dark);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(34, 72, 67, 0.18);
  border-radius: 4px;
  padding: 1px 4px;
}

.row-7::before {
  border-top-color: rgba(180, 36, 32, 0.72);
}

.face-width,
.axis-label,
.drag-handle {
  position: absolute;
  z-index: 9;
  pointer-events: auto;
  font-weight: 900;
}

.face-width {
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #d82020;
  font-size: 13px;
  cursor: ew-resize;
}

.axis-label {
  transform: translate(-50%, -50%);
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(34, 72, 67, 0.18);
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 13px;
  line-height: 1;
  cursor: ew-resize;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.axis-label-bottom {
  transform: translate(-50%, 50%);
}

.axis-label-o { color: #d82020; }

.axis-line.locked,
.axis-row.locked,
.axis-label.locked,
.face-width.locked {
  pointer-events: none;
  opacity: 0.45;
}

.axis-line.locked::before {
  border-left: 1px dashed rgba(35, 47, 45, 0.5);
}

.axis-row.locked::before {
  border-top-width: 1px;
  border-top-style: dashed;
  border-top-color: rgba(35, 47, 45, 0.5);
}

.axis-guide.photo-calibration .axis-line.locked,
.axis-guide.photo-calibration .axis-row.locked,
.axis-guide.photo-calibration .axis-label.locked,
.axis-guide.photo-calibration .face-width.locked {
  opacity: 0.84;
}

.axis-guide.photo-calibration .axis-line.locked::before {
  border-left: 1px dashed rgba(28, 36, 35, 0.62);
}

.axis-guide.photo-calibration .axis-row.locked::before {
  border-top-width: 1px;
  border-top-style: dashed;
  border-top-color: rgba(28, 36, 35, 0.62);
}

.axis-guide.photo-calibration .axis-line.manual::before {
  width: 0;
  border-left: 1.6px solid rgba(18, 78, 70, 0.9);
  background: none;
}

.axis-guide.photo-calibration .axis-line.axis-o.manual::before {
  border-left-color: rgba(216, 32, 32, 0.92);
}

.axis-guide.photo-calibration .axis-row.manual::before {
  border-top-width: 1.6px;
  border-top-style: solid;
  border-top-color: rgba(18, 78, 70, 0.9);
}

.axis-guide.photo-calibration .axis-label.manual,
.axis-guide.photo-calibration .axis-row.manual b {
  background: #fff;
  border-color: rgba(216, 32, 32, 0.42);
  color: #b42420;
  box-shadow: 0 0 0 2px rgba(216, 32, 32, 0.08);
}

.axis-guide.photo-calibration .face-width {
  width: 22px;
  height: 22px;
  border: 2px solid #d82020;
  border-radius: 50%;
  background: #fff;
  color: #d82020;
  opacity: 1;
}

.axis-guide.template-point-grid .axis-line.locked,
.axis-guide.template-point-grid .axis-row.locked,
.axis-guide.template-point-grid .axis-label.locked,
.axis-guide.template-point-grid .face-width.locked {
  opacity: 0.66;
}

.axis-guide.template-point-grid .axis-line.locked::before {
  border-left: 1px dashed rgba(28, 36, 35, 0.5);
}

.axis-guide.template-point-grid .axis-row.locked::before {
  border-top-width: 1px;
  border-top-style: dashed;
  border-top-color: rgba(28, 36, 35, 0.5);
}

.axis-guide.template-point-grid .axis-label.locked,
.axis-guide.template-point-grid .axis-row.locked b {
  background: rgba(255, 255, 255, 0.86);
}

.axis-guide.template-point-grid .axis-line.axis-o.locked::before {
  border-left-color: rgba(216, 32, 32, 0.62);
}

.axis-line.manual,
.axis-label.manual,
.face-width.manual {
  cursor: ew-resize;
}

.axis-row.manual {
  cursor: ns-resize;
}

.axis-guide.photo-calibration .axis-row.manual b,
.axis-guide.photo-calibration .face-width.manual {
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.axis-guide.photo-calibration .axis-line.manual:hover + .axis-label.manual,
.axis-guide.photo-calibration .axis-label.manual:hover,
.axis-guide.photo-calibration .axis-row.manual:hover b,
.axis-guide.photo-calibration .face-width.manual:hover {
  background: #fff4f2;
  border-color: rgba(216, 32, 32, 0.72);
  color: #d82020;
  box-shadow: 0 0 0 3px rgba(216, 32, 32, 0.12);
}

.axis-guide.photo-calibration .axis-line.manual:hover + .axis-label-top.manual,
.axis-guide.photo-calibration .axis-label-top.manual:hover {
  transform: translate(-50%, -50%) scale(1.5);
}

.axis-guide.photo-calibration .axis-line.manual:hover + .axis-label-bottom.manual,
.axis-guide.photo-calibration .axis-label-bottom.manual:hover {
  transform: translate(-50%, 50%) scale(1.5);
}

.axis-guide.photo-calibration .axis-row.manual:hover b {
  transform: translateY(-50%) scale(1.5);
}

.axis-guide.photo-calibration .face-width.manual:hover {
  transform: translate(-50%, -50%) scale(1.5);
}

.guide-cursor-tooltip {
  position: absolute;
  z-index: 18;
  transform: translate(10px, 10px);
  white-space: nowrap;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(25, 31, 30, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 8px 20px rgba(25, 31, 30, 0.18);
}

.drag-handle {
  transform: translate(0, -50%);
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(13, 139, 124, 0.92);
  color: #fff;
  font-size: 12px;
  box-shadow: 0 8px 22px rgba(13, 139, 124, 0.24);
  cursor: grab;
}

.move-all-handle {
  transform: translate(-100%, -50%);
}

.guide-action-cluster {
  position: absolute;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 6px;
  transform: translate(-100%, -50%);
  pointer-events: auto;
}

.guide-action-cluster button {
  min-height: 28px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.guide-lock-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: #fff;
  border-color: rgba(216, 32, 32, 0.34);
  color: #d82020;
  box-shadow: 0 8px 20px rgba(25, 31, 30, 0.1);
}

.guide-lock-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.guide-lock-button.unlocked {
  border-color: rgba(13, 139, 124, 0.38);
  color: var(--accent-dark);
}

.guide-lock-button.locked {
  background: #fff4f2;
  border-color: rgba(216, 32, 32, 0.72);
}

.guide-reset-button {
  min-height: 28px;
  padding: 6px 9px;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.guide-reset-standalone {
  position: absolute;
  z-index: 12;
  transform: translate(0, -50%);
  pointer-events: auto;
}

.guide-action-cluster .move-all-handle {
  position: static;
  transform: none;
  border-color: rgba(13, 139, 124, 0.92);
  min-height: 28px;
  white-space: nowrap;
  line-height: 1;
  padding: 6px 10px;
}

.guide-action-cluster button:hover,
.guide-action-cluster .move-all-handle:hover {
  transform: none;
}

.guide-reset-standalone:hover {
  transform: translate(0, -50%);
}

.axis-guide.guide-locked .axis-line.manual,
.axis-guide.guide-locked .axis-label.manual,
.axis-guide.guide-locked .axis-row.manual,
.axis-guide.guide-locked .face-width.manual {
  cursor: default;
}

.axis-guide.guide-locked .axis-line,
.axis-guide.guide-locked .axis-row,
.axis-guide.guide-locked .axis-label,
.axis-guide.guide-locked .face-width {
  pointer-events: none;
}

.axis-guide.photo-calibration.guide-locked .axis-line,
.axis-guide.photo-calibration.guide-locked .axis-row,
.axis-guide.photo-calibration.guide-locked .axis-label,
.axis-guide.photo-calibration.guide-locked .face-width {
  opacity: 0.32;
}

.nostril-point {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #111;
  color: #111;
  z-index: 2;
}

.nostril-point span {
  position: absolute;
  left: 50%;
  bottom: 7px;
  transform: translateX(-50%);
  color: inherit;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.nostril-point.past {
  background: #9a9a9a;
  color: #8e8e8e;
  opacity: 0.72;
}

.nostril-point.current {
  width: 10px;
  height: 10px;
  background: #d82020;
  color: #d82020;
}

.nostril-point.current.flashing::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: #d82020;
  box-shadow: 0 0 0 4px rgba(216, 32, 32, 0.18);
  animation: facePulse 900ms ease-out infinite;
}

.nostril-point.current span {
  font-size: 18px;
}

.face-point {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #111;
  z-index: 2;
}

.face-point::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  background: currentColor;
}

.face-point span {
  position: absolute;
  left: 50%;
  bottom: 7px;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  color: #111;
  text-shadow: none;
}

.face-point.past {
  background: #9a9a9a;
  color: #9a9a9a;
  opacity: 0.72;
}

.face-point.past span {
  color: #8e8e8e;
}

.face-point.current {
  z-index: 4;
  width: 10px;
  height: 10px;
  background: #d82020;
  color: #d82020;
}

.face-point.current.flashing::before {
  inset: -2px;
  background: #d82020;
  box-shadow: 0 0 0 4px rgba(216, 32, 32, 0.18);
  animation: facePulse 900ms ease-out infinite;
}

.face-point.current span {
  color: #d82020;
  font-size: 18px;
}

.user-added-point {
  position: absolute;
  z-index: 5;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  border: 2px solid #111;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.user-added-point.saved {
  opacity: 0.62;
}

.nostril-inset .user-added-point {
  width: 12px;
  height: 12px;
  border-width: 2px;
}

.nostril-inset .user-added-point span {
  bottom: 11px;
  font-size: 12px;
}

.nostril-axis-line,
.nostril-row-line {
  position: absolute;
  display: block;
  pointer-events: none;
}

.nostril-axis-line {
  top: 12%;
  bottom: 8%;
  border-left: 1px dashed rgba(13, 139, 124, 0.45);
}

.nostril-axis-line.axis-o {
  border-left-color: rgba(216, 32, 32, 0.58);
}

.nostril-row-line {
  left: 8%;
  right: 8%;
  border-top: 1px dashed rgba(13, 139, 124, 0.36);
}

.user-added-point span {
  position: absolute;
  left: 50%;
  bottom: 15px;
  transform: translateX(-50%);
  color: #111;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.calibration-point {
  position: absolute;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  border: 2px solid #0d8b7c;
  border-radius: 50%;
  background: #fff;
  color: #0d8b7c;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 4px 14px rgba(13, 139, 124, 0.24);
}

.pulse-ring {
  position: absolute;
  width: 96px;
  height: 96px;
  border: 3px solid var(--gold);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.pulse-ring.animate {
  animation: pulse 720ms ease-out;
}

.source-row {
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}

.source-row a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

@keyframes pulse {
  0% {
    opacity: 0.9;
    transform: scale(0.65);
  }
  100% {
    opacity: 0;
    transform: scale(1.45);
  }
}

@keyframes facePulse {
  0%, 100% {
    transform: scale(0.94);
  }
  50% {
    transform: scale(1.08);
  }
}

@keyframes pointStatusFlash {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.28;
  }
}

@media (max-width: 880px) {
  .control-band,
  .workspace {
    grid-template-columns: 1fr;
  }

  .search-select {
    grid-template-columns: 1fr;
  }

  .sequence-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: none;
  }

  .diagram-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .diagram-controls,
  .photo-tools {
    justify-items: start;
    justify-content: flex-start;
  }

  .calibration-panel {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .diagram-frame {
    min-height: 320px;
  }

  .diagram-frame img {
    max-height: none;
  }

  .image-stage {
    width: min(100%, calc(62vh * 0.717));
    min-width: 0;
  }

}

@media (max-width: 520px) {
  .transport {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
