/* Commissary: operations-tool look. Steel background, white panels, one red for actions.
   Barlow Semi Condensed for headings and quantities, Barlow for text. */
:root {
  --bg: #EEF0F2; --card: #FFFFFF; --ink: #16181D; --mut: #5B6270; --faint: #8A919C; --line: #D9DDE3; --line2: #E8EBEF;
  --brand: #C8102E; --brand-d: #A00D25; --brand-t: #FBE9EC;
  --ok: #1F7A4D; --okb: #E3F2EA; --warn: #9A5B00; --warnb: #FCF1DE; --soon: #7A6300; --soonb: #FBF6D9; --bad: #B42318; --badb: #FCE8E6;
  --info: #1D4F91; --infob: #E6EEF8;
  --head: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  --r-lg: 10px; --r: 6px; --r-sm: 4px;
}
* { box-sizing: border-box }
body { margin: 0; font-family: Barlow, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px; line-height: 1.45; background: var(--bg); color: var(--ink); -webkit-tap-highlight-color: transparent; font-variant-numeric: tabular-nums }
button { font: inherit; cursor: pointer; color: inherit }
input, select, textarea { font: inherit; color: inherit }
:focus-visible { outline: 2px solid var(--info); outline-offset: 2px }
h2 { font-family: var(--head); font-weight: 600; font-size: 24px; line-height: 1.15; margin: 4px 0 14px; letter-spacing: 0 }
h3 { font-family: var(--head); font-weight: 600; font-size: 18px; margin: 0 0 10px }
.mut { color: var(--mut) } .sm { font-size: 14px }
b, strong { font-weight: 600 }

/* header + navigation */
.hdr { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); padding: 8px 14px; display: flex; align-items: center; gap: 10px; min-height: 56px }
.hdr h1 { font-family: var(--head); font-size: 20px; font-weight: 600; margin: 0; flex: 1; line-height: 1.1; min-width: 0 }
.hdr small { display: block; font-family: Barlow, sans-serif; font-weight: 400; font-size: 13px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.hbtns { display: flex; gap: 6px }
.hbtn { background: var(--card); border: 1px solid var(--line); color: var(--ink); padding: 7px 11px; border-radius: var(--r); font-size: 14px; font-weight: 500; white-space: nowrap }
.hbtn:hover { background: #F6F7F9 }
.brandpair { display: flex; flex: 0 0 auto }
.brandpair img { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--card); background: #fff }
.brandpair img + img { margin-left: -9px }
.live { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); margin-right: 5px; vertical-align: 1px; font-size: 0 }
.live.on { background: #2E9D5B }
.tabs { position: sticky; top: 56px; z-index: 15; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none }
.tabs::-webkit-scrollbar { display: none }
.tabs .in-tabs { display: flex; max-width: 1000px; margin: 0 auto }
.tabs button { flex: 0 0 auto; border: 0; background: none; padding: 13px 14px 11px; color: var(--mut); border-bottom: 2px solid transparent; font-weight: 500; font-size: 15px; white-space: nowrap }
.tabs button.on { color: var(--ink); border-color: var(--brand); font-weight: 600 }
.bnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom) }
.bnav button { flex: 1; min-width: 0; border: 0; background: none; padding: 8px 2px 10px; color: var(--mut); font-size: 11.5px; font-weight: 500; display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative }
.bnav button.on { color: var(--brand); font-weight: 600 }
.bnav svg, .ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round }
.bnav button.on svg { stroke-width: 2.2 }
.badge { background: var(--brand); color: #fff; border-radius: 9px; font-size: 11px; font-weight: 600; padding: 0 5px; min-width: 18px; line-height: 18px; display: inline-block; text-align: center; margin-left: 5px }
.bnav .badge { position: absolute; top: 3px; left: calc(50% + 6px); margin: 0 }
@media (max-width: 400px) { .bnav button { font-size: 10.5px } .bnav svg { width: 20px; height: 20px } }
.wrap { max-width: 1000px; margin: 0 auto; padding: 16px 14px 110px }

/* panels + rows */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 12px }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px }
.grid2 > .card { margin-bottom: 0 }
@media (min-width: 760px) { .grid2 { grid-template-columns: 1fr 1fr } }
.flexb { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap }
.list .it { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line2) }
.list .it:last-child, .line:last-child, .chk:last-child { border-bottom: 0 }
.it .nm { flex: 1; min-width: 0 }
.it .nm b { display: block; font-weight: 600 }
.it .q { text-align: right; font-weight: 600; white-space: nowrap }
.it.click { cursor: pointer }
.dayh { font-size: 13px; font-weight: 600; color: var(--mut); padding: 14px 0 2px; border-bottom: 1px solid var(--line2) }
.list > .dayh:first-child { padding-top: 0 }
.empty { text-align: center; color: var(--mut); padding: 20px 8px; font-size: 15px }
.line { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line2) }
.line .nm { flex: 1; font-weight: 500 }
.notice { background: var(--infob); border: 1px solid #C9D9EE; color: #19385F; border-radius: var(--r); padding: 10px 12px; font-size: 15px; margin-bottom: 12px }
.notice.click { cursor: pointer }
.notice.plain { background: var(--card); border-color: var(--line); color: var(--ink) }

/* forms + buttons */
label.f { display: block; font-size: 14px; color: var(--mut); margin: 0 0 4px; font-weight: 500 }
.fg { margin-bottom: 12px }
.in { width: 100%; padding: 10px 12px; border: 1px solid #C4CAD2; border-radius: var(--r); background: #fff; font-size: 16px; min-height: 44px }
.in:focus { outline: 2px solid var(--info); outline-offset: -1px; border-color: transparent }
.row { display: flex; gap: 10px; align-items: flex-end }
.btn { border: 1px solid var(--brand); border-radius: var(--r); padding: 10px 16px; min-height: 44px; font-weight: 600; background: var(--brand); color: #fff }
.btn:hover { background: var(--brand-d); border-color: var(--brand-d) }
.btn.big { width: 100%; font-size: 17px; min-height: 50px }
.btn.sec, .btn.ghost { background: var(--card); color: var(--ink); border-color: #C4CAD2 }
.btn.sec:hover, .btn.ghost:hover { background: #F6F7F9; border-color: #AEB5BF }
.btn.danger { background: var(--card); color: var(--bad); border-color: #E7B4AE }
.btn.danger:hover { background: var(--badb) }
.btn.sm { padding: 6px 11px; min-height: 36px; font-size: 14px }
.btn:disabled { opacity: .45 }
.wait { opacity: .6 }
.acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap }
.x { border: 1px solid var(--line); background: var(--card); border-radius: var(--r); width: 34px; height: 34px; color: var(--mut); font-size: 18px; line-height: 1; flex: 0 0 auto }
.x:hover { color: var(--bad); border-color: #E7B4AE }
.chips { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; scrollbar-width: none }
.chips::-webkit-scrollbar { display: none }
.chip { flex: 0 0 auto; border: 1px solid #C4CAD2; background: var(--card); border-radius: var(--r); padding: 6px 12px; font-size: 14px; font-weight: 500; color: var(--ink) }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink) }
.daterow { display: flex; gap: 8px; margin-bottom: 12px }
.daterow input { flex: 1 }
.err-msg { color: var(--bad); font-size: 14px; margin: 6px 0 }
.chk { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line2) }
.chk input { width: 22px; height: 22px; accent-color: var(--brand); flex: 0 0 auto }
.cnt { width: 96px; text-align: right; padding: 8px 10px; font-family: var(--head); font-size: 19px; font-weight: 600 }
.line .cnt { width: 84px }
.cnt.chg { background: var(--soonb); border-color: #D9C25A }
.savebar { position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 12; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--ink); color: #fff; border-radius: var(--r-lg); padding: 8px 8px 8px 16px; margin-top: 12px }
.savebar b { font-family: var(--head); font-size: 20px }

/* send-out destinations */
.dest { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px }
.dest button { border: 1px solid #C4CAD2; background: var(--card); border-radius: var(--r-lg); padding: 10px 6px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; line-height: 1.2 }
.dest button.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; background: var(--brand-t) }
.logo { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 600; font-size: 13px; flex: 0 0 auto; overflow: hidden; vertical-align: middle }
.logo.s { width: 22px; height: 22px; font-size: 10px }
.logo img { width: 100%; height: 100%; object-fit: cover; display: block }
.dest .logo { width: 42px; height: 42px }

/* status */
.pill { display: inline-block; padding: 1px 7px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; white-space: nowrap }
.p-ok { background: var(--okb); color: var(--ok) } .p-low { background: var(--warnb); color: var(--warn) } .p-out { background: var(--badb); color: var(--bad) }
.p-soon { background: var(--soonb); color: var(--soon) } .p-n { background: #EDEFF2; color: var(--mut) } .p-b { background: var(--infob); color: var(--info) }
.tag { font-size: 14px; font-weight: 600 }
.req { border-left: 3px solid var(--warn); border-radius: 0 var(--r-lg) var(--r-lg) 0 }
.req.done { border-left-color: var(--line) } .req.ordered { border-left-color: var(--info) }

/* numbers */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px }
.kpi .l { font-size: 14px; color: var(--mut); font-weight: 500; display: flex; align-items: center; gap: 6px }
.kpi .v { font-family: var(--head); font-size: 30px; font-weight: 600; line-height: 1.1; margin-top: 4px }
.kpi .s { font-size: 13px; color: var(--mut); margin-top: 2px }
.it .q { font-family: var(--head); font-size: 18px }
.tbl { overflow-x: auto; margin: 0 -16px; padding: 0 16px }
table { width: 100%; border-collapse: collapse; font-size: 15px }
th { text-align: left; font-size: 13px; color: var(--mut); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap }
td { padding: 8px; border-bottom: 1px solid var(--line2); vertical-align: middle }
td.n, th.n { text-align: right; white-space: nowrap }
tr.click { cursor: pointer } tr.click:hover td { background: #F6F7F9 }
tr.tot td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--line) }

/* charts */
.split { height: 10px; border-radius: var(--r-sm); overflow: hidden; display: flex; background: #E5E8EC; margin: 10px 0 6px }
.legend { display: flex; gap: 14px; font-size: 14px; color: var(--mut); margin-top: 8px; flex-wrap: wrap }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; background: var(--c) }
.chart svg { display: block; max-width: 100%; height: auto }
.ax { font-size: 11px; fill: var(--faint); font-family: Barlow, sans-serif }
.dv { font-size: 17px; font-weight: 600; fill: var(--ink); font-family: "Barlow Semi Condensed", sans-serif }
.bar { cursor: pointer } .bar.sel rect { opacity: .7 }
.ctip { font-size: 14px; color: var(--mut); min-height: 20px; margin-top: 6px }
.donut { display: flex; gap: 18px; align-items: center; flex-wrap: wrap }
.donut svg { flex: 0 0 auto }
.dleg { flex: 1; min-width: 180px }
.dleg div { display: flex; gap: 8px; align-items: center; padding: 5px 0; font-size: 15px; border-bottom: 1px solid var(--line2) }
.dleg div:last-child { border-bottom: 0 }
.dl { flex: 1 } .dvv { color: var(--mut); font-size: 14px; min-width: 70px; text-align: right }
.sw { width: 10px; height: 10px; border-radius: 2px; flex: 0 0 auto }
.hbr { display: grid; grid-template-columns: minmax(96px, 36%) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 15px }
.hl { overflow: hidden; text-overflow: ellipsis; line-height: 1.25 }
.ht { height: 8px; background: #E9ECEF; border-radius: 2px; overflow: hidden }
.ht i { display: block; height: 100%; border-radius: 2px }
.hv { font-weight: 600; text-align: right; min-width: 64px }

/* receipts */
.thumb { width: 44px; height: 44px; border-radius: var(--r); object-fit: cover; background: #EDEFF2; display: grid; place-items: center; color: var(--faint); font-size: 12px; flex: 0 0 auto; border: 1px solid var(--line) }
.rcpt { max-width: 100%; border-radius: var(--r); display: block; margin: 0 auto; border: 1px solid var(--line) }
.photo-pick { display: flex; gap: 12px; align-items: center; border: 1px dashed #AEB5BF; border-radius: var(--r-lg); padding: 10px 12px; cursor: pointer }
.photo-pick img, .photo-pick .thumb { width: 60px; height: 60px; object-fit: cover; border-radius: var(--r) }

/* overlays, toasts, sync */
.toast { position: fixed; left: 50%; top: 66px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r); font-weight: 500; font-size: 15px; z-index: 60; max-width: 90vw }
.ov { position: fixed; inset: 0; background: rgba(22, 24, 29, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center }
.modal { background: var(--card); width: 100%; max-width: 480px; border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 18px; max-height: 90vh; overflow: auto }
@media (min-width: 600px) { .ov { align-items: center } .modal { border-radius: var(--r-lg) } }
.sync { background: var(--warnb); color: #6B3F00; font-size: 14px; font-weight: 500; padding: 7px 14px; text-align: center; border-bottom: 1px solid #EDD6AE }
.sync.err { background: var(--badb); color: var(--bad); border-color: #EFC4BF }
.sync:empty { display: none }
.loading { display: grid; place-items: center; min-height: 60vh; color: var(--mut) }
.spin { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: sp .8s linear infinite; margin: 0 auto 12px }
@keyframes sp { to { transform: rotate(360deg) } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s } }

/* sign in */
.loginbg { min-height: 100vh; background: var(--bg) }
.loginwrap { max-width: 400px; margin: 0 auto; padding: 32px 18px 40px }
.loginlogos { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 0 0 22px }
.loginlogos .td { width: 56%; max-width: 210px }
.loginlogos .bf { width: 28%; max-width: 108px; border-radius: 50% }
.logincard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px }
.logincard h2 { margin-top: 0 }
.joint { text-align: center; font-size: 13px; color: var(--mut); margin-top: 16px }
.login { max-width: 420px; margin: 0 auto; padding: 32px 18px }
@media (max-width: 480px) { .hdr .htxt { display: none } .hbtn { padding: 7px 10px } }

/* collapsible groups */
.grp { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line2); padding: 11px 0 9px; text-align: left; font-family: var(--head); font-size: 17px; font-weight: 600; color: var(--ink); min-height: 44px }
.grp:disabled { cursor: default; color: var(--ink) }
.grp .gt { flex: 1; min-width: 0 }
.grp .gm { font-family: Barlow, sans-serif; font-size: 14px; font-weight: 400; color: var(--mut); white-space: nowrap }
.chev { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: var(--mut); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; vertical-align: -2px }
.grp.open .chev, .chev.down { transform: rotate(90deg) }
@media (prefers-reduced-motion: reduce) { .chev { transition: none } }
.list .grp:first-child { padding-top: 0 }
.chgm { color: var(--soon) }
.grp-tools { display: flex; gap: 16px; justify-content: flex-end; margin: -4px 0 8px }
.lnk { background: none; border: 0; color: var(--info); font-weight: 500; font-size: 14px; padding: 6px 2px; min-height: 32px }
tr.grow td { padding: 0 8px; background: #FAFBFC }
tr.grow .grp { border-bottom: 0; font-size: 16px }
.card.compact { padding: 10px 14px; cursor: pointer }
.card.compact:hover { background: #FAFBFC }

/* sticky search + item picker */
.searchbar { position: sticky; top: 56px; z-index: 11; background: var(--bg); padding: 8px 0; margin: -8px 0 6px; display: flex; gap: 8px; align-items: center }
.tabs ~ .wrap .searchbar { top: 101px }
.searchbar .pick-box { flex: 1 }
.pick-box { position: relative }
.pick-box svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; pointer-events: none }
.pick-box .in { padding-left: 38px }
.pick-res:empty { display: none }
.pick-list { border: 1px solid var(--line); border-radius: var(--r); margin-top: 6px; max-height: 300px; overflow-y: auto; background: var(--card) }
.pick-row { display: flex; width: 100%; align-items: center; gap: 10px; background: none; border: 0; border-bottom: 1px solid var(--line2); padding: 11px 12px; text-align: left; min-height: 46px }
.pick-row:last-child { border-bottom: 0 }
.pick-row:hover, .pick-row:focus-visible { background: #F3F6FA }
.pick-row .pn { flex: 1; font-weight: 500 }
.pick-row .pu { color: var(--mut); font-size: 14px; white-space: nowrap }
.pick-none { color: var(--mut); font-size: 14px; padding: 10px 2px }
.pick-recent { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px }
.pick-recent .chip { font-size: 13px; padding: 5px 10px }
.pick-sel { display: flex; align-items: center; gap: 10px; border: 1px solid var(--info); background: #F5F9FE; border-radius: var(--r); padding: 8px 8px 8px 12px; min-height: 44px }
.pick-sel .nm { flex: 1; min-width: 0 }
.pick-sel .nm b { display: block; font-weight: 600 }
.hbtn[hidden] { display: none }
