:root {
  --umber: #14120e; --umber-2: #2a241c; --bronze: #b89a6f; --bronze-deep: #8a6d45;
  --bg: #f6f2ec; --card: #fffdf9; --text: #221d17; --muted: #7a6f61; --line: #e8e0d4; --brand: #14120e;
  --red: #a8322a; --red-bg: #f8e8e4; --amber: #95630f; --amber-bg: #f6ecda; --green: #3d6b3f; --green-bg: #e7eee2;
  --blue: #4a5868; --blue-bg: #ebeef1; --grey-bg: #efebe5;
  --serif: 'Fraunces', Georgia, serif; --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; background: var(--bg); color: var(--text); }
a { color: var(--bronze-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
header { background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; gap: 12px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
header .brand { color: #f3ece1; padding: 12px 0; line-height: 1.15; }
header .brand:hover { text-decoration: none; }
.brand small { display: block; font: 600 10px/1.4 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--bronze); }
.brand span { font: 500 19px/1.2 var(--serif); }
header nav { display: flex; gap: 4px; flex-wrap: wrap; }
header nav a { color: #c9bfb0; padding: 8px 10px; border-radius: 6px; font-size: 14px; }
header nav a.on, header nav a:hover { background: rgba(184,154,111,.16); color: #f3ece1; text-decoration: none; }
#unread { background: var(--red); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; margin-left: 2px; }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font: 500 28px/1.2 var(--serif); margin: 4px 0 14px; letter-spacing: -.01em; }
h2 { font: 500 19px/1.3 var(--serif); margin: 28px 0 10px; }
h3 { font: 500 16px var(--serif); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; color: var(--muted); font-size: 13px; }
.stat b { display: block; font: 500 34px/1.1 var(--serif); color: var(--text); margin-bottom: 4px; }
.stat.red { border-color: #ecc6bf; background: var(--red-bg); } .stat.red b { color: var(--red); }
.stat.amber { border-color: #e8d3ae; background: var(--amber-bg); } .stat.amber b { color: var(--amber); }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: #faf6f0; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: #faf5ee; }
tr.row-overdue td { background: #fcf3f1; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.s-overdue { background: var(--red-bg); color: var(--red); }
.s-awaiting_ack, .s-due_soon { background: var(--amber-bg); color: var(--amber); }
.s-in_progress, .s-pending, .s-partial { background: var(--blue-bg); color: var(--blue); }
.s-dispatched, .s-received { background: var(--green-bg); color: var(--green); }
.s-dispatched_late { background: #f1e6dc; color: #8a4b2a; }
.s-cancelled { background: var(--grey-bg); color: var(--muted); }
button, .btn { font: inherit; font-weight: 600; border: 1px solid #d9cfc0; background: var(--card); color: var(--text); padding: 10px 16px; border-radius: 8px; transition: background .15s, border-color .15s; cursor: pointer; display: inline-block; }
button:hover, .btn:hover { border-color: var(--bronze); text-decoration: none; }
button.primary, .btn.primary { background: var(--umber-2); color: #f6efe3; border-color: var(--umber-2); }
button.primary:hover, .btn.primary:hover { background: var(--umber); border-color: var(--umber); }
button.danger { background: var(--red); color: #fff; border-color: var(--red); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 9px 10px; border: 1px solid #d9cfc0; border-radius: 8px; width: 100%; background: #fffdf9; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--bronze); box-shadow: 0 0 0 3px rgba(184,154,111,.22); }
input[type=checkbox] { accent-color: var(--umber-2); width: 18px !important; height: 18px; }
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 200px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.banner { background: #efe6d8; border-bottom: 1px solid #e3d5bf; color: var(--umber-2); padding: 10px 16px; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: 14px; }
.alert { padding: 10px 14px; border-radius: 8px; margin: 10px 0; }
.alert.err { background: var(--red-bg); color: var(--red); }
.alert.warn { background: var(--amber-bg); color: var(--amber); }
.alert.ok { background: var(--green-bg); color: var(--green); }
.login { max-width: 400px; margin: 12vh auto; padding: 32px 28px; }
.login .eyebrow { font: 600 11px var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--bronze-deep); margin-bottom: 6px; }
.login-wrap { min-height: 100vh; background: radial-gradient(ellipse at top left, #3a3024 0%, #14120e 60%); padding: 1px 16px; }
.login-wrap .login { background: var(--card); border: 0; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.notif { padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: pre-line; }
.notif.unread { background: #faf3e8; border-left: 3px solid var(--bronze); }
.notif:last-child { border-bottom: 0; }
.timeline div { padding: 8px 0; border-bottom: 1px dashed var(--line); white-space: pre-line; font-size: 14px; }
.meta { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; font-size: 14px; }
.big-ack { background: #f3ead9; border: 1px solid #e3cfa9; border-radius: 12px; padding: 16px 18px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
dialog { border: 0; border-radius: 12px; padding: 20px; width: min(520px, 94vw); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0,0,0,.35); }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--umber); color: #f3ece1; box-shadow: 0 8px 30px rgba(0,0,0,.25); padding: 10px 18px; border-radius: 8px; z-index: 20; max-width: 90vw; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filters button { padding: 6px 12px; font-size: 13px; }
.filters button { border-radius: 20px; }
.filters button.on { background: var(--umber-2); color: #f6efe3; border-color: var(--umber-2); }
.qty-in { width: 90px; }
@media (max-width: 640px) { th, td { padding: 8px 6px; font-size: 13px; } .hide-sm { display: none; } h1 { font-size: 19px; } }
#rows .mat { min-width: 170px; } #rows .qty-in { width: 80px; }
.pick-list tr.picked td { background: #f5ecdd; }
.pick-list td { padding: 8px 10px; }
.submit-bar { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 12px 0; margin-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }

@media (max-width: 640px) { h1 { font-size: 23px; } .brand span { font-size: 17px; } }
main:has(.login-wrap) { max-width: none; padding: 0; }

/* ---------- readability pass: function over design ---------- */
:root { --text: #17130e; --muted: #4f463a; --line: #ddd3c4; --red: #9e1d14; --amber: #7a4f00; --green: #245a28; --blue: #34414f; }
body { font-size: 16px; line-height: 1.55; }
h1 { font-size: 28px; font-weight: 600; }
h2 { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
th { font-size: 12.5px; color: #3f372c; background: #f3ede3; }
td { font-size: 15.5px; }
.stat { font-size: 14.5px; color: var(--muted); font-weight: 500; }
.stat b { font-size: 36px; font-weight: 600; }
.pill { font-size: 13px; padding: 4px 11px; }
/* urgent states are solid so they can't be missed */
.s-overdue { background: #b3261e; color: #fff; }
.s-awaiting_ack { background: #c77700; color: #fff; }
.s-due_soon { background: #f4dfb5; color: #5a3a00; }
.s-dispatched, .s-received { background: #d6e8d4; color: #1d4a21; }
button, .btn { font-size: 15.5px; min-height: 44px; }
input, select, textarea { font-size: 16px; min-height: 44px; }
textarea { min-height: 0; }
label { font-size: 14.5px; color: var(--text); }
header nav a { font-size: 15px; color: #e6ddcf; }
.alert { font-size: 15px; font-weight: 500; }
.alert.err { background: #fbe1dc; color: #7d140d; border: 1px solid #efb3a9; }
.alert.warn { background: #fbeccb; color: #5a3a00; border: 1px solid #ecce8d; }
.banner { font-size: 15px; }
.notif { font-size: 15px; }
.pick-list td { font-size: 16px; }
.pick-list label { font-size: 16px !important; }
@media (max-width: 640px) { th, td { font-size: 14.5px; } h1 { font-size: 24px; } }
[hidden] { display: none !important; }
.brand small { font-size: 11.5px; letter-spacing: .16em; color: #cdb48c; }
.brand span { font-size: 20px; }
.filters button { font-size: 15px; padding: 8px 16px; }
.show-sm { display: none; }
@media (max-width: 640px) { .show-sm { display: block; } }

/* ---------- plain fonts only ---------- */
:root { --serif: var(--sans); }
h1 { font-weight: 700; letter-spacing: -.01em; }
h2, h3 { font-weight: 700; }
.brand span { font-weight: 700; font-size: 18px; }
.stat b { font-weight: 700; }

/* ---------- material autosuggest ---------- */
.picker { position: relative; }
.picker input { font-size: 17px; padding: 12px 14px; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(20,18,14,.15); max-height: 320px; overflow-y: auto; z-index: 10; }
.suggest div { padding: 12px 14px; font-size: 16px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid #f0e9df; }
.suggest div:last-child { border-bottom: 0; }
.suggest div.active, .suggest div:hover { background: #f3ead9; }
.suggest div.added { color: var(--muted); }
.suggest mark { background: #f4dfb5; color: inherit; border-radius: 2px; }
.suggest .none { color: var(--muted); cursor: default; }
.sel-list td { font-size: 16px; vertical-align: middle; }
.sel-list .qty-in { width: 110px; font-size: 17px; }
.rm { min-height: 40px; width: 40px; padding: 0; font-size: 20px; line-height: 1; }
