:root {
  font: 16px/1.45 system-ui, sans-serif;
  color: #202a2a;
  background: #f3f6f4;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; overflow-wrap: anywhere; }
header {
  display: flex; justify-content: space-between; align-items: center; gap: 2rem;
  background: #fff; padding: 1rem max(1rem, calc((100vw - 1280px) / 2));
  border-bottom: 1px solid #d7e0dc;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .2rem; }
main { max-width: 1280px; margin: 1.25rem auto; padding: 0 1rem; }
.eyebrow { margin: 0; color: #52645c; text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; }
.muted, small { color: #607169; }
.session { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.session label { font-size: .8rem; }
.session input { width: 190px; }
nav { display: flex; gap: 1rem; margin-bottom: 1rem; }
nav a { color: #155f4a; }
.panel, .notice { min-width: 0; background: #fff; border: 1px solid #d7e0dc; border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.notice { background: #fff8e5; border-color: #e7d294; }
.columns { display: grid; grid-template-columns: minmax(280px, 350px) minmax(0, 1fr); gap: 1rem; }
.heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.heading h2 { margin-bottom: 0; }
.recipe-card {
  display: grid; gap: .2rem; text-align: left; width: 100%; padding: .8rem; margin: .5rem 0;
  border: 1px solid #d7e0dc; border-radius: 8px; background: #fff; color: #26352e;
}
.recipe-card.selected { border-color: #25866a; box-shadow: 0 0 0 1px #25866a; }
.recipe-card span { color: #52645c; }
.badge { display: inline-block; width: max-content; padding: .1rem .45rem; border-radius: 999px; background: #e6eee9; font-size: .8rem; }
.state-approved { background: #dff1e6; }
.state-submitted { background: #e4effa; }
.state-rejected { background: #f7e4de; }
.state-draft { background: #fff0cc; }
button, input, select, textarea { font: inherit; padding: .5rem .6rem; border: 1px solid #b9c8c0; border-radius: 6px; background: white; }
button { cursor: pointer; background: #155f4a; color: white; border-color: #155f4a; font-weight: 600; }
button:hover { background: #104b3a; }
.secondary { background: #edf3ef; color: #2e4940; border-color: #cbd8d1; font-size: .8rem; }
.danger { background: #fff1ee; border-color: #d59b8e; color: #8c3223; }
form { display: grid; gap: .65rem; max-width: 620px; }
label { display: grid; gap: .2rem; font-size: .88rem; color: #40534b; }
textarea { min-height: 3.1rem; resize: vertical; }
details { margin-top: 1rem; }
summary { cursor: pointer; font-weight: 650; }
#status { min-height: 1.4rem; color: #913c25; }
.digest { display: block; overflow-wrap: anywhere; word-break: break-word; font-size: .76rem; margin: .45rem 0; color: #52645c; }
.table-scroll { overflow: auto; margin: .7rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .86rem; }
th, td { border: 1px solid #d7e0dc; padding: .45rem; vertical-align: top; text-align: left; }
th { background: #f4f7f5; white-space: nowrap; }
td input, td select, td textarea { width: 100%; min-width: 90px; padding: .35rem; font-size: .82rem; }
.quantity-fields { display: grid; gap: .3rem; }
.product-id { margin-top: .3rem; }
.actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.evidence-list { min-width: 230px; }
.evidence { padding: .4rem; margin: 0 0 .4rem; border: 1px solid #d7e0dc; border-radius: 6px; }
.evidence legend { font-size: .75rem; color: #52645c; }
.evidence label { font-size: .76rem; margin: .25rem 0; }
.evidence input, .evidence textarea, .evidence select { font-size: .76rem !important; }
.evidence textarea { min-height: 2.5rem; }
.unresolved { color: #9b4b1c; background: #fff9ef; }
#history-panel li { padding: .4rem 0; border-bottom: 1px solid #e7ece9; }
#history-panel p { margin: .25rem 0; }
.purchasing { margin-top: .25rem; }
.variant-lookup { border: 1px solid #d7e0dc; border-radius: 8px; padding: .7rem; }
.variant-lookup legend { font-size: .85rem; font-weight: 650; }
.lookup-grid, .lookup-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.revision-toolbar { display: flex; align-items: end; gap: .7rem; flex-wrap: wrap; }
.revision-toolbar label { min-width: 220px; }
.product-picker { min-width: 180px; }
.product-picker[hidden] { display: none; }
.product-picker .lookup-row { grid-template-columns: 1fr auto; gap: .25rem; margin: .3rem 0; }
.product-picker .lookup-row input { min-width: 110px; }
.product-picker select { margin: .2rem 0; }
.product-picker small { display: block; font-size: .68rem; }
.handoff-section { border-top: 1px solid #d7e0dc; padding-top: 1rem; margin-top: 1rem; }
.handoff-section, .handoff-section * { min-inline-size: 0; }
.handoff-section select, .handoff-section input, .handoff-section button { max-inline-size: 100%; }
.handoff-section > label { max-width: 520px; margin: .55rem 0; }
.handoff-section .notice { margin: .6rem 0; }
.kit-chooser, .choice-group { border: 1px solid #d7e0dc; border-radius: 8px; padding: .7rem; margin: .6rem 0; }
.kit-chooser { inline-size: 100%; max-inline-size: 100%; box-sizing: border-box; }
.kit-chooser legend, .choice-group legend { font-weight: 650; font-size: .88rem; }
.lookup-row { display: flex; gap: .4rem; }
.lookup-row input { flex: 1; min-width: 0; }
.kit-chooser .lookup-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
#kit-results { display: block; inline-size: 100%; max-inline-size: 100%; }
#handoff-pin { max-width: 100%; width: auto; overflow-wrap: anywhere; white-space: normal; }
.kit-row, .choice-row, .need-row, .selected-kit { border: 1px solid #e0e8e3; border-radius: 7px; padding: .6rem; margin: .45rem 0; }
.choice-row, .selected-kit { display: flex; align-items: center; gap: .55rem; }
.choice-row label { display: flex; align-items: flex-start; gap: .45rem; }
.choice-row input[type=checkbox], #unresolved-ack-row input[type=checkbox], .need-row input[type=checkbox] { width: auto; }
.choice-group-select { min-width: 160px; }
.choice-cardinality-fields { display: flex; align-items: center; gap: .25rem; margin: .25rem 0; }
.choice-cardinality-fields input { width: 54px; min-width: 54px; }
.choice-group-label { display: block; overflow-wrap: anywhere; }
.kit-row small, .need-row small { display: block; margin-top: .2rem; }
.state-good { color: #176b42; }
.state-blocked, .state-unresolved { color: #9b4b1c; }
.preview-summary { display: flex; gap: .5rem; flex-wrap: wrap; margin: .7rem 0; }
.basket-result, .demand-result { overflow-wrap: anywhere; }
#purchase-expansion, #demand-expansion { margin-top: .8rem; }
#basket-result, #demand-result { margin-top: .5rem; }
#create-draft-basket, #create-selected-demands { margin: .55rem 0; }
@media (max-width: 900px) {
  header { align-items: flex-start; flex-direction: column; }
  .columns { grid-template-columns: minmax(0, 1fr); }
  .session { align-items: flex-start; }
  .session input { width: 100%; }
  .purchasing .heading { align-items: flex-start; flex-direction: column; }
  .lookup-grid { grid-template-columns: 1fr; }
}
