:root { --fg: #1d2433; --muted: #5b6475; --line: #dde1e8; --bg: #fff; --panel: #f4f6f9; --accent: #1f5fbf;
	--must: #b4232a; --should: #b86e00; --could: #4b6a8a; --good: #1d7a3a; }
@media (prefers-color-scheme: dark) {
	:root { --fg: #e6e9ef; --muted: #a3abba; --line: #353b47; --bg: #15181e; --panel: #1f232b; --accent: #7fb0ff;
		--must: #ff7b7f; --should: #f0b14d; --could: #9db7d2; --good: #6fd08c; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, "Segoe UI", sans-serif; color: var(--fg); background: var(--bg); }
header { display: flex; gap: 18px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
header b { font-size: 17px; letter-spacing: .02em; }
nav button { font: inherit; background: none; border: 0; padding: 6px 10px; border-radius: 6px; color: var(--fg); cursor: pointer; }
nav button.on { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
#status { margin-left: auto; }
main { padding: 14px 18px; }
footer { padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12px; }
.muted { color: var(--muted); }
.order { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
aside { position: sticky; top: 10px; }
aside input, .filters input { width: 100%; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); }
.filters { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.filters input { width: 320px; }
.legend { display: flex; gap: 6px; justify-content: flex-end; margin: 8px 4px 4px; font-size: 11px; }
ul.suppliers { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 170px); overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
ul.suppliers li { display: flex; justify-content: space-between; gap: 6px; padding: 7px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
ul.suppliers li .muted { font-size: 12px; }
ul.suppliers li.on { background: var(--panel); box-shadow: inset 3px 0 0 var(--accent); }
.counts { display: flex; gap: 4px; white-space: nowrap; }
.counts b, .legend b { min-width: 26px; text-align: center; border-radius: 4px; padding: 0 4px; font-size: 12px; font-variant-numeric: tabular-nums; }
.must { color: var(--must); } .should { color: var(--should); } .could { color: var(--could); } .good { color: var(--good); } .bad, .warn { color: var(--must); }
.counts b.must, .legend b.must, .tag.must { background: color-mix(in srgb, var(--must) 14%, transparent); }
.counts b.should, .legend b.should, .tag.should { background: color-mix(in srgb, var(--should) 16%, transparent); }
.counts b.could, .legend b.could, .tag.could { background: color-mix(in srgb, var(--could) 16%, transparent); }
.tag { font-size: 11px; font-weight: 700; text-transform: uppercase; border-radius: 4px; padding: 2px 6px; margin-right: 6px; }
h2 { margin: 0 0 8px; font-size: 18px; } h2 .muted { font-weight: 400; }
h3 { margin: 18px 0 6px; font-size: 14px; }
.actions { margin-bottom: 4px; }
.actions button { font: inherit; padding: 6px 14px; border-radius: 6px; border: 0; background: var(--accent); color: #fff; cursor: pointer; }
.actions button:disabled { opacity: .45; cursor: default; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 4px 7px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
td.clip { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td.code, td.n { white-space: nowrap; }
td.code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
tr.order-head td { background: var(--panel); font-weight: 600; padding-top: 8px; }
td.st.order-required { color: var(--must); } td.st.overdue, td.st.backorder-unconfirmed, td.st.requested, td.st.quoted { color: var(--should); } td.st.from-stock { color: var(--good); }
details summary { cursor: pointer; color: var(--accent); font-size: 12px; }
details { max-width: 420px; font-size: 12px; }
pre { background: var(--panel); padding: 12px; border-radius: 8px; overflow: auto; }
.note { margin-top: 14px; font-size: 12px; }
/* Replenishment */
.sub-head { margin: -4px 0 10px; }
.filters select, button.plain { font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); }
button.plain { cursor: pointer; font-weight: 600; }
table.replen th.sort { cursor: pointer; white-space: nowrap; }
table.replen tr.rep { cursor: pointer; }
table.replen tr.rep:hover td, table.replen tr.rep.open td { background: var(--panel); }
table.replen tr.rep td:first-child { box-shadow: inset 3px 0 0 transparent; }
table.replen tr.rep.must td:first-child { box-shadow: inset 3px 0 0 var(--must); }
table.replen tr.rep.should td:first-child { box-shadow: inset 3px 0 0 var(--should); }
table.replen tr.rep.could td:first-child { box-shadow: inset 3px 0 0 var(--could); }
table.replen td.n { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.sub { font-size: 11px; color: var(--muted); font-weight: 400; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 4px; padding: 1px 6px; white-space: nowrap; font-family: ui-monospace, Consolas, monospace; }
.badge.must { background: color-mix(in srgb, var(--must) 14%, transparent); }
.badge.should { color: var(--should); background: color-mix(in srgb, var(--should) 16%, transparent); }
.badge.could { color: var(--could); background: color-mix(in srgb, var(--could) 16%, transparent); }
.badge.ok { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
svg.spark { fill: var(--accent); vertical-align: middle; }
tr.detail > td { background: var(--panel); padding: 10px 14px 16px; }
.item-detail h4 { margin: 14px 0 4px; font-size: 13px; } .item-detail h4 .muted { font-weight: 400; }
.item-detail p { margin: 0 0 6px; } .item-detail .why { font-size: 12px; max-width: 1100px; }
.scroll { overflow-x: auto; }
table.months, table.lines { width: auto; background: var(--bg); border-radius: 6px; }
table.months th, table.months td { padding: 3px 8px; white-space: nowrap; }
table.months th.lead { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 4px; }
table.lines td.clip { max-width: 220px; }
table.replen td.clip { max-width: 300px; }
table.replen td.clip.sup, table.replen td.clip.grp { max-width: 150px; font-size: 12px; }
td.pick { width: 1px; }
input.qty { width: 78px; font: 13px ui-monospace, Consolas, monospace; text-align: right; padding: 2px 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--fg); }
input.qty.edited { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 700; }
td.rec b { font-weight: 600; }
.po-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.po-bar button:disabled { opacity: .45; cursor: default; }
button.link { border: 0; background: none; color: var(--accent); font-weight: 400; }
.filters { flex-wrap: wrap; }
.filters select { max-width: 240px; }
.order.wide { grid-template-columns: 1fr; } .order.wide > aside { display: none; }
button.icon { padding: 0 8px; font-size: 16px; line-height: 24px; vertical-align: 2px; }
.filters.options { gap: 14px; font-size: 13px; }
.filters.options label { display: flex; gap: 5px; align-items: center; white-space: nowrap; cursor: pointer; }
details.multi { position: relative; }
details.multi > summary { list-style: none; font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); cursor: pointer; white-space: nowrap; }
details.multi > summary::after { content: ' ▾'; color: var(--muted); }
details.multi[open] > summary { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
details.multi .menu { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; min-width: 240px; max-height: 360px; overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); box-shadow: 0 6px 20px rgba(0, 0, 0, .15); }
details.multi .menu label { display: flex; gap: 6px; align-items: center; padding: 3px 6px; border-radius: 4px; font-size: 13px; white-space: nowrap; cursor: pointer; }
details.multi .menu label:hover { background: var(--panel); }
.sub.cat-irrigation { color: var(--accent); } .sub.cat-machinery { color: var(--should); }
/* Ordering desk landing */
.desk { max-width: 1400px; }
.desk h1 { margin: 2px 0 4px; font-size: 24px; }
.desk > p { margin: 0 0 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 14px 0 18px; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile b { font: 600 28px ui-monospace, Consolas, monospace; }
.tile span:first-of-type { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.desk-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.card { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; overflow: hidden; }
.card h3 { margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.card.pad, .pad { padding: 0 14px 12px; } .card.pad h3 { margin: 0 -14px 10px; }
ul.desk-items, ul.desk-suppliers { list-style: none; margin: 0; padding: 0; }
ul.desk-items li { display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
ul.desk-items li:last-child, ul.desk-suppliers li:last-child { border-bottom: 0; }
ul.desk-items li:hover, ul.desk-suppliers li:hover { background: var(--panel); }
ul.desk-items .what { display: flex; flex-direction: column; min-width: 0; }
ul.desk-items .what span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } ul.desk-items .what .muted { font-size: 12px; }
ul.desk-items .qty { display: flex; flex-direction: column; align-items: flex-end; } ul.desk-items .qty b { font: 600 16px ui-monospace, Consolas, monospace; } ul.desk-items .qty .muted { font-size: 11px; }
ul.desk-suppliers li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
ul.desk-suppliers .what { display: flex; flex-direction: column; gap: 2px; min-width: 0; } ul.desk-suppliers .what .muted { font-size: 12px; }
tr.waits td { opacity: .6; } tr.waits td:first-child, tr.waits td:last-child { opacity: 1; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.chip { font-size: 11px; border-radius: 10px; padding: 1px 8px; white-space: nowrap; font-family: ui-monospace, Consolas, monospace; }
.chip.must { background: color-mix(in srgb, var(--must) 14%, transparent); } .chip.should { background: color-mix(in srgb, var(--should) 16%, transparent); }
.chip.could { background: color-mix(in srgb, var(--could) 16%, transparent); } .chip.ok { color: var(--muted); background: var(--panel); }
button.go { font: inherit; font-weight: 600; padding: 8px 14px; border: 0; border-radius: 6px; background: var(--good); color: #fff; cursor: pointer; }
a.back { color: var(--accent); text-decoration: none; }
/* Roll-out bars on the landing */
.desk-section { margin-bottom: 22px; }
.desk-section h2 { margin: 0 0 2px; font-size: 16px; } .desk-section h2 .muted { font-size: 12px; font-weight: 400; margin-left: 6px; }
.desk-section > p { margin: 0 0 8px; font-size: 12px; } .desk-section > p a { color: var(--accent); text-decoration: none; }
details.bar { max-width: none; font-size: inherit; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: var(--bg); overflow: hidden; }
details.bar > summary { display: flex; align-items: center; gap: 12px; padding: 9px 14px; color: var(--fg); font-size: 14px; list-style: none; box-shadow: inset 4px 0 0 var(--line); }
details.bar > summary::-webkit-details-marker { display: none; }
details.bar > summary::before { content: '▸'; color: var(--muted); width: 10px; }
details.bar[open] > summary::before { content: '▾'; }
details.bar > summary:hover, details.bar[open] > summary { background: var(--panel); }
details.bar[open] > summary { border-bottom: 1px solid var(--line); }
details.bar.urgent > summary { box-shadow: inset 4px 0 0 var(--must); }
details.bar.group > summary { padding: 12px 14px; font-size: 15px; }
.bar-name { font-weight: 600; min-width: 240px; } .bar-note { margin-left: auto; font-size: 12px; text-align: right; }
details.bar .chips { justify-content: flex-start; } details.bar .chip { font-size: 12px; padding: 2px 9px; }
.bar-body { padding: 10px 10px 4px; background: var(--panel); }
.bar-foot { margin: 0; padding: 9px 14px; font-size: 12px; } .bar-foot a { color: var(--accent); text-decoration: none; }
table.desk-lines { margin: 0; } table.desk-lines td:not(.warn) { white-space: nowrap; } table.desk-lines th:first-child, table.desk-lines td:first-child { padding-left: 14px; }
table.desk-lines td.cover, table.desk-lines td.acts { white-space: nowrap; }
button.small { font-size: 12px; padding: 2px 8px; }
table.desk-lines tr:hover td { background: var(--panel); }
@media (max-width: 800px) { details.bar > summary { flex-wrap: wrap; } .bar-name { min-width: 0; } .bar-note { margin-left: 0; text-align: left; width: 100%; } details.bar { overflow-x: auto; } }
@media (max-width: 800px) { .desk-grid { grid-template-columns: 1fr; } ul.desk-items li { grid-template-columns: 1fr auto; } ul.desk-items li .code { grid-column: 1 / -1; } }
@media (max-width: 800px) { .order { grid-template-columns: 1fr; } aside { position: static; } ul.suppliers { max-height: 240px; } }
