/* Same layout as DE Portal. The accent ("blue" in the names below) is teal, so the two apps are easy to tell apart. */
:root {
  --navy: #1b2230;
  --navy-2: #2b3447;
  --blue: #0f766e;
  --blue-dark: #115e59;
  --blue-soft: #d5f0ec;
  --bg: #e8f3f1;
  --card: #ffffff;
  --row: #f3faf8;
  --text: #15223a;
  --muted: #5a6982;
  --line: #d0e5e1;
  --accent-light: #5fd3c4;
  --accent-deep: #0f4f4a;
  --ok: #1d8a43;
  --ok-soft: #dcf3e4;
  --warn: #b35f00;
  --warn-soft: #fdecd5;
  --danger: #c3262b;
  --danger-soft: #fbe0e1;
  --special: #ffd60a;
  --special-text: #1f1a00;
  --special-muted: #5c4d00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 34, 58, .08), 0 2px 8px rgba(20, 34, 58, .06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h2 { font-size: 1.3rem; margin: 0 0 4px; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 4px 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .02em; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- header ---------- */
#top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 4px;
  height: calc(56px + env(safe-area-inset-top)); padding: 0 6px; padding-top: env(safe-area-inset-top);
  background: var(--navy); color: #fff;
}
#title { flex: 1; margin: 0; font-size: 1.15rem; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--accent-light); cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,.08); }
.icon-btn svg.i { width: 26px; height: 26px; }
body.auth #top, body.print-mode #top { display: none; }
/* The Android app runs under the phone's status bar and navigation bar, so keep those strips navy
   (they're 0px tall everywhere else) and keep the page out from under them. */
html.native::before, html.native::after { content: ''; position: fixed; left: 0; right: 0; z-index: 4000; background: var(--navy); pointer-events: none; }
html.native::before { top: 0; height: env(safe-area-inset-top); }
html.native::after { bottom: 0; height: env(safe-area-inset-bottom); }
html.native body { padding-bottom: env(safe-area-inset-bottom); }
html.native body.auth, html.native body.print-mode { padding-top: env(safe-area-inset-top); }
/* Shopping list button with the number of things on the list. */
#cart-btn { position: relative; }
#cart-btn .badge {
  position: absolute; top: 3px; right: 0; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: var(--blue); border: 2px solid var(--navy); color: #fff; font-size: .68rem; font-weight: 700; line-height: 15px; text-align: center;
}

main#view { max-width: 760px; margin: 0 auto; padding: 12px 16px 96px; }

/* ---------- tabs (dark band under header) ---------- */
.tabs { display: flex; gap: 6px; background: var(--navy); margin: -12px -16px 14px; padding: 4px 16px 12px; }
.tabs a {
  flex: 1; text-align: center; padding: 9px 6px; border-radius: 6px;
  background: var(--navy-2); color: #9aa6bb; font-weight: 500;
}
.tabs a.on { background: var(--blue); color: #fff; }

/* ---------- cards & rows ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head h2 { color: var(--blue-dark); font-size: 1.1rem; margin: 0; }
.rows { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px;
  border-bottom: 1px solid var(--line); color: var(--text); background: var(--card); width: 100%;
  text-align: left; border-left: 0; border-right: 0; border-top: 0; cursor: pointer;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--row); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.row-side { text-align: right; flex: none; }
.row-side .big { font-size: 1.25rem; font-weight: 600; display: block; line-height: 1.1; }
.row-side .lbl { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.row .chev { color: var(--blue); }
.row.static { cursor: default; }
.row.static:hover { background: var(--card); }
.group-head { display: flex; justify-content: space-between; align-items: baseline; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--blue-soft); color: var(--blue-dark); white-space: nowrap; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.dark { background: var(--navy); color: #fff; }
.pill.test { background: #ece2fb; color: #6b2fb3; }
.stat.bad b { color: var(--danger); }
/* Square photo box: the whole photo always shows (no cropping), on a light background if it isn't square. */
.product-photo {
  display: block; width: 100%; max-width: 400px; aspect-ratio: 1; margin: 0 auto 14px;
  object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: var(--row); cursor: zoom-in;
}
.photo-zoom { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: 10px; background: var(--row); }
.row-thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex: none; background: var(--row); }
.row-thumb.empty { display: grid; place-items: center; color: #a9cdc6; }
.row-thumb.empty svg.i { width: 22px; height: 22px; }
.field > span { display: block; font-size: .85rem; color: var(--blue-dark); font-weight: 600; margin-bottom: 5px; }
div.field { margin-bottom: 14px; }
.photo-pick { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.photo-pick img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.photo-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.grab { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-soft); color: #5c3200; border-left: 4px solid var(--warn); padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.grab svg.i { color: var(--warn); margin-top: 2px; }
.grab.bad { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.serial-rows { display: grid; gap: 8px; max-height: 42vh; overflow-y: auto; padding-right: 2px; }
.serial-row { display: flex; align-items: center; gap: 10px; }
.serial-row span { width: 1.8em; text-align: right; flex: none; font-size: .85rem; }
.serial-row input { flex: 1; min-width: 0; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.serial-row .scan-into { flex: none; width: 46px; padding: 0; color: var(--blue); }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.status-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; }
.status-opt input { width: 20px; height: 20px; margin: 0; accent-color: var(--blue); }
.status-opt:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.status-opt .pill { font-size: .85rem; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 4px; }
.stat { background: var(--row); border-radius: 10px; padding: 10px 6px; text-align: center; }
.stat b { display: block; font-size: 1.35rem; line-height: 1.2; }
.stat span { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat.warn b { color: var(--warn); }
.stat.ok b { color: var(--ok); }
@media (max-width: 420px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- shortcuts grid ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 120px; padding: 14px 8px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--blue-dark); font-weight: 600; text-align: center;
}
.tile svg.i { width: 40px; height: 40px; color: var(--blue); stroke-width: 1.8; }
.tile:hover { background: var(--row); }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--blue-dark); font-weight: 600; cursor: pointer; text-align: center;
}
.btn:hover { background: var(--row); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.dark { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; letter-spacing: .05em; }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg.i { width: 20px; height: 20px; }
.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 14px 0 0; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: .85rem; color: var(--blue-dark); font-weight: 600; margin-bottom: 5px; }
label.field > small { display: block; color: var(--muted); font-size: .8rem; margin-top: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #b3d1cb; border-radius: 10px; background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 72px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--blue); font-weight: 600; padding: 8px 10px; cursor: pointer; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 420px) { .two { grid-template-columns: 1fr; } }
.error-msg { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: .95rem; }
.error-msg:empty { display: none; }
.info-msg { background: var(--blue-soft); color: var(--blue-dark); padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: .95rem; }
.idle-warning {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 3000;
  display: flex; align-items: center; gap: 12px; width: min(520px, calc(100% - 32px));
  background: var(--navy); color: #fff; padding: 12px 12px 12px 16px; border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.35);
}
.idle-warning span { flex: 1; }

.search-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.search-bar input { flex: 1; background: var(--accent-deep); color: #fff; border-color: var(--accent-deep); font-size: 1.05rem; }
.search-bar input::placeholder { color: #bfe6e0; }
.search-bar .btn { flex: none; width: 52px; padding: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; font-size: .9rem; }
.chip.on { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-dark); font-weight: 600; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.seg button { flex: 1; min-height: 44px; border: 0; background: var(--card); cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--blue); color: #fff; }

.checks { display: grid; gap: 8px; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--blue); }
.check b { display: block; font-weight: 600; }
.check small { color: var(--muted); }

/* ---------- detail header ---------- */
.detail { display: flex; gap: 14px; align-items: flex-start; }
.detail .qr { width: 96px; height: 96px; flex: none; border-radius: 8px; border: 1px solid var(--line); background: #fff; padding: 4px; cursor: zoom-in; }
.detail-main { flex: 1; min-width: 0; }
.code-big { font-size: 1.3rem; font-weight: 700; color: var(--blue-dark); }
.meta { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.notes { white-space: pre-wrap; margin-top: 10px; color: var(--text); font-size: .95rem; }

/* ---------- auth screens ---------- */
.auth-box { max-width: 380px; margin: 8vh auto 0; text-align: center; }
.logo { display: block; width: 96px; height: 96px; margin: 0 auto 12px; border-radius: 20px; box-shadow: var(--shadow); }
.auth-box h1 { color: var(--blue-dark); letter-spacing: .12em; text-transform: uppercase; font-size: 1.5rem; margin: 0 0 4px; }
.auth-box form { text-align: left; margin-top: 24px; }
.auth-box .card { padding: 20px; }
.auth-box .auth-msg { text-align: left; margin-top: 24px; }
.auth-msg h2 { color: var(--blue-dark); font-size: 1.15rem; margin: 0 0 8px; }
.auth-links { text-align: center; margin: 14px 0 0; }
.auth-alt { margin: 16px 0 0; }
.auth-box a:not(.btn) { color: var(--blue); font-weight: 600; }
.btn.signup { border: 2px solid var(--blue); color: var(--blue); }
.btn.signup:hover { background: var(--blue-soft); }

/* ---------- nearest shops ---------- */
.place-fields { display: grid; grid-template-columns: 1fr 110px; gap: 0 12px; margin-bottom: 14px; }
.place-fields .field { margin-bottom: 0; }
.place-fields > small { grid-column: 1 / -1; color: var(--muted); font-size: .8rem; margin-top: 4px; }
.rows.inset { box-shadow: none; border: 1px solid var(--line); }
.chain { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; color: #fff; }
.chain.woolworths { background: #178841; }
.chain.coles { background: #e01a22; }
.or-line { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: .85rem; }
.or-line::before, .or-line::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.btn.g-btn { border-color: #747775; color: #1f1f1f; font-weight: 500; }
.g-logo { width: 20px; height: 20px; flex: none; }
.copy-row { margin-bottom: 10px; }
.copy-row > div { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.copy-row code { flex: 1; min-width: 0; overflow-wrap: anywhere; background: var(--row); padding: 8px 10px; border-radius: 8px; font-size: .85rem; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.link-btn { border: 0; background: none; padding: 0; color: var(--blue); font: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- drawer ---------- */
#drawer-wrap { position: fixed; inset: 0; z-index: 200; background: rgba(10, 16, 28, .45); }
#drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(330px, 88vw);
  background: var(--bg); display: flex; flex-direction: column; box-shadow: -4px 0 24px rgba(0,0,0,.25);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; background: var(--navy); color: #fff; height: 56px; padding: 0 6px 0 16px; font-weight: 600; }
.drawer-head .brand { display: flex; align-items: center; gap: 10px; }
.drawer-head .brand img { width: 34px; height: 34px; }
.drawer-links { flex: 1; overflow-y: auto; padding: 6px 0; }
.drawer-links a, .drawer-links button {
  display: flex; align-items: center; gap: 16px; width: 100%; padding: 13px 20px; border: 0; background: none;
  color: var(--blue-dark); font-size: 1.05rem; cursor: pointer; text-align: left;
}
.drawer-links a:hover, .drawer-links button:hover { background: var(--blue-soft); }
.drawer-links svg.i { width: 28px; height: 28px; color: var(--blue); }
.drawer-foot { border-top: 1px solid var(--line); padding: 14px 20px; color: var(--blue-dark); font-weight: 600; font-size: .92rem; line-height: 1.7; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 1000; background: rgba(10, 16, 28, .5); display: flex; align-items: flex-end; justify-content: center; }
.modal {
  background: var(--card); width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
}
@media (min-width: 600px) { .modal-wrap { align-items: center; } .modal { border-radius: 16px; } }
.modal h2 { margin-bottom: 10px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }
.modal .rows { box-shadow: none; border: 1px solid var(--line); max-height: 45vh; overflow-y: auto; }
.qr-zoom { width: 100%; max-width: 360px; display: block; margin: 0 auto; }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 2000; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 520px; animation: pop .18s ease-out; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* ---------- hint bar (like the scan prompt at the bottom of a screen) ---------- */
.hint { display: flex; gap: 12px; align-items: center; background: var(--blue-soft); border-top: 3px solid #5bbfb2; padding: 12px 14px; border-radius: 10px; color: var(--navy); font-size: .92rem; margin-top: 14px; }
.hint .dot { width: 38px; height: 38px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; flex: none; }
.hint .dot svg.i { width: 20px; height: 20px; }

/* ---------- scanner ---------- */
#scanner { position: fixed; inset: 0; z-index: 1100; background: #000; color: #fff; display: flex; flex-direction: column; }
#scanner[hidden] { display: none; }
.sc-top { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; padding-top: calc(8px + env(safe-area-inset-top)); background: var(--navy); }
.sc-title { font-weight: 600; }
/* Green bar when scanning items onto a list, red when scanning them off, so nobody mixes them up. */
.sc-top.add { background: var(--ok); }
.sc-top.remove { background: var(--danger); }
.sc-top.add .icon-btn, .sc-top.remove .icon-btn { color: #fff; }
.scan-mode { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; }
.scan-mode.add { background: var(--ok); }
.scan-mode.remove { background: var(--danger); }
/* Waiting for the handheld scanner (the camera is off until asked for). */
.sc-wait { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; background: #111a29; }
.sc-wait svg.i { width: 84px; height: 84px; color: var(--accent-light); stroke-width: 1.4; margin-bottom: 6px; }
.sc-wait b { font-size: 1.3rem; }
.sc-wait span { color: #b9c4d6; }
.sc-cam { margin-top: 10px; background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.sc-cam:hover { background: rgba(255,255,255,.08); }
.scan-ready { text-align: center; }
.scan-ready > svg.i { width: 64px; height: 64px; color: var(--blue); stroke-width: 1.5; margin: 6px 0 4px; }
.sc-video { position: relative; flex: 1; overflow: hidden; display: grid; place-items: center; }
.sc-video video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sc-frame { position: relative; width: min(64vw, 300px); aspect-ratio: 1; border: 3px solid rgba(255,255,255,.9); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
.sc-msg { position: absolute; left: 16px; right: 16px; bottom: 16px; text-align: center; background: rgba(0,0,0,.6); border-radius: 10px; padding: 10px; }
.sc-msg:empty { display: none; }
.sc-bottom { background: var(--navy); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.sc-last { min-height: 24px; margin-bottom: 10px; }
.sc-last .ok { color: #7ee2a0; }
.sc-last .err { color: #ff9c9c; }
.sc-last .btn { min-height: 38px; padding: 0 12px; margin-left: 6px; }
.sc-manual { display: flex; gap: 8px; }
.sc-manual input { flex: 1; }

.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- steppers ---------- */
.stepper { display: flex; align-items: center; gap: 2px; flex: none; }
.stepper button {
  width: 36px; height: 36px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--blue-dark); cursor: pointer;
}
.stepper button:hover { background: var(--row); }
.stepper button svg.i { width: 18px; height: 18px; }
.stepper b { min-width: 34px; text-align: center; font-size: 1.1rem; }

/* ---------- DE Home ---------- */
/* The four big buttons at the top of the home screen. */
.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.big-actions .tile { min-height: 104px; }
button.tile { border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.tile.put { color: var(--ok); }
.tile.put svg.i { color: var(--ok); }
.tile.use { color: var(--danger); }
.tile.use svg.i { color: var(--danger); }
.tile .count { font-size: .8rem; color: var(--muted); font-weight: 500; margin-top: -6px; }
/* A line of stock: name, where/when, and − n + to change how many. */
.row .stepper { margin-left: auto; }
.row.ticked .row-title { text-decoration: line-through; color: var(--muted); }
.row.ticked .row-thumb { opacity: .5; }
.tick { width: 26px; height: 26px; margin: 0; flex: none; accent-color: var(--blue); }
.price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price b { font-size: 1.5rem; }
.price s { color: var(--muted); }
/* Specials: yellow like a supermarket's special ticket, so they stand out. */
.price.special { background: var(--special); color: var(--special-text); padding: 10px 12px; border-radius: 10px; align-items: center; }
.price.special s, .price.special .muted { color: var(--special-muted); }
.price .save { font-weight: 700; }
.pill.special { background: var(--special); color: var(--special-text); }
.tag.special { display: inline-block; background: var(--special); color: var(--special-text); padding: 4px 8px; border-radius: 8px; text-align: right; }
.tag.special .was { color: var(--special-muted); }
.row-side .was { font-size: .75rem; color: var(--muted); text-decoration: line-through; display: block; }
.links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.links .btn { min-height: 38px; font-size: .9rem; }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 4px 0; font-weight: 600; }
/* The scanner's last result: the product's photo next to what happened. */
.sc-item { display: flex; align-items: center; gap: 10px; }
.sc-item img, .sc-item .row-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; background: #fff; }
.sc-item > div { flex: 1; min-width: 0; }
.sc-item .btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.sc-item .btns .btn { margin: 0; color: #fff; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); }
.date-picks { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.wwrow .row-side b { display: block; }

/* ---------- printing ---------- */
.print-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: var(--card); padding: 14px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.print-bar label.field { margin: 0; }
.print-bar input { width: 90px; }
.sheet { background: #fff; padding: 8mm; box-shadow: var(--shadow); }
.label { border: 1px dashed #9aa; border-radius: 3mm; padding: 3mm; color: #000; break-inside: avoid; page-break-inside: avoid; }
/* Sticker sheets: real-size A4 pages with each label placed on its 63.5 × 38.1 mm sticker.
   On screen the page is shrunk to fit (--s); the text is sized to fit by fitStickers(). */
.sheet.stickers { background: none; padding: 0; box-shadow: none; }
.sheet-fit { width: 100%; max-width: 210mm; aspect-ratio: 210 / 296; margin: 0 auto 16px; overflow: hidden; }
.sticker-sheet { position: relative; width: 210mm; height: 296mm; background: #fff; color: #000; outline: 1px solid var(--line); outline-offset: -1px; transform: scale(var(--s, 1)); transform-origin: 0 0; }
.sticker {
  position: absolute; width: 63.5mm; height: 38.1mm; border: 1px dashed #b9c4d3; border-radius: 2.5mm;
  display: flex; align-items: center; gap: 2.5mm; padding: 3mm; overflow: hidden;
}
.sticker[data-pos] { cursor: pointer; }
.sticker[data-pos]:hover { border: 1px solid var(--blue); }
.sticker.used { background: repeating-linear-gradient(135deg, #eef1f6 0 3mm, #e2e7ef 3mm 6mm); justify-content: center; color: var(--muted); font-size: 11pt; }
.sticker .l-qr { width: 28mm; height: 28mm; flex: none; }
.sticker .l-text { flex: 1; min-width: 0; align-self: stretch; display: flex; align-items: center; overflow: hidden; font-size: 10pt; }
.sticker .l-text > div { width: 100%; }
.sticker .l-app { font-size: .7em; margin-bottom: .45em; }
.sticker .l-logo { height: 1.9em; }
.sticker .l-name { font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.sticker .l-no { font: 700 1.4em/1.1 ui-monospace, Consolas, monospace; margin-top: .25em; overflow-wrap: anywhere; }
.sticker .l-no small { font-size: .6em; }
.sticker .l-sub { font-size: .75em; margin-top: .2em; overflow-wrap: anywhere; }
.l-app { font-size: 7pt; text-transform: uppercase; letter-spacing: .08em; color: #444; display: flex; align-items: center; gap: .6em; }
.label-lg .l-app { justify-content: center; }
.l-logo { height: 2.2em; width: auto; flex: none; }
.l-sub { font-size: 8pt; color: #333; }
.label-lg { text-align: center; padding: 10mm; height: 128mm; display: flex; flex-direction: column; align-items: center; justify-content: center; margin-bottom: 6mm; }
.label-lg .l-qr { width: 80mm; height: 80mm; }
.label-lg .l-name { font-weight: 800; font-size: 22pt; line-height: 1.1; margin: 3mm 0 1mm; }
.label-lg .l-no { font: 700 18pt ui-monospace, Consolas, monospace; }
/* Full page list sign: A4 landscape, QR code on the left, name and number on the right.
   Sizes use the sign's own width (cqw), so the on-screen preview matches the printout. */
.label-page {
  container-type: inline-size; display: flex; align-items: center; gap: 6%;
  aspect-ratio: 281 / 190; padding: 4% 5%; text-align: left; break-after: page;
}
.label-page:last-child { break-after: auto; }
.label-page .l-qr { width: 48%; height: auto; aspect-ratio: 1; flex: none; }
.label-page .l-text { flex: 1; min-width: 0; }
.label-page .l-app { font-size: 1.8cqw; margin-bottom: 3cqw; justify-content: flex-start; }
.label-page .l-logo { height: 3.2em; }
.label-page .l-name { font-weight: 800; font-size: 6.6cqw; line-height: 1.05; margin-bottom: 3cqw; overflow-wrap: anywhere; }
.label-page .l-no { font: 700 4.4cqw ui-monospace, Consolas, monospace; }
.label-page .l-sub { font-size: 2.4cqw; margin-top: 1.2cqw; }

@media screen and (max-width: 820px) {
  /* The preview is shrunk to fit a phone; the printout keeps real sizes. */
  .sheet { padding: 4mm; }
  .label .l-qr { max-width: 100%; height: auto; }
  .label-lg { height: auto; }
}

@page { size: A4; margin: 8mm; }
@media print {
  body { background: #fff; min-height: 0; }
  html.native::before, html.native::after { display: none; }
  html.native body { padding: 0 !important; }
  .no-print, .print-bar { display: none !important; }
  main#view { max-width: none; padding: 0; margin: 0; }
  .sheet { padding: 0; box-shadow: none; }
  .label { border-color: #bbb; }
  /* Stickers: one full-size sheet per page, with nothing printed but the labels. */
  .sheet-fit { max-width: none; aspect-ratio: auto; margin: 0; overflow: visible; break-after: page; }
  .sheet-fit:last-child { break-after: auto; }
  .sticker-sheet { transform: none; outline: none; }
  .sticker { border-color: transparent !important; }
  .sticker.used, .sticker.empty { visibility: hidden; }
}
