:root {
  color-scheme: light;
  --navy: #142536;
  --navy-deep: #101f2d;
  --ink: #1b2e40;
  --muted: #536679;
  --subtle: #708095;
  --line: #dee6ee;
  --line-soft: #ecf0f4;
  --background: #f5f7fa;
  --white: #fff;
  --teal: #17685d;
  --teal-deep: #125347;
  --teal-light: #e5f1ee;
  --mint: #8dd1bd;
  --warning: #85491a;
  --warning-bg: #fff4df;
  --error: #993a42;
  --error-bg: #fff0f1;
  --sidebar-width: 258px;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--background);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; line-height: 1.55; }
[hidden] { display: none !important; }
a { color: var(--teal); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .62; }
:focus-visible { outline: 2px solid #318c79; outline-offset: 3px; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 20; transform: translateY(-160%); padding: 8px 12px; background: var(--white); }
.skip-link:focus { transform: translateY(0); }
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; align-self: start; height: 100dvh; display: flex; flex-direction: column; padding: 29px 14px 20px; color: #c4cfd9; background: var(--navy); }
.brand { display: flex; align-items: center; color: #fff; gap: 11px; text-decoration: none; min-height: 44px; padding: 0 10px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 20px; font-weight: 680; letter-spacing: -.045em; line-height: 1.12; }
.brand small { margin-top: 5px; color: #aebfce; font-size: 11.5px; letter-spacing: .01em; }
.brand-mark { position: relative; display: block; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; background: #28463e; }
.brand-mark i { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #b5e5d4; z-index: 1; }
.brand-mark i:nth-child(1) { left: 8px; top: 15px; }
.brand-mark i:nth-child(2) { left: 23px; top: 8px; }
.brand-mark i:nth-child(3) { left: 21px; top: 23px; }
.brand-mark b { position: absolute; width: 17px; height: 1px; left: 12px; top: 18px; transform-origin: left center; background: #8dd1bd; }
.brand-mark b:nth-of-type(1) { transform: rotate(-25deg); }
.brand-mark b:nth-of-type(2) { transform: rotate(31deg); }
.nav-group { margin: 38px 12px 8px; color: #92a7ba; font-weight: 650; font-size: 10px; text-transform: uppercase; letter-spacing: .17em; }
#main-nav { display: grid; gap: 4px; }
.nav-link { display: flex; position: relative; min-height: 42px; align-items: center; gap: 10px; padding: 8px 9px 8px 12px; border: 1px solid transparent; border-radius: 7px; color: #c6d3df; text-decoration: none; font-size: 13px; letter-spacing: -.012em; }
.nav-link .icon { color: #9db4c4; }
.nav-link:hover { background: #203549; color: #fff; }
.nav-link[aria-current="page"] { color: #eaf9f4; border-color: #355e59; background: #29443f; font-weight: 620; }
.nav-link[aria-current="page"] .icon { color: #a3ddc8; }
.sidebar-footer { display: flex; margin: auto 10px 0; padding: 15px 2px 0; gap: 8px; align-items: center; color: #abbccd; border-top: 1px solid #2c3e50; font-size: 12px; }
.mode-dot { height: 7px; width: 7px; background: #8dd1bd; border-radius: 50%; }
.icon { display: inline-block; flex: 0 0 auto; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.18em; }
.main-shell { min-width: 0; }
.topbar { position: sticky; z-index: 5; top: 0; border-bottom: 1px solid var(--line); background: var(--white); }
.topbar-inner { display: flex; min-height: 64px; padding: 9px clamp(18px, 3.4vw, 48px); gap: 16px; justify-content: space-between; align-items: center; }
.topbar-left, .topbar-right, .breadcrumbs { display: flex; align-items: center; gap: 13px; min-width: 0; }
.breadcrumbs { gap: 9px; font-size: 13px; color: var(--muted); }
.breadcrumbs strong { color: var(--ink); font-weight: 620; }
.topbar-right { flex-shrink: 0; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; border: 1px solid #d0e6de; padding: 3px 9px; border-radius: 20px; background: #eff8f5; color: #286253; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #4e967e; }
.nav-toggle { display: none !important; }
.main-content { width: 100%; max-width: 1540px; padding: 34px clamp(18px, 3.4vw, 48px) 48px; margin-inline: auto; }
.page-header { display: flex; justify-content: space-between; gap: 14px 25px; align-items: end; margin: 2px 0 24px; }
.page-header > div { min-width: 0; }
.page-header .button { flex-shrink: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(27px, 3vw, 37px); line-height: 1.13; letter-spacing: -.043em; font-weight: 700; }
h2 { font-size: 17px; font-weight: 660; letter-spacing: -.02em; }
h3 { font-size: 14px; font-weight: 660; }
.page-description { max-width: 76ch; margin-top: 10px; font-size: 14px; color: var(--muted); }
.section-description { color: var(--muted); font-size: 13px; }
.notice { overflow-wrap: anywhere; margin: 0 0 15px; padding: 10px 13px; border: 1px solid #cfe6df; border-left: 3px solid #438b77; border-radius: 7px; background: #eff8f5; color: #225749; font-size: 14px; }
.notice[data-state="error"] { border-color: #f0d4d8; border-left-color: #ad4b53; background: var(--error-bg); color: var(--error); }
.context-note { display: flex; align-items: flex-start; gap: 9px; padding: 12px 14px; margin-bottom: 17px; border: 1px solid #d1e4df; border-radius: 8px; background: #edf6f3; color: #2d5e55; font-size: 13px; }
.context-note .icon { margin-top: 2px; }
.context-note.warning { color: var(--warning); background: var(--warning-bg); border-color: #f1dfb8; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin: 0 0 17px; }
.comparison-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { display: flex; position: relative; flex-direction: column; min-width: 0; gap: 6px; border: 1px solid var(--line); border-radius: 9px; padding: 15px 16px; background: var(--white); }
.metric .icon { position: absolute; top: 18px; right: 15px; color: var(--teal); }
.metric-name { color: var(--muted); font-size: 12.5px; padding-right: 18px; }
.metric strong { font-size: 29px; font-weight: 690; line-height: 1.07; letter-spacing: -.035em; }
.metric-detail { min-height: 16px; color: var(--subtle); font-size: 12px; overflow-wrap: anywhere; }
.overview-grid, .split-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 15px; align-items: start; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 15px; }
.panel { margin: 0; min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--white); }
.panel-header { display: flex; justify-content: space-between; align-items: start; padding: 15px 18px 13px; gap: 10px; border-bottom: 1px solid var(--line-soft); }
.panel-header p { margin-top: 4px; }
.panel-body { min-width: 0; padding: 16px 18px; }
.panel-body > :first-child { margin-top: 0; }
.panel-body > :last-child { margin-bottom: 0; }
.workflow { padding: 4px 18px; margin: 0; list-style: none; }
.workflow li { position: relative; display: grid; grid-template-columns: 32px minmax(0,1fr) 18px; align-items: center; gap: 10px; padding: 12px 0; }
.workflow li + li { border-top: 1px solid var(--line-soft); }
.workflow a { color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 640; }
.workflow a:hover { color: var(--teal); text-decoration: underline; }
.workflow small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.stage-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 6px; background: var(--teal-light); color: var(--teal); }
.stage-arrow { color: #7b8c9e; }
.boundary-list { display: grid; gap: 13px; padding: 0; margin: 0; list-style: none; }
.boundary-list li { display: grid; grid-template-columns: 20px minmax(0,1fr); align-items: start; gap: 9px; }
.boundary-list .icon { color: var(--teal); margin-top: 2px; }
.boundary-list strong { display: block; font-size: 13px; font-weight: 650; }
.boundary-list small, .hint { color: var(--muted); font-size: 12px; }
.boundary-list small { display: block; margin-top: 2px; line-height: 1.4; }
.empty-state { text-align: center; color: var(--muted); padding: 28px 15px; overflow-wrap: anywhere; font-size: 13px; }
.empty-state.initial { padding: 65px 15px; }
.empty-state .icon { display: block; width: 23px; height: 23px; margin: 0 auto 8px; color: #6d8c84; }
.empty-state strong { color: var(--ink); font-size: 14px; display: block; font-weight: 640; margin-bottom: 4px; }
.button { min-height: 35px; display: inline-flex; justify-content: center; align-items: center; gap: 7px; padding: 6px 11px; border: 1px solid transparent; border-radius: 6px; color: var(--ink); background: var(--white); text-decoration: none; text-align: center; font-size: 12.5px; font-weight: 620; line-height: 1.25; }
.button-primary { background: var(--teal); color: var(--white); border-color: var(--teal); }
.button-primary:hover:not(:disabled) { background: var(--teal-deep); border-color: var(--teal-deep); }
.button-quiet { border-color: #cfdbe2; }
.button-quiet:hover:not(:disabled) { background: #f1f6f7; }
.button-small { min-height: 30px; font-size: 12px; padding: 5px 9px; }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--ink); font-size: 21px; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--teal); text-align: left; font-weight: 620; text-decoration: underline; text-underline-offset: 3px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid.single { grid-template-columns: minmax(0, 1fr); }
.align-end { align-self: end; }
.form-stack { display: grid; min-width: 0; gap: 12px; }
.search-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
label:not(.checkbox-label) { display: grid; min-width: 0; gap: 5px; color: var(--ink); font-weight: 610; font-size: 12.5px; }
input:not([type="checkbox"]), select, textarea { display: block; width: 100%; min-width: 0; max-width: 100%; min-height: 38px; color: var(--ink); background: var(--white); border: 1px solid #cdd9e2; border-radius: 6px; padding: 8px 10px; font-size: 13px; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: #78899b; }
textarea { min-height: 96px; resize: vertical; }
input[type="file"] { padding: 5px; }
input[type="file"]::file-selector-button { margin-right: 8px; padding: 5px 8px; border: 1px solid #d2e0e5; border-radius: 4px; background: #eff6f5; color: var(--teal); cursor: pointer; }
.checkbox-label { font-size: 13px; display: flex; align-items: start; gap: 8px; color: var(--muted); }
.checkbox-label input { margin-top: 4px; flex: 0 0 auto; accent-color: var(--teal); }
.collection-panel { margin-bottom: 15px; }
.collection-panel .panel-body > :not(:last-child) { margin-bottom: 10px; }
.table-scroll { min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
table { width: 100%; min-width: max(100%, 400px); border-collapse: collapse; text-align: left; font-size: 12.5px; }
th, td { padding: 10px 13px; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
th { background: #f7f9fb; color: #4b5d6f; font-weight: 660; font-size: 11.5px; white-space: nowrap; }
td { max-width: 365px; overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfd; }
.cell-title { display: block; color: var(--ink); font-weight: 640; }
.cell-subtitle { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.subdued { color: var(--muted); }
.mono, code, .sequence-text { font-family: "IBM Plex Mono", Consolas, ui-monospace, monospace; }
.sequence-text { color: #18384a; font-weight: 600; overflow-wrap: anywhere; }
.pill { display: inline-flex; max-width: 100%; align-items: center; background: #edf3f7; padding: 2px 7px; border-radius: 4px; color: #4b6274; font-size: 11px; font-weight: 630; line-height: 1.4; white-space: nowrap; }
.pill.good { background: #e7f3ee; color: #286555; }
.pill.warn { background: #fff2dd; color: #855028; }
.pill.bad { background: var(--error-bg); color: var(--error); }
.pills { display: flex; flex-wrap: wrap; gap: 5px; }
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-list > div { display: grid; min-width: 0; grid-template-columns: minmax(95px, .55fr) minmax(0, 1.45fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: 12px; font-weight: 620; }
.detail-list dd { min-width: 0; margin: 0; color: var(--ink); font-size: 13px; overflow-wrap: anywhere; }
.details-panel { border-top: 1px solid var(--line-soft); }
.details-panel summary { cursor: pointer; padding: 9px 17px; color: var(--ink); font-size: 13px; font-weight: 620; }
.details-panel summary:hover { background: #f7fafb; }
.details-panel > .panel-body { padding-top: 3px; }
.task-list { display: grid; list-style: none; margin: 0; padding: 0; }
.task-list li { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; padding: 9px 17px; border-bottom: 1px solid var(--line-soft); }
.task-list li:last-child { border-bottom: 0; }
.task-list small { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.task-name { font-size: 13px; font-weight: 630; overflow-wrap: anywhere; }
.section-addendum { margin-top: 15px; }
.code-data { margin: 0; font-size: 11.5px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 350px; overflow: auto; background: #f6f9fa; color: #273b50; padding: 9px; border-radius: 6px; }
.bar-chart { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(112px, 152px) minmax(40px, 1fr) auto; gap: 9px; align-items: center; color: var(--ink); font-size: 12px; }
.bar-row meter { appearance: none; width: 100%; height: 15px; background: #e6edf1; border-radius: 4px; border: 0; }
.bar-row meter::-webkit-meter-bar { border: 0; border-radius: 4px; background: #e6edf1; }
.bar-row meter::-webkit-meter-optimum-value { background: #429481; border-radius: 3px; }
.bar-row meter::-moz-meter-bar { background: #429481; border-radius: 3px; }
.bar-row:nth-child(2) meter::-webkit-meter-optimum-value { background: #6487a1; }
.bar-row:nth-child(2) meter::-moz-meter-bar { background: #6487a1; }
.aa-bars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; }
.aa-bars > div { display: grid; grid-template-columns: 18px minmax(0, 1fr) 76px; gap: 7px; align-items: center; color: var(--muted); font-size: 12px; }
.aa-bars meter { width: 100%; accent-color: var(--teal); }
.distribution + .distribution { margin-top: 20px; }
.distribution h3 { margin-bottom: 8px; }
.evidence-block { padding: 10px 0; border-top: 1px solid var(--line-soft); }
.evidence-block strong { color: var(--teal-deep); font-size: 12px; }
.evidence-block p { margin-top: 4px; color: var(--muted); font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dialog-error { color: var(--error) !important; }
.members { display: flex; flex-wrap: wrap; gap: 6px; max-height: 240px; overflow-y: auto; margin-top: 8px; }
.members code { display: inline-block; font-size: 11px; padding: 2px 6px; background: #eef4f6; border-radius: 4px; overflow-wrap: anywhere; }
.report-links { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.report-link { display: grid; min-width: 0; gap: 5px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; }
.report-link:hover { background: #f0f7f5; border-color: #bbd9d0; }
.report-link strong { font-size: 13px; }
.report-link small { color: var(--muted); font-size: 12px; }
.dialog-form { padding: 18px; display: grid; gap: 14px; }
.dialog-form > p { font-size: 13px; color: var(--muted); }
.dialog-form .button { justify-self: end; }
.dialog-header { display: flex; justify-content: space-between; align-items: start; gap: 15px; }
dialog { width: min(425px, calc(100% - 30px)); padding: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
dialog::backdrop { background: rgb(15 32 45 / 54%); }

@media (max-width: 1180px) {
  :root { --sidebar-width: 223px; }
  .nav-link { font-size: 12.5px; }
}
@media (max-width: 980px) {
  .overview-grid, .split-grid { grid-template-columns: minmax(0,1fr); }
  .main-content { padding-top: 26px; }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { display: none; position: fixed; top: 53px; height: auto; max-height: calc(100dvh - 53px); z-index: 10; left: 0; right: 0; overflow-y: auto; padding: 11px 12px 15px; border-bottom: 1px solid #3d5365; }
  .sidebar.open { display: flex; }
  .sidebar .brand, .sidebar .nav-group, .sidebar .sidebar-footer { display: none; }
  .nav-toggle { display: inline-grid !important; }
  .topbar-inner { min-height: 53px; padding: 7px 12px; gap: 8px; }
  .topbar-left, .topbar-right { gap: 7px; }
  .breadcrumbs { gap: 0; }
  .breadcrumbs span { display: none; }
  .breadcrumbs strong { font-size: 12px; line-height: 1.15; }
  .topbar-right .button { font-size: 11px; padding-inline: 6px; min-height: 31px; }
  .status-pill { font-size: 10px; padding-inline: 6px; }
  .main-content { padding: 22px 12px 34px; }
  .page-header { align-items: start; flex-wrap: wrap; gap: 10px; margin-bottom: 17px; }
  .panel-header, .panel-body { padding-inline: 12px; }
  .workflow { padding-inline: 12px; }
  .metrics { gap: 6px; }
  .comparison-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 9px; }
  .metric .icon { display: none; }
  .metric-name { padding-right: 0; font-size: 11px; }
  .metric strong { font-size: 21px; }
  .metric-detail { font-size: 10px; }
  .bar-row { grid-template-columns: 99px minmax(35px, 1fr) auto; }
}
@media (max-width: 440px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .report-links { grid-template-columns: minmax(0, 1fr); }
  .report-link { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
  .report-link small { flex-basis: 100%; }
  .task-list li { padding-inline: 12px; }
  .aa-bars { grid-template-columns: minmax(0, 1fr); }
}
.task-progress {
  display: block;
  margin-top: 6px;
  width: min(100%, 144px);
  height: 6px;
  accent-color: #397b70;
}

.stage-navigation, .analysis-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 21px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
}
.analysis-tabs button[aria-pressed="true"] {
  color: var(--teal-deep);
  background: var(--teal-light);
  border-color: #badbd1;
}
.literature-stages { gap: 26px; }
.literature-stages .workflow-section { scroll-margin-top: 80px; }
.results-controls {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
}
.results-controls form { justify-items: start; }
.batch-checklist {
  min-width: 0;
  max-height: 230px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.batch-checklist legend { color: var(--ink); font-size: 13px; font-weight: 650; }
.batch-checklist label { overflow-wrap: anywhere; padding-block: 3px; }
.table-scroll select[data-source-format] { min-width: 78px; width: auto; }
.table-scroll input[data-select-source] { accent-color: var(--teal); }
.pca-figure { margin: 12px 0; max-width: 720px; }
.pca-figure svg { display: block; width: 100%; height: auto; overflow: visible; background: #f7fafb; border: 1px solid var(--line); border-radius: 8px; }
.pca-figure text { fill: var(--muted); font-size: 13px; }
.pca-axes { fill: none; stroke: #a8bac9; stroke-width: 1.4; }
.pca-figure circle { fill: var(--point); stroke: var(--white); stroke-width: .8; }
.pca-figure figcaption { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 12px; }
.pca-legend::before { content: ""; display: inline-block; margin-right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--point); }
.pca-neutral, .pca-group-1 { --point: #1e7467; }
.pca-group-2 { --point: #376b92; }
.pca-group-3 { --point: #a3632d; }
.pca-group-4 { --point: #77578a; }
@media (max-width: 760px) {
  .literature-stages .workflow-section { scroll-margin-top: 63px; }
  .stage-navigation, .analysis-tabs { gap: 5px; margin-bottom: 16px; }
}
