:root {
  color-scheme: light;
  --ink: #162e3c;
  --muted: #526a77;
  --accent: #08697a;
  --accent-dark: #054e5b;
  --line: #d8e1e5;
  --paper: #fff;
  --wash: #f2f6f7;
  --danger: #9d3035;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--wash);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select,
summary {
  touch-action: manipulation;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid #b6c8cf;
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 8px 13px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
button:hover:not(:disabled) {
  background: #eaf2f4;
  border-color: var(--accent);
}
button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
button.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
button.primary:hover:not(:disabled) {
  background: var(--accent-dark);
}
button.quiet {
  background: transparent;
  border-color: var(--line);
}
button.small {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12px;
}
.text-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  padding: 4px 0;
  min-height: 28px;
}
.text-button:hover:not(:disabled) {
  background: transparent;
  text-decoration: underline;
}
.topbar {
  height: 86px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 34px;
  background: white;
  border-bottom: 1px solid var(--line);
  gap: 20px;
}
.brand {
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.brand small {
  display: block;
  font-size: 11px;
  letter-spacing: 0.6px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 3px;
}
.brand-mark {
  background: var(--accent);
  color: white;
  padding: 10px 8px;
  border-radius: 6px;
  font-size: 14px;
  letter-spacing: 1px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.privacy {
  color: var(--muted);
  font-size: 12px;
  margin-right: 14px;
}
.workspace {
  max-width: 1800px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 285px minmax(0, 1fr);
  gap: 28px;
  padding: 28px 34px;
}
.sidebar {
  min-width: 0;
}
.sidebar h1 {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.8px;
  margin: 2px 0 10px;
}
.lede {
  color: var(--muted);
  line-height: 1.65;
  margin: 0 0 24px;
}
.drop {
  background: white;
  border: 1.5px dashed #9cb8c3;
  border-radius: var(--radius);
  text-align: center;
  padding: 24px 12px;
}
.drop strong {
  font-size: 16px;
}
.drop p {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 18px;
}
.drop.drag {
  background: #e1f0f3;
  border-color: var(--accent);
}
.import-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 12px;
  color: var(--muted);
}
.setup-section {
  border-top: 1px solid var(--line);
  margin-top: 25px;
  padding-top: 20px;
}
h2 {
  font-size: 16px;
  font-weight: 650;
  margin: 0;
  letter-spacing: -0.2px;
}
.mode-selector {
  border: 0;
  padding: 0;
  margin: 12px 0 17px;
  display: grid;
  gap: 8px;
}
fieldset.mode-selector label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  padding: 12px;
  background: white;
  border-radius: 6px;
  cursor: pointer;
}
.mode-selector label:has(:checked) {
  border-color: var(--accent);
  box-shadow: inset 3px 0 var(--accent);
}
.mode-selector small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 4px;
}
input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
  margin: 0;
}
.check {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin: 12px 0;
  font-weight: 500 !important;
}
.help {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin: 7px 0 0;
}
.main-content {
  min-width: 0;
}
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 20px;
  padding: 22px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 15px;
}
.count {
  font-weight: 500;
  font-size: 11px;
  display: inline-block;
  padding: 3px 7px;
  border-radius: 4px;
  background: #eaf1f3;
  color: var(--muted);
  margin-left: 5px;
  vertical-align: middle;
}
.file-list {
  display: grid;
  gap: 9px;
  max-height: 340px;
  overflow: auto;
}
.file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.file-item strong {
  display: block;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.file-item small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
  line-height: 1.5;
}
.file-item button {
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
}
.empty-state {
  padding: 55px 8% 60px;
  min-height: 610px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.35px;
  color: var(--accent);
  font-weight: 650;
}
.empty-state h2 {
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.12;
  letter-spacing: -2px;
  margin: 23px 0;
}
.empty-state > p {
  max-width: 480px;
  line-height: 1.7;
  color: var(--muted);
}
.empty-state ol {
  padding: 0;
  list-style: none;
  margin: 32px 0;
  display: grid;
  gap: 18px;
  counter-reset: steps;
}
.empty-state li {
  display: grid;
  grid-template-columns: 28px 80px 1fr;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
}
.empty-state li::before {
  counter-increment: steps;
  content: counter(steps, decimal-leading-zero);
  font-size: 11px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.empty-state li span {
  color: var(--muted);
}
label:not(.check) {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}
:where(
  input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
  select
) {
  width: 100%;
  min-height: 37px;
  padding: 8px 10px;
  border: 1px solid #b9cbd2;
  border-radius: 5px;
  color: var(--ink);
  background: white;
  min-width: 0;
}
input::placeholder {
  color: #657e8b;
  font-weight: 400;
}
input[type="color"] {
  width: 30px;
  height: 28px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}
.table-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 10px;
}
.search-label {
  width: min(360px, 60%);
}
.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.table-scroll {
  overflow: auto;
  max-height: 430px;
  overscroll-behavior: contain;
}
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 12px;
  text-align: left;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f0f5f6;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
}
th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid #e6edef;
  vertical-align: middle;
}
td input:not([type="checkbox"]):not([type="color"]) {
  min-width: 110px;
  min-height: 33px;
  padding: 6px 8px;
  border-color: transparent;
  background: #f7f9fa;
}
td input:hover,
td input:focus {
  border-color: #adc3cc !important;
  background: white !important;
}
.source-cell {
  min-width: 100px;
  max-width: 180px;
  overflow-wrap: anywhere;
}
.source-cell strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
}
.source-cell small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  margin-top: 3px;
}
.colour-cell {
  width: 38px;
  padding: 5px;
}
.use-cell {
  width: 36px;
}
tr.excluded {
  opacity: 0.55;
}
.selected-cell {
  outline: 2px solid var(--accent) !important;
  outline-offset: -2px;
  background: #e4f3f5 !important;
}
.table-hint {
  margin: 10px 0 0;
}
.series-names {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px;
  background: #f2f7f8;
  border-radius: 6px;
}
.series-names label {
  flex: 1;
  min-width: 160px;
  max-width: 260px;
}
.form-grid {
  display: grid;
  grid-template-columns: 2fr 0.8fr 1.3fr auto;
  gap: 12px;
  align-items: end;
  margin: 15px 0;
}
.figure-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}
.figure-grid .check {
  margin-top: 25px;
}
.concentration-tools {
  margin-top: 14px;
}
.plot-select {
  max-width: 390px;
  min-width: 180px;
}
.plot {
  background: #fff;
  overflow: auto;
  min-height: 220px;
  text-align: center;
}
.plot svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 1100px;
  margin: auto;
}
.plot-empty {
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
  border: 1px dashed var(--line);
}
details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}
details summary:hover {
  color: var(--accent);
}
.figure-options,
.plate-panel,
.data-preview {
  border-top: 1px solid var(--line);
  padding-top: 15px;
  margin-top: 18px;
}
.plate-panel .muted {
  font-weight: 400;
  color: var(--muted);
  margin-left: 8px;
}
.plate-panel .button-row {
  margin: 10px 0;
}
.plate-panel table {
  min-width: 800px;
  table-layout: fixed;
}
.plate-panel th {
  position: static;
  text-align: center;
}
.plate-panel th:first-child {
  width: 30px;
}
.plate-panel td {
  height: 42px;
  min-width: 64px;
  overflow-wrap: anywhere;
  padding: 4px;
  text-align: center;
  border: 1px solid #e6edef;
  border-top: 0;
  border-left: 0;
}
.export-bar {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 19px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}
.export-bar b {
  font-size: 13px;
}
.export-help {
  margin-top: 14px;
}
.download-status {
  font-size: 12px;
  margin-top: 12px;
  color: var(--accent);
  overflow-wrap: anywhere;
}
.download-status a {
  color: inherit;
}
.issues,
.notice {
  border: 1px solid #e0c998;
  background: #fff9ed;
  border-radius: 6px;
  padding: 12px 15px;
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 16px;
  color: #714a18;
}
.issues ul {
  padding-left: 18px;
  max-height: 180px;
  overflow: auto;
  margin-bottom: 0;
}
.issues li + li {
  margin-top: 5px;
}
.message {
  padding: 12px 22px;
  background: #e4f2f4;
  color: #174e59;
  border-bottom: 1px solid #bcdae0;
  font-size: 13px;
  line-height: 1.6;
}
.message.error {
  background: #fff1ef;
  color: #962e32;
  border-color: #f0c7c1;
}
.figure-panel .message {
  border-radius: 5px;
  margin-bottom: 14px;
}
.data-preview table {
  font-variant-numeric: tabular-nums;
  margin: 12px 0;
}
.data-preview td {
  white-space: nowrap;
}
footer {
  font-size: 11px;
  color: var(--muted);
  padding: 8px 4px 20px;
  line-height: 1.8;
}
footer a {
  color: var(--accent);
}
.hidden {
  display: none !important;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
:focus-visible {
  outline: 3px solid #24a0b4;
  outline-offset: 3px;
}
.skip-link {
  position: absolute;
  top: -60px;
  left: 10px;
  background: white;
  padding: 12px;
  z-index: 20;
}
.skip-link:focus {
  top: 10px;
}
button:focus-visible {
  outline-offset: 3px;
}
@media (min-width: 1450px) {
  .workspace {
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 38px;
  }
  .panel {
    padding: 26px;
  }
  .sidebar {
    padding-right: 5px;
  }
}
@media (max-width: 1050px) {
  .workspace {
    grid-template-columns: 245px minmax(0, 1fr);
    gap: 18px;
    padding: 22px;
  }
  .topbar {
    padding: 0 22px;
  }
  .privacy {
    display: none;
  }
  .panel {
    padding: 17px;
  }
  .export-bar {
    align-items: flex-start;
    flex-direction: column;
  }
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .figure-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .topbar {
    height: auto;
    min-height: 75px;
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .brand {
    font-size: 17px;
  }
  .top-actions {
    gap: 6px;
  }
  .top-actions button {
    font-size: 11px;
    padding: 7px 9px;
    min-height: 34px;
  }
  .workspace {
    display: block;
    padding: 18px 14px;
  }
  .sidebar {
    margin-bottom: 22px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .sidebar .setup-section {
    margin: 0;
    padding: 0;
    border: 0;
  }
  .sidebar > section:first-child {
    grid-column: 1/-1;
  }
  .sidebar h1 {
    font-size: 24px;
  }
  .lede {
    margin-bottom: 15px;
  }
  .drop {
    padding: 16px;
  }
  .drop p {
    margin-bottom: 12px;
  }
  .setup-section:last-child {
    grid-column: 1/-1;
  }
  .panel {
    padding: 15px;
  }
  .empty-state {
    min-height: 0;
    padding: 34px 24px;
  }
  .empty-state h2 {
    font-size: 38px;
  }
  .empty-state ol li {
    grid-template-columns: 24px 68px 1fr;
    font-size: 12px;
    gap: 6px;
  }
  .section-head {
    flex-wrap: wrap;
  }
  .plot-select {
    max-width: none;
    width: 100%;
  }
  .figure-grid {
    grid-template-columns: 1fr 1fr;
  }
  .table-toolbar {
    align-items: start;
    flex-wrap: wrap;
  }
  .search-label {
    width: 100%;
  }
  .table-scroll {
    max-height: 340px;
  }
  .export-bar .button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .export-bar button {
    min-height: 42px;
  }
  .plot {
    min-height: 130px;
  }
  .series-names label {
    min-width: 120px;
  }
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .file-list {
    max-height: 240px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition:
      background 0.12s,
      border-color 0.12s;
  }
}
@media print {
  .topbar,
  .sidebar,
  .curves-panel,
  .figure-options,
  .export-bar,
  .export-help,
  .download-status,
  .data-preview,
  .issues,
  footer,
  .plot-select {
    display: none !important;
  }
  .workspace {
    display: block;
    padding: 0;
  }
  .figure-panel {
    border: 0;
    padding: 0;
  }
  .plot svg {
    width: 100%;
  }
}

[hidden] {
  display: none !important;
}

/* Spreadsheet label editing */
.grid-tools { display:flex; flex-wrap:wrap; align-items:center; gap:6px; padding:9px; background:#f0f5f6; border:1px solid #d4e0e4; border-bottom:0; border-radius:8px 8px 0 0; }
.grid-tools button { padding:5px 9px; font-size:12px; min-height:32px; }
#gridSelection { font-size:12px; font-variant-numeric:tabular-nums; margin-right:auto; min-width:135px; }
#curveTable { border:1px solid #d4e0e4; }
#curveTable td:has(.cell-input) { padding:0; border-right:1px solid #d4e0e4; }
#curveTable .cell-input { min-height:48px; border:0; border-radius:0; background:white; padding:10px; }
#curveTable .selected-cell { background:#dceff0 !important; outline:1px solid #72aeb3 !important; }
#curveTable .cell-input:focus { outline:2px solid var(--accent) !important; outline-offset:-2px; }
#curveTable th button { border:0; background:transparent; padding:4px 0; font:inherit; color:inherit; text-align:left; width:100%; }
#curveTable th button:hover { color:var(--accent); }

.group-controls,.row-tools { display:flex; flex-wrap:wrap; gap:10px; align-items:end; margin:12px 0; }
.group-controls label { flex:1; min-width:180px; }
.row-tools { align-items:center; }
.row-tools button { font-size:12px; padding:6px 10px; }
#rowSelection { margin-right:auto; font-size:12px; }
#curveTable .row-handle { padding:0; width:36px; background:#f0f5f6; }
.row-handle button { border:0; border-radius:0; width:100%; min-height:48px; padding:6px; background:transparent; }
#curveTable tr.row-selected .source-cell,#curveTable tr.row-selected .row-handle { background:#dceff0; }
.row-handle button[aria-pressed="true"] { background:var(--accent); color:white; }

.figure-panel .section-head { flex-wrap:wrap; }
.figure-panel .section-head label { min-width:0; max-width:100%; }
