/* Station 91 Grocery — shared "Signal" editorial system.
   Display/UI: Bricolage Grotesque · Data: IBM Plex Mono · one red accent, hairline rules, no cards. */
:root {
  --bg: #0c0c0e; --bg-2: #141417; --surf: #161619; --surf-2: #1c1c20;
  --ink: #f6f6f7; --mut: #83838d; --faint: #4d4d56; --line: #222227; --line-2: #2c2c33;
  --red: #ff4438; --red-deep: #d92b20; --red-soft: rgba(255,68,56,0.14);
  --lime: #c8f63e; --lime-deep: #9bc91f; --lime-soft: rgba(200,246,62,0.14);
  --green: #c8f63e; --r: 12px; --header-h: 168px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 16px; line-height: 1.35; letter-spacing: -0.005em; padding-bottom: 100px; }
.mono { font-family: "IBM Plex Mono", monospace; font-feature-settings: "tnum" 1; }

/* ---------- Header ---------- */
header { position: sticky; top: 0; z-index: 30; padding: 18px 20px 0; background: var(--bg); }
.brand { display: flex; align-items: center; gap: 13px; }
.badge { font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 22px; width: 42px; height: 42px;
  border-radius: 11px; line-height: 1; display: grid; place-items: center; color: #fff; background: var(--red); }
.brand h1 { font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 28px; line-height: 0.92;
  letter-spacing: -0.03em; margin: 0; }
.brand h1 small { display: block; font-family: "IBM Plex Mono", monospace; font-size: 10px; color: var(--mut);
  letter-spacing: 0.22em; font-weight: 400; text-transform: uppercase; margin-top: 5px; }

/* ---------- Mode toggle (pill nav) ---------- */
.modes { display: flex; gap: 6px; margin-top: 16px; padding: 13px 0 11px; border-top: 1px solid var(--line); }
.modes button { border: 0; background: transparent; color: var(--mut); cursor: pointer; font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700; font-size: 15px; letter-spacing: -0.01em; padding: 8px 17px; border-radius: 100px;
  display: inline-flex; align-items: center; gap: 8px; transition: all 0.16s; }
.modes button.active { background: var(--ink); color: var(--bg); }
.pill { font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: 11px; min-width: 19px; height: 19px;
  padding: 0 6px; border-radius: 100px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--red); color: #fff; }
.modes button.active .pill { background: var(--bg); color: var(--ink); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 9px; align-items: center; margin-top: 4px; padding-bottom: 6px; position: relative; }
.toolbar input.search { flex: 1; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 100px; padding: 11px 15px; font-size: 15px; }
.toolbar input.search:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.btn { border: 1px solid var(--line); background: var(--bg-2); color: var(--ink); border-radius: 100px; padding: 10px 15px;
  font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-family: "Bricolage Grotesque", sans-serif; transition: all 0.14s; }
.btn.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.danger { color: var(--faint); border: 0; background: transparent; font-family: "IBM Plex Mono", monospace;
  font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- Jump bar ---------- */
.jump { display: flex; gap: 7px; overflow-x: auto; margin-top: 8px; padding-bottom: 4px; scrollbar-width: none; position: relative; }
.jump::-webkit-scrollbar { display: none; }
.jump.hidden { display: none; }
.jump .chip { flex: none; background: var(--bg-2); border: 1px solid var(--line); color: var(--mut); border-radius: 100px;
  padding: 7px 13px; font-size: 12.5px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: all 0.14s; }
.jump .chip:active { background: var(--surf-2); color: var(--ink); }
.jump .chip .n { font-family: "IBM Plex Mono", monospace; color: var(--red); font-weight: 700; }

main { padding: 6px 20px 0; max-width: 720px; margin: 0 auto; }

/* ---------- Categories ---------- */
.cat { margin-bottom: 22px; }
.cat-head { position: sticky; top: var(--header-h); z-index: 10; display: flex; align-items: center; justify-content: space-between;
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  font-size: 14px; color: var(--ink); padding: 11px 0 9px; margin-bottom: 2px; border-bottom: 1px solid var(--line);
  background: var(--bg); cursor: pointer; }
.cat-head .left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cat-head .caret { color: var(--faint); font-size: 12px; transition: transform 0.15s; }
.cat.collapsed .cat-head .caret { transform: rotate(-90deg); }
.cat-head .count { font-family: "IBM Plex Mono", monospace; color: var(--red); font-size: 13px; }
.cat-head .tools { display: flex; gap: 2px; }
.cat.collapsed .item, .cat.collapsed .cat-add { display: none; }

/* ---------- Items — hairline rows ---------- */
.item { display: flex; align-items: center; gap: 13px; padding: 14px 2px; border-top: 1px solid var(--line);
  cursor: pointer; transition: opacity 0.12s; }
.cat .item:first-of-type, section .item:first-of-type { border-top: 0; }
.item .tick { width: 22px; height: 22px; flex: none; border-radius: 7px; border: 1.5px solid var(--line-2);
  display: grid; place-items: center; font-size: 14px; color: transparent; transition: all 0.12s; }
.item.on .tick { border-color: var(--red); background: var(--red); color: #fff; }
.item .name { flex: 1; font-size: 16px; }
.item.on .name { font-weight: 700; }
.item .qty { width: 96px; flex: none; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 100px; padding: 8px 12px; font-size: 14px; text-align: center; font-family: "IBM Plex Mono", monospace; }
.item .qty:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.item .qty::placeholder { color: var(--faint); }
.item.flash { animation: flash 0.5s ease; }
@keyframes flash { 0% { background: var(--red-soft); } 100% {} }

/* ---------- Shopping ---------- */
.shop .item.checked { opacity: 0.4; }
.shop .item.checked .name { text-decoration: line-through; }
.shop .item .tick { width: 26px; height: 26px; border-radius: 8px; }
.shop .item.checked .tick { border-color: var(--green); background: var(--green); color: #07120b; }
.shop .item .qtytext { font-family: "IBM Plex Mono", monospace; color: var(--red); font-weight: 600; font-size: 14px; }
.tick.pop { animation: pop 0.32s ease; }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* ---------- Progress ---------- */
.progress { margin: 16px 2px 18px; }
.progress .bar { height: 5px; background: var(--bg-2); border-radius: 100px; overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--green); width: 0; transition: width 0.3s; }
.progress .lbl { font-size: 12px; color: var(--mut); margin-bottom: 8px; display: flex; justify-content: space-between;
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.progress .lbl span:last-child { font-family: "IBM Plex Mono", monospace; color: var(--ink); letter-spacing: 0; }

/* ---------- Edit affordances ---------- */
.editbtn { color: var(--faint); background: transparent; border: 0; font-size: 17px; padding: 6px; cursor: pointer; flex: none; transition: color 0.12s; }
.editbtn:active { color: var(--red); }
.cat-add, .add-cat { width: 100%; border: 1px dashed var(--line); background: transparent; color: var(--mut);
  border-radius: 100px; padding: 12px; font-size: 13px; cursor: pointer; margin-top: 8px; transition: all 0.15s; }
.cat-add:hover { border-color: var(--red); color: var(--red); }
.add-cat { margin: 6px 0 40px; }

/* ---------- Empty / FAB / toast ---------- */
.empty { text-align: center; color: var(--mut); padding: 56px 20px; }
.empty .big { font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 30px; color: var(--faint); letter-spacing: -0.02em; }
.fab { position: fixed; left: 0; right: 0; bottom: 0; padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, var(--bg) 64%, transparent); display: flex; gap: 10px; max-width: 720px; margin: 0 auto; z-index: 25; }
.fab .btn { flex: 1; justify-content: center; padding: 15px; font-size: 15px; font-weight: 700; }
.toast { position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%) translateY(8px); background: var(--ink); color: var(--bg);
  padding: 11px 18px; border-radius: 100px; font-size: 13px; font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,0.6);
  opacity: 0; transition: opacity 0.22s, transform 0.22s; pointer-events: none; z-index: 40; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Choreographed reveal (mode switch only) ---------- */
@keyframes navrise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
#app.navin > * { animation: navrise 0.42s cubic-bezier(.2,.7,.2,1) both; }
#app.navin > *:nth-child(1){animation-delay:.02s} #app.navin > *:nth-child(2){animation-delay:.06s}
#app.navin > *:nth-child(3){animation-delay:.10s} #app.navin > *:nth-child(4){animation-delay:.14s}
#app.navin > *:nth-child(5){animation-delay:.17s} #app.navin > *:nth-child(n+6){animation-delay:.20s}

/* ---------- Micro-interactions ---------- */
.modes button, .btn, .jump .chip, .addrow, .editbtn, .item .tick { transition: transform 0.1s ease, background 0.16s, color 0.16s, border-color 0.16s; }
.modes button:active, .btn:active, .addrow:active { transform: scale(0.97); }
.jump .chip:active { transform: scale(0.95); }
.item:active { background: var(--surf); }
.item:active .tick { transform: scale(0.9); }

/* ---------- Staples ---------- */
.staplesbtn { width: 100%; border: 1px dashed var(--lime-deep); background: var(--lime-soft); color: var(--lime);
  border-radius: 100px; padding: 12px; font-size: 14px; font-weight: 600; cursor: pointer; margin: 4px 0 14px;
  font-family: "Bricolage Grotesque", sans-serif; transition: all 0.14s; }
.staplesbtn:active { transform: scale(0.98); }
.staplemark { color: #e5b04a; font-size: 12px; }

/* ---------- Offline / sync chip ---------- */
.syncchip { font-family: "IBM Plex Mono", monospace; font-size: 10px; color: #e5b04a; letter-spacing: 0.08em;
  border: 1px solid #e5b04a55; border-radius: 100px; padding: 6px 10px; white-space: nowrap; }

/* ---------- Undo bar ---------- */
.undobar { position: fixed; bottom: 88px; left: 50%; transform: translateX(-50%); z-index: 45;
  background: var(--ink); color: var(--bg); border-radius: 100px; padding: 10px 12px 10px 18px;
  display: flex; align-items: center; gap: 14px; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6); }
.undobar button { border: 0; background: var(--red); color: #fff; border-radius: 100px; padding: 8px 16px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; cursor: pointer; font-family: "IBM Plex Mono", monospace; }

/* ---------- Trip history ---------- */
.triphist-sub { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--mut); padding: 8px 2px 2px; letter-spacing: 0.04em; }
.triphist-row { display: flex; justify-content: space-between; padding: 9px 2px; border-top: 1px solid var(--line);
  font-size: 13.5px; color: var(--ink); }
.triphist-row .mono { color: var(--lime); font-weight: 600; }

/* ---------- Store bar + aisle order ----------
   The master list is in pantry order; a store is walked in its own order. The
   chips pick which store you're standing in, and the sheet below sets the walk.
   Per-phone, so two people can shop two stores off the same list. */
.storebar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  padding: 2px 0 14px; margin-bottom: 2px; border-bottom: 1px solid var(--line); }
.storechip { background: var(--bg-2); border: 1px solid var(--line); color: var(--mut);
  border-radius: 100px; padding: 8px 15px; font-size: 13.5px; font-weight: 700; cursor: pointer;
  font-family: "Bricolage Grotesque", sans-serif; display: inline-flex; align-items: center; gap: 7px;
  transition: all 0.14s; }
.storechip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.storechip.ghost { font-weight: 600; color: var(--faint); border-style: dashed; }
.storechip.ghost:active { color: var(--red); border-color: var(--red); }
.storechip:active { transform: scale(0.96); }
/* A store whose route has been taught gets a mark — otherwise there's no way
   to tell a set layout from master order, since both just look like a list. */
.storechip .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.storechip.on .dot { background: var(--red); }

.ordersheet-sub { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--faint);
  letter-spacing: 0.04em; padding: 2px 0 10px; }
.orderrow { display: grid; grid-template-columns: 1.6rem 1fr auto auto; gap: 8px;
  align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.orderrow .n { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--faint);
  font-variant-numeric: tabular-nums; }
.orderrow .nm { font-weight: 600; font-size: 15px; }
.ordbtn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--ink); font-size: 15px; cursor: pointer;
  font-family: "IBM Plex Mono", monospace; transition: all 0.12s; }
.ordbtn:active { background: var(--red); border-color: var(--red); color: #fff; transform: scale(0.92); }
.ordbtn[disabled] { color: var(--faint); opacity: 0.4; pointer-events: none; }
