:root {
  color-scheme: light;
  --bg: #eef0ed;
  --panel: #fbfbf8;
  --panel-line: #d7d9d2;
  --ink: #202420;
  --muted: #667069;
  --viewer: #151719;
  --viewer-grid: #24282b;
  --brand-yellow: #fff200;
  --accent: #ef1c25;
  --accent-strong: #b9151c;
  --warn: var(--brand-yellow);
  --focus: var(--brand-yellow);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

[hidden] {
  display: none !important;
}

button,
.file-picker,
#newProjectButton {
  min-height: 34px;
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
}

.button-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

button {
  padding: 0 12px;
}

button:hover:not(:disabled),
.file-picker:hover,
.button-link:hover {
  border-color: #9da59d;
}

button:disabled,
fieldset:disabled button {
  color: #9aa19a;
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.file-picker:focus-within,
.button-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.app-shell {
  display: flex;
  width: 100%;
  height: 100vh;
  min-width: 0;
  overflow: hidden;
}

.viewer-pane {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: var(--viewer);
}

.topbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-bottom: 1px solid #2f3437;
  background: #202326;
  color: #f2f3ee;
}

.topbar-main-row {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 12px;
}

.guest-mode-banner {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-top: 1px solid var(--brand-yellow);
  background: var(--brand-yellow);
  color: #171713;
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
}

.guest-mode-banner[hidden] {
  display: none;
}

.diagnostics-strip {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  gap: 9px;
  padding: 5px 12px;
  overflow-x: auto;
  border-top: 1px solid #3a4044;
  background: #141719;
  color: #eef1ed;
  font: 600 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
  scrollbar-width: thin;
}

.diagnostics-strip[hidden] {
  display: none;
}

.diagnostics-title {
  flex: 0 0 auto;
  color: var(--brand-yellow);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.diagnostics-values {
  display: flex;
  flex: 1 0 auto;
  align-items: center;
  gap: 6px;
}

.diagnostics-value {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid #3b4246;
  border-radius: 5px;
  background: #24292c;
  color: #dfe5e0;
}

.diagnostics-value.is-elevated {
  border-color: #c79019;
  background: #3a2f16;
  color: #ffe19a;
}

.diagnostics-value.is-high {
  border-color: #e44a4a;
  background: #431d1d;
  color: #ffb4b4;
}

.diagnostics-reset {
  min-height: 24px;
  flex: 0 0 auto;
  padding: 3px 8px;
  border-color: #525a5f;
  background: #2a3033;
  color: #f0f2ef;
  font-size: 10px;
}

.toolbar-group,
.button-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-meta {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-left: auto;
}

.topbar-signed-in-status {
  max-width: min(34vw, 360px);
  overflow: hidden;
  color: #f2f3ee;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.help-button {
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-decoration: none;
}

.login-shortcut-button {
  border-color: #d7d9d2;
  background: #ffffff;
  color: #000000;
  font-weight: 650;
}

.help-button img {
  display: block;
  width: 34px;
  height: 34px;
}

.help-icon-close {
  display: none;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #f40d0d;
  color: #ffffff;
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
}

.help-button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.help-button[aria-pressed="true"] .help-icon-question {
  display: none;
}

.help-button[aria-pressed="true"] .help-icon-close {
  display: grid;
}

.help-button[aria-pressed="true"] {
  box-shadow: 0 0 0 2px #ffffff;
}

.file-picker,
#newProjectButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 650;
}

.file-picker input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid #4b5355;
  border-radius: 6px;
}

.segmented button {
  min-height: 32px;
  border: 0;
  border-radius: 0;
  background: #2a2f32;
  color: #e9ece7;
}

.segmented button + button {
  border-left: 1px solid #4b5355;
}

.segmented button.active {
  background: var(--brand-yellow);
  color: #1c1c18;
}

.module-tool-toggle {
  width: 100%;
  margin: 0 0 12px;
  border-color: var(--panel-line);
}

.module-tool-toggle button {
  flex: 1 1 0;
  background: #ffffff;
  color: var(--ink);
}

.module-tool-toggle button + button {
  border-left-color: var(--panel-line);
}

.module-tool-toggle button.active {
  background: var(--accent);
  color: #ffffff;
  font-weight: 750;
}

.module-tool-toggle button:disabled {
  background: #f1f2ef;
  color: #9aa19a;
}

.measurement-primary-tools {
  margin-bottom: 8px;
}

.measurement-extreme-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.measurement-extreme-tools button {
  width: 100%;
}

.new-project-dialog {
  width: min(430px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.new-project-dialog::backdrop {
  background: rgba(15, 17, 18, 0.65);
}

.new-project-dialog form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.new-project-dialog h2,
.new-project-dialog .project-list-status {
  margin: 0;
}

.new-project-dialog input {
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
}

.new-project-dialog .project-list-status:empty {
  display: none;
}

.new-project-actions {
  justify-content: flex-end;
}

#saveNewProjectButton {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.app-message-dialog p {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
  white-space: pre-wrap;
}

.app-message-actions {
  justify-content: flex-end;
}

.app-message-actions button {
  flex: 0 1 120px;
}

.app-message-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.app-message-primary.danger-button {
  color: #ffffff;
}

.project-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.project-dialog::backdrop {
  background: rgba(15, 17, 18, 0.65);
}

.password-setup-dialog {
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-top: 5px solid var(--accent);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.password-setup-dialog::backdrop {
  background: rgba(10, 12, 13, 0.82);
}

.password-setup-form,
.password-setup-mobile-success,
.auth-link-error-content,
.login-dialog-form {
  padding: 22px;
}

.password-setup-form,
.auth-link-error-content,
.auth-link-recovery-form,
.login-dialog-form {
  display: grid;
  gap: 11px;
}

.password-setup-eyebrow,
.password-setup-dialog h2,
.password-setup-helper,
.password-setup-status,
.password-setup-mobile-success p {
  margin: 0;
}

.password-setup-eyebrow {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.password-setup-dialog h2 {
  font-size: 22px;
  line-height: 1.15;
}

.password-setup-helper,
.password-setup-mobile-success p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.password-setup-dialog input {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

.password-setup-status {
  min-height: 20px;
  color: var(--muted);
  font-weight: 650;
}

.password-setup-status.is-error {
  color: #b91c1c;
}

.password-setup-status.is-success {
  color: #0f766e;
}

.password-setup-button {
  width: 100%;
  min-height: 46px;
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
}

.password-setup-button:hover:not(:disabled) {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.password-setup-mobile-success {
  display: grid;
  gap: 14px;
  text-align: center;
}

.password-setup-mobile-success h2:focus {
  outline: 0;
}

.auth-link-guidance p,
.auth-link-resend-success {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

.auth-link-guidance {
  padding: 14px;
  border: 1px solid #f0b8bb;
  border-radius: 7px;
  background: #fff5f5;
  color: #7f1d1d;
}

.auth-link-resend-success {
  padding: 14px;
  border: 1px solid #99d5c8;
  border-radius: 7px;
  background: #eefbf7;
  color: #0f6b5f;
  text-align: center;
}

.auth-link-error-close {
  width: 100%;
}

.login-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.login-dialog-heading .password-setup-eyebrow {
  margin-bottom: 7px;
}

.login-dialog-close {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-color: var(--panel-line);
  background: transparent;
  font-weight: 800;
}

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

.login-dialog-actions > * {
  width: 100%;
}

.password-input-control {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

.password-input-control > input {
  width: 100%;
  padding-right: 44px;
}

.password-input-control > .password-visibility-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #555e58;
}

.password-input-control > .password-visibility-toggle:hover {
  border: 0;
  background: #eef0ed;
  color: var(--ink);
}

.password-visibility-toggle svg {
  width: 21px;
  height: 21px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  pointer-events: none;
}

.password-visibility-slash {
  display: none;
  stroke-width: 2.2;
}

.password-visibility-toggle.is-visible .password-visibility-slash {
  display: block;
}

@media (max-width: 900px) {
  .password-setup-dialog {
    width: min(360px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
  }

  .password-setup-form,
  .password-setup-mobile-success,
  .auth-link-error-content,
  .login-dialog-form {
    padding: 20px 16px;
  }

  .login-dialog-actions {
    grid-template-columns: 1fr;
  }

  .password-setup-dialog h2 {
    font-size: 21px;
  }

  .password-setup-dialog input {
    font-size: 16px;
  }
}

.project-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--panel-line);
}

.project-dialog-heading h2,
.project-dialog-heading p {
  margin: 0;
}

.project-dialog-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.project-dialog-close {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 0;
}

.project-name-form {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--panel-line);
}

.project-name-form .stacked {
  flex: 1 1 auto;
  min-width: 240px;
  margin-block: 0;
}

.project-name-form input {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
}

.project-search {
  display: block;
  padding: 14px 20px 4px;
}

.project-search input {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
}

.danger-button {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.danger-button:hover:not(:disabled) {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: #ffffff;
}

.project-list-status {
  min-height: 20px;
  padding: 12px 20px 4px;
  color: var(--muted);
  font-size: 13px;
}

.project-list {
  display: grid;
  max-height: min(390px, calc(100vh - 315px));
  gap: 8px;
  padding: 8px 20px 20px;
  overflow-y: auto;
}

.project-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--panel-line);
  border-radius: 7px;
  background: #ffffff;
}

.project-list-thumbnail {
  width: 76px;
  height: 56px;
  flex: 0 0 auto;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  background: #202326;
  object-fit: cover;
}

.project-list-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.project-list-item.is-current {
  border-color: var(--accent);
}

.project-list-copy {
  min-width: 0;
}

.project-list-name,
.project-list-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-list-name {
  font-weight: 700;
}

.project-list-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.project-list-item.is-current .project-open-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.project-image-filmstrip {
  display: flex;
  flex: 0 0 auto;
  min-height: 104px;
  gap: 9px;
  padding: 9px 12px;
  overflow-x: auto;
  border-top: 1px solid #363a3d;
  background: #202326;
}

.project-image-filmstrip.is-drag-over {
  cursor: grabbing;
}

.project-image-card {
  position: relative;
  width: 124px;
  flex: 0 0 124px;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: 7px;
  background: #303438;
  color: #ffffff;
  cursor: grab;
}

.project-image-card.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.project-image-card.is-drop-before::before,
.project-image-card.is-drop-after::after {
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 4px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 1px #ffffff;
  content: "";
}

.project-image-card.is-drop-before::before {
  left: -7px;
}

.project-image-card.is-drop-after::after {
  right: -7px;
}

.project-image-card:hover {
  border-color: #8c9499;
}

.project-image-card.is-active {
  border-color: var(--accent);
}

.project-image-card img {
  display: block;
  width: 100%;
  height: 62px;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: 3px;
  background: #151719;
  object-fit: cover;
}

.project-image-card-name {
  display: block;
  margin-top: 4px;
  user-select: none;
  overflow: hidden;
  font-size: 11px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-image-delete {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 24px;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(21, 23, 25, 0.9);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.area-histogram-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 12px;
}

.area-histogram-panel {
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  background: #ffffff;
}

.area-histogram-panel summary {
  position: relative;
  min-height: 34px;
  padding: 8px 10px;
  padding-right: 44px;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  user-select: none;
}

.area-histogram-panel[open] summary {
  border-bottom: 1px solid var(--panel-line);
  background: #f7f8f7;
}

.measurement-result-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.measurement-comparison-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  width: 24px;
  min-height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  transform: translateY(-50%);
}

.measurement-comparison-toggle img {
  display: block;
  width: 20px;
  height: 28px;
  object-fit: contain;
}

.measurement-comparison {
  margin: -5px 0 12px;
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  background: #ffffff;
}

.measurement-comparison table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 10px;
}

.measurement-comparison caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.measurement-comparison th,
.measurement-comparison td {
  width: 33.333%;
  padding: 6px 4px;
  border: 1px solid var(--panel-line);
  overflow-wrap: anywhere;
  text-align: center;
}

.measurement-comparison thead th {
  background: #202326;
  color: #ffffff;
  font-weight: 750;
}

.measurement-comparison tbody th {
  background: #f2f4f1;
  color: #424940;
  font-weight: 750;
}

.area-histogram-content {
  padding: 9px 10px 8px;
}

.area-histogram-meta {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
}

.area-histogram-alarm {
  margin: -1px 0 8px;
  padding: 5px 6px;
  border-left: 3px solid #ef1c25;
  background: #fff6f6;
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
}

.area-histogram-alarm.is-below {
  border-left-color: #316db5;
  background: #f3f7fc;
}

.area-histogram-alarm.is-between {
  border-left-color: var(--brand-yellow);
  background: var(--brand-yellow);
}

.area-histogram-chart {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  grid-template-rows: 90px auto;
  column-gap: 5px;
  row-gap: 4px;
}

.area-histogram-y-axis {
  display: flex;
  grid-column: 1;
  grid-row: 1;
  flex-direction: column;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
  text-align: right;
}

.area-histogram-bars {
  display: flex;
  grid-column: 2;
  grid-row: 1;
  align-items: end;
  gap: 1px;
  min-width: 0;
  padding: 3px 3px 0;
  border-bottom: 1px solid #7d857f;
  border-left: 1px solid #7d857f;
  background: linear-gradient(to top, #f1f3f1 1px, transparent 1px) 0 50% / 100% 50%;
}

.area-histogram-bar {
  flex: 1 1 0;
  min-width: 1px;
  background: linear-gradient(180deg, var(--brand-yellow) 0%, #ef1c25 100%);
}

.area-histogram-scale {
  display: flex;
  grid-column: 2;
  grid-row: 2;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.measurement-line-tools {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.measurement-line-tools button {
  width: 100%;
}

.measurement-line-tools button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 750;
}

.annotation-controls {
  margin: 0;
}

.annotation-tool-groups {
  display: grid;
  gap: 0;
}

.annotation-tool-group {
  margin: 0;
  border-radius: 6px;
}

.annotation-tool-group button {
  min-width: 0;
  padding-inline: 6px;
}

.annotation-clear-tools {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
}

.annotation-clear-tools button {
  width: 100%;
}

.annotation-editor {
  display: grid;
  gap: 9px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  background: #f7f8f7;
}

.annotation-editor[hidden] {
  display: none;
}

.annotation-editor input[type="text"],
.annotation-editor textarea {
  width: 100%;
}

.annotation-editor textarea {
  min-height: 40px;
}

.annotation-colour-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.annotation-colour-row input {
  width: 44px;
  height: 30px;
  padding: 2px;
}

.layer-tool-toggle {
  margin: 0 0 12px;
}

.range-mode-toggle {
  margin: 10px 0 6px;
}

.cutoff-mode-toggle {
  width: 100%;
  margin: 0 0 12px;
}

.cutoff-mode-toggle button:disabled {
  background: #f1f2ef;
}

.isotherm-controls {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--panel-line);
}

.isotherm-controls h3 {
  margin: 0 0 9px;
  font-size: 12px;
}

.isotherm-mode-toggle {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 10px;
}

.isotherm-mode-toggle button {
  min-width: 0;
  padding-right: 5px;
  padding-left: 5px;
  font-size: 11px;
}

.isotherm-mode-toggle button.active,
.isotherm-mode-toggle button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 750;
}

.isotherm-settings {
  padding: 9px;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  background: #f7f8f7;
}

.range-row.isotherm-temperature-row {
  grid-template-columns: minmax(54px, auto) minmax(70px, 1fr) 58px;
  margin-block: 0;
  font-size: 11px;
}

.isotherm-temperature-row + .isotherm-temperature-row {
  margin-top: 7px;
}

.isotherm-opacity-row {
  grid-template-columns: minmax(0, 1fr) minmax(70px, 1fr) 36px;
  margin-top: 10px;
  font-size: 11px;
}

.isotherm-summary {
  min-height: 18px;
  margin: 9px 0 0;
  padding: 7px 8px;
  border-left: 4px solid #ef1c25;
  background: #ffffff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.isotherm-controls[data-mode="below"] .isotherm-summary {
  border-left-color: #316db5;
}

.isotherm-controls[data-mode="between"] .isotherm-summary {
  border-left-color: var(--brand-yellow);
}

.range-mode-toggle button.active,
.range-mode-toggle button[aria-pressed="true"],
.cutoff-mode-toggle button.active,
.cutoff-mode-toggle button[aria-pressed="true"],
.tsir-mode-toggle button.active,
.tsir-mode-toggle button[aria-pressed="true"],
.layer-tool-toggle button.active,
.layer-tool-toggle button[aria-pressed="true"],
.measurement-primary-tools button.active,
.measurement-primary-tools button[aria-pressed="true"],
.measurement-extreme-tools button.active,
.measurement-extreme-tools button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 750;
}

.canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background-color: var(--viewer);
  background-image:
    linear-gradient(45deg, var(--viewer-grid) 25%, transparent 25%),
    linear-gradient(-45deg, var(--viewer-grid) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--viewer-grid) 75%),
    linear-gradient(-45deg, transparent 75%, var(--viewer-grid) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

#viewerCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 16px;
  padding: 24px;
  color: #f0f2ed;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-state h2 {
  margin: 0;
  font-size: clamp(24px, 5vw, 44px);
  font-weight: 750;
  letter-spacing: 0;
}

.empty-state button {
  justify-self: center;
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.canvas-wrap.is-help-visible #viewerCanvas,
.canvas-wrap.is-help-visible .empty-state {
  display: none;
}

.help-view {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: #f4f5f1;
  color: var(--ink);
}

.help-content {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 64px) clamp(22px, 6vw, 72px) 72px;
  font-size: 15px;
  line-height: 1.6;
}

.help-heading {
  padding-bottom: 24px;
  border-bottom: 1px solid #cfd3cc;
}

.help-eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.help-heading h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.15;
}

.help-build-version {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: inherit;
  font-weight: 400;
}

.help-section {
  padding-top: 30px;
}

.help-section > h2 {
  margin: 0 0 20px;
  color: var(--accent-strong);
  font-size: 23px;
  line-height: 1.2;
}

.help-entry + .help-entry {
  margin-top: 18px;
}

.help-entry h3,
.help-entry h4 {
  margin: 0 0 3px;
  font-size: 16px;
  line-height: 1.35;
}

.help-entry p,
.help-function p,
.help-footer p {
  margin: 0;
}

.help-note {
  margin: 18px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: #ffffff;
}

.help-note strong {
  display: block;
  margin-bottom: 3px;
  color: var(--accent-strong);
}

.help-note p {
  margin: 0;
}

.help-function {
  padding: 20px 0;
  border-top: 1px solid #d9dcd6;
}

.help-function > h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.35;
}

.help-function > h3 span {
  display: inline-grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
}

.help-function > p + p,
.help-function > p + .help-entry,
.help-function > .help-entry + p {
  margin-top: 12px;
}

.help-function .help-entry + .help-entry {
  margin-top: 14px;
}

.help-footer {
  margin-top: 12px;
  padding: 20px;
  border-radius: 8px;
  background: #202326;
  color: #f2f3ee;
}

.help-footer a {
  color: #ffffff;
  font-weight: 750;
}

.control-panel {
  width: 330px;
  max-width: 100%;
  overflow: auto;
  border-left: 1px solid var(--panel-line);
  background: var(--panel);
}

.panel-header {
  display: grid;
  padding: 0 18px 14px;
  border-bottom: 1px solid var(--panel-line);
  background: var(--panel);
}

.panel-logo-band {
  margin: 0 -18px 12px;
  padding: 18px;
  border-bottom: 1px solid var(--accent-strong);
  background: var(--accent);
}

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

.panel-header h1 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.file-meta {
  font-size: 12px;
  line-height: 1.35;
}

.radiometric-meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 3px 8px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.radiometric-meta dt {
  margin: 0;
  font-weight: 700;
  color: #424940;
}

.radiometric-meta dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.panel-logo {
  display: block;
  width: 100%;
  max-height: 64px;
  object-fit: contain;
  object-position: left center;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.control-section {
  padding: 0;
  border-bottom: 1px solid var(--panel-line);
}

.control-section.is-dragging {
  opacity: 0.55;
}

.section-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 12px 18px;
}

.section-header.has-section-help {
  grid-template-columns: minmax(0, 1fr) 28px 34px;
}

.section-toggle,
.section-help-button,
.drag-handle {
  min-height: 32px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
}

.section-help-button {
  display: grid;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  place-items: center;
  border: 1px solid #aeb4ad;
  border-radius: 50%;
  background: #ffffff;
  color: #424940;
  font-size: 15px;
  font-weight: 850;
  line-height: 1;
}

.section-help-button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.section-toggle {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  padding: 0;
  text-align: left;
}

.section-toggle:hover:not(:disabled),
.drag-handle:hover:not(:disabled) {
  background: #eef0ed;
  border-color: transparent;
}

.section-title,
.control-section h2 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  color: #424940;
}

.section-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-arrow {
  position: relative;
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
}

.section-arrow::before {
  position: absolute;
  top: 4px;
  left: 2px;
  width: 6px;
  height: 6px;
  border-right: 2px solid #424940;
  border-bottom: 2px solid #424940;
  content: "";
  transform: rotate(-135deg);
}

.control-section.is-collapsed .section-arrow::before {
  top: 1px;
  transform: rotate(45deg);
}

.drag-handle {
  display: grid;
  width: 34px;
  padding: 0;
  place-content: center;
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.drag-dots {
  display: grid;
  grid-template-columns: repeat(2, 4px);
  gap: 3px 4px;
}

.drag-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
}

.section-content {
  padding: 0 18px 16px;
}

.section-content.is-disabled {
  opacity: 0.6;
  pointer-events: none;
}

.control-section.is-collapsed .section-content {
  display: none;
}

.section-help-dialog {
  position: fixed;
  z-index: 20;
  top: 72px;
  left: max(16px, calc(100vw - 1020px));
  width: min(680px, calc(100vw - 32px));
  min-width: min(360px, calc(100vw - 32px));
  min-height: 300px;
  max-height: calc(100dvh - 32px);
  margin: 0;
  padding: 0;
  overflow: auto;
  border: 0;
  border-top: 5px solid var(--accent);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  resize: both;
}

.section-help-dialog-content {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.section-help-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  cursor: move;
  touch-action: none;
  user-select: none;
}

.section-help-dialog.is-dragging {
  opacity: 0.96;
}

.section-help-eyebrow,
.section-help-dialog h2,
.section-help-description {
  margin: 0;
}

.section-help-eyebrow {
  margin-bottom: 5px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-help-dialog h2 {
  font-size: 25px;
  line-height: 1.15;
}

.section-help-dialog-close {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-color: var(--panel-line);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.section-help-description {
  color: #3f4942;
  font-size: 15px;
  line-height: 1.55;
}

.section-help-media {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid #cfd3cc;
  border-radius: 8px;
  background: #151719;
  aspect-ratio: 16 / 9;
}

.section-help-media video {
  display: block;
  width: 100%;
  height: 100%;
  background: #151719;
  object-fit: contain;
}

.section-help-video-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  padding: 24px;
  place-items: center;
  background: linear-gradient(145deg, #22282a, #111415);
  color: #f2f3ee;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.section-help-tips {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 21px;
  color: #3f4942;
  line-height: 1.5;
}

.section-help-actions {
  display: grid;
  gap: 9px;
  padding-top: 2px;
}

.section-help-pop-out-status {
  min-height: 0;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.section-help-pop-out-status:empty {
  display: none;
}

.section-help-actions > .button-link {
  justify-self: end;
}

.section-help-action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.section-help-pop-out-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 750;
}

@media (max-width: 700px) {
  .section-help-dialog {
    top: 12px;
    left: 12px;
    width: min(680px, calc(100vw - 24px));
    min-width: min(320px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
  }

  .section-help-dialog-content {
    gap: 15px;
    padding: 20px 16px;
  }

  .section-help-dialog h2 {
    font-size: 22px;
  }

  .section-help-action-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }
}

.check-row,
.range-row,
.stacked {
  display: grid;
  gap: 8px;
  margin-block: 10px;
}

.check-row {
  grid-template-columns: 18px 1fr;
  align-items: center;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.range-row {
  grid-template-columns: 64px minmax(0, 1fr) 44px;
  align-items: center;
}

.range-row output {
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.thermal-alignment-control {
  display: grid;
  gap: 8px;
  margin: 12px 0 2px;
}

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

.thermal-alignment-pad {
  display: grid;
  grid-template-columns: repeat(3, 48px);
  grid-template-rows: repeat(3, 48px);
  gap: 2px;
  justify-content: center;
  align-items: center;
}

.thermal-align-button {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  place-items: center;
}

.thermal-align-button:hover {
  transform: translateY(-1px);
}

.thermal-align-button:active,
.thermal-align-button.is-pressed {
  transform: translateY(0);
}

.thermal-align-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.thermal-align-up {
  grid-column: 2;
  grid-row: 1;
}

.thermal-align-left {
  grid-column: 1;
  grid-row: 2;
}

.thermal-align-right {
  grid-column: 3;
  grid-row: 2;
}

.thermal-align-down {
  grid-column: 2;
  grid-row: 3;
}

.thermal-align-icon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.thermal-align-icon-active {
  opacity: 0;
}

.thermal-align-button:active .thermal-align-icon-default,
.thermal-align-button.is-pressed .thermal-align-icon-default {
  opacity: 0;
}

.thermal-align-button:active .thermal-align-icon-active,
.thermal-align-button.is-pressed .thermal-align-icon-active {
  opacity: 1;
}

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

.palette-icon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}

.palette-button {
  display: flex;
  min-width: 0;
  min-height: 82px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 4px;
  border-radius: 6px;
  background: #ffffff;
}

.palette-button.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
  color: var(--accent);
  font-weight: 750;
}

.palette-button:disabled img {
  opacity: 0.42;
}

.palette-button img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.palette-button span {
  max-width: 100%;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.temperature-range-control {
  margin: 0;
  color: var(--muted);
}

.temperature-range-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 6px;
}

.palette-range-bar {
  position: relative;
  margin-top: 52px;
  height: 30px;
  border: 1px solid #323638;
  border-radius: 6px;
  background-color: #111416;
  background-image: linear-gradient(to right, #000000, #ffffff);
  background-position: center;
  background-size: 100% 100%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  touch-action: none;
}

.range-handle {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 0;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ffffff;
  cursor: ew-resize;
  transform: translateX(-50%);
  touch-action: none;
}

.range-handle::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 2px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(21, 23, 25, 0.85), 0 0 7px rgba(0, 0, 0, 0.72);
  content: "";
}

.range-handle span {
  position: absolute;
  top: -25px;
  left: 50%;
  min-width: 60px;
  padding: 3px 5px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 4px;
  background: rgba(21, 23, 25, 0.88);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}

.range-handle.low span {
  transform: translateX(-12%);
}

.range-handle.high span {
  transform: translateX(-88%);
}

.temperature-range-control.is-tight-range .range-handle.high span {
  top: -49px;
  z-index: 3;
}

.temperature-range-control.is-disabled .palette-range-bar {
  opacity: 0.82;
}

.temperature-range-control.is-disabled .range-handle {
  cursor: not-allowed;
}

.tsir-control {
  margin-top: 14px;
}

.tsir-control h3 {
  margin: 0 0 8px;
  color: #424940;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tsir-mode-toggle {
  margin-bottom: 0;
}

select,
input[type="date"],
input[type="email"],
input[type="url"],
input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.4;
}

.image-management-form input[readonly] {
  background: #f3f5f2;
  color: var(--muted);
}

.image-management-status.is-error {
  color: #b42318;
}

.fault-rating-select {
  border-color: var(--fault-rating-color, var(--panel-line));
  background-color: var(--fault-rating-color, #ffffff);
  color: var(--fault-rating-text, var(--ink));
  font-weight: 750;
}

.fault-rating-select option[value="normal"] {
  background: #33b94b;
  color: #ffffff;
}

.fault-rating-select option[value="abnormal"] {
  background: var(--brand-yellow);
  color: #111111;
}

.fault-rating-select option[value="concerning"] {
  background: #f28c28;
  color: #ffffff;
}

.fault-rating-select option[value="dangerous"] {
  background: #ef1c25;
  color: #111111;
}

.reviewer-comments-field {
  min-height: 94px;
}

.project-comments-dialog {
  width: min(460px, calc(100vw - 32px));
}

.project-comments-dialog textarea {
  width: 100%;
  min-height: 190px;
  resize: vertical;
}

.number-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.number-grid label,
.stacked {
  color: var(--muted);
}

.number-grid span,
.stacked span {
  display: block;
  margin-bottom: 0;
  font-size: 12px;
  font-weight: 700;
}

.measurement {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 7px 12px;
  margin: 0;
}

.measurement dt {
  color: var(--muted);
  font-weight: 700;
}

.measurement dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.measurement-label-input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 3px 5px;
  border: 1px solid var(--panel-line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.measurement-label-input:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 20%, transparent);
  outline-offset: 1px;
}

.measurement-chart-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  background: #ffffff;
}

.measurement-result-chart {
  cursor: pointer;
  user-select: none;
}

.line-profile-axis-labels {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: 4px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.line-profile-axis-labels span:nth-child(2) {
  text-align: center;
}

.line-profile-axis-labels span:last-child {
  text-align: right;
}

.thermal-histogram {
  margin-top: 12px;
}

.panel-title .thermal-histogram {
  margin-top: 10px;
}

.thermal-histogram-plot {
  position: relative;
  height: 112px;
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  background: #ffffff;
}

.thermal-histogram-bars {
  position: absolute;
  top: 8px;
  right: 8px;
  bottom: 8px;
  left: 8px;
  display: flex;
  align-items: flex-end;
  gap: 1px;
}

.thermal-histogram-bar {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(to top, var(--accent), var(--brand-yellow));
}

.thermal-histogram-markers {
  position: absolute;
  inset: 0 8px 8px;
  pointer-events: none;
}

.thermal-histogram-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  color: var(--accent);
}

.thermal-histogram-marker::before {
  position: absolute;
  top: 8px;
  bottom: 0;
  left: 0;
  width: 2px;
  background: currentColor;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
  content: "";
  transform: translateX(-1px);
}

.thermal-histogram-marker.is-median {
  color: #0f766e;
}

.thermal-histogram-legend {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 4px 8px;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
}

.thermal-histogram-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  white-space: nowrap;
}

.thermal-histogram-legend-item::before {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.thermal-histogram-legend-item.is-median {
  color: #0f766e;
}

.thermal-histogram-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.button-row button {
  flex: 1 1 0;
}

.project-information-actions {
  margin-top: 12px;
}

.project-information-actions button[type="submit"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 750;
}

.project-information-status {
  min-height: 16px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ai-analysis-intro,
.ai-analysis-privacy,
.field-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.ai-analysis-intro {
  margin: 0 0 12px;
}

.ai-analysis-form {
  display: grid;
}

.ai-analysis-form .stacked:first-child {
  margin-top: 0;
}

.ai-analysis-form .field-help {
  margin-top: -3px;
}

.ai-analysis-form .ai-context-textarea {
  min-height: 82px;
}

.ai-analysis-privacy {
  margin: 2px 0 12px;
}

#aiAnalyzeButton {
  width: 100%;
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 750;
}

.ai-report {
  max-height: 360px;
  margin: 12px 0 0;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.unit-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: 6px;
}

.thermal-alignment-control + .unit-toggle {
  margin-top: 17px;
}

.unit-toggle button {
  min-height: 34px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
}

.unit-toggle button + button {
  border-left: 1px solid var(--panel-line);
}

.unit-toggle button.active {
  background: var(--accent);
  color: #ffffff;
  font-weight: 750;
}

.settings-business-form {
  margin-top: 0;
}

.my-account-login-prompt {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--panel-line);
  border-radius: 7px;
  background: #f7f8f5;
}

.my-account-login-prompt p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.my-account-login-prompt button {
  width: 100%;
}

.user-auth-form,
.my-account-fields {
  display: grid;
  gap: 8px;
}

.my-account-fields {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.my-account-fields:disabled {
  opacity: 0.55;
}

.password-update-form .settings-update-button,
.my-account-fields > .settings-update-button {
  width: 100%;
}

.password-update-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-line);
}

#passwordUpdateHeading {
  color: #b91c1c;
  font-size: 15px;
  font-weight: 800;
}

.settings-logo-dropzone.is-drag-over .settings-logo-preview-frame {
  border-color: var(--accent);
  background: #eefaf8;
}

.settings-logo-preview-frame {
  display: grid;
  min-height: 72px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed var(--panel-line);
  border-radius: 6px;
  background: #f7f8f5;
}

.settings-logo-preview {
  display: block;
  max-width: 100%;
  max-height: 96px;
  object-fit: contain;
}

.settings-logo-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.settings-logo-preview-frame.has-logo .settings-logo-empty {
  display: none;
}

.settings-logo-actions,
.settings-config-actions {
  margin-top: 8px;
}

.settings-config-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.settings-config-actions > button,
.settings-config-actions > .button-link {
  width: auto;
  min-width: 0;
  height: 100%;
  padding-right: 8px;
  padding-left: 8px;
}

.settings-logo-button,
.settings-update-button {
  width: 100%;
}

.settings-update-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 750;
}

.settings-status {
  min-height: 16px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.settings-status:empty {
  display: none;
}

.settings-status.is-error {
  color: #b91c1c;
}

.settings-status.is-success {
  color: #0f766e;
}

@media (max-width: 900px) {
  .app-shell {
    height: 100dvh;
    flex-direction: column;
  }

  .viewer-pane {
    min-height: 55dvh;
  }

  .topbar-main-row {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .toolbar-group {
    flex-wrap: wrap;
  }

  .topbar-meta {
    max-width: 100%;
    align-self: flex-end;
    margin-left: 0;
  }

  .topbar-signed-in-status {
    max-width: min(58vw, 360px);
  }

  .control-panel {
    width: 100%;
    max-height: 45dvh;
    border-top: 1px solid var(--panel-line);
    border-left: 0;
  }

  .number-grid {
    grid-template-columns: 1fr;
  }
}
