/* B600 Buddy: dark blue-grey theme. Print stays light (the packet). */
:root {
  --bg: #141a23; --card: #1e2733; --card2: #253140; --ink: #e7edf5;
  --muted: #90a2b6; --line: #334357; --accent: #43c6a5;
  --accent-ink: #07231b; --accent-soft: rgba(67, 198, 165, .16);
  --ok: #6fdc8f; --ok-bg: rgba(58, 175, 96, .16);
  --warn: #f2c14e; --warn-bg: rgba(242, 193, 78, .13);
  --error: #f97066; --error-bg: rgba(249, 112, 102, .13);
  --info: #7fb8ff; --info-bg: rgba(127, 184, 255, .12);
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI",
       Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
main { max-width: 30rem; margin: .8rem auto 7rem; padding: 0 .7rem; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .7rem 1.2rem;
  background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-size: 1.25rem; font-weight: 800; color: var(--accent);
  text-decoration: none; letter-spacing: .2px; }
.brand span { color: var(--ink); }
.tagline { color: var(--muted); font-size: .85rem; flex: 1; }
.actor-form { display: flex; gap: .4rem; align-items: center; font-size: .9rem;
  color: var(--muted); }
footer { max-width: 30rem; margin: 2rem auto 8rem; padding: 0 .7rem;
  color: var(--muted); font-size: .8rem; }
a { color: var(--accent); }

.card { background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 1.2rem 1.4rem; margin-bottom: 1rem; }
.card h2 { margin: 0 0 .6rem; font-size: 1.15rem; }
.card h3 { margin: 1rem 0 .4rem; font-size: 1rem; color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }

/* Teaching layer: every screen says what it is and why CRA cares. */
.teach { border: 1px solid var(--line); border-left: 5px solid var(--info);
  background: var(--info-bg); border-radius: 10px; padding: .9rem 1.1rem;
  margin: .9rem 0; font-size: .95rem; }
.teach .tag { display: inline-block; font-size: .72rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase; color: var(--info);
  margin-bottom: .3rem; }
.teach details { margin: .4rem 0 0; }
.teach summary { color: var(--info); font-weight: 650; cursor: pointer; }
.teach p { margin: .35rem 0; }

.check { border-left: 4px solid var(--line); border-radius: 8px;
  padding: .6rem .85rem; margin: .45rem 0; background: var(--card2); }
.check .t { font-weight: 650; }
.check .d { color: var(--muted); font-size: .88rem; margin-top: .15rem; white-space: pre-line; }
.check-ok    { border-color: var(--ok);    background: var(--ok-bg); }
.check-ok .t { color: var(--ok); }
.check-warn  { border-color: var(--warn);  background: var(--warn-bg); }
.check-warn .t { color: var(--warn); }
.check-error { border-color: var(--error); background: var(--error-bg); }
.check-error .t { color: var(--error); }
.check-info  { border-color: var(--info);  background: var(--info-bg); }
.check-info .t { color: var(--info); }

table { border-collapse: collapse; width: 100%; margin: .5rem 0; background: var(--card); }
th, td { border: 1px solid var(--line); padding: .45rem .65rem; text-align: left;
  font-size: .93rem; }
th { background: var(--card2); color: var(--muted); font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; background: var(--card2); }
.muted { color: var(--muted); }

form.inline { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin: .6rem 0; }
label.f { display: flex; flex-direction: column; font-size: .82rem; color: var(--muted); gap: .2rem; }
input, select { padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 8px;
  font-size: 1.1rem; background: #131922; color: var(--ink); }
input::placeholder { color: #5d6f84; }
input:focus, select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
input[readonly] { background: var(--card2); color: var(--muted); }
input[type=number] { width: 8.5rem; }
input[type=file] { font-size: .85rem; background: transparent; border: none; color: var(--muted); }
button, .btn { padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer;
  text-decoration: none; display: inline-block; font-size: 1.05rem; }
button.ghost, .btn.ghost { background: transparent; color: var(--accent); }
button.tiny { padding: .15rem .5rem; font-size: .8rem; }
button.danger { background: transparent; border-color: var(--error); color: var(--error); }
button:disabled { background: var(--card2); border-color: var(--line);
  color: var(--muted); cursor: not-allowed; }
.btn-row { display: flex; gap: .6rem; margin-top: .8rem; flex-wrap: wrap; align-items: center; }

/* Flashes are toasts: they drop in, confirm, and get out of the way. */
.flashes { position: fixed; top: .8rem; left: 50%; transform: translateX(-50%);
  z-index: 100; width: min(92vw, 30rem); pointer-events: none; }
.flash { padding: .75rem 1rem; border-radius: 12px; margin-bottom: .4rem;
  font-size: 1rem; font-weight: 650; text-align: center;
  border: 1px solid var(--line); background: var(--card2); color: var(--ink);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .45); animation: toast-in .22s ease; }
.flash-ok { border-color: var(--ok); color: var(--ok); background: #17251c;
  animation: toast-in .22s ease, toast-out .45s ease 2.2s forwards; }
.flash-warn { border-color: var(--warn); color: var(--warn); background: #2b2415; }
.flash-error { border-color: var(--error); color: var(--error); background: #2d1a18; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px);
  visibility: hidden; } }

.big { font-size: 1.5rem; font-weight: 800; }
.pill { padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.pill-open { background: var(--info-bg); color: var(--info); }
.pill-locked { background: var(--ok-bg); color: var(--ok); }
.help { font-size: .87rem; color: var(--muted); margin: .3rem 0 .6rem; }
pre.email { background: #131922; border: 1px solid var(--line); border-radius: 8px;
  padding: 1rem; white-space: pre-wrap; font-size: .9rem; color: var(--ink); }

/* Big, simple controls: the wizard is used standing at a scale. */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: .9rem; margin: 1rem 0; }
.choice { display: block; padding: 1.4rem 1.5rem; border: 2px solid var(--line);
  border-radius: 16px; background: var(--card2); text-decoration: none;
  color: var(--ink); font-size: 1.2rem; font-weight: 750; text-align: center;
  cursor: pointer; width: 100%; }
.choice:hover { border-color: var(--accent); }
.choice .sub { display: block; font-size: .85rem; font-weight: 500;
  color: var(--muted); margin-top: .4rem; }
.choice.primary { border-color: var(--accent); background: var(--accent);
  color: var(--accent-ink); }
.choice.primary .sub { color: #0b4436; }
.choice.done-choice { border-color: var(--ok); }
.hero-row { display: flex; gap: .8rem; align-items: end; flex-wrap: wrap; margin: .8rem 0; }
.hero-input { font-size: 2.1rem; padding: .8rem 1rem; width: 13rem;
  font-variant-numeric: tabular-nums; }
.hero-add { font-size: 1.35rem; padding: 1rem 1.7rem; }
.hero-preview { font-size: 1.25rem; color: var(--accent); font-weight: 750;
  min-height: 1.7rem; }
.comp-tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin: .8rem 0 1rem; }
.comp-tab { padding: .75rem 1.25rem; border-radius: 999px; border: 2px solid var(--line);
  background: var(--card2); text-decoration: none; color: var(--ink);
  font-weight: 700; font-size: 1.05rem; }
.comp-tab.active { border-color: var(--accent); background: var(--accent);
  color: var(--accent-ink); }
.comp-tab .mini { font-weight: 500; font-size: .8rem; opacity: .85; }
.question { font-size: 1.55rem; font-weight: 800; margin: .2rem 0 .6rem;
  letter-spacing: -.01em; }

/* ---------- The counter: a wizard in the wizard, iOS-calm ---------- */
.counter { max-width: 34rem; margin: 0 auto; }
.counter-bar { display: flex; align-items: center; gap: .6rem; margin: .2rem 0 .9rem; }
.counter-back { text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.counter-title { flex: 1; text-align: center; font-weight: 750; }
.counter-pos { color: var(--muted); font-size: .85rem; }
.seg { display: flex; gap: 4px; background: var(--card2); border: 1px solid var(--line);
  border-radius: 13px; padding: 4px; margin-bottom: 1rem; }
.seg a { flex: 1; text-align: center; padding: .6rem .2rem; border-radius: 10px;
  color: var(--muted); font-weight: 700; font-size: .82rem; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg a.active { background: var(--accent); color: var(--accent-ink); }
.seg a.done { color: var(--ok); }
.counter-card { border-radius: 18px; }
.counter-form { display: flex; flex-direction: column; align-items: stretch; }
.scale-wrap { position: relative; margin: .4rem 0 .2rem; }
.scale-input { width: 100%; font-size: 3rem; text-align: center; padding: 1rem 3rem;
  border-radius: 16px; font-variant-numeric: tabular-nums; }
.scale-unit { position: absolute; right: 1.1rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 1.4rem; font-weight: 700; }
.counter .hero-preview { text-align: center; margin: .35rem 0; }
.density-note { text-align: center; color: var(--muted); font-size: .85rem;
  margin: .1rem 0 .8rem; }
.tally { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .5rem; }
.tally-n { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.tally-sub { color: var(--muted); font-size: .9rem; }
.meter { height: 8px; border-radius: 999px; background: var(--card2);
  border: 1px solid var(--line); overflow: hidden; margin: .4rem 0; }
.meter i { display: block; height: 100%; background: var(--accent);
  border-radius: 999px; transition: width .4s ease; }
.ioslist { border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  background: var(--card); margin-bottom: 1rem; }
.iosrow { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem;
  border-bottom: 1px solid var(--line); }
.iosrow:last-child { border-bottom: none; }
.iosrow-main { flex: 1; font-size: 1.02rem; }
.iosrow-edit { font-weight: 700; text-decoration: none; }
.iosrow form { margin: 0; }
.iosrow.fresh { animation: fresh-in .5s ease; }
@keyframes fresh-in { from { background: var(--accent-soft); } to { background: transparent; } }
.counter-next { margin: 1rem 0 2rem; }
.bulk-form { display: flex; flex-direction: column; align-items: stretch; }
.stepper { display: flex; align-items: center; gap: .7rem; justify-content: center;
  margin: .4rem 0; }
.step-btn { width: 3.4rem; height: 3.4rem; border-radius: 50%; font-size: 1.7rem;
  padding: 0; line-height: 1; background: var(--card2); color: var(--ink);
  border: 1px solid var(--line); flex: none; }
.stepper-n { width: 7rem; font-size: 2.4rem; text-align: center; padding: .6rem;
  border-radius: 14px; font-variant-numeric: tabular-nums; }
.unit-seg { display: flex; gap: 4px; justify-content: center; margin: .4rem auto;
  background: var(--card2); border: 1px solid var(--line); border-radius: 10px;
  padding: 3px; width: fit-content; }
.unit-seg button { padding: .3rem 1.3rem; border-radius: 8px; font-size: .95rem;
  background: transparent; border: none; color: var(--muted); }
.unit-seg button.active { background: var(--accent); color: var(--accent-ink); }
.counter-divider { display: flex; align-items: center; gap: .8rem;
  color: var(--muted); font-size: .85rem; margin: 1rem 0 .6rem; }
.counter-divider::before, .counter-divider::after { content: ""; flex: 1;
  height: 1px; background: var(--line); }

/* Wizard chrome */
.wizard-head { margin-bottom: 1rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .8rem; }
.crumbs a { color: var(--muted); }
.progress { display: flex; align-items: center; gap: .15rem; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: .75rem 1rem; }
.p-step { display: flex; align-items: center; gap: .4rem; }
.p-step a { display: flex; align-items: center; gap: .4rem; text-decoration: none;
  color: inherit; }
.p-dot { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem;
  border-radius: 50%; background: var(--card2); color: var(--muted);
  border: 1px solid var(--line); font-size: .8rem; font-weight: 800; flex: none; }
.p-step.done .p-dot { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.p-step.current .p-dot { background: var(--accent); border-color: var(--accent);
  color: var(--accent-ink); box-shadow: 0 0 0 3px var(--accent-soft); }
.p-name { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.p-step.current .p-name { color: var(--ink); font-weight: 750; }
.p-line { height: 2px; flex: 1 1 .6rem; min-width: .5rem; background: var(--line); }
.p-line.done { background: var(--ok); }
.wizard-title { margin: 1rem 0 .2rem; font-size: 1.4rem; }
.lead { font-size: 1.05rem; color: var(--ink); max-width: 64rem; }
.wizard-nav { display: flex; justify-content: space-between; align-items: center;
  margin: 1.2rem 0 0; padding: 1rem 1.2rem; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; }
button.next, .btn.big-btn { font-size: 1.15rem; padding: .85rem 1.6rem; }
.loc-status { display: flex; gap: .5rem; flex-wrap: wrap; margin: .4rem 0 .8rem; }
.loc-chip { padding: .3rem .7rem; border-radius: 999px; font-size: .82rem; font-weight: 650; }
.loc-chip.in { background: var(--ok-bg); color: var(--ok); }
.loc-chip.waiting { background: var(--warn-bg); color: var(--warn); }
.resume h2 { font-size: 1.05rem; color: var(--muted); }
details { margin: .6rem 0; }
details summary { cursor: pointer; color: var(--accent); font-weight: 650; }
.p-name { display: none; }
.p-step.current .p-name { display: inline; }

/* ---------- One layout: a phone column, on every screen ---------- */
@media (min-width: 1px) {
  main { margin: .6rem auto 6.5rem; padding: 0 .6rem; }  /* room for the fixed nav */
  .topbar { padding: .55rem .8rem; gap: .6rem; }
  .tagline { display: none; }
  .card { padding: .95rem 1rem; }
  .question { font-size: 1.35rem; }
  .lead { font-size: 1rem; }

  /* Forms stack; every control is full-width and thumb-sized. */
  form.inline { flex-direction: column; align-items: stretch; }
  form.inline label.f { width: 100%; font-size: .9rem; }
  form.inline input, form.inline select, input[type=number] { width: 100%; }
  form.inline button { width: 100%; padding: .85rem; font-size: 1.15rem; }
  .hero-row { flex-direction: column; align-items: stretch; }
  .hero-input { width: 100%; font-size: 2.4rem; text-align: center; }
  .hero-add { width: 100%; }
  .hero-preview { text-align: center; }

  /* Component tabs swipe sideways instead of wrapping. */
  .comp-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: .3rem; }
  .comp-tab { flex: none; }

  /* Wide tables scroll inside themselves instead of breaking the page. */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch;
    white-space: nowrap; }
  button.tiny { padding: .55rem .8rem; font-size: .95rem; }

  /* The one action that matters rides fixed at the thumb. */
  .wizard-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    margin: 0; border-radius: 0; border-left: none; border-right: none;
    border-bottom: none; gap: .6rem; padding: .7rem .8rem;
    padding-bottom: calc(.7rem + env(safe-area-inset-bottom)); }
  .wizard-nav form { flex: 1; }
  button.next { width: 100%; }
  .progress { padding: .5rem .6rem; }
  .choice { padding: 1.1rem 1rem; font-size: 1.1rem; }
  .flashes { padding: 0 .6rem; }
  .grid2 { grid-template-columns: 1fr; }
}

/* The packet prints light no matter the screen theme. */
@media print {
  .no-print, .topbar, footer, .btn, button, form, .teach { display: none !important; }
  :root { --card2: #f2f2f2; }
  body { background: #fff; color: #111; }
  main { max-width: none; margin: 0; }
  .card { border: none; padding: 0; background: #fff; color: #111; }
  .card h2, .card h3, .help, .muted { color: #333; }
  table { background: #fff; }
  th, td { border: 1px solid #999; color: #111; }
  th, tr.total td { background: #eee; }
}

/* ---------- Live multi-device: quiet cross-shop presence ---------- */
/* Another device added a line: a soft line that says so and fades itself
   away. Never a blocking toast; it must not steal a mid-count thumb. */
.live-whisper { margin: 0 0 .6rem; padding: .5rem .8rem; border-radius: 10px;
  background: var(--info-bg); border: 1px solid var(--info);
  color: var(--info); font-size: .85rem; font-weight: 650; text-align: center;
  opacity: 0; }
.live-whisper[hidden] { display: none; }
.live-whisper-show { animation: whisper-fade 5s ease forwards; }
@keyframes whisper-fade {
  0% { opacity: 0; transform: translateY(-4px); }
  8% { opacity: 1; transform: none; }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-4px); }
}

/* Mini per-component total inside a counter segment tab. */
.seg-mini { font-weight: 500; opacity: .85; }

/* A tiny connection dot in the corner: green live, amber connecting/down.
   Driven by body[data-live] set from live.js; unobtrusive, never blocks. */
body[data-live]::after { content: ""; position: fixed; right: .55rem;
  top: .55rem; width: .55rem; height: .55rem; border-radius: 50%;
  background: var(--muted); z-index: 60; pointer-events: none;
  box-shadow: 0 0 0 2px var(--bg); }
body[data-live="live"]::after { background: var(--ok); }
body[data-live="connecting"]::after { background: var(--warn); }
body[data-live="down"]::after { background: var(--error); }

/* ---------- Vapeflow brand, login, people ---------- */
.brand { display: inline-flex; align-items: center; gap: .5rem; }
.jelly { display: inline-flex; flex: none; }
.jelly-svg { display: block; width: 100%; height: 100%; }
.jelly-sm { width: 1.7rem; height: 1.7rem; }
.jelly-lg { width: 5rem; height: 5rem; }
.brandword { color: var(--ink); font-weight: 850; letter-spacing: .2px; }
.brandword span { color: var(--accent); }

/* Header identity controls */
.whoami { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.who-person { font-weight: 750; color: var(--ink); font-size: .92rem; }
.shop-switch { padding: .3rem .5rem; font-size: .88rem; border-radius: 8px; }
.who-admin { margin-left: auto; font-weight: 750; color: var(--accent); }
.logout { color: var(--muted); font-size: .84rem; font-weight: 650; text-decoration: none; }
.logout:hover { color: var(--ink); }

/* Login */
.login-wrap { max-width: 23rem; margin: 1.4rem auto; }
.login-hero { text-align: center; margin: 1rem 0 1.4rem; }
.login-title { font-size: 2.2rem; font-weight: 850; margin: .5rem 0 .1rem;
  color: var(--ink); letter-spacing: -.01em; }
.login-title span { color: var(--accent); }
.login-sub { color: var(--muted); margin: 0; }
.login-card .field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.login-card .field > span { font-size: .85rem; color: var(--muted); font-weight: 650; }
.login-card select, .login-card input { width: 100%; }
.login-card .hero-add { width: 100%; }
.login-foot { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 1rem; }

/* Pick-your-name grid */
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: .7rem; margin: 0 0 6rem; }
.name-card { display: flex; flex-direction: column; align-items: center; gap: .55rem;
  padding: 1.05rem .6rem; border-radius: 14px; border: 2px solid var(--line);
  background: var(--card2); color: var(--ink); cursor: pointer; }
.name-card:hover { border-color: var(--accent); }
.avatar { width: 3rem; height: 3rem; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; font-weight: 800;
  font-size: 1.05rem; letter-spacing: .03em; }
.name-label { font-size: .95rem; font-weight: 700; line-height: 1.15; text-align: center; }

/* Per-person attribution chip + weight-primary saved line */
.who-chip { display: inline-block; padding: .05rem .5rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: .72rem;
  font-weight: 750; vertical-align: middle; }
.iosrow-l { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums;
  margin-right: .1rem; }
.counter-back.who-person { color: var(--muted); font-weight: 700; }

/* ---------- Admin = the desktop: wide layout, no phone chrome ---------- */
/* The whole app is phone-first (30rem column, fixed bottom action bar). The
   admin role is the desktop/filing view, so widen it and un-phone the chrome.
   Shop (counting) and the login card stay mobile-first. */
body.view-desktop main { max-width: 64rem; margin: 1.3rem auto 3rem; padding: 0 1.4rem; }
body.view-desktop .topbar { padding: .7rem 1.4rem; gap: 1rem; }
body.view-desktop .tagline { display: inline; }
/* The single Continue button is a phone thumb-bar on mobile; on the desktop it
   is a normal footer bar in the flow, not fixed over the content. */
body.view-desktop .wizard-nav { position: static; margin: 1.4rem 0 0; border-radius: 12px;
  border: 1px solid var(--line); padding: 1rem 1.2rem; padding-bottom: 1rem; }
body.view-desktop button.next { width: auto; }
/* Inline forms return to a row; controls size to their content. */
body.view-desktop form.inline { flex-direction: row; flex-wrap: wrap; align-items: end; }
body.view-desktop form.inline label.f,
body.view-desktop form.inline input,
body.view-desktop form.inline select,
body.view-desktop form.inline button,
body.view-desktop input[type=number] { width: auto; }
/* Two-up where the design allows, and roomier choice tiles. */
body.view-desktop .grid2 { grid-template-columns: 1fr 1fr; }
body.view-desktop .choice-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
/* Tables lay out normally instead of scrolling in a phone strip. */
body.view-desktop table { display: table; white-space: normal; overflow: visible; }
body.view-desktop .comp-tabs { flex-wrap: wrap; overflow: visible; }
