/* Market List. Plain, legible, quantity first. */
:root {
  --bg: #F2F4F1; --surface: #FFFFFF; --ink: #16201B; --muted: #5A6860; --line: #D3DAD4; --line-soft: #E6EAE6;
  --green: #1D6B4B; --green-dark: #134B35; --green-soft: #E3F0E9;
  --amber: #8F5507; --amber-soft: #FBF0DA; --red: #A32D1C; --red-soft: #FAE7E3; --grey-soft: #E9EDEA;
  --radius: 10px; --tap: 46px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); font-variant-numeric: tabular-nums; }
h1 { font-size: 1.45rem; line-height: 1.2; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 1.08rem; margin: 26px 0 8px; }
h3 { font-size: 1rem; margin: 0; }
p { margin: 0 0 10px; }
a { color: var(--green-dark); }
.muted { color: var(--muted); } .small { font-size: 0.86rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.boot { padding: 40px 20px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }

/* Top bar */
.top { background: var(--green-dark); color: #fff; position: sticky; top: 0; z-index: 20; }
.top-in { max-width: 1240px; margin: 0 auto; padding: 8px 14px 6px; display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: -0.01em; margin-right: 6px; }
.brand span { font-weight: 400; opacity: 0.75; }
.nav { display: flex; gap: 2px; order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
.nav a { color: #fff; text-decoration: none; padding: 8px 10px; border-radius: 8px; white-space: nowrap; opacity: 0.8; font-size: 0.95rem; }
.nav a.on { background: rgba(255,255,255,0.16); opacity: 1; font-weight: 600; }
.nav a:hover { opacity: 1; }
.badge { background: #F4C55B; color: #2A1D00; border-radius: 99px; padding: 0 7px; font-size: 0.78rem; font-weight: 700; margin-left: 5px; }
.who { font-size: 0.86rem; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.who button { background: none; border: 1px solid rgba(255,255,255,0.4); color: #fff; min-height: 32px; padding: 3px 10px; font-size: 0.84rem; }
.sample-bar { background: repeating-linear-gradient(135deg, #F4C55B, #F4C55B 14px, #EDB73B 14px, #EDB73B 28px); color: #2A1D00; text-align: center; padding: 5px 10px; font-weight: 600; font-size: 0.9rem; }
main { max-width: 1240px; margin: 0 auto; padding: 18px 14px 80px; }
main.narrow { max-width: 620px; }

/* Controls */
button, .btn { font: inherit; min-height: var(--tap); padding: 8px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button:hover, .btn:hover { border-color: var(--muted); }
button.primary, .btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--green-dark); }
button.danger { color: var(--red); border-color: #E2B7AF; }
button.quiet { border-color: transparent; background: none; color: var(--green-dark); padding: 6px 8px; min-height: 36px; text-decoration: underline; }
button.sm, .btn.sm { min-height: 34px; padding: 4px 10px; font-size: 0.88rem; border-radius: 8px; }
button:disabled { opacity: 0.5; cursor: default; }
button.big { width: 100%; min-height: 54px; font-size: 1.05rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid #B9C3BB; border-radius: var(--radius); min-height: var(--tap); padding: 8px 11px; width: 100%; }
textarea { min-height: 70px; }
input.sm, select.sm { min-height: 34px; padding: 3px 8px; border-radius: 8px; font-size: 0.9rem; }
input.num { text-align: right; font-weight: 600; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--green); }
:focus-visible { outline: 3px solid #F4C55B; outline-offset: 2px; }
label { display: block; font-size: 0.88rem; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 140px; } .row > .fit { flex: 0 0 auto; }
.bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin: 10px 0 14px; }
.bar .field { margin: 0; min-width: 150px; }
.bar .grow { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 0.95rem; margin: 0; }
.inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.note { border-radius: var(--radius); padding: 10px 12px; margin: 10px 0; font-size: 0.93rem; background: var(--grey-soft); }
.note.warn { background: var(--amber-soft); color: #5B3603; } .note.bad { background: var(--red-soft); color: #7A2114; } .note.good { background: var(--green-soft); color: var(--green-dark); }
.err { color: var(--red); font-size: 0.92rem; margin: 6px 0; min-height: 1.2em; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 2px 10px 2px 8px; font-size: 0.82rem; font-weight: 600; white-space: nowrap; background: var(--grey-soft); color: #3D4A43; }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip.wait { background: var(--amber-soft); color: var(--amber); } .chip.act { background: var(--red-soft); color: var(--red); }
.chip.ok { background: var(--green-soft); color: var(--green); } .chip.done { background: var(--green); color: #fff; }

/* Login */
.login { max-width: 380px; margin: 9vh auto 0; padding: 0 16px; }
.login .mark { width: 56px; height: 56px; margin-bottom: 14px; }
.login h1 { font-size: 1.7rem; }

/* Kitchen order form */
.search-wrap { position: relative; }
.results { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-top: 6px; overflow: hidden; }
.results button { width: 100%; justify-content: space-between; text-align: left; border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; min-height: 50px; }
.results button:last-child { border-bottom: 0; }
.results .unit { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.oline { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 8px; }
.oline-head { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.oline-name { font-weight: 600; }
.oline-qty { display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px; margin-top: 8px; }
.oline-qty input { font-size: 1.25rem; min-height: 52px; }
.oline-qty select { min-height: 52px; }
.conv { margin-top: 8px; background: var(--green-soft); color: var(--green-dark); border-radius: 8px; padding: 6px 10px; font-weight: 600; }
.conv b { font-size: 1.05rem; }
.dupe { margin-top: 8px; background: var(--amber-soft); color: #5B3603; border-radius: 8px; padding: 6px 10px; font-size: 0.9rem; }
.x { min-height: 34px; width: 34px; padding: 0; border-radius: 50%; color: var(--muted); flex: 0 0 auto; }
.save-state { font-size: 0.86rem; color: var(--muted); text-align: center; margin: 8px 0; min-height: 1.3em; }
.sticky-send { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 22%); padding: 18px 0 10px; }
.sum-list { list-style: none; padding: 0; margin: 10px 0; }
.sum-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.sum-list b { white-space: nowrap; }

.last { margin-top: 8px; font-size: 0.9rem; color: var(--muted); }
.often-title { margin: 2px 0 6px; }
.often { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.often button { background: var(--green-soft); border-color: #BFD9CB; color: var(--green-dark); text-align: left; }
.help ol { margin: 6px 0 0; padding-left: 22px; } .help li { margin-bottom: 9px; } .help h2 { margin-top: 0; }
.foot { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 0 14px 22px; }
/* Kitchen: my orders */
.olist { margin-bottom: 18px; }
.olist-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.mline { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px; margin-bottom: 6px; }
.mline.act { border-color: #D9A297; border-left: 5px solid var(--red); }
.mline-top { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.qty-big { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.feedback { margin-top: 7px; padding: 7px 10px; border-radius: 8px; background: var(--grey-soft); font-size: 0.92rem; }
.progress { height: 8px; border-radius: 99px; background: var(--grey-soft); overflow: hidden; margin: 7px 0 4px; }
.progress i { display: block; height: 100%; background: var(--green); }

/* Tables for purchasing */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.82rem; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #F8FAF8; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child > td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.strong { font-weight: 700; }
td .sub { color: var(--muted); font-size: 0.84rem; }
tr.sub-row > td { background: #F8FAF8; }
tr.total > td { font-weight: 700; border-top: 2px solid var(--line); }
tr.click { cursor: pointer; } tr.click:hover > td { background: var(--green-soft); }
.actions { display: flex; gap: 5px; flex-wrap: wrap; }
.hist { margin: 6px 0 0; padding: 0; list-style: none; font-size: 0.85rem; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 10px 0; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi b { display: block; font-size: 1.45rem; letter-spacing: -0.01em; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.basis { display: inline-block; background: var(--green-dark); color: #fff; border-radius: 6px; padding: 1px 8px; font-size: 0.8rem; font-weight: 600; margin-left: 6px; vertical-align: middle; }
.rec-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.rec-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px; flex-wrap: wrap; }
.rec-nums { display: flex; gap: 18px; flex-wrap: wrap; }
.rec-nums div { font-size: 0.82rem; color: var(--muted); } .rec-nums b { display: block; font-size: 1.1rem; color: var(--ink); }
.rec-nums .out b { color: var(--amber); }
.rec-body { border-top: 1px solid var(--line-soft); padding: 10px 14px; }
.rec-form { background: #F8FAF8; border-top: 1px solid var(--line); padding: 14px; }
.calc { font-size: 1.15rem; font-weight: 700; }
dialog { border: 0; border-radius: 14px; padding: 20px; max-width: min(520px, 92vw); width: 100%; box-shadow: 0 20px 60px rgba(10,30,20,0.35); }
dialog::backdrop { background: rgba(15,30,22,0.5); }

/* Version 2: outlet colours, grouping, inbox, account */
.otag { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; vertical-align: baseline; }
.otag i { width: 11px; height: 11px; border-radius: 3px; background: var(--oc, #9AA79F); flex: 0 0 auto; }
.ohead { border-left: 6px solid var(--oc, var(--green)); background: var(--surface); border-radius: var(--radius); border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 9px 14px; margin-bottom: 12px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ohead b { font-size: 1.1rem; }
.olist { border-left: 5px solid var(--oc, var(--green)); padding-left: 10px; }
tr.lstripe > td:first-child { box-shadow: inset 4px 0 0 var(--oc, transparent); }
.rgroup { background: #EEF2EE; color: #3D4A43; font-weight: 700; font-size: 0.82rem; padding: 6px 12px; border-bottom: 1px solid var(--line-soft); }
.results .rgroup + button { border-top: 0; }
.often button.dept { background: var(--surface); border-color: var(--line); color: var(--ink); }
.often button.dept.on { background: var(--green-dark); border-color: var(--green-dark); color: #fff; font-weight: 600; }
tr.grp-row > td { background: #EEF2EE; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.grp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.sup-head { margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--line); }
.deliverybar { border-left: 6px solid var(--green); }
.deliverybar h3 { margin-bottom: 8px; }
.ncard { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 13px; margin-bottom: 7px; text-decoration: none; color: var(--ink); }
.ncard.new { border-left: 5px solid var(--green); background: #F6FBF8; }
.ncard:hover { border-color: var(--muted); }
.bell, .me { color: #fff; text-decoration: none; padding: 5px 8px; border-radius: 8px; white-space: nowrap; }
.bell:hover, .me:hover { background: rgba(255,255,255,0.14); }
.me { text-decoration: underline; text-underline-offset: 3px; }
select.company { width: auto; min-height: 34px; padding: 3px 8px; border-radius: 8px; font-size: 0.88rem; background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.4); max-width: 46vw; }
select.company option { color: var(--ink); background: #fff; }
.steps { padding-left: 22px; margin: 8px 0; } .steps li { margin-bottom: 8px; }
.confirmed { color: var(--green); font-weight: 600; margin-top: 6px; }
.chip.late { margin-left: 8px; }
.share { margin-top: 8px; display: flex; }
.modal-title { margin: 0 0 10px; font-size: 1.15rem; }
dialog.wide { max-width: min(980px, 96vw); }
dialog .table-wrap { margin-bottom: 12px; }
input[type=color] { width: 54px; min-height: 36px; height: 36px; padding: 2px; cursor: pointer; }
input[type=time].sm, input[type=month], input[type=date] { width: auto; min-width: 150px; }
.bar input[type=search] { min-width: 220px; }
code.key { display: inline-block; font: 600 1rem/1.4 ui-monospace, Menlo, Consolas, monospace; background: var(--grey-soft); border-radius: 8px; padding: 6px 10px; letter-spacing: 0.06em; word-break: break-all; }
.codes { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; font: 600 1rem/1.4 ui-monospace, Menlo, Consolas, monospace; }
.codes li { background: var(--grey-soft); border-radius: 8px; padding: 6px 10px; text-align: center; }

/* The printed A4 market list */
.sheet { display: none; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body { background: #fff; font-size: 11pt; }
  .top, .sample-bar, .foot, main > *:not(.sheet), dialog { display: none !important; }
  main { padding: 0; max-width: none; }
  .sheet { display: block; }
  .sheet h1 { font-size: 18pt; margin: 0; }
  .sheet-meta { display: flex; justify-content: space-between; margin: 2mm 0 5mm; font-size: 10pt; }
  .sheet table { font-size: 10.5pt; }
  .sheet th { background: none; color: #000; border-bottom: 1.5pt solid #000; font-size: 9pt; padding: 2mm; }
  .sheet td { border-bottom: 0.5pt solid #888; padding: 2.4mm 2mm; }
  .sheet tr { break-inside: avoid; }
  .sheet .sheet-grp td { font-weight: 700; font-size: 10pt; border-bottom: 1pt solid #000; padding-top: 4mm; break-after: avoid; }
  .sheet .tick { width: 9mm; } .sheet .tick i { display: block; width: 5.5mm; height: 5.5mm; border: 1pt solid #000; }
  .sheet .total-q { font-weight: 700; font-size: 12pt; white-space: nowrap; }
  .sheet .recv { width: 34mm; } .sheet .recv i { display: block; border-bottom: 0.5pt solid #000; height: 6mm; }
  .sheet-foot { margin-top: 8mm; display: flex; gap: 14mm; font-size: 10pt; }
  .sheet-foot span { flex: 1; border-top: 0.5pt solid #000; padding-top: 1.5mm; }
}

@media (max-width: 760px) {
  .table-wrap table:has(th:nth-child(5)) { min-width: 700px; }
  .grp-head { justify-content: flex-start; }
  .rec-body table, .rec-body tbody, .rec-form table, .rec-form tbody { display: block; }
  .rec-body tr, .rec-form tr { display: flex; flex-wrap: wrap; gap: 3px 14px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); align-items: baseline; }
  .rec-body tr:last-child, .rec-form tr:last-child { border-bottom: 0; }
  .rec-body td, .rec-form td { display: block; padding: 0; border: 0; text-align: left; white-space: normal; background: none; }
  .rec-body td:first-child, .rec-form td:first-child { flex-basis: 100%; }
  .rec-body tr.sub-row { background: #F8FAF8; padding: 9px 10px; border-radius: 8px; margin-top: 6px; border-bottom: 0; }
  .rec-head { align-items: flex-start; }
  .rec-head > button { width: 100%; }
  .depts { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -14px; padding-right: 14px; }
  .depts button { flex: 0 0 auto; white-space: nowrap; }
  .two { grid-template-columns: 1fr; }
  .who .name { display: none; }
  h1 { font-size: 1.3rem; }
}
@media (prefers-reduced-motion: no-preference) { .progress i { transition: width 0.3s; } }
.grp-head .btn { min-height: 34px; padding: 4px 10px; font-size: 0.88rem; border-radius: 8px; }
.line { display: flex; gap: 8px; align-items: center; }
.line > input, .line > select { flex: 1 1 auto; min-width: 0; }
.line > button { flex: 0 0 auto; }
.card .table-wrap + .row { margin-top: 10px; }
.card > h3:not(:first-child) { margin: 16px 0 8px; }
main > div > h3, .two h3 { margin: 16px 0 6px; }
.inv-card .field { margin: 10px 0 0; max-width: 420px; }
td input.sm, td select.sm { min-width: 110px; }
