:root {
  --ink: #17201f;
  --ink-soft: #52605e;
  --ink-faint: #7d8987;
  --paper: #f4f2eb;
  --card: rgba(255, 255, 252, 0.94);
  --line: #dcded7;
  --grid: #e8e9e3;
  --teal: #0b716d;
  --teal-dark: #075552;
  --teal-soft: #dcecea;
  --blue: #1d6687;
  --coral: #c75b43;
  --warning: #9a6400;
  --danger: #a83d32;
  --shadow: 0 18px 42px rgba(36, 52, 49, 0.08);
  --radius: 16px;
  font-family:
    "Microsoft YaHei UI", "Noto Sans CJK SC", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background:
    radial-gradient(circle at 12% 0%, rgba(11, 113, 109, 0.09), transparent 26rem),
    var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.32) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.32) 1px, transparent 1px);
  background-size: 28px 28px;
}

button,
select,
input,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(11, 113, 109, 0.28);
  outline-offset: 2px;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  max-width: 1640px;
  margin: 0 auto;
  padding: 30px 34px 22px;
}

.header-status {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-direction: column;
}

.session-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.session-summary[hidden] {
  display: none;
}

.session-summary > div {
  display: grid;
  gap: 2px;
  text-align: right;
}

.session-summary strong {
  color: var(--ink);
}

.app-header h1 {
  margin: 2px 0 4px;
  font-family: Georgia, "Noto Serif CJK SC", "Songti SC", serif;
  font-size: clamp(2rem, 4vw, 3.3rem);
  font-weight: 600;
  letter-spacing: -0.035em;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--teal);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.subtitle {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.health-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 35px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-faint);
  box-shadow: 0 0 0 4px rgba(125, 137, 135, 0.13);
}

.health-badge--checking .health-dot {
  animation: pulse 1.25s infinite ease-in-out;
}

.health-badge--online {
  color: var(--teal-dark);
  border-color: #b6d6d1;
  background: #eff9f7;
}

.health-badge--online .health-dot {
  background: #159269;
  box-shadow: 0 0 0 4px rgba(21, 146, 105, 0.13);
}

.health-badge--offline {
  color: var(--danger);
  border-color: #ebc2bb;
  background: #fff4f2;
}

.health-badge--offline .health-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(168, 61, 50, 0.12);
}

.workspace {
  display: grid;
  gap: 18px;
  width: min(100% - 40px, 1640px);
  margin: 0 auto;
  padding-bottom: 46px;
}

.workspace[hidden] {
  display: none;
}

.auth-shell {
  display: grid;
  width: min(100% - 40px, 520px);
  margin: 30px auto 60px;
}

.auth-shell[hidden] {
  display: none;
}

.auth-card {
  padding: 28px;
}

.auth-card h2 {
  margin: 6px 0 8px;
  font-family: Georgia, "Noto Serif CJK SC", "Songti SC", serif;
  font-size: 1.55rem;
}

.auth-intro,
.course-closed-card p {
  margin: 0 0 22px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 10px;
  background: #e9ebe5;
}

.auth-tab {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  color: var(--ink-soft);
  background: transparent;
  font-weight: 700;
}

.auth-tab.is-active {
  color: var(--teal-dark);
  background: #fff;
  box-shadow: 0 1px 5px rgba(22, 39, 36, 0.12);
}

.auth-panel[hidden] {
  display: none;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.auth-form .button {
  width: 100%;
  margin-top: 4px;
}

.auth-status {
  min-height: 1.3em;
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 0.78rem;
}

.course-closed-card {
  text-align: center;
}

.course-closed-card .section-kicker {
  margin-bottom: 6px;
}

.card {
  border: 1px solid rgba(205, 209, 201, 0.9);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.data-source-card {
  min-width: 0;
  padding: 20px 22px 22px;
}

.data-source-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 15px;
}

.data-source-heading h2,
.section-heading h2 {
  margin: 4px 0 0;
  font-size: 1.08rem;
  line-height: 1.3;
}

.muted {
  color: var(--ink-faint);
  font-size: 0.8em;
  font-weight: 500;
}

.data-source-flow {
  display: grid;
  grid-template-columns:
    minmax(250px, 0.8fr)
    minmax(330px, 1.15fr)
    minmax(330px, 1.15fr);
  align-items: stretch;
  gap: 0;
}

.data-source-pane {
  display: flex;
  min-width: 0;
  min-height: 264px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(249, 250, 246, 0.86);
  flex-direction: column;
}

.data-source-flow > .data-source-pane {
  border-radius: 0;
}

.data-source-flow > .data-source-pane:first-child {
  border-radius: 12px 0 0 12px;
}

.data-source-flow > .data-source-pane:last-child {
  margin-left: -1px;
  border-radius: 0 12px 12px 0;
}

.pane-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  margin-bottom: 10px;
}

.pane-heading > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pane-heading h3 {
  margin: 0;
  font-size: 0.84rem;
}

.pane-heading-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.queue-check-button,
.header-transfer-button {
  display: grid;
  width: 27px;
  height: 27px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--teal-dark);
  background: #fff;
  font-size: 0.72rem;
  font-weight: 800;
}

.queue-check-button:hover:not(:disabled),
.header-transfer-button:hover:not(:disabled) {
  border-color: #8bbab4;
  background: var(--teal-soft);
}

.header-transfer-button {
  font-size: 0.86rem;
}

.step-number {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 50%;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-size: 0.68rem;
  font-weight: 800;
}

.path-input-label {
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
}

.path-input {
  width: 100%;
  min-height: 126px;
  padding: 10px 11px;
  resize: vertical;
  border: 1px solid #cbd1ca;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.55;
}

.path-input::placeholder {
  color: #a0aaa8;
}

.dataset-select {
  width: 100%;
  min-height: 168px;
  padding: 6px;
  border: 1px solid #cbd1ca;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
}

.dataset-select option {
  padding: 6px 8px;
  border-radius: 5px;
}

.pane-hint {
  margin: 7px 0 10px;
  color: var(--ink-faint);
  font-size: 0.67rem;
  line-height: 1.4;
}

.pane-button {
  width: 100%;
  margin-top: auto;
}

.file-tree {
  overflow: auto;
  min-height: 166px;
  max-height: 220px;
  padding: 7px;
  border: 1px solid #e1e4de;
  border-radius: 9px;
  background: #fff;
}

.file-tree-empty {
  display: grid;
  min-height: 146px;
  margin: 0;
  place-items: center;
  color: var(--ink-faint);
  font-size: 0.72rem;
}

.selection-hint {
  margin: 7px 2px 0;
  color: var(--ink-faint);
  font-size: 0.62rem;
  line-height: 1.35;
}

.file-group + .file-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eceee9;
}

.file-group-title {
  overflow: hidden;
  margin: 0 4px 5px;
  color: var(--ink-faint);
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-size: 0.64rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row {
  display: grid;
  align-items: center;
  gap: 7px;
  min-height: 31px;
  padding: 4px 5px;
  border-radius: 6px;
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.file-row--loaded {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.file-row--queue {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.file-role-select {
  width: 74px;
  height: 25px;
  padding: 2px 18px 2px 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-faint);
  background: #fff;
  font-size: 0.58rem;
}

.file-row--selectable {
  cursor: default;
  user-select: none;
}

.file-row:hover,
.file-row--selectable:focus-visible {
  background: #f1f7f5;
}

.file-row--selectable.is-selected {
  color: var(--teal-dark);
  background: var(--teal-soft);
  box-shadow: inset 3px 0 var(--teal);
}

.file-row--selectable.is-selected .file-name {
  color: var(--teal-dark);
}

.file-name {
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--ink-faint);
  font-size: 0.62rem;
  white-space: nowrap;
}

.file-check-checkbox {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--teal);
}

.remove-file-button {
  display: grid;
  width: 24px;
  height: 24px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 5px;
  color: var(--ink-faint);
  background: transparent;
}

.remove-file-button:hover {
  color: var(--danger);
  background: #fff0ed;
}

.tic-legend-toolbar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: -2px 0 10px;
}

.tic-palette-control {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  color: var(--ink-faint);
  font-size: 0.64rem;
  font-weight: 700;
  white-space: nowrap;
}

.tic-palette-select {
  height: 28px;
  padding: 3px 24px 3px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink-soft);
  background: #fff;
  font-size: 0.66rem;
}

.tic-legend {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  gap: 7px 14px;
  padding: 3px 1px 6px;
  color: var(--ink-soft);
  font-size: 0.66rem;
}

.tic-legend-group {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.tic-legend-path {
  max-width: 210px;
  overflow: hidden;
  color: var(--ink-faint);
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-size: 0.61rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tic-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.tic-color {
  display: inline-block;
  width: 15px;
  height: 3px;
  border-radius: 999px;
}

.tic-peak-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: -1px 0 11px;
  padding: 8px 10px;
  border: 1px solid #e0e4dc;
  border-radius: 9px;
  background: rgba(247, 249, 245, 0.82);
}

.tic-peak-setting {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-faint);
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
}

.tic-peak-setting input,
.tic-peak-setting select {
  width: 62px;
  height: 30px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-size: 0.7rem;
}

.tic-peak-setting select {
  width: auto;
  padding-right: 24px;
}

.tic-peak-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-faint);
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
}

.tic-peak-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--teal);
}

.tic-peak-status {
  min-width: 190px;
  margin-left: auto;
  color: var(--ink-faint);
  font-size: 0.66rem;
  text-align: right;
}

.button--compact {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 0.7rem;
}

.workflow-workspace {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.workflow-tabs {
  display: flex;
  gap: 5px;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(238, 241, 235, 0.94);
}

.workflow-tab {
  min-width: 128px;
  min-height: 36px;
  padding: 7px 18px;
  border: 0;
  border-radius: 8px;
  color: var(--ink-faint);
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
}

.workflow-tab:hover {
  color: var(--teal-dark);
}

.workflow-tab.is-active {
  color: #fff;
  background: var(--teal);
  box-shadow: 0 3px 10px rgba(11, 113, 109, 0.16);
}

.workflow-panel {
  min-width: 0;
}

.workflow-panel[hidden] {
  display: none;
}

.workflow-feature-card {
  min-width: 0;
  padding: 21px 22px 18px;
}

.feature-intro {
  margin: 4px 0 0;
  color: var(--ink-faint);
  font-size: 0.7rem;
}

.rt-method-toolbar,
.rt-pin-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid #e0e4dc;
  border-radius: 9px;
  background: rgba(247, 249, 245, 0.82);
}

.rt-method-toolbar label,
.rt-pin-form label,
.target-input-grid label,
.target-actions label {
  display: grid;
  gap: 4px;
  color: var(--ink-faint);
  font-size: 0.65rem;
  font-weight: 700;
}

.rt-method-toolbar input,
.rt-method-toolbar select,
.rt-pin-form input,
.target-actions input,
.target-actions select,
.library-name-search input {
  height: 34px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 0.72rem;
}

.rt-method-toolbar select {
  min-width: 130px;
}

.rt-method-toolbar input {
  min-width: 150px;
}

.method-runtime {
  align-self: center;
  color: var(--ink-faint);
  font-size: 0.66rem;
}

.rt-pin-form {
  display: grid;
  grid-template-columns: minmax(150px, 0.35fr) minmax(220px, 1fr) auto;
}

.feature-table-wrap {
  overflow: auto;
  max-height: 520px;
  border: 1px solid #e0e3dd;
  border-radius: 9px;
}

.feature-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.7rem;
}

.feature-table th,
.feature-table td {
  padding: 9px 10px;
  border-right: 1px solid #e7e9e3;
  border-bottom: 1px solid #e7e9e3;
  text-align: left;
  vertical-align: middle;
}

.feature-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  color: var(--ink-faint);
  background: #f7f8f4;
  font-weight: 800;
  white-space: nowrap;
}

.feature-table tr:last-child td {
  border-bottom: 0;
}

.rt-pin-table-input {
  box-sizing: border-box;
  width: 100%;
  min-width: 160px;
  height: 32px;
  padding: 5px 8px;
  border: 1px solid #d9ded6;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.rt-pin-table-input:focus {
  border-color: var(--teal);
  outline: 2px solid rgba(48, 119, 115, 0.14);
  outline-offset: 0;
}

.rt-pin-table-time {
  min-width: 100px;
  max-width: 180px;
}

.button--danger {
  border-color: #e9c4bc;
  color: var(--danger);
  background: #fff6f4;
}

.button--danger:hover:not(:disabled) {
  border-color: var(--danger);
  background: #fff0ed;
}

.library-name-search {
  display: grid;
  grid-template-columns: auto minmax(130px, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  margin: -2px 0 10px;
  color: var(--ink-faint);
  font-size: 0.64rem;
  font-weight: 700;
}

.target-input-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(180px, 0.28fr);
  align-items: start;
  gap: 12px;
  margin-bottom: 12px;
}

.target-input-grid textarea {
  min-height: 132px;
  padding: 9px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-size: 0.65rem;
}

.target-actions {
  display: grid;
  align-content: start;
  gap: 8px;
}

.target-record-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 10px;
}

.target-record-list .analysis-empty {
  width: 100%;
  min-height: 54px;
}

.target-record {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 6px 6px 9px;
  border: 1px solid #d6dfda;
  border-radius: 8px;
  background: #f7fbfa;
}

.target-record div {
  display: grid;
  gap: 1px;
}

.target-record strong {
  color: var(--ink);
  font-size: 0.68rem;
}

.target-record span {
  color: var(--ink-faint);
  font-size: 0.58rem;
}

.target-record .target-expected-rt {
  display: grid;
  min-width: 104px;
  gap: 2px;
  color: var(--ink-faint);
  font-size: 0.56rem;
  font-weight: 700;
}

.target-expected-rt input {
  width: 104px;
  min-height: 28px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.target-table {
  min-width: 760px;
}

.target-pin-cell {
  width: 1%;
  text-align: center !important;
  white-space: nowrap;
}

.target-pin-button {
  min-width: 52px;
}

.target-amount {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.target-amount--review {
  color: var(--warning);
  font-weight: 700;
}

.target-rt-status {
  white-space: nowrap;
}

.target-rt-status--review {
  color: var(--warning);
  font-weight: 700;
}

.analysis-card {
  min-width: 0;
  padding: 21px 22px 18px;
}

.analysis-empty {
  display: grid;
  min-height: 150px;
  place-items: center;
  border: 1px dashed #d6dad3;
  border-radius: 10px;
  color: var(--ink-faint);
  background: rgba(250, 250, 247, 0.74);
  font-size: 0.76rem;
}

.analysis-empty[hidden] {
  display: none;
}

.analysis-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 2px 0 10px;
  color: var(--ink-faint);
  font-size: 0.7rem;
}

.analysis-table-actions,
.analysis-table-actions label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.analysis-table-actions select {
  height: 30px;
  padding: 4px 25px 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-size: 0.7rem;
}

.analysis-selection-hint {
  margin: -4px 0 8px;
  color: var(--ink-faint);
  font-size: 0.62rem;
}

.button.is-pending {
  border-color: #d9b86e;
  color: #76530c;
  background: #fff9e9;
}

.analysis-table-wrap {
  overflow: auto;
  max-height: 560px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.analysis-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.72rem;
}

.analysis-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  min-width: 126px;
  padding: 9px 10px;
  border-right: 1px solid #e7e9e3;
  border-bottom: 1px solid var(--line);
  color: var(--ink-faint);
  background: #f7f7f3;
  font-size: 0.65rem;
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
}

.analysis-table th:first-child {
  z-index: 3;
  left: 0;
}

.analysis-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.analysis-sort-button {
  display: grid;
  width: 21px;
  height: 21px;
  padding: 0;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #8a9592;
  background: transparent;
  font-size: 0.57rem;
  line-height: 1;
}

.analysis-sort-button:hover {
  border-color: #b8d2ce;
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.analysis-sort-button:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.analysis-table th[aria-sort="ascending"] .analysis-sort-button,
.analysis-table th[aria-sort="descending"] .analysis-sort-button {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.analysis-table td,
.analysis-table tbody th {
  padding: 9px 10px;
  border-right: 1px solid #eff0eb;
  border-bottom: 1px solid #eceee8;
  color: var(--ink-soft);
  background: #fff;
  vertical-align: top;
}

.analysis-table tbody th {
  position: sticky;
  z-index: 1;
  top: auto;
  left: 0;
  color: var(--teal-dark);
  background: #fbfcf8;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.analysis-table tbody th:first-child {
  z-index: 1;
  top: auto;
}

.analysis-feature-id,
.analysis-feature-time {
  display: block;
}

.analysis-feature-time {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 0.63rem;
  font-weight: 600;
}

.analysis-table tbody tr:hover td,
.analysis-table tbody tr:hover th {
  background: #f3f8f6;
}

.analysis-table tbody tr:hover th {
  background: #eaf4f1;
}

.analysis-table .is-grid-selected {
  background: #dcefeb !important;
  box-shadow: inset 0 0 0 1px #6ca9a1;
}

.standards-card {
  min-width: 0;
  padding: 21px 22px 24px;
}

.standards-heading {
  align-items: flex-start;
}

.standards-intro,
.standards-subheading p,
.standards-build-bar p {
  margin: 5px 0 0;
  color: var(--ink-faint);
  font-size: 0.7rem;
}

.standards-method-badge {
  padding: 6px 10px;
  border: 1px solid #c9deda;
  border-radius: 999px;
  color: var(--teal-dark);
  background: #eff8f6;
  font-size: 0.67rem;
  font-weight: 800;
  white-space: nowrap;
}

.standards-import {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) auto minmax(220px, auto);
  align-items: end;
  gap: 10px;
  margin: 18px 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(247, 249, 245, 0.9);
}

.standards-import label {
  display: grid;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 800;
}

.standards-import input {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #cfd4cc;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: 0.7rem Consolas, "Cascadia Mono", monospace;
}

.standards-status {
  align-self: center;
  color: var(--ink-faint);
  font-size: 0.68rem;
  line-height: 1.4;
}

.standards-section {
  margin-top: 18px;
}

.standards-subheading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 9px;
}

.standards-subheading h3 {
  margin: 0;
  font-size: 0.84rem;
}

.standards-table-wrap {
  overflow: auto;
  max-height: 410px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.standards-table {
  width: 100%;
  min-width: 880px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.68rem;
}

.standards-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  padding: 8px 9px;
  border-right: 1px solid #e7e9e3;
  border-bottom: 1px solid var(--line);
  color: var(--ink-faint);
  background: #f7f7f3;
  font-size: 0.62rem;
  text-align: left;
  white-space: nowrap;
}

.standards-table td {
  padding: 5px 7px;
  border-right: 1px solid #eff0eb;
  border-bottom: 1px solid #eceee8;
  color: var(--ink-soft);
  background: #fff;
}

.standards-table td:first-child,
.standards-table th:first-child {
  width: 44px;
  text-align: center;
}

.standards-table strong {
  display: block;
  max-width: 230px;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.standards-table input:not([type="checkbox"]),
.standards-table select {
  width: 100%;
  min-width: 82px;
  height: 30px;
  padding: 4px 7px;
  border: 1px solid #d9dcd5;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font-size: 0.66rem;
}

.standards-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.standards-table input:disabled {
  background: #f1f2ee;
}

.analyte-settings-table {
  min-width: 920px;
}

.analyte-settings-table th:first-child,
.analyte-settings-table td:first-child {
  width: 240px;
  text-align: left;
}

.analyte-settings-table td:first-child input {
  min-width: 220px;
}

.standards-build-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 12px 13px;
  border: 1px solid #cbdedb;
  border-radius: 10px;
  background: #f0f8f6;
}

.standards-build-bar p {
  margin: 0;
}

.standards-results {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 510px), 1fr));
  gap: 14px;
}

.profile-grid > .analysis-empty {
  grid-column: 1 / -1;
}

.standard-profile {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.standard-profile > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.standard-profile h4 {
  margin: 0;
  font-size: 0.9rem;
}

.standard-profile header p {
  margin: 3px 0 0;
  color: var(--ink-faint);
  font-size: 0.63rem;
}

.profile-status {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.61rem;
  font-weight: 800;
  white-space: nowrap;
}

.profile-status--review {
  color: #7a5100;
  background: #fff3cf;
}

.profile-status--ready {
  color: #17623f;
  background: #e1f5e9;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, auto 1fr);
  gap: 4px 7px;
  margin: 12px 0 0;
  padding: 9px;
  border-radius: 8px;
  background: #f7f8f4;
  font-size: 0.62rem;
}

.profile-stats dt {
  color: var(--ink-faint);
  font-weight: 700;
}

.profile-stats dd {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

.profile-identity-note {
  margin: 10px 0;
  color: var(--ink-soft);
  font-size: 0.67rem;
}

.profile-figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.profile-figures figure {
  min-width: 0;
  margin: 0;
  padding: 7px;
  border: 1px solid #e5e8e1;
  border-radius: 8px;
}

.profile-figures figcaption {
  margin-bottom: 3px;
  color: var(--ink-soft);
  font-size: 0.62rem;
  font-weight: 800;
}

.profile-chart {
  display: block;
  width: 100%;
  height: auto;
}

.profile-axis {
  stroke: #aeb7b4;
  stroke-width: 1;
}

.profile-fit-line {
  fill: none;
  stroke: var(--coral);
  stroke-width: 2;
}

.profile-calibration-point {
  fill: var(--teal);
  stroke: #fff;
  stroke-width: 1.5;
}

.profile-fingerprint-peak {
  stroke: var(--blue);
  stroke-width: 1.7;
}

.profile-chart-label {
  fill: #7d8987;
  font-size: 9px;
}

.profile-levels {
  overflow: auto;
  margin-top: 9px;
}

.profile-levels table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.62rem;
}

.profile-levels th,
.profile-levels td {
  padding: 5px 6px;
  border-bottom: 1px solid #eceee8;
  color: var(--ink-soft);
  text-align: right;
}

.profile-levels th {
  color: var(--ink-faint);
  font-weight: 800;
}

.profile-levels th:first-child,
.profile-levels td:first-child {
  text-align: left;
}

.profile-warnings {
  margin: 10px 0 0;
  padding: 8px 8px 8px 25px;
  border: 1px solid #ecd9a8;
  border-radius: 8px;
  color: #76530c;
  background: #fff9e9;
  font-size: 0.64rem;
}

.standard-profile footer {
  margin-top: 9px;
  color: var(--ink-faint);
  font-size: 0.59rem;
}

.analysis-candidate {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 7px;
  min-width: 190px;
  max-width: 240px;
}

.analysis-candidate-checkbox {
  width: 15px;
  height: 15px;
  margin: 1px 0 0;
  accent-color: var(--teal);
}

.analysis-candidate-copy {
  min-width: 0;
}

.analysis-candidate-name {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-candidate-score {
  display: block;
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 0.63rem;
}

.analysis-abundance,
.analysis-average {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.analysis-average {
  color: var(--teal-dark);
  font-weight: 800;
}

.untarget-table {
  min-width: 1080px;
}

.untarget-table-input {
  width: 100%;
  min-width: 104px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.untarget-table-input:hover,
.untarget-table-input:focus {
  border-color: var(--line);
  background: #fff;
  outline: none;
}

.compound-context-source {
  cursor: context-menu;
}

.compound-context-menu {
  position: fixed;
  z-index: 80;
  display: grid;
  min-width: 210px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 15px 40px rgba(36, 48, 44, 0.22);
}

.compound-context-menu[hidden] {
  display: none;
}

.compound-context-menu strong {
  overflow: hidden;
  padding: 10px 12px 8px;
  color: var(--ink);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compound-context-menu button {
  padding: 9px 12px;
  border: 0;
  border-top: 1px solid #edf0eb;
  color: var(--ink-soft);
  background: #fff;
  font: inherit;
  font-size: 0.7rem;
  text-align: left;
}

.compound-context-menu button:hover:not(:disabled) {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.compound-context-menu button:disabled {
  color: #aab1ae;
  background: #fafaf7;
}

.chart-card,
.result-panel {
  min-width: 0;
  padding: 21px 22px 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 42px;
  margin-bottom: 13px;
}

.heading-actions,
.scan-controls,
.legend {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spectrum-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 13px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f3f5f1;
}

.spectrum-tab {
  flex: 1;
  min-height: 34px;
  padding: 6px 14px;
  border: 0;
  border-radius: 7px;
  color: var(--ink-faint);
  background: transparent;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 750;
  cursor: pointer;
  transition:
    color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.spectrum-tab:hover {
  color: var(--teal-dark);
}

.spectrum-tab.is-active {
  color: var(--teal-dark);
  background: #fff;
  box-shadow: 0 1px 5px rgba(22, 39, 36, 0.12);
}

.spectrum-tab:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.spectrum-tab-panel {
  min-width: 0;
}

.spectrum-tab-panel[hidden] {
  display: none;
}

.mirror-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 28px;
  margin-bottom: 10px;
}

.interaction-hint,
.scan-meta {
  color: var(--ink-faint);
  font-size: 0.72rem;
}

.button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 700;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    transform 150ms ease;
}

.button:not(:disabled):active,
.icon-button:not(:disabled):active {
  transform: translateY(1px);
}

.button {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 0.8rem;
}

.button--quiet {
  border-color: var(--line);
  color: var(--ink-soft);
  background: #fafaf7;
}

.button--quiet:hover:not(:disabled) {
  border-color: #b8c0b9;
  background: #fff;
}

.button--primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 156px;
  color: #fff;
  background: var(--teal);
  box-shadow: 0 7px 18px rgba(11, 113, 109, 0.2);
}

.button--primary:hover:not(:disabled) {
  background: var(--teal-dark);
}

.button--loading {
  pointer-events: none;
}

.button--loading .button-icon {
  animation: spin 0.9s linear infinite;
}

.svg-chart {
  position: relative;
  overflow: hidden;
  width: 100%;
  border: 1px solid #e0e2dc;
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(248, 249, 245, 0.84), rgba(255, 255, 255, 0.96));
  user-select: none;
}

.svg-chart--tic {
  height: 305px;
}

.svg-chart--spectrum {
  height: 352px;
}

.svg-chart--mirror {
  height: 352px;
}

.svg-chart svg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--ink-faint);
  text-align: center;
}

.empty-state p {
  margin: 0;
  font-size: 0.8rem;
}

.empty-icon {
  color: #9eaaa7;
  font-size: 1.7rem;
}

.chart-axis {
  stroke: #8d9895;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-grid {
  stroke: var(--grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
  vector-effect: non-scaling-stroke;
}

.chart-label {
  fill: #6b7775;
  font-size: 11px;
}

.chart-axis-title {
  fill: #6b7775;
  font-size: 11px;
  font-weight: 700;
}

.tic-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
  vector-effect: non-scaling-stroke;
}

.tic-line--overlay {
  opacity: 0.78;
  stroke-width: 1.45;
}

.tic-line--overlay.is-active {
  opacity: 1;
  stroke-width: 2.1;
}

.tic-peak-guide {
  pointer-events: none;
  stroke: #87918e;
  stroke-width: 0.8;
  stroke-dasharray: 2 4;
  opacity: 0.5;
  vector-effect: non-scaling-stroke;
}

.tic-rt-pin-guide {
  pointer-events: none;
  stroke: var(--coral);
  stroke-width: 1;
  stroke-dasharray: 5 4;
  opacity: 0.78;
  vector-effect: non-scaling-stroke;
}

.tic-rt-pin-label {
  pointer-events: none;
  fill: #a44334;
  font-size: 8px;
  font-weight: 800;
}

.tic-peak-label {
  pointer-events: none;
  fill: #75817e;
  font-size: 8px;
  font-weight: 700;
}

.tic-peak-dot {
  pointer-events: none;
  stroke: #fff;
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.tic-selection {
  stroke: #4c1d95;
  stroke-width: 1.25;
  stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke;
}

.tic-selection-dot {
  fill: #fff;
  stroke: #4c1d95;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.tic-hover-dot {
  pointer-events: none;
  stroke: #fff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.hover-line {
  pointer-events: none;
  stroke: #6f7a77;
  stroke-width: 1;
  stroke-dasharray: 3 3;
  vector-effect: non-scaling-stroke;
}

.spectrum-stick--query {
  stroke: var(--blue);
}

.spectrum-stick--library {
  stroke: var(--coral);
}

.spectrum-stick {
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.spectrum-stick:hover {
  stroke-width: 3;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(560px, 1.45fr) minmax(410px, 0.75fr);
  gap: 18px;
}

.section-heading--spectrum {
  align-items: flex-end;
}

.scan-meta {
  min-height: 1.2em;
  margin: 3px 0 0;
}

.scan-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 35px;
  padding: 6px 10px;
  border-color: var(--line);
  color: var(--ink-soft);
  background: #fafaf7;
  font-size: 0.75rem;
}

.icon-button:hover:not(:disabled) {
  border-color: #b6c2bc;
  color: var(--teal-dark);
  background: #fff;
}

.scan-position {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-faint);
  font-size: 0.72rem;
}

.scan-position input {
  width: 68px;
  height: 35px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-align: right;
}

.spectrum-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 13px;
}

.spectrum-action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.spectrum-summary {
  color: var(--ink-faint);
  font-size: 0.75rem;
}

.result-panel {
  display: flex;
  flex-direction: column;
  max-height: 538px;
}

.count-pill {
  display: grid;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  place-items: center;
  border-radius: 999px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-size: 0.75rem;
  font-weight: 800;
}

.tic-annotation-band {
  pointer-events: none;
}

.table-wrap {
  overflow: auto;
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.74rem;
}

.result-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-faint);
  background: #f7f7f3;
  font-size: 0.66rem;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.result-table th:first-child,
.result-table tbody tr:not(.table-empty) td:first-child {
  position: sticky;
  left: 0;
  min-width: 48px;
  text-align: center;
}

.result-table th:first-child {
  z-index: 3;
}

.result-table td {
  padding: 9px 8px;
  border-bottom: 1px solid #ecece7;
  vertical-align: middle;
}

.result-table tbody tr:not(.table-empty) td:first-child {
  z-index: 1;
  background: #fff;
}

.result-table tbody tr:not(.table-empty) {
  cursor: pointer;
  transition: background 120ms ease;
}

.result-table tbody tr:not(.table-empty):hover {
  background: #f0f7f5;
}

.result-table tbody tr:not(.table-empty):hover td:first-child {
  background: #f0f7f5;
}

.result-table tbody tr.is-copy-selected {
  box-shadow: inset 3px 0 var(--teal);
}

.result-table tbody tr.is-copy-selected:not(.is-selected) {
  background: #f5faf8;
}

.result-table tbody tr.is-copy-selected:not(.is-selected) td:first-child {
  background: #f5faf8;
}

.result-table tbody tr.is-selected {
  background: var(--teal-soft);
  box-shadow: inset 3px 0 var(--teal);
}

.result-table tbody tr.is-selected td:first-child {
  background: var(--teal-soft);
}

.rank {
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.compound-name {
  display: block;
  max-width: 230px;
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compound-formula {
  display: block;
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 0.66rem;
}

.score-value {
  color: var(--teal-dark);
  font-size: 0.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.standard-match-status {
  display: inline-grid;
  min-width: 52px;
  min-height: 22px;
  padding: 3px 7px;
  place-items: center;
  border-radius: 999px;
  font-size: 0.61rem;
  font-weight: 800;
}

.standard-match-status--pass {
  color: #17623f;
  background: #dff3e7;
}

.standard-match-status--review {
  color: #7a5100;
  background: #fff0bf;
}

.standard-match-status--fail {
  color: #8c332b;
  background: #fae2de;
}

.table-empty td {
  height: 190px;
  color: var(--ink-faint);
  text-align: center;
}

.match-details {
  min-height: 82px;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid #e3e4de;
  border-radius: 9px;
  color: var(--ink-soft);
  background: #fafaf7;
  font-size: 0.72rem;
  line-height: 1.55;
}

.match-details p {
  margin: 0;
}

.match-details dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
}

.match-details dt {
  color: var(--ink-faint);
  font-size: 0.64rem;
}

.match-details dd {
  overflow: hidden;
  margin: 2px 0 0;
  color: var(--ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-details--standard {
  overflow: auto;
  max-height: 245px;
}

.standard-match-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.standard-match-summary strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.standard-match-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.standard-profile-review {
  display: inline-grid;
  min-height: 22px;
  padding: 3px 7px;
  place-items: center;
  border-radius: 999px;
  color: #7a5100;
  background: #fff0bf;
  font-size: 0.58rem;
  font-weight: 800;
  white-space: nowrap;
}

.standard-match-note {
  margin-top: 10px !important;
  padding-top: 8px;
  border-top: 1px solid #e3e4de;
  color: var(--ink-soft);
}

.qualifier-check-table {
  width: 100%;
  margin-top: 9px;
  border-collapse: collapse;
  font-size: 0.64rem;
}

.qualifier-check-table th,
.qualifier-check-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #e9ebe5;
  text-align: right;
}

.qualifier-check-table th {
  color: var(--ink-faint);
  font-weight: 800;
}

.qualifier-check-table th:first-child,
.qualifier-check-table td:first-child {
  text-align: left;
}

.standard-warning-title {
  display: block;
  margin-top: 10px;
  color: var(--warning);
  font-size: 0.65rem;
}

.standard-match-warnings {
  margin: 4px 0 0;
  padding-left: 18px;
  color: #76530c;
  font-size: 0.63rem;
}

.legend {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-line {
  display: inline-block;
  width: 18px;
  height: 2px;
}

.legend-line--query {
  background: var(--blue);
}

.legend-line--library {
  background: var(--coral);
}

.chart-tooltip {
  position: fixed;
  z-index: 40;
  max-width: 260px;
  padding: 7px 9px;
  border: 1px solid rgba(22, 39, 36, 0.12);
  border-radius: 7px;
  color: #fff;
  background: rgba(25, 38, 36, 0.92);
  box-shadow: 0 8px 24px rgba(15, 25, 23, 0.18);
  font-size: 0.7rem;
  line-height: 1.5;
  pointer-events: none;
  white-space: nowrap;
}

.toast-region {
  position: fixed;
  z-index: 50;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(390px, calc(100vw - 40px));
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid #edbeb5;
  border-radius: 10px;
  color: #713028;
  background: #fff5f3;
  box-shadow: 0 14px 34px rgba(48, 35, 32, 0.16);
  font-size: 0.78rem;
  line-height: 1.45;
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast--info {
  border-color: #b8d7d2;
  color: var(--teal-dark);
  background: #f0f9f7;
}

.toast--notice {
  border-color: #b8d7d2;
  color: var(--teal-dark);
  background: #f0f9f7;
}

.toast button {
  border: 0;
  color: inherit;
  background: transparent;
  font-size: 1rem;
  line-height: 1;
}

.loading-overlay {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  color: var(--teal-dark);
  background: rgba(255, 255, 252, 0.84);
  font-size: 0.76rem;
  font-weight: 700;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  margin: auto;
  border: 3px solid var(--teal-soft);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 1120px) {
  .data-source-flow {
    grid-template-columns: minmax(250px, 0.8fr) minmax(330px, 1.2fr);
    gap: 10px;
  }

  .data-source-flow > .data-source-pane:last-child {
    grid-column: 1 / -1;
  }

  .data-source-flow > .data-source-pane,
  .data-source-flow > .data-source-pane:first-child,
  .data-source-flow > .data-source-pane:last-child {
    margin-left: 0;
    border-radius: 12px;
  }

  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .result-panel {
    max-height: none;
  }

  .standards-import {
    grid-template-columns: 1fr auto;
  }

  .standards-status {
    grid-column: 1 / -1;
  }

  .profile-figures {
    grid-template-columns: 1fr;
  }

  .target-input-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-header {
    align-items: flex-start;
    padding: 22px 18px 16px;
  }

  .header-status {
    gap: 8px;
  }

  .session-summary {
    align-items: flex-end;
    flex-direction: column;
  }

  .session-summary > div {
    max-width: 170px;
  }

  .subtitle {
    display: none;
  }

  .health-badge {
    max-width: 150px;
    white-space: normal;
  }

  .workspace {
    width: min(100% - 20px, 1640px);
    gap: 12px;
  }

  .auth-shell {
    width: min(100% - 20px, 520px);
    margin-top: 16px;
  }

  .auth-card {
    padding: 20px;
  }

  .data-source-card {
    padding: 17px;
  }

  .data-source-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .data-source-flow {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .data-source-flow > .data-source-pane:last-child {
    grid-column: auto;
  }

  .file-tree {
    max-height: 260px;
  }

  .chart-card,
  .result-panel {
    padding: 17px 13px 14px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-heading--spectrum {
    flex-direction: column;
  }

  .heading-actions {
    align-items: flex-end;
    flex-direction: column;
  }

  .mirror-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .interaction-hint {
    display: none;
  }

  .tic-legend-toolbar {
    flex-direction: column;
    gap: 6px;
  }

  .tic-legend {
    width: 100%;
  }

  .tic-peak-status {
    width: 100%;
    margin-left: 0;
    text-align: left;
  }

  .workflow-tabs {
    width: 100%;
  }

  .workflow-tab {
    flex: 1;
    min-width: 0;
  }

  .analysis-card {
    padding: 17px 13px 14px;
  }

  .workflow-feature-card {
    padding: 17px 13px 14px;
  }

  .rt-pin-form,
  .library-name-search {
    grid-template-columns: 1fr;
  }

  .standards-card {
    padding: 17px 13px 14px;
  }

  .standards-heading,
  .standards-build-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .standards-import {
    grid-template-columns: 1fr;
  }

  .standards-import .button {
    width: 100%;
  }

  .standards-status {
    grid-column: auto;
  }

  .profile-stats {
    grid-template-columns: auto 1fr;
  }

  .analysis-table-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .analysis-table-actions {
    flex-wrap: wrap;
  }

  .scan-controls {
    justify-content: flex-start;
  }

  .svg-chart--tic {
    height: 250px;
  }

  .svg-chart--spectrum {
    height: 300px;
  }

  .svg-chart--mirror {
    height: 300px;
  }

  .spectrum-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .spectrum-action-buttons {
    align-items: stretch;
    flex-direction: column;
  }

  .spectrum-action-buttons .button {
    width: 100%;
  }

  .match-details dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
