:root {
  color-scheme: light;
  font-family: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  color: #1b302f;
  background: #f2f5f1;
  --ink: #1b302f;
  --muted: #4f645e;
  --line: #d9e3da;
  --surface: #fff;
  --rail: #172c32;
  --green: #205b49;
  --wash: #eaf2ea;
  --copper: #e4a779;
  --alert: #8d381e;
  --caution: #fbefe2;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--green); }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid #b5623a; outline-offset: 3px; }
.skip { position: fixed; left: 1rem; top: -5rem; padding: .75rem; background: white; z-index: 10; }
.skip:focus { top: .5rem; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 235px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100dvh; padding: 1.7rem 1.05rem;
  display: flex; flex-direction: column; background: var(--rail); color: #e5eeea;
}
.brand { display: flex; gap: .78rem; align-items: center; margin: 0 .25rem 2rem; text-decoration: none; color: white; font-weight: 730; line-height: 1.25; }
.brand small { display: block; color: #bdd0c5; font-size: .8rem; font-weight: 500; margin-top: .25rem; }
.chip { width: 36px; height: 36px; flex: none; display: grid; place-items: center; color: #24423a; background: var(--copper); border-radius: 8px; }
.chip span { width: 15px; height: 15px; border: 2px solid currentColor; border-radius: 3px; box-shadow: -7px 0 0 -5px currentColor, 7px 0 0 -5px currentColor, 0 -7px 0 -5px currentColor, 0 7px 0 -5px currentColor; }
nav { display: grid; gap: .3rem; }
nav a, .archive-link { font-size: .9rem; color: #d9e6e1; text-decoration: none; padding: .7rem .62rem; border-radius: 7px; }
nav a:hover, .archive-link:hover { background: #ffffff12; }
nav a[aria-current="page"] { color: #ffdbbd; background: #e4a77926; box-shadow: inset 3px 0 var(--copper); font-weight: 700; }
.archive-link { margin-top: auto; color: #b8c9c2; }
.topbar {
  min-height: 65px; padding: .65rem clamp(1rem, 3vw, 2.5rem); display: flex; justify-content: space-between;
  align-items: center; gap: .75rem; border-bottom: 1px solid var(--line); background: #fdfefb;
}
.lot-picker { display: flex; gap: .6rem; align-items: center; font-size: .875rem; font-weight: 650; }
select {
  color: var(--ink); border: 1px solid #bdcec3; border-radius: 7px; min-height: 40px;
  background: linear-gradient(45deg, transparent 50%, #53695f 50%) right 14px top 17px / 5px 5px no-repeat,
              linear-gradient(135deg, #53695f 50%, transparent 50%) right 9px top 17px / 5px 5px no-repeat, white;
  padding: .45rem 1.65rem .45rem .6rem; appearance: none; min-width: 0; max-width: 100%;
}
main { max-width: 1510px; margin: auto; padding: 1.9rem clamp(1rem, 3vw, 2.5rem) 3rem; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 3.3vw, 3.1rem); letter-spacing: -.054em; line-height: 1.05; }
h2 { font-size: 1.18rem; letter-spacing: -.02em; }
h3 { font-size: .95rem; }
p { line-height: 1.55; }
.page-header { margin-bottom: 1.25rem; }
.page-header p { color: var(--muted); margin-top: .6rem; max-width: 72ch; }
.case-banner {
  padding: 1.2rem 1.4rem; color: #f2f8ee; border-radius: var(--radius);
  background: linear-gradient(110deg, #19363b, #235248);
  display: grid; grid-template-columns: 1.15fr 1fr; align-items: start; gap: 1.2rem; margin-bottom: 1rem;
}
.case-banner p { margin-top: .35rem; color: #dae6db; }
.case-banner .case-ids { font-size: .875rem; padding-top: .1rem; }
.case-ids dt { color: #cadcd0; }
.case-ids dd { color: #fff; }
.tag { display: inline-block; padding: .24rem .43rem; font-size: .8rem; font-weight: 700; line-height: 1.35; color: #275842; background: #e7f1e8; border-radius: 5px; }
.tag.sample { color: #443126; background: #f4d5b9; }
.tag.review { color: #813d22; background: #fae9d9; }
.tag.neutral { color: #304f59; background: #eaf0f2; }
.banner-title { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .65rem; margin-bottom: 1rem; }
.metric { border: 1px solid var(--line); border-radius: 9px; min-width: 0; background: #fff; padding: .78rem; }
.metric strong { font-size: clamp(1.2rem, 2.55vw, 1.83rem); letter-spacing: -.04em; line-height: 1.1; display: block; margin: .35rem 0 .25rem; }
.metric .unit { font-size: .84rem; letter-spacing: 0; color: var(--muted); }
.metric p { font-size: .875rem; color: var(--muted); font-weight: 650; }
.metric.review { background: var(--caution); }
.columns { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 1rem; margin-top: 1rem; }
.stack { display: grid; gap: 1rem; }
.card { min-width: 0; padding: 1.04rem; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); }
.card > h2 + p, .card > h3 + p { margin: .4rem 0 .7rem; }
.card + .card, .notice + .card { margin-top: 1rem; }
.columns .card + .card, .stack .card + .card { margin-top: 0; }
.group-label { margin-bottom: .65rem; display: flex; justify-content: space-between; align-items: center; gap: .65rem; flex-wrap: wrap; }
.group-label label { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.note, time, .secondary { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.note + .scroll { margin-top: .55rem; }
.notice { margin: .95rem 0; padding: .75rem .88rem; border: 1px solid #d8e5dc; background: var(--wash); border-radius: 8px; color: #344e42; }
.notice.warn { background: var(--caution); border-color: #efdbcc; color: #793b22; }
.notice.error { background: #fae6e0; border-color: #edc3b6; color: #82341c; }
.notice:first-child { margin-top: 0; }
.notice ul { padding-left: 1.25rem; margin: .45rem 0 0; }
.notice li { margin: .3rem 0; overflow-wrap: anywhere; }
dl { margin: 0; }
dl.rows { display: grid; grid-template-columns: auto minmax(0,1fr); gap: .36rem .8rem; }
dt { font-weight: 660; overflow-wrap: anywhere; }
dd { margin: 0; overflow-wrap: anywhere; }
.scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { border-bottom: 1px solid #e1e8e1; padding: .61rem .52rem; font-size: .9rem; vertical-align: top; line-height: 1.42; overflow-wrap: anywhere; }
th { color: #345645; background: #edf3ee; font-weight: 690; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 620; }
td .secondary, dd .secondary { display: block; margin-top: .18rem; }
.wide-table { min-width: 680px; }
.caption { margin: .7rem 0 0; }
.toolbar { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap; margin-top: .8rem; }
.button, button {
  display: inline-flex; justify-content: center; align-items: center; min-height: 40px; padding: .54rem .78rem;
  border: 1px solid #bdcec3; border-radius: 7px; background: white; color: #204638;
  text-decoration: none; font-weight: 680; font-size: .9rem; line-height: 1.3; cursor: pointer;
}
.button:hover, button:hover { background: var(--wash); }
.primary { background: var(--green); border-color: var(--green); color: white; }
.primary:hover { background: #194b3d; }
button:disabled { cursor: wait; opacity: .65; }
.kit-files { display: grid; gap: .4rem; margin-top: .5rem; }
.kit-files button { text-align: left; justify-content: flex-start; }
input[type="file"], input[type="search"] { padding: .6rem; width: 100%; min-width: 0; border: 1px solid #bdcec3; border-radius: 7px; color: var(--ink); background: #fff; }
input::file-selector-button { margin-right: .6rem; border: 1px solid #b7cbbf; background: var(--wash); border-radius: 5px; color: var(--green); font: inherit; padding: .45rem; cursor: pointer; }
.form-label { display: block; font-weight: 650; margin: .8rem 0 .42rem; }
.file-names { margin-top: .55rem; }
#preview { scroll-margin-top: 1rem; }
#saved-message:not(:empty) { margin-bottom: .9rem; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .55rem; margin-bottom: .75rem; }
.filters label { display: block; flex: 1; min-width: min(100%, 185px); font-size: .875rem; font-weight: 650; }
.filters input, .filters select { display: block; margin-top: .3rem; width: 100%; }
details { margin-top: .6rem; }
summary { min-height: 40px; cursor: pointer; font-size: .91rem; font-weight: 680; color: var(--green); }
.empty { max-width: 72ch; }
.empty p { margin-top: .5rem; }
.record-detail { white-space: pre-wrap; }
@media (max-width: 1100px) {
  .shell { grid-template-columns: 198px minmax(0,1fr); }
  .sidebar { padding-inline: .65rem; }
}
@media (max-width: 900px) {
  .columns { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 680px) {
  .shell { display: flex; flex-direction: column; }
  .sidebar { position: static; height: auto; padding: .52rem .6rem; flex-direction: row; align-items: center; gap: .4rem; overflow-x: auto; }
  .brand { margin: 0 .15rem 0 0; }
  .brand .chip { width: 29px; height: 29px; }
  .brand > span:last-child { display: none; }
  nav { display: flex; white-space: nowrap; gap: .25rem; }
  nav a, .archive-link { padding: .55rem .63rem; flex: none; }
  .archive-link { margin-top: 0; }
  .topbar { padding: .55rem .72rem; }
  .case-banner { grid-template-columns: 1fr; gap: .72rem; padding: .9rem; }
  main { padding: 1.05rem .75rem 2rem; }
  .page-header { margin-bottom: .85rem; }
  .lot-picker { gap: .4rem; max-width: calc(100% - 112px); }
  .lot-picker select { max-width: 100%; font-size: 1rem; }
  .card { padding: .76rem; }
  td, th { padding: .5rem .38rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { scroll-behavior: auto !important; }
}
