:root {
  --ink: #17232d;
  --muted: #60717d;
  --line: #d8e0e5;
  --line-strong: #b8c7d0;
  --canvas: #f3f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --blue: #00669b;
  --blue-dark: #004d76;
  --blue-soft: #e8f3f9;
  --green: #16734a;
  --green-soft: #e8f6ef;
  --amber: #8b5b00;
  --amber-soft: #fff5d9;
  --red: #aa2738;
  --red-soft: #fff0f2;
  --shadow: 0 1px 2px rgba(21, 36, 46, 0.06), 0 7px 22px rgba(21, 36, 46, 0.05);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 900px;
}

body {
  margin: 0;
  background: var(--canvas);
}

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

button,
.button {
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 14px;
  font-weight: 650;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}

button:active,
.button:active {
  transform: translateY(1px);
}

button:disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.52;
}

.primary {
  background: var(--blue);
  color: #fff;
}

.primary:hover:not(:disabled) {
  background: var(--blue-dark);
}

.secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.secondary:hover:not(:disabled) {
  background: var(--surface-soft);
  border-color: #8fa4b1;
}

.compact {
  min-height: 30px;
  padding: 4px 9px;
  font-size: 0.82rem;
}

.app-header {
  min-height: 78px;
  padding: 14px 28px 12px;
  background: #102937;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.app-header h1 {
  margin: 1px 0 0;
  font-size: 1.48rem;
  letter-spacing: -0.015em;
}

.eyebrow {
  margin: 0;
  color: #6f8591;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.app-header .eyebrow {
  color: #93bdcf;
}

.service-health {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  color: #dbeaf1;
  font-size: 0.84rem;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e4ae42;
  box-shadow: 0 0 0 3px rgba(228, 174, 66, 0.15);
}

.service-health.ok .status-dot {
  background: #55c68a;
  box-shadow: 0 0 0 3px rgba(85, 198, 138, 0.16);
}

.service-health.error .status-dot {
  background: #ff6f7e;
  box-shadow: 0 0 0 3px rgba(255, 111, 126, 0.16);
}

.workspace-tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 2px;
  padding: 0 22px;
  overflow-x: auto;
}

.workspace-tab {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: #50636f;
  min-height: 47px;
  padding: 9px 12px 7px;
  white-space: nowrap;
  font-size: 0.88rem;
}

.workspace-tab:hover {
  background: #f1f7fa;
  color: var(--blue-dark);
}

.workspace-tab.active {
  border-bottom-color: var(--blue);
  color: var(--blue-dark);
  background: var(--blue-soft);
}

main {
  padding: 20px 24px 72px;
}

.workspace {
  display: none;
  max-width: 1760px;
  margin: 0 auto;
}

.workspace.active {
  display: block;
}

.workspace-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 2px 16px;
}

.workspace-heading h2 {
  margin: 3px 0 3px;
  font-size: 1.65rem;
  letter-spacing: -0.025em;
}

.workspace-heading p:last-child {
  margin: 0;
  color: var(--muted);
}

.safety-badge,
.phase-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 750;
}

.safety-badge {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid #b7dfca;
}

.phase-badge {
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid #ead39e;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(380px, 0.8fr) minmax(540px, 1.45fr);
  gap: 14px;
  align-items: start;
}

.control-column {
  display: grid;
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
  padding: 15px;
}

.card h3 {
  margin: 0 0 11px;
  font-size: 1rem;
}

.migration-card {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  max-width: 900px;
}

.migration-card p {
  color: var(--muted);
  max-width: 760px;
  line-height: 1.55;
}

.catalog-result {
  margin-top: 14px;
  width: 100%;
}

.form-grid {
  display: grid;
  gap: 11px;
}

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

.four-columns {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

label {
  display: grid;
  gap: 5px;
  color: #394d59;
  font-size: 0.8rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  padding: 7px 9px;
  font-weight: 450;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
.button:focus-visible {
  outline: 3px solid rgba(0, 102, 155, 0.18);
  outline-offset: 1px;
  border-color: var(--blue);
}

.check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}

.check input {
  width: 16px;
  min-height: 16px;
  height: 16px;
}

.align-end {
  align-self: end;
  min-height: 36px;
}

.option-row,
.preset-row,
.action-row,
.button-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-row {
  margin-top: 9px;
}

.action-row {
  margin-top: 12px;
}

.button-group {
  justify-content: flex-end;
}

.inline-status {
  min-width: 160px;
  color: var(--muted);
  font-size: 0.82rem;
}

.inline-status.error {
  color: var(--red);
}

.inline-status.success {
  color: var(--green);
}

.disclosure {
  margin-top: 11px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.disclosure summary {
  cursor: pointer;
  color: var(--blue-dark);
  font-size: 0.83rem;
  font-weight: 700;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 15px;
  max-height: 260px;
  overflow: auto;
  margin-top: 10px;
  padding: 3px;
}

.category-group {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px;
}

.category-group summary {
  color: var(--ink);
}

.category-options {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 9px;
}

.section-title-row h3 {
  margin-bottom: 3px;
}

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

.table-scroll {
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: auto;
  background: #fff;
}

.table-scroll.tall {
  height: 630px;
}

.table-scroll.extra-tall {
  min-height: 510px;
  max-height: calc(100vh - 300px);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.78rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eaf0f3;
  color: #314753;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-strong);
  padding: 8px 9px;
}

td {
  border-bottom: 1px solid #e7ecef;
  padding: 7px 9px;
  vertical-align: top;
}

tbody tr:nth-child(even) td {
  background: #fbfcfd;
}

tbody tr:hover td {
  background: #eef7fb;
}

.select-column {
  width: 38px;
  text-align: center;
}

.select-column input {
  width: 15px;
  min-height: 15px;
  height: 15px;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 38px 10px;
}

.health-problem {
  color: var(--red);
  font-weight: 750;
}

.health-warning,
.health-unknown {
  color: var(--amber);
  font-weight: 750;
}

.health-ok {
  color: var(--green);
  font-weight: 750;
}

.source-pill {
  display: inline-block;
  margin-right: 3px;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 0.68rem;
  font-weight: 750;
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.plot-card {
  margin-top: 14px;
}

.plot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 12px;
}

.plot-panel {
  width: 100%;
  min-width: 0;
  min-height: 440px;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.beam-motion-navigation {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto minmax(260px, auto);
  align-items: center;
  gap: 9px;
  margin: 4px 0 12px;
}

.beam-motion-slider {
  min-height: 30px;
  padding: 0;
}

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

.beam-motion-plots .plot-panel {
  min-height: 470px;
}

.beam-motion-warnings {
  color: var(--amber);
  white-space: pre-line;
  margin: 12px 1px 0;
}

.empty-state {
  min-height: 300px;
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.compact-empty {
  min-height: 160px;
}

.empty-icon {
  font-size: 2.2rem;
  color: #8aa2af;
}

pre {
  max-height: 360px;
  overflow: auto;
  background: #14232b;
  color: #d7e6ed;
  border-radius: 5px;
  padding: 12px;
  font-size: 0.76rem;
  white-space: pre-wrap;
}

.job-drawer {
  position: fixed;
  right: 18px;
  bottom: 14px;
  z-index: 20;
  width: min(460px, calc(100vw - 36px));
}

.job-drawer details {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: 0 10px 34px rgba(20, 38, 49, 0.2);
}

.job-drawer summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-size: 0.84rem;
  font-weight: 750;
}

.count-badge {
  min-width: 22px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  padding: 2px 6px;
  text-align: center;
}

.job-list {
  max-height: 330px;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding: 7px;
}

.job-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 9px;
  border-bottom: 1px solid var(--line);
  padding: 8px 5px;
}

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

.job-row strong {
  font-size: 0.78rem;
}

.job-row span {
  color: var(--muted);
  font-size: 0.72rem;
}

.toast-region {
  position: fixed;
  right: 20px;
  top: 94px;
  z-index: 30;
  display: grid;
  gap: 8px;
}

.toast {
  max-width: 420px;
  background: #172b36;
  color: white;
  border-radius: 5px;
  box-shadow: 0 9px 28px rgba(0, 0, 0, 0.22);
  padding: 10px 13px;
  font-size: 0.82rem;
}

.toast.error {
  background: #8f2030;
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .split-layout {
    grid-template-columns: 1fr;
  }

  .table-scroll.tall {
    height: 500px;
  }

  .four-columns {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .beam-motion-navigation {
    grid-template-columns: auto 1fr auto;
  }

  #beam-motion-capture-label {
    grid-column: 1 / -1;
  }

  .beam-motion-plots {
    grid-template-columns: 1fr;
  }
}

/* Extended review workspace controls */
.medium-table {
  min-height: 260px;
  max-height: 390px;
}

.result-table {
  min-height: 180px;
  max-height: 540px;
}

.selection-list {
  display: grid;
  gap: 5px;
  max-height: 240px;
  overflow: auto;
  margin-top: 9px;
  padding: 3px;
}

.selection-item {
  border-bottom: 1px solid #edf1f3;
  padding: 5px 3px;
  font-weight: 550;
}

.selection-item:last-child {
  border-bottom: 0;
}

.selection-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.top-gap {
  margin-top: 12px;
}

.field-caption {
  color: #394d59;
  font-size: 0.8rem;
  font-weight: 700;
}

.reference-range {
  margin-top: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
}

.reference-range h4 {
  margin: 0 0 9px;
  font-size: 0.86rem;
}


/* Change History and SCR workspace layouts */
.snapshot-workspace {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(460px, 1.2fr);
  gap: 14px;
  align-items: start;
}

.snapshot-workspace > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
}

.snapshot-list {
  max-height: 430px;
}

select[multiple] {
  min-height: 112px;
}

.selected-result-row {
  background: var(--blue-soft);
}

#scr-activity-table td:first-child,
#scr-activity-table th:first-child {
  width: 42px;
  text-align: center;
}

@media (max-width: 1180px) {
  .snapshot-workspace {
    grid-template-columns: 1fr;
  }
}


/* SDDS Analysis compact option controls */
.divider-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.divider-label::before,
.divider-label::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.sdds-options {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
}

.inline-inputs {
  display: flex;
  gap: 5px;
}

.inline-inputs > input,
.inline-inputs > select {
  min-width: 0;
  flex: 1;
}

.check-value {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) minmax(90px, 0.7fr);
  align-items: center;
  gap: 7px;
}

#sdds-columns td:first-child,
#sdds-columns td:nth-child(2),
#sdds-columns th:first-child,
#sdds-columns th:nth-child(2) {
  width: 44px;
  text-align: center;
}


.saved-review-bar {
  margin: 10px 28px 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.saved-review-bar > summary,
.card-summary {
  cursor: pointer;
  padding: 10px 13px;
  font-size: 0.86rem;
  font-weight: 750;
}

.saved-review-bar > summary .muted {
  margin-left: 5px;
  font-weight: 500;
}

.saved-review-controls {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(210px, 1fr) minmax(180px, 0.7fr) auto;
  align-items: end;
  gap: 10px;
  padding: 0 13px 13px;
}

.saved-review-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.saved-review-controls > .inline-status {
  grid-column: 1 / -1;
}

.saved-review-import {
  position: relative;
  overflow: hidden;
}

.saved-review-import input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 1px;
  opacity: 0;
}

.card-summary {
  margin: -14px -16px 0;
  padding: 14px 16px;
  font-size: 1rem;
}

.field-help {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

#trend-compare-table table {
  min-width: 1900px;
}

@media (max-width: 1250px) {
  .saved-review-controls {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}


.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-button {
  min-height: 34px;
  border-color: rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
}

.header-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.feedback-dialog {
  width: min(820px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 18px 70px rgba(9, 28, 39, 0.35);
}

.feedback-dialog::backdrop {
  background: rgba(11, 29, 39, 0.58);
}

.feedback-dialog form {
  padding: 20px;
  overflow: auto;
}

.feedback-dialog h2 {
  margin: 2px 0 4px;
}

.feedback-screenshot {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  padding: 11px;
}

.feedback-screenshot > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.feedback-screenshot p {
  margin: 3px 0 9px;
}

#feedback-screenshot-preview {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border: 1px solid var(--line-strong);
  background: #fff;
}

#feedback-screenshot-preview.hidden {
  display: none;
}
