:root {
  color-scheme: light;
  --ink: #172d3b;
  --muted: #526977;
  --line: #d8e3e9;
  --navy: #112a39;
  --teal: #14635f;
  --surface: #f2f6f7;
  --sand: #e1c995;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--surface);
}
* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.55rem); letter-spacing: -.05em; }
h2 { font-size: 1.15rem; padding: 1rem 1.2rem; }
a { color: var(--teal); font-weight: 650; }
button, input, textarea, select { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #327aad; outline-offset: 3px; }
.topbar { background: var(--navy); color: #fff; border-bottom: 3px solid var(--sand); }
.bar, main { max-width: 1280px; margin: auto; padding: 0 24px; }
.bar { max-width: none; display: flex; align-items: center; min-height: 70px; gap: 26px; }
.brand { color: #fff; display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-logo { display: block; width: 96px; height: auto; padding: 6px 8px; background: white; border-radius: 7px; }
.brand small, .identity small { display: block; color: #bdd0da; font-size: .69rem; letter-spacing: .07em; }
nav, .identity, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.bar nav a, .identity a { color: #f6f9fa; padding: 7px; text-decoration: none; }
.bar nav a[aria-current] { border-bottom: 2px solid var(--sand); }
.identity { margin-inline-start: auto; }
main { padding-block: 28px 45px; }
.heading { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 19px; }
.eyebrow { color: var(--teal); font-size: .72rem; font-weight: 800; letter-spacing: .13em; }
.muted { color: var(--muted); margin-top: .3rem; }
.card { background: white; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; box-shadow: 0 3px 15px #13334109; }
.primary, .quiet { display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; padding: 8px 12px; font-weight: 650; text-decoration: none; min-height: 38px; }
.primary { color: white; background: var(--teal); border: 1px solid var(--teal); }
.quiet { color: var(--ink); background: white; border: 1px solid var(--line); }
.primary:hover { background: #0d4a47; }
.quiet:hover { background: #e8f1f4; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; padding: 14px 18px; }
.filters label, .form-panel label { display: block; font-size: .87rem; font-weight: 650; }
.filters .search { flex: 1 1 220px; }
input:not([type=checkbox]):not([type=hidden]), select, textarea { width: 100%; padding: 8px 9px; min-height: 39px; margin-top: 4px; color: var(--ink); border: 1px solid #a9bac4; border-radius: 6px; background: #fff; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 11px 16px; text-align: start; border-block-start: 1px solid var(--line); }
th { background: #edf4f6; color: #384e5d; font-size: .76rem; letter-spacing: .025em; white-space: nowrap; }
td small { display: block; color: var(--muted); margin-top: 3px; }
td a { white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 22px; }
.ref { font-variant-numeric: tabular-nums; }
.badge { display: inline-block; background: #e8f3f2; color: #195754; border-radius: 5px; padding: 2px 6px; }
.badge.warning { background: #fff0d0; color: #794800; }
.pagination, .growth { padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.form-panel { max-width: 660px; padding: 22px; }
.login { max-width: 420px; margin: 6vh auto 0; }
.form-panel form > p { margin: 14px 0; }
.helptext { display: block; margin: 4px 0 6px; color: var(--muted); font-size: .8rem; }
ul.helptext, .helptext ul { padding-inline-start: 18px; }
.errorlist { color: #982422; padding-inline-start: 18px; }
.notice { background: #e7f4ee; border-radius: 7px; padding: 9px 13px; margin-bottom: 12px; }
.notice.error { background: #fae8e5; color: #85231f; }
.notice.warning { background: #fff3d6; color: #68470c; }
.details { padding: 14px 18px; }
details summary { font-weight: 650; }
dl { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
dt { color: var(--muted); font-size: .78rem; font-weight: 650; }
dd { overflow-wrap: anywhere; }
.full { grid-column: 1 / -1; }
.history { list-style: none; padding: 0 18px 12px; margin: 0; }
.history li { border-top: 1px solid var(--line); padding: 9px 0; }
.history span { color: var(--muted); margin-inline-start: 9px; font-size: .82rem; }
.history dl { margin-top: 6px; }
@media (max-width: 740px) {
  .bar, main { padding-inline: 13px; }
  .bar { flex-wrap: wrap; gap: 9px; padding-block: 9px; }
  .identity { margin-inline-start: auto; }
  dl { grid-template-columns: repeat(2,minmax(0,1fr)); }
  th, td { padding: 9px 11px; }
}

main:has(.iqc-grid) { max-width: 1920px; }
.plant-tabs { gap: 4px 8px; padding: 9px 12px; }
.plant-tabs a { padding: 6px 10px; border-radius: 6px; color: var(--muted); font-size: .8125rem; text-decoration: none; }
.plant-tabs a:hover { background: #edf4f6; }
.plant-tabs a[aria-current] { background: #dcefeb; color: #164e47; }
.register-toolbar { display: flex; align-items: center; }
.register-toolbar .plant-tabs { flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; }
.register-toolbar .plant-tabs a { flex: none; white-space: nowrap; }
.register-filter {
  display: flex; flex: none; align-items: center; gap: 8px; margin: 6px 12px; padding-inline-start: 12px;
  border-inline-start: 1px solid var(--line); font-size: .8125rem;
}
.register-filter .quiet { min-height: 30px; padding: 4px 9px; }
.register-filter .is-active { background: #fff0ee; color: #85231f; border-color: #e4bdb7; }
.iqc-scroll {
  --sample-id: 78px;
  --casting-date: 92px;
  --gridline: #e0e9ed;
  --column-heading: #edf4f6;
  --result-heading: #e5f1ef;
  overflow: auto;
  max-height: clamp(310px, 65vh, 770px);
  border-block: 1px solid var(--line);
}
.iqc-scroll:focus-visible { outline-offset: -3px; }
.iqc-grid {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--ink);
  font-size: .75rem;
  line-height: 1.35;
}
.iqc-grid col { width: 62px; }
.iqc-grid .iqc-id { width: var(--sample-id); }
.iqc-grid .iqc-date { width: var(--casting-date); }
.iqc-grid .iqc-plant { width: 95px; }
.iqc-grid .iqc-text { width: 144px; }
.iqc-grid .iqc-mix-description { width: 288px; }
.iqc-grid .iqc-mix-code { width: 84px; }
.iqc-grid .iqc-location { width: 97px; }
.iqc-grid .iqc-grade { width: 60px; }
.iqc-grid .iqc-derived { width: 106px; }
.iqc-grid .iqc-source { width: 152px; }
.iqc-grid .iqc-status { width: 192px; }
.iqc-grid .iqc-controls { width: 150px; }
.iqc-grid th, .iqc-grid td {
  padding: 5px 8px;
  border: 0;
  border-block-end: 1px solid var(--gridline);
  vertical-align: middle;
  overflow-wrap: anywhere;
}
.iqc-grid thead { position: sticky; inset-block-start: 0; z-index: 3; }
.iqc-grid th {
  background: var(--column-heading);
  color: #304957;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: normal;
  white-space: normal;
}
.iqc-grid .iqc-strength-title {
  background: #d9ebe8;
  color: #154e49;
  padding-block: 6px;
  padding-inline: 14px;
}
.iqc-strength-title span {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 1px 6px;
  border-radius: 10px;
  background: #f5faf9;
  font-size: .6875rem;
  font-weight: 650;
}
.iqc-ages th, .iqc-specimens th { background: var(--result-heading); text-align: center; }
.iqc-grid .iqc-age-group { padding-block: 4px; color: #17524e; }
.iqc-grid .iqc-specimens th { padding-block: 4px; color: #426760; font-weight: 600; }
.iqc-formula small {
  display: block;
  margin-block-start: 2px;
  color: var(--muted);
  font-size: .6875rem;
  font-weight: 550;
}
.iqc-grid .iqc-divider,
.iqc-grid tbody td:is(:nth-child(10), :nth-child(12), :nth-child(15), :nth-child(18), :nth-child(20), :nth-child(22), :nth-child(25), :nth-child(27), :nth-child(28)) {
  border-inline-start: 1px solid var(--gridline);
}
.iqc-grid tbody { font-variant-numeric: tabular-nums; }
.iqc-grid tbody tr { --row-fill: white; }

.iqc-grid tbody tr:hover, .iqc-grid tbody tr:focus-within { --row-fill: #edf6f6; }
.iqc-grid tbody td {
  height: 37px;
  padding-block: 2px;
  background: var(--row-fill);
  white-space: nowrap;
}
.iqc-grid tbody tr:not(.sample-entry-row) td { overflow: hidden; text-overflow: ellipsis; }
.iqc-grid tbody .add-sample-row { --row-fill: #dfecff; --row-accent: #075dcc; color: #064a9e; font-weight: 750; }
.iqc-grid tbody .add-sample-row:hover,
.iqc-grid tbody .add-sample-row:focus-within { --row-fill: #cbdfff; }
.iqc-grid .add-sample { display: inline-grid; place-items: center; width: 30px; height: 30px; color: white; background: #075dcc; border-radius: 6px; font-size: 1.4rem; font-weight: 750; }
.iqc-grid .add-sample:hover,
.iqc-grid .add-sample:focus-visible { background: #064a9e; }
.iqc-grid .add-sample-label { display: inline-block; padding-block: 7px; color: inherit; text-decoration: none; }
.iqc-grid .add-sample-label:hover { text-decoration: underline; }
.iqc-grid tbody td:nth-child(n+10):nth-child(-n+27) { text-align: center; }
.iqc-grid tbody td:is(:nth-child(18), :nth-child(19), :nth-child(25), :nth-child(26)) {
  background: color-mix(in srgb, var(--row-fill) 82%, #cce3df);
  color: #184f4a;
  font-weight: 700;
}
.iqc-grid :is(#iqc-3-days, [headers="iqc-3-days"]),
.iqc-grid tbody td:nth-child(n+12):nth-child(-n+14) {
  --specimen: #e1edfc;
  --average: #c8dcf7;
  --age-ink: #284c7a;
}
.iqc-grid :is(#iqc-7-days, [headers="iqc-7-days"]),
.iqc-grid tbody td:nth-child(n+15):nth-child(-n+17) {
  --specimen: #dcefeb;
  --average: #bfdfd8;
  --age-ink: #1c5550;
}
.iqc-grid :is(#iqc-28-days, [headers="iqc-28-days"]),
.iqc-grid tbody td:nth-child(n+22):nth-child(-n+24) {
  --specimen: #ede7f8;
  --average: #ddcfee;
  --age-ink: #533e75;
}
.iqc-grid thead :is(.iqc-age-group, .iqc-specimens th) {
  background: var(--specimen);
  color: var(--age-ink);
}
.iqc-grid thead :is(.iqc-age-group, .iqc-specimens th:nth-child(3n)) {
  background: var(--average);
  font-weight: 700;
}
.iqc-grid tbody td:where(:nth-child(n+12):nth-child(-n+17), :nth-child(n+22):nth-child(-n+24)) {
  background: color-mix(in srgb, var(--row-fill) 52%, var(--specimen));
}
.iqc-grid tbody td:is(:nth-child(14), :nth-child(17), :nth-child(24)) {
  background: color-mix(in srgb, var(--row-fill) 35%, var(--average));
  color: var(--age-ink);
  font-weight: 750;
}
.iqc-grid tbody td:nth-child(2) { color: var(--muted); }
.iqc-grid tbody td:nth-child(8) { font-weight: 650; }
.iqc-grid tbody .review-error { --row-fill: #e4f0ff; --row-accent: #3476bb; }
.iqc-grid tbody .review-mismatch { --row-fill: #e4f0ff; --row-accent: #3476bb; }
.iqc-grid tbody .review-mismatch:hover, .iqc-grid tbody .review-mismatch:focus-within { --row-fill: #e4f0ff; }
.iqc-grid tbody .review-valid { --row-fill: #edf7ef; --row-accent: #42855c; }
.iqc-grid--review tbody .review-error:hover, .iqc-grid--review tbody .review-error:focus-within { --row-fill: #e4f0ff; }
.iqc-grid tbody .review-valid:hover, .iqc-grid tbody .review-valid:focus-within { --row-fill: #edf7ef; }
.iqc-grid tbody .iqc-sticky-id { border-inline-start: 3px solid var(--row-accent, transparent); }
.iqc-preview .review-valid td { background: #edf8ef; }
.iqc-preview .review-error td { background: #e4f0ff; }
.iqc-preview .review-mismatch td { background: #e4f0ff; }
.iqc-grid .iqc-sticky-id, .iqc-grid .iqc-sticky-date { position: sticky; z-index: 1; }
.iqc-grid .iqc-sticky-id { inset-inline-start: 0; }
.iqc-grid .iqc-sticky-date {
  inset-inline-start: var(--sample-id);
  box-shadow: 3px 0 5px #112a3912;
}
.iqc-grid .iqc-sticky-id a { text-decoration: none; white-space: nowrap; }
.iqc-grid .iqc-sticky-id a:hover, .iqc-grid .iqc-sticky-id a:focus-visible { text-decoration: underline; }
.iqc-grid .empty { padding: 20px; }
.iqc-grid .review-actions { justify-content: center; }
.iqc-grid .review-icon { width: 28px; height: 28px; font: 14px system-ui, sans-serif; }
.iqc-grid .review-actions .approve { border-color: #98c3aa; }
.iqc-grid .review-actions .approve:not(:disabled):hover { background: #d7eee0; }
.iqc-grid .review-actions .exclude:hover { background: #ffe8e4; }
.sample-verified { padding-inline: 5px; color: #176443; font-weight: 700; }
.iqc-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 9px 16px;
  color: var(--muted);
  font-size: .8125rem;
}
.iqc-footer .pagination { padding: 0; gap: 8px; }
.iqc-footer-summary { display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: center; }
.iqc-footer .pagination .quiet { min-height: 30px; padding: 3px 9px; }
@media (max-width: 620px) {
  .iqc-grid .iqc-sticky-date { position: static; box-shadow: none; }
  .iqc-grid .iqc-sticky-id { box-shadow: 3px 0 5px #112a3912; }
}
.review-actions { display: flex; align-items: center; gap: 5px; }
.review-icon { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); text-decoration: none; }
.review-icon.approve { color: #00a84f; }
.review-icon.exclude { color: #9b2929; }
.review-icon:disabled { opacity: .38; cursor: default; }
#confirm-action { max-width: min(430px, calc(100vw - 28px)); padding: 0; }
#confirm-action::backdrop { background: #112a3980; }
#confirm-action .actions { margin-top: 14px; justify-content: flex-end; }
.catalog-field { position: relative; display: block; }
.catalog-options { position: absolute; z-index: 2; inset-inline: 0; top: 100%; max-height: 12rem; overflow: auto; background: white; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 12px #112a3920; }
.catalog-options button { display: block; width: 100%; border: 0; background: white; padding: 8px 10px; text-align: start; color: var(--ink); }
.catalog-options button:hover, .catalog-options button:focus-visible { background: #edf4f6; outline-offset: -3px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.sample-entry-layout .iqc-scroll { --casting-date: 137px; }
.sample-entry-layout .iqc-grid .iqc-mix-code { width: 84px; }
.sample-entry-layout .iqc-grid .iqc-grade { width: 150px; }
.iqc-grid tbody .sample-entry-row { --row-fill: #f5faf9; }
.iqc-grid tbody .sample-entry-row.review-error { --row-fill: #e4f0ff; }
.iqc-scroll:has(.inline-edit-row) { --casting-date: 137px; }
.iqc-grid:has(.inline-edit-row) .iqc-grade { width: 82px; }
.iqc-grid:has(.inline-edit-row) .iqc-mix-code { width: 84px; }
.iqc-grid tbody .inline-edit-row td { box-shadow: inset 0 -1px #81afa4; }
.inline-edit-status, .inline-edit-dates, #iqc-row-form > .notice { margin: 8px 12px; }
.inline-edit-status, .inline-edit-dates { font-size: .8125rem; color: var(--muted); }
.sample-entry-row td { position: relative; }
.sample-entry-row input:not([type=hidden]), .sample-entry-row select, .sample-entry-row textarea {
  display: block;
  margin: 0;
  padding: 5px;
  min-height: 32px;
  border-color: #c5d6da;
  border-radius: 5px;
}
.sample-entry-row textarea { height: 32px; resize: none; }
.sample-entry-row .quiet { display: flex; min-height: 32px; padding-block: 4px; }
.sample-entry-row input[type=number] { appearance: textfield; }
.sample-entry-row input[type=number]::-webkit-inner-spin-button { appearance: none; }
.entry-grade-fields { display: flex; gap: 4px; align-items: center; }
.entry-grade-fields > select, .entry-grade-fields > span { min-width: 0; flex: 1; }
.sample-entry-row .catalog-options { position: fixed; inset: auto; z-index: 4; }
.entry-readonly { color: var(--muted); font-size: .6875rem; }
.sample-entry-layout > .notice { margin: 12px; }
.sample-entry-footer { display: grid; justify-items: start; gap: 12px; padding: 12px 16px; }
.entry-test-dates { display: flex; flex-wrap: wrap; gap: 10px; margin-block-start: 8px; }
.entry-test-dates label { font-size: .8125rem; }

.iqc-grid .review-actions .confirm-sample {
  color: #fff;
  background: #00a84f;
  border-color: #00a84f;
}
.iqc-grid .review-actions .confirm-sample:not(:disabled):hover {
  background: #008f43;
  border-color: #008f43;
}

.page-size-form { display: flex; align-items: center; gap: 8px; }
.page-size-form select { width: auto; min-height: 30px; margin: 0; padding: 3px 8px; }
.iqc-footer .page-size-form button { min-height: 30px; padding: 3px 9px; }

/* Remove only the outside spacing around the register. */
main.register-page { max-width: none; margin: 0; padding: 0; }
.register-page > section.card { margin-bottom: 0; }

/* Let the register scroll area use the remaining window height. */
body:has(main.register-page) { height: 100dvh; display: flex; flex-direction: column; }
body:has(main.register-page) > .topbar { flex: none; }
main.register-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.register-page > section.card { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.register-page .iqc-scroll { flex: 1; min-height: 160px; max-height: none; }
.register-page .register-toolbar, .register-page .iqc-footer, .register-page .sample-entry { flex: none; }

.iqc-grid tbody .review-overdue,
.iqc-grid tbody .review-overdue:is(:hover, :focus-within) { --row-fill: #ffe1df; --row-accent: #c63e36; }
.iqc-grid tbody .review-waiting,
.iqc-grid tbody .review-waiting:is(:hover, :focus-within) { --row-fill: #fff3bf; --row-accent: #b68b0c; }
.iqc-grid tbody .review-error:is(:hover, :focus-within),
.iqc-grid tbody .review-mismatch:is(:hover, :focus-within) { --row-fill: #e4f0ff; }

/* Keep the grid legible across all row status colors. */
.iqc-grid { --gridline: #b4c3ce; }
.iqc-grid th, .iqc-grid td {
  border-inline-end: 1px solid var(--gridline);
  border-block-end: 1px solid var(--gridline);
}
.iqc-grid tr > :last-child { border-inline-end: 0; }

.iqc-grid th.iqc-formula:has(small) { white-space: nowrap; }
