:root {
  /* Navy actions from the logo blue; slate text for AA contrast. */
  --brand: #1e3a8a;
  --brand-ink: #172554;
  --brand-ring: #2563eb;
  --teal: var(--brand);
  --teal-ink: var(--brand-ink);
  --focus: var(--brand-ring);

  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #0f172a;
  --label: #1e293b;
  --muted: #475569;
  --placeholder: #64748b;
  --line: #e2e8f0;
  --line-strong: #8494a7;
  --hover: #e8eef5;
  --tint: #f8fafc;
  --tint-strong: #e8eef8;
  --quiet-line: #8494a7;
  --brand-wash: #dbe4f5;

  --pass: var(--brand);
  --pass-bg: #eef2fb;
  --info: var(--brand-ink);
  --info-bg: #e8eef9;
  --warn: #8a5a12;
  --warn-bg: #fbf6ec;
  --fail: #8d3b34;
  --fail-bg: #fbf4f3;
  --radius: 12px;
  --radius-sm: 6px;
  --control: 2.75rem;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --font: "Vazirmatn", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;
  --page: 1180px;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--ink);
  /* Vazirmatn localizes 0-9 when lang=fa. Keep Western digits in both languages. */
  font-feature-settings: "locl" 0;
  font-variant-numeric: lining-nums;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
}

a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--teal-ink); }

h1, h2, h3, p { margin-block: 0; }

.shell {
  width: min(var(--page), calc(100% - 2rem));
  margin-inline: auto;
}

body.workstation { --page: 1240px; }

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.6rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  font-size: 1.05rem;
}

.mark {
  width: 1.7rem;
  height: 1.7rem;
  flex: none;
  display: block;
}

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.15rem;
}

nav a, button.link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
}

nav a:hover, button.link:hover { color: var(--ink); background: var(--hover); }

nav form { margin: 0; display: inline; }

button.link {
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.nav-cta {
  background: var(--teal) !important;
  color: #fff !important;
  margin-inline-start: 0.35rem;
}

.nav-cta:hover { background: var(--teal-ink) !important; }

main.shell { padding-block: 1.6rem 2.4rem; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

h1 {
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
}

.lede, .help, .note { color: #475569; font-size: 0.875rem; font-weight: 400; line-height: 1.625; }
.lede, .page-head + .help { color: #334155; max-width: 46rem; }
.lede { margin-top: 0.35rem; }

.badge {
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 500;
}

.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.05rem 1.15rem 1.15rem;
  margin-bottom: 0.85rem;
}

.section h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 0.9rem;
}

.section h3 {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 1.15rem 0 0.55rem;
}

.section h3:first-of-type { margin-top: 0; }

.group + .group {
  margin-top: 1.85rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--line);
}

.group h3 {
  margin: 0 0 0.65rem;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.fields {
  display: grid;
  gap: 0.85rem 0.85rem;
  align-items: stretch;
}

.fields > label {
  display: grid;
  grid-template-rows: minmax(44px, 1fr) auto;
  align-items: end;
  gap: 0.35rem;
}

.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

label, .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--label);
  min-width: 0;
}

input, select, textarea {
  width: 100%;
  height: var(--control);
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
}

input::placeholder, textarea::placeholder {
  color: var(--placeholder);
  font-weight: 400;
}

input:focus, select:focus, textarea:focus {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 0 2px #2563eb;
}

button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

input[readonly], input:disabled, select:disabled {
  background: var(--tint);
  color: var(--ink);
}

.mono, .readout, .seq, .log {
  font-family: var(--mono);
  font-size: 0.95rem;
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control);
  padding: 0 1rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--teal);
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 560;
  text-decoration: none;
  cursor: pointer;
}

button:hover, .btn:hover { background: var(--teal-ink); color: #fff; }

button.quiet, .btn.quiet {
  background: #fff;
  color: var(--brand);
  border: 1px solid var(--quiet-line);
}

button.quiet:hover, .btn.quiet:hover { background: var(--tint); color: var(--brand-ink); }

.profile-bar {
  display: grid;
  grid-template-columns: minmax(14rem, 1.4fr) auto minmax(12rem, 1fr) auto;
  gap: 0.7rem;
  align-items: end;
}

.profile-list {
  list-style: none;
  padding: 0;
  margin: 0.8rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.profile-list li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding-block: 0.1rem;
  padding-inline: 0.7rem 0.15rem;
  background: var(--tint);
  font-size: 0.82rem;
}

.profile-list button {
  min-height: 1.8rem;
  padding: 0 0.6rem;
  font-size: 0.75rem;
}

.target input[name="variant"],
.target textarea[name="variant"] {
  width: 100%;
  min-height: 3.1rem;
  font-size: 1rem;
  background: var(--tint);
  resize: vertical;
}

.target .file-field {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.85rem;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 550;
}

.target .file-field input[type="file"] {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.2rem;
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.meta-row strong { color: var(--ink); font-weight: 600; }

.readout:empty { display: none; }
.readout { margin-top: 0.45rem; color: var(--teal-ink); }

.why { margin: 0.15rem 0 0.85rem; }
.why summary {
  cursor: pointer;
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 550;
  width: fit-content;
}
.why .help,
.fold-body > .help {
  margin-top: 0.55rem;
  max-width: 56rem;
  padding: 0.75rem 0.85rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-inline-start: 4px solid #3b82f6;
  border-radius: 6px;
  color: #1e293b;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.625;
  text-align: justify;
}

.why.compact { margin: 0.125rem 0 0.5rem; }
.why.compact summary { color: #475569; font-size: 0.75rem; font-weight: 500; }
.why.compact summary::before { content: "ℹ"; margin-inline-end: 0.3rem; }
.why.compact .help {
  margin: 0.125rem 0 0;
  padding: 0;
  max-width: none;
  background: none;
  border: 0;
  border-radius: 0;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.5;
  text-align: justify;
}

.fields input,
.fields select {
  text-align: center;
  font-weight: 500;
}

.mix-field { display: flex; flex-direction: column; gap: 0.35rem; max-width: 28rem; }
.mix-caption { font-weight: 600; }
.mix-picker { position: relative; }
.mix-current,
.mix-brand,
.mix-product {
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  justify-content: flex-start;
}
.mix-current:hover,
.mix-brand:hover,
.mix-product:hover,
.mix-brand-item:hover > .mix-brand,
.mix-brand-item:focus-within > .mix-brand,
.mix-current:focus-visible,
.mix-brand:focus-visible,
.mix-product:focus-visible {
  background: var(--hover, #f1f5f9);
  color: var(--ink);
}
.mix-current {
  width: 100%;
  text-align: start;
  border: 1px solid var(--line-strong, #cbd5e1);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  cursor: pointer;
}
.mix-panel[hidden] { display: none !important; }
.mix-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 0.25rem);
  inset-inline-start: 0;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}
.mix-brands {
  list-style: none;
  margin: 0;
  padding: 0.3rem;
  min-width: 14rem;
  overflow: visible;
}
.mix-brand-item { position: relative; }
.mix-products {
  display: none;
  position: absolute;
  z-index: 41;
  top: 0;
  inset-inline-start: calc(100% - 6px);
  list-style: none;
  margin: 0;
  padding: 0.3rem;
  min-width: 18rem;
  max-height: 20rem;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}
.mix-brand-item:hover > .mix-products {
  display: block;
}
.mix-brand,
.mix-product {
  display: block;
  width: 100%;
  border: 0;
  text-align: start;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}
.mix-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.mix-current .mix-label {
  flex: 1;
  min-width: 0;
  text-align: start;
}
.mix-current .mix-chev { flex: none; margin-inline-end: 0.15rem; }
.mix-current[aria-expanded="true"] .mix-chev { transform: rotate(-135deg) translateY(-1px); }
.mix-brand-item > .mix-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.mix-sub {
  flex: none;
  margin-inline-end: 0.2rem;
  transform: rotate(-45deg);
}
[dir="rtl"] .mix-sub { transform: rotate(135deg); }
.mix-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.zone-af select,
.zone-af option {
  text-align: center;
}

.snp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(10.5rem, 0.95fr);
  gap: 0.75rem;
  align-items: start;
  margin-top: 0.35rem;
}

.snp-sources h3,
.snp-cuts .zone h3 {
  margin-top: 0;
}

.snp-cuts {
  display: grid;
  gap: 0.75rem;
}

.snp-cuts[dir="rtl"] {
  text-align: start;
}

.snp-cuts[dir="rtl"] .zone-af h3,
.snp-cuts[dir="rtl"] .zone-af label {
  text-align: start;
}

.zone-af {
  background: linear-gradient(#fff, #f7f9fd) padding-box,
    linear-gradient(180deg, var(--brand-wash), var(--line)) border-box;
  border: 1px solid transparent;
  box-shadow: var(--shadow);
}

.zone-af label {
  margin-bottom: 0;
}

.freq-dbs {
  display: grid;
  gap: 0.65rem;
  margin: 0.35rem 0 0.5rem;
}

.dbsnp-option {
  margin-top: 1.15rem;
  margin-bottom: 0.35rem;
}

.dbsnp-help {
  margin-top: 0.35rem;
  text-align: justify;
}

.dbsnp-help[dir="rtl"] {
  text-align: justify;
}

.freq-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--tint);
  font-size: 0.9rem;
  font-weight: 550;
  cursor: pointer;
}

.freq-row input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--ink);
}

.freq-af {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  color: #475569;
  white-space: nowrap;
}

.freq-af select {
  min-width: 6.5rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: #fff;
  font: inherit;
  color: var(--ink);
}

.freq-none-note {
  margin-top: 0.25rem;
}

.segment {
  display: inline-flex;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--tint);
  margin-bottom: 0.85rem;
  gap: 0.15rem;
}

.segment label {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 550;
  cursor: pointer;
}

.segment input { width: auto; height: auto; margin: 0; accent-color: var(--teal); }
.segment label:has(input:checked) { background: #fff; box-shadow: 0 1px 2px rgba(18, 32, 51, 0.06); }

.chemistry { background: linear-gradient(#fff, #fff) padding-box, linear-gradient(180deg, var(--tint-strong), var(--line)) border-box; border: 1px solid transparent; }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.zone {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  background: var(--tint);
}

.zone h3 { margin-top: 0; }

.locus-fig {
  direction: ltr;
  margin: 0.15rem 0 0.35rem;
}

.locus-ruler {
  position: relative;
  height: 1.55rem;
  border-bottom: 1px solid #cbd5e1;
}

.locus-ruler span {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-align: center;
}

.locus-ruler span::before {
  content: "";
  display: block;
  width: 1px;
  height: 6px;
  margin: 0 auto 0.2rem;
  background: #cbd5e1;
}

.locus-ruler span:first-child { transform: translateX(0); text-align: start; }
.locus-ruler span:first-child::before { margin-inline: 0 auto; }
.locus-ruler span:last-child { transform: translateX(-100%); text-align: end; }
.locus-ruler span:last-child::before { margin-inline: auto 0; }

.locus {
  position: relative;
  height: 2.55rem;
  margin-top: 0.4rem;
  background: #e8edf2;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  direction: ltr;
}

.locus-zone {
  position: absolute;
  bottom: 0.4rem;
  height: 1.15rem;
  box-sizing: border-box;
}

.locus-prefer {
  z-index: 1;
  background: #6ee7b7;
  border: 1px solid #10b981;
  border-radius: 4px;
}

.locus-edge {
  z-index: 0;
  background: #d1fae5;
  border: 1px solid #86efac;
  border-radius: 3px;
}

.locus-exclude {
  z-index: 2;
  background: repeating-linear-gradient(-45deg, #fff1f2, #fff1f2 4px, #fda4af 4px, #fda4af 5px);
  border-block: 1px solid #fda4af;
}

.locus-fail {
  z-index: 0;
  background: repeating-linear-gradient(
    -45deg,
    rgba(254, 226, 226, 0.35),
    rgba(254, 226, 226, 0.35) 5px,
    rgba(248, 113, 113, 0.45) 5px,
    rgba(248, 113, 113, 0.45) 7px
  );
  border: 1px dashed #e11d48;
  border-radius: 3px;
}

.locus > .locus-variant {
  position: absolute;
  left: 50%;
  bottom: 0.28rem;
  z-index: 2;
  width: 4px;
  height: 1.55rem;
  transform: translateX(-50%);
  background: #f59e0b;
  border-radius: 2px;
  box-shadow: 0 0 0 1px #b45309;
}

.locus > .locus-variant::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -7px;
  width: 8px;
  height: 8px;
  transform: translateX(-50%) rotate(45deg);
  background: #f59e0b;
  border: 1px solid #b45309;
  border-radius: 1px;
}

.locus-dims {
  position: relative;
  height: 1.45rem;
  margin-top: 0.15rem;
}

.locus-bracket {
  position: absolute;
  top: 0;
  box-sizing: border-box;
  border-inline: 1px solid #fda4af;
  border-bottom: 1px solid #fda4af;
  height: 7px;
}

.locus-bracket i {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  color: #334155;
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.locus-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.9rem;
  margin: 0.35rem 0 0.85rem;
  color: #334155;
  font-size: 12px;
  font-weight: 500;
}

.swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  margin-inline-end: 0.35rem;
  vertical-align: -2px;
  border-radius: 3px;
}

.swatch.locus-prefer { background: #6ee7b7; border: 1px solid #10b981; }
.swatch.locus-edge { background: #d1fae5; border: 1px solid #86efac; }
.swatch.locus-exclude {
  background: repeating-linear-gradient(-45deg, #fff1f2, #fff1f2 3px, #fda4af 3px, #fda4af 4px);
  border: 1px solid #fda4af;
}
.swatch.locus-fail {
  background: repeating-linear-gradient(-45deg, #fee2e2, #fee2e2 3px, #f87171 3px, #f87171 4px);
  border: 1px dashed #e11d48;
}

.swatch.locus-variant {
  width: 4px;
  height: 0.85rem;
  border-radius: 2px;
  background: #f59e0b;
  box-shadow: 0 0 0 1px #b45309;
}

.folds {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 0.35rem 0 1.5rem;
}

.fold {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.fold.chemistry { overflow: visible; }

.fold > summary {
  min-height: 3.15rem;
  padding: 0.85rem 1.25rem;
  list-style: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.fold-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.85rem;
  min-height: 2.2rem;
  pointer-events: none;
}

.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::marker { content: ""; }

.fold > summary:hover { background: var(--hover); }
.fold > summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.fold-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.fold.quiet .fold-title {
  font-weight: 500;
  color: var(--muted);
}

.fold-sum {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #334155;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: end;
}

.num {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

.chev {
  width: 0.45rem;
  height: 0.45rem;
  margin-inline-end: 0.25rem;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg) translateY(-1px);
  transition: transform 160ms ease;
}

.fold[open] > summary {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  border-inline-start: 3px solid var(--teal);
}

.fold[open] > summary .fold-title { color: var(--ink); }
.fold[open] > summary .chev { transform: rotate(-135deg) translateY(-1px); color: var(--teal); }

.fold-body { padding: 1.25rem; }
.fold[open] .fold-body { animation: unfold 160ms ease; }

@keyframes unfold {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.fold.chemistry[open] { background: #fff; }

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(100%, 42rem);
  margin: 0.85rem auto 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.summary-grid dt,
.summary-grid dd {
  display: flex;
  align-items: center;
  margin: 0;
  min-height: 2.5rem;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
}

.summary-grid dt {
  color: var(--label);
  font-weight: 500;
}

.summary-grid dd {
  color: #0f172a;
  font-weight: 600;
  direction: ltr;
  justify-content: flex-start;
}

html[dir="rtl"] .summary-grid dd { justify-content: flex-end; }

.summary-grid dt:nth-of-type(odd),
.summary-grid dd:nth-of-type(odd) { background: #f8fafc; }

.summary-grid dt:nth-of-type(even),
.summary-grid dd:nth-of-type(even) { background: #fff; }

.summary-grid dt:last-of-type,
.summary-grid dd:last-of-type { border-bottom: 0; }

.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border: 0;
  border-top: 1px solid #e2e8f0;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.12), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
}

.action-bar button[type="submit"] {
  font-weight: 600;
  min-width: 12rem;
  min-height: 2.75rem;
  padding-inline: 1.5rem;
}

.action-bar .mini {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  direction: ltr;
}

.flash {
  border: 1px solid #efd3d0;
  border-inline-start: 3px solid var(--fail);
  background: var(--fail-bg);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.9rem;
}

.flash ul { margin: 0.35rem 0 0; padding-inline-start: 1.1rem; }

.ruo {
  width: min(var(--page), calc(100% - 2rem));
  margin: 0 auto 1.2rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  color: #475569;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.hero {
  padding-top: 0.6rem;
  margin-bottom: 0.85rem;
}

.hero h1 { font-size: 2.15rem; max-width: 18ch; }
.hero .lead { font-size: 1.02rem; color: var(--ink); margin-top: 0.7rem; max-width: 42rem; }

.job-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: job;
  display: grid;
  gap: 0.95rem;
}
.job-steps li {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr);
  gap: 0.15rem 0.75rem;
  align-items: baseline;
}
.job-steps li::before {
  content: counter(job);
  counter-increment: job;
  grid-row: 1 / span 2;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--brand);
  padding-top: 0.15rem;
}
.job-steps strong { font-weight: 600; color: var(--ink); }
.job-steps span { color: var(--label); font-size: 0.92rem; line-height: 1.55; }

.specimen-note { margin: 0 0 0.85rem; color: var(--label); max-width: 46rem; }
.methods {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.9rem;
  padding: 0;
  list-style: none;
}
.methods li {
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--label);
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
}
.specimen-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16.5rem;
  gap: 1rem 1.25rem;
  align-items: start;
}
.sheet-wrap { overflow-x: auto; direction: ltr; }
.sheet {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  direction: ltr;
}
.sheet th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.72rem;
  padding: 0.35rem 0.55rem 0.45rem 0;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.sheet td {
  padding: 0.7rem 0.55rem 0.7rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  white-space: nowrap;
}
.sheet td:first-child { white-space: normal; min-width: 8.5rem; }
.flag-note {
  display: block;
  margin-top: 0.35rem;
  color: var(--warn);
  font-size: 0.75rem;
  line-height: 1.35;
}
.status-key {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.75rem;
}
.status-key li {
  display: grid;
  gap: 0.28rem;
  color: var(--label);
  font-size: 0.86rem;
  line-height: 1.45;
}
.status-key .status { justify-self: start; }

.refuse { margin: 0; padding: 0; list-style: none; }
.refuse li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
.refuse li:last-child { border-bottom: 0; }

.auth {
  width: min(26rem, 100%);
  margin-inline: auto;
  margin-top: 1.5rem;
}

.auth form, .stack form { display: grid; gap: 0.75rem; }
.auth h1, .stack h1 { margin-bottom: 0.8rem; }

.jobs-table { width: 100%; border-collapse: collapse; margin-top: 0.4rem; }
.jobs-table th {
  text-align: start;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.35rem 0.75rem 0.45rem 0;
  border-bottom: 1px solid var(--line-strong);
}
.jobs-table td {
  padding: 0.85rem 0.75rem 0.85rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.jobs-table a { font-family: var(--mono); font-size: 0.86rem; text-decoration: none; color: var(--ink); }
.jobs-table a:hover { color: var(--teal); }
.jobs-table .when { white-space: nowrap; font-size: 0.86rem; color: var(--label); width: 11rem; }
.jobs-table .state { width: 7rem; text-align: end; }
.jobs-table th.state { text-align: end; }

.jobs { list-style: none; padding: 0; margin: 0.4rem 0 0; }
.jobs li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}
.jobs a { font-family: var(--mono); font-size: 0.86rem; text-decoration: none; color: var(--ink); }
.jobs a:hover { color: var(--teal); }
.jobs a.dl {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--teal);
  flex-shrink: 0;
}
.jobs a.dl:hover { text-decoration: underline; }

.status {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  background: var(--hover);
  color: var(--muted);
}
.status-queued, .status-running { background: var(--info-bg); color: var(--info); }
.status-done, .status-pass { background: var(--pass-bg); color: var(--pass); }
.status-failed, .status-fail, .status-killed { background: var(--fail-bg); color: var(--fail); }
.status-successful { background: var(--pass-bg); color: var(--pass); }
.status-not_started, .status-waiting, .status-reading { background: var(--hover); color: var(--muted); }
.status-partial { background: #fff7ed; color: #c2410c; }
.status-warn { background: var(--warn-bg); color: var(--warn); }

.pair {
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.9rem;
  margin: 0.55rem 0;
  background: #fff;
}
.pair header { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.pair p { margin-top: 0.35rem; }
.seq { direction: ltr; text-align: start; word-break: break-all; }

.log {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #0f1720;
  color: #d7e0ea;
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  direction: ltr;
  text-align: start;
  max-height: 18rem;
  overflow: auto;
}

.rejection-note {
  white-space: pre-wrap;
  margin: 0.4rem 0 0;
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink);
}

.job-error {
  margin: 0.85rem 0 1.1rem;
  padding: 0.85rem 1rem;
  border: 1px solid color-mix(in srgb, var(--fail) 35%, var(--line));
  border-radius: var(--radius);
  background: var(--fail-bg);
  color: var(--fail);
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 46rem;
}

.progress-panel { max-width: 40rem; }
.stage-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.stage {
  display: grid;
  grid-template-columns: 1.1rem 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
}
.stage-mark {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  justify-self: center;
}
.stage-waiting .stage-mark { opacity: 0.45; }
.stage-running {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent, #1e3a8a) 25%, var(--line));
  background: color-mix(in srgb, var(--accent, #1e3a8a) 6%, #fff);
}
.stage-running .stage-mark {
  background: var(--accent, #1e3a8a);
  border-color: var(--accent, #1e3a8a);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #1e3a8a) 18%, transparent);
}
.stage-done { color: var(--ink); }
.stage-done .stage-mark {
  background: color-mix(in srgb, #15803d 85%, #fff);
  border-color: #15803d;
}
.stage-failed { color: var(--fail); background: var(--fail-bg); }
.stage-failed .stage-mark {
  background: var(--fail);
  border-color: var(--fail);
}
.stage-skipped { opacity: 0.7; }
.stage-skipped .stage-mark { border-style: dashed; }
.stage-state {
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: inherit;
  opacity: 0.85;
}
.progress-detail {
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: #334155;
}

.prose { max-width: 44rem; }
.prose h2 { font-size: 1.05rem; font-weight: 600; margin-top: 1.3rem; }
.prose p, .prose h3 { margin-top: 0.45rem; }
.prose h3 { font-size: 0.95rem; font-weight: 600; }

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 1.2rem;
  color: var(--muted);
  background: var(--tint);
}

.ocr-list { display: flex; flex-direction: column; gap: 0.65rem; margin-top: 0.8rem; }
.ocr-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}
.ocr-row input { width: 100%; }
.ocr-meta { font-size: 0.82rem; color: var(--muted); text-align: end; white-space: nowrap; }
.ocr-low input { border-color: #c4a574; background: var(--warn-bg); }
.ocr-low .ocr-meta { color: var(--warn); font-weight: 600; }

@media (max-width: 1024px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-bar { grid-template-columns: 1fr 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero h1 { max-width: none; }
  .specimen-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .cols-4, .cols-3, .cols-2, .split, .profile-bar { grid-template-columns: 1fr; }
  .page-head, .action-bar, .bar { align-items: stretch; flex-direction: column; }
  .bar { padding-block: 0.55rem; }
  h1, .hero h1 { font-size: 1.55rem; }
  .action-bar .mini { display: none; }
  .fold-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title chev" "sum sum";
    row-gap: 0.1rem;
  }
  .fold-title { grid-area: title; }
  .fold-sum { grid-area: sum; white-space: normal; text-align: start; }
  .chev { grid-area: chev; justify-self: end; }
  .shell, .ruo { width: min(var(--page), calc(100% - 1.25rem)); }
}

@media (max-width: 420px) {
  .snp-layout { grid-template-columns: 1fr; }
}
