/* YSJB Food Bank. Big, plain and clear: made for a tablet at the store and for phones on delivery rounds. */
:root {
  --blue: #1C3F94; --blue-dark: #142E6E; --blue-bg: #E7EDFB; --sun: #F5B800; --sun-ink: #231A00;
  --bg: #F4F6FA; --card: #FFFFFF; --ink: #101828; --mute: #536079; --line: #D9DFEA;
  --ok: #0B7A47; --ok-bg: #E2F4EA; --warn: #8A5000; --warn-bg: #FFF1D9; --bad: #B42318; --bad-bg: #FDE7E5;
}
* { box-sizing: border-box; min-width: 0; }
html { font-size: 18px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; }
h1 { font-size: 1.75rem; line-height: 1.15; margin: .3rem 0 .6rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: 0 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1.1rem 0 .4rem; }
p { margin: .4rem 0; }
a { color: var(--blue); }
.muted { color: var(--mute); }
.small { font-size: .85rem; }
.loading { color: var(--mute); padding: 2rem 0; }
.empty { color: var(--mute); text-align: center; padding: 2rem 1rem; border: 2px dashed var(--line); border-radius: 16px; }
.q { font-weight: 700; margin: 0 0 .3rem; display: block; }
.warn-text { color: var(--warn); font-weight: 700; }
.bad-text { color: var(--bad); font-weight: 700; }
.ok-text { color: var(--ok); font-weight: 700; }
.big-text { font-size: 1.15rem; }

/* layout */
.top { display: flex; align-items: center; gap: .7rem; background: var(--blue); color: #fff; padding: .6rem 1rem; padding-top: max(.6rem, env(safe-area-inset-top)); }
.logo { width: 34px; height: 34px; flex: none; }
.logo.big { width: 64px; height: 64px; background: var(--blue); border-radius: 16px; padding: 8px; }
.brand { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.brand b { font-size: 1.05rem; }
.brand span { font-size: .8rem; color: #D5DFFF; }
.nav { display: flex; gap: .25rem; overflow-x: auto; background: var(--blue-dark); padding: 0 .5rem; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: none; color: #D5DFFF; text-decoration: none; font-weight: 700; padding: .8rem .9rem; border-bottom: 4px solid transparent; }
.nav a.on { color: #fff; border-bottom-color: var(--sun); }
main { max-width: 1100px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.back { display: inline-block; font-weight: 700; text-decoration: none; padding: .4rem 0; min-height: 44px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 1rem 1.1rem; margin: .8rem 0; }
.card.bad { border-color: var(--bad); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 0 1rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 0 1rem; }
.row-end { display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; margin-top: .8rem; align-items: center; }
.row-start { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; margin-top: .7rem; }
.center-card { max-width: 460px; margin: 8vh auto; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 1.6rem; text-align: center; }
.center-card form { text-align: left; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: .8rem; }
.tile { display: flex; flex-direction: column; gap: .2rem; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 1.1rem; text-decoration: none; color: var(--ink); min-height: 110px; }
.tile b { font-size: 1.15rem; color: var(--blue); }
.tile span { color: var(--mute); font-size: .9rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; margin: .6rem 0; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .7rem .8rem; }
.stats b { display: block; font-size: 1.8rem; line-height: 1.1; }
.stats span { color: var(--mute); font-size: .85rem; }
.bignum { font-size: 2.2rem; font-weight: 800; line-height: 1.05; margin: 0; font-variant-numeric: tabular-nums; }
.bignum small { font-size: .9rem; font-weight: 600; color: var(--mute); }
.meter { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; margin: .6rem 0; }
.meter i { display: block; height: 100%; background: var(--sun); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .4rem 1rem; }
.kv span { color: var(--mute); }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.note { background: var(--warn-bg); border-radius: 12px; padding: .6rem .8rem; }

/* controls */
.btn { appearance: none; border: 0; border-radius: 14px; background: var(--blue); color: #fff; font: inherit; font-weight: 700; min-height: 52px; padding: .6rem 1.2rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { background: var(--blue-dark); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.big { min-height: 60px; font-size: 1.1rem; padding: .7rem 1.6rem; }
.btn.wide { width: 100%; margin-top: 1rem; }
.btn.sm { min-height: 44px; padding: .3rem .9rem; font-size: .9rem; }
.btn.ghost { background: var(--blue-bg); color: var(--blue); }
.btn.ghost:hover { background: #D7E1F8; }
.btn.on-dark { background: rgba(255, 255, 255, .14); color: #fff; }
.btn.sun { background: var(--sun); color: var(--sun-ink); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.sq { width: 52px; padding: 0; font-size: 1.5rem; }
.link { appearance: none; background: none; border: 0; color: var(--blue); font: inherit; font-weight: 700; padding: .5rem .2rem; min-height: 44px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link.danger { color: var(--bad); }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
label { display: block; font-weight: 700; margin: .7rem 0 0; }
label.inline { display: inline-flex; flex-direction: column; margin: 0; }
label.grow { flex: 1; }
label.check { display: flex; gap: .6rem; align-items: center; font-weight: 600; margin: .8rem 0; cursor: pointer; }
input, select, textarea { display: block; width: 100%; font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: .6rem .8rem; min-height: 52px; margin-top: .3rem; font-weight: 400; }
textarea { min-height: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(28, 63, 148, .18); }
input[type=checkbox] { width: 28px; height: 28px; min-height: 0; margin: 0; flex: none; accent-color: var(--blue); }
.seg { display: flex; gap: .4rem; margin: .6rem 0; flex-wrap: wrap; }
.seg button, .seg a { appearance: none; border: 2px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 700; border-radius: 999px; padding: .4rem 1rem; min-height: 48px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.seg .on { background: var(--blue); border-color: var(--blue); color: #fff; }
.scanbar { display: flex; gap: .5rem; flex-wrap: wrap; margin: .7rem 0; }
.scanbar input { flex: 1 1 260px; margin: 0; }
.scanbar .btn { flex: none; }
.scanbar.big input { min-height: 64px; font-size: 1.15rem; border-color: var(--blue); }
input.scan { background: #FFFDF2; }

/* lists */
.group { color: var(--mute); font-size: .9rem; margin: 1.2rem 0 .3rem; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .75rem 1rem; margin: .45rem 0; color: var(--ink); text-decoration: none; min-height: 60px; }
a.row:hover { border-color: var(--blue); }
.row.static { background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; margin: 0; padding: .6rem 0; }
.qty { font-size: 1.4rem; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qty small { font-size: .8rem; font-weight: 600; color: var(--mute); }
.flags { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .2rem; }
.pill { display: inline-block; font-size: .8rem; font-weight: 700; border-radius: 999px; padding: .15rem .65rem; background: var(--blue-bg); color: var(--blue); line-height: 1.5; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.muted { background: #EEF0F4; color: var(--mute); }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0; }
.chip { display: inline-flex; align-items: center; gap: .2rem; background: var(--blue-bg); color: var(--blue); font-weight: 700; font-size: .85rem; border-radius: 10px; padding: .2rem .6rem; }
.chip .x { appearance: none; border: 0; background: none; color: var(--bad); font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 0 0 .3rem; min-height: 32px; min-width: 32px; }
.fam .fam-top { display: flex; justify-content: space-between; gap: .8rem; align-items: flex-start; }
.fam .fam-top b { font-size: 1.15rem; }
.fam a { text-decoration: none; }
.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tbl th { text-align: left; color: var(--mute); font-size: .8rem; padding: .4rem .4rem; border-bottom: 2px solid var(--line); }
.tbl td { padding: .55rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl .neg { color: var(--bad); font-weight: 700; }
.tbl .pos { color: var(--ok); font-weight: 700; }
.tbl tr.limit td { background: var(--warn-bg); }
.card:has(> .tbl), section.card { overflow-x: auto; }

/* receive / count lines */
.line { display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1fr) auto; gap: .6rem 1rem; align-items: center; background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: .7rem .9rem; margin: .5rem 0; }
.line.flash { animation: flash 1.2s ease-out; border-color: var(--sun); }
@keyframes flash { from { background: #FFF3C4; } to { background: var(--card); } }
.line-name { display: flex; flex-direction: column; }
.line-name b { font-size: 1.05rem; }
.line-actions { display: flex; gap: .3rem; justify-content: flex-end; flex-wrap: wrap; }
.stepper { display: flex; gap: .3rem; align-items: center; }
.stepper input { width: 6.5rem; text-align: center; margin: 0; font-size: 1.2rem; font-weight: 700; }
.exp { margin: 0; font-size: .85rem; }
.exp input { margin-top: .15rem; }
.line.compact { grid-template-columns: minmax(0, 1fr) 8rem auto; }
.line.compact input { margin: 0; text-align: center; font-weight: 700; }
.line.done { border-color: var(--ok); }
.line .tick { color: var(--ok); font-weight: 800; font-size: 1.3rem; width: 1.5rem; text-align: center; }
@media (max-width: 720px) {
  .line { grid-template-columns: minmax(0, 1fr) auto; }
  .line-name { grid-column: 1 / -1; }
  .line-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .line.compact { grid-template-columns: minmax(0, 1fr) 6.5rem auto; }
  .line.compact .line-name { grid-column: auto; }
}
.sticky-foot { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; background: rgba(244, 246, 250, .96); border-top: 1px solid var(--line); padding: .7rem 0; padding-bottom: max(.7rem, env(safe-area-inset-bottom)); margin-top: 1rem; z-index: 5; }
.stepq { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.stepq .n { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--sun); color: var(--sun-ink); font-weight: 800; display: grid; place-items: center; }
.stepq label.q { margin: 0; }
.calc { background: var(--blue-bg); border-radius: 14px; padding: .7rem 1rem; margin: .8rem 0; }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; background: var(--line); }
.photo { display: block; width: 100%; max-width: 420px; max-height: 320px; object-fit: cover; border-radius: 14px; background: var(--line); margin: .4rem 0; }
.hist { display: flex; gap: .9rem; align-items: flex-start; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.noimg { width: 72px; height: 72px; border-radius: 12px; background: var(--bg); color: var(--mute); display: grid; place-items: center; font-size: .75rem; text-align: center; flex: none; }
.acct-card { border-bottom: 1px solid var(--line); padding: .7rem 0; }
.acct-card summary { cursor: pointer; padding: .4rem 0; min-height: 44px; }

/* picker and modal */
.modal-wrap { position: fixed; inset: 0; background: rgba(10, 18, 40, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 0; }
.modal { background: var(--card); width: min(100%, 560px); max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 1.2rem 1.1rem; padding-bottom: max(1.2rem, env(safe-area-inset-bottom)); }
.modal.wide { width: min(100%, 760px); }
@media (min-width: 700px) { .modal-wrap { align-items: center; padding: 1rem; } .modal { border-radius: 22px; } }
.pick-list { display: flex; flex-direction: column; gap: .35rem; margin: .7rem 0; max-height: 50vh; overflow-y: auto; }
.pick { appearance: none; text-align: left; border: 2px solid var(--line); background: #fff; color: var(--ink); font: inherit; border-radius: 12px; padding: .6rem .8rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; cursor: pointer; min-height: 56px; }
.pick:hover { border-color: var(--blue); }
.pick span { color: var(--mute); font-size: .85rem; white-space: nowrap; }
.cam { position: relative; background: #000; border-radius: 16px; overflow: hidden; aspect-ratio: 4 / 3; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-frame { position: absolute; inset: 18% 12%; border: 4px solid var(--sun); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); }

#toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, 1rem); background: #101828; color: #fff; font-weight: 700; border-radius: 14px; padding: .8rem 1.2rem; max-width: min(92vw, 560px); opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 100; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); }

/* printed bag tags */
#print { display: none; }
.labels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; }
.label { border: 1px dashed #999; border-radius: 3mm; padding: 3mm; text-align: center; break-inside: avoid; display: flex; flex-direction: column; align-items: center; }
.label svg { width: 38mm; height: 38mm; }
.label b { font: 700 13pt/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .05em; margin-top: 1mm; }
.label span { font-size: 8pt; color: #333; }
@media print {
  body.printing > *:not(#print) { display: none !important; }
  body.printing #print { display: block; }
  @page { margin: 10mm; }
}
@media (prefers-reduced-motion: reduce) { .line.flash { animation: none; } #toast { transition: none; } }
