/*
 * Owner app — layout and components on top of theme.css.
 * Tokens (colour, type, space, buttons, inputs) live in theme.css; this file
 * must never redefine them or the two drift apart.
 */

html, body { height: 100%; overscroll-behavior-y: none; }

body {
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ───────────────────────────────── top bar ─────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.property-select {
  flex: 1; min-width: 0;
  appearance: none;
  padding: 9px 32px 9px 12px;
  font: inherit; font-weight: 600;
  color: var(--text);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.icon-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px; flex: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }

/* ─────────────────────────────────── views ─────────────────────────────── */

#main { flex: 1; }
.view { padding: 14px; max-width: 720px; margin: 0 auto; }
.view[hidden] { display: none; }

p.muted { margin: 2px 0 0; font-size: var(--fs-sm); }
.hint { margin: -2px 0 4px; }
.section-label { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }

/* ────────────────────────────────── scanner ────────────────────────────── */

.scanner {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #0b0e11;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
#video { width: 100%; height: 100%; object-fit: cover; display: block; }

.camera-idle {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 10px;
  padding: 24px; text-align: center;
  color: #9aa4b0;
}
.camera-idle p { margin: 0; font-size: 14.5px; max-width: 24ch; }
.big-icon { width: 44px; height: 44px; opacity: .75; }
.scanner.is-live .camera-idle { display: none; }

.reticle { position: absolute; inset: 16% 12%; opacity: 0; transition: opacity .2s; }
.scanner.is-live .reticle { opacity: 1; }
.reticle span { position: absolute; width: 26px; height: 26px; border: 3px solid rgba(255,255,255,.9); border-radius: 4px; }
.reticle span:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.reticle span:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.reticle span:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.reticle span:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }

.scan-status { margin: 12px 2px; min-height: 1.4em; font-size: 14.5px; color: var(--muted); }
.scan-status.is-error { color: var(--danger); }
.scan-status.is-busy::after { content: "…"; }

.scan-actions { display: flex; gap: 8px; }
.scan-actions .btn { flex: 1; justify-content: center; white-space: nowrap; padding-inline: 10px; }

.recent { margin-top: 22px; }
.recent-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.recent-list li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 9px 12px; font-size: 14.5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
.recent-list b { font-weight: 600; }
.recent-list span { color: var(--muted); flex: none; }

/* ─────────────────────────────────── forms ─────────────────────────────── */

.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.stepper { display: grid; grid-template-columns: 44px 1fr 44px; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.stepper button { font-size: 20px; font-weight: 600; color: var(--text); background: var(--surface-2); border: 0; cursor: pointer; }
.stepper button:active { background: var(--accent); color: var(--accent-text); }
.stepper-value { min-width: 0; padding: 11px 4px; font: inherit; font-weight: 700; text-align: center; color: var(--text); background: transparent; border: 0; -moz-appearance: textfield; }
.stepper-value::-webkit-outer-spin-button, .stepper-value::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-value:focus-visible { outline: none; }

.filters { display: grid; gap: 10px; margin-bottom: 14px; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--muted); }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ─────────────────────────────────── lists ─────────────────────────────── */

.list { display: grid; gap: 18px; }
.group-label { margin: 0 2px 7px; font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }

.rows { display: grid; gap: 7px; }

.row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px;
  padding: 11px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.row.is-low { background: var(--warn-bg); border-color: var(--warn-line); }
.row-main { min-width: 0; cursor: pointer; }
.row-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.is-low .row-meta { color: var(--warn-text); }

.row-qty { display: flex; align-items: center; gap: 2px; flex: none; }
.row-qty button {
  width: 34px; height: 34px; font-size: 19px; font-weight: 600;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
}
.row-qty button:active { background: var(--accent); color: var(--accent-text); }
.row-qty output { min-width: 3.2ch; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }

.shop-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.shop-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; }
.shop-row input[type=checkbox] { width: 21px; height: 21px; accent-color: var(--accent); flex: none; }
.shop-row.is-checked .row-name, .shop-row.is-checked .row-meta { opacity: .45; text-decoration: line-through; }
.need { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; color: var(--warn-text); white-space: nowrap; }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 4px; }
/* When an empty state sits above real content it shouldn't dominate the screen. */
.empty.compact { padding: 4px 8px 18px; text-align: left; }

.shop-head .btn { white-space: nowrap; }

/* ─────────────────────────────────── usage ─────────────────────────────── */

.apply-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; padding: 11px 12px 11px 14px;
  font-size: 14px;
  background: var(--warn-bg); color: var(--warn-text);
  border: 1px solid var(--warn-line); border-radius: 12px;
}
.apply-bar[hidden] { display: none; }

.usage-row { grid-template-columns: 1fr auto; }
.rate { font-variant-numeric: tabular-nums; }
.par-change {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--warn-text); background: var(--warn-bg);
  border: 1px solid var(--warn-line); border-radius: 999px;
  white-space: nowrap;
}
.par-change s { opacity: .6; }
.usage-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.link-btn {
  font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--accent); background: none; border: 0; padding: 4px 2px; cursor: pointer;
}
.badge-quiet { background: var(--accent); color: var(--accent-text); }
.turnover-note { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }

/* ────────────────────────────── cleaner view ───────────────────────────── */

body.cleaner { padding-bottom: env(safe-area-inset-bottom); }
.cleaner-title { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.cleaner-title strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cleaner-title small { font-size: 12.5px; }

/* share link row inside the properties sheet */
.prop-list li { flex-wrap: wrap; }
.share-row {
  flex-basis: 100%;
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.share-row code {
  flex: 1; min-width: 0;
  padding: 6px 8px; font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--surface-2); border-radius: 7px; color: var(--muted);
}
.share-row button { color: var(--accent); }

/* ────────────────────────────────── tab bar ────────────────────────────── */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  position: relative;
  display: grid; justify-items: center; gap: 2px;
  height: var(--tabbar-h);
  font: inherit; font-size: 11.5px; font-weight: 600;
  color: var(--muted); background: none; border: 0; cursor: pointer;
  padding-top: 9px;
}
.tab.is-active { color: var(--accent); }
.badge {
  position: absolute; top: 5px; left: 50%; margin-left: 5px;
  min-width: 18px; padding: 0 5px;
  font-size: 11px; font-style: normal; font-weight: 700; line-height: 18px; text-align: center;
  color: var(--accent-text); background: var(--danger); border-radius: 9px;
}

/* ─────────────────────────────── sheets / dialogs ──────────────────────── */

.sheet {
  width: min(560px, 100%);
  margin: auto auto 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  color: var(--text); background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  max-height: 92dvh;
}
@media (min-width: 600px) {
  .sheet { margin: auto; border-radius: 18px; }
}
.sheet::backdrop { background: rgba(0, 0, 0, .5); }
.sheet form, .sheet { overflow: visible; }
.sheet form { display: grid; gap: 13px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { margin: 0; font-size: 18px; }
.sheet-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.spacer { flex: 1; }

.origin {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; font-size: 13.5px;
  background: var(--surface-2); border-radius: 10px; color: var(--muted);
}
.origin img { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; background: #fff; flex: none; }
.origin b { color: var(--text); font-weight: 600; }

.prop-list { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 7px; max-height: 46dvh; overflow-y: auto; }
.prop-list li { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.prop-list span { flex: 1; font-weight: 600; }
.prop-list button { color: var(--danger); background: none; border: 0; font: inherit; font-size: 13.5px; cursor: pointer; }
.prop-add { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* ──────────────────────────────────── toast ────────────────────────────── */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px);
  transform: translateX(-50%);
  z-index: 40; max-width: min(92vw, 420px);
  padding: 11px 16px; font-size: 14.5px; font-weight: 500;
  color: var(--accent-text); background: var(--text);
  border-radius: 11px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.toast[hidden] { display: none; }
.toast.is-error { background: var(--danger); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ────────────────────────────── passcode gate ──────────────────────────── */

.sheet-center { margin: auto; border-radius: 18px; max-width: min(420px, 92vw); }
.lock-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.lock-head img { border-radius: 9px; flex: none; }
.lock-head h2 { margin: 0 0 2px; font-size: 18px; }
.lock-head .hint { margin: 0; }
.login-error { margin: -4px 0 0; font-size: 13.5px; font-weight: 500; color: var(--danger); }
.login-error[hidden] { display: none; }
#login-form { display: grid; gap: 13px; }
#login-form .btn { justify-content: center; }
.lock-row { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.lock-row .btn { width: 100%; justify-content: center; }
.lock-row[hidden] { display: none; }

/* ──────────────────────────────── accounts ─────────────────────────────── */

.auth-switch { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.auth-switch .link-btn { padding: 0; }
.auth-note { margin: -2px 0 0; padding: 9px 11px; font-size: 13.5px; color: var(--warn-text); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 9px; }
.auth-note[hidden] { display: none; }

.account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.account-who { display: grid; min-width: 0; line-height: 1.3; }
.account-who strong { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-who small { font-size: 12.5px; }
.account-actions { display: flex; align-items: center; gap: 12px; flex: none; }

/* ─────────────────────────── consolidated shopping ─────────────────────── */

.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 3px; margin: -4px 0 14px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px;
}
.segmented button {
  padding: 8px 10px;
  font: inherit; font-size: 14px; font-weight: 600;
  color: var(--muted); background: none; border: 0; border-radius: 8px; cursor: pointer;
}
.segmented button.is-on { color: var(--text); background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* Where each unit's share goes when you unpack. */
.split { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 5px; }
.split span {
  font-size: 12.5px; font-variant-numeric: tabular-nums;
  padding: 2px 7px; border-radius: 999px;
  color: var(--warn-text); background: var(--warn-bg); border: 1px solid var(--warn-line);
}
.split b { font-weight: 700; }

.putaway-bar {
  position: sticky; bottom: 8px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px; padding: 11px 12px 11px 14px;
  font-size: 14px; font-weight: 500;
  color: var(--accent-text); background: var(--text);
  border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.22);
}
.putaway-bar .btn-primary { background: var(--accent); color: var(--accent-text); }

/* ────────────────────────────────── staff view ─────────────────────────── */

body.staff { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.staff-lede { margin: -2px 0 14px; font-size: 14.5px; color: var(--muted); }

.staff-row { grid-template-columns: 1fr auto; }
.staff-row.is-taken { background: var(--warn-bg); border-color: var(--warn-line); }
.staff-main {
  display: block; width: 100%; min-width: 0;
  padding: 0; text-align: left;
  font: inherit; color: inherit; background: none; border: 0; cursor: pointer;
}
.staff-side { flex: none; }

/* Deliberately large: this is tapped standing up, one-handed, holding things. */
.took-add, .took-badge {
  min-width: 76px; padding: 11px 14px;
  font: inherit; font-size: 15px; font-weight: 700;
  border-radius: 10px; cursor: pointer;
}
.took-add { color: var(--accent-text); background: var(--accent); border: 0; }
.took-badge {
  color: var(--warn-text); background: var(--surface);
  border: 1px solid var(--warn-line);
  font-variant-numeric: tabular-nums;
}
.took-add:active, .took-badge:active { transform: translateY(1px); }

.quick-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 4px; }
.quick {
  padding: 16px 0;
  font: inherit; font-size: 19px; font-weight: 700;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 11px; cursor: pointer;
}
.quick:active { background: var(--accent); color: var(--accent-text); }

.staff-basket { position: fixed; left: 14px; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); margin: 0; }
.basket-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.link-btn.on-dark { color: var(--accent); }

/* ──────────────────────────── staff management (owner) ─────────────────── */

.staff-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; }
.staff-list li { padding: 11px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; }
.staff-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.staff-top strong { font-size: 15px; }
.staff-props { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.staff-props label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
}
.staff-props input { accent-color: var(--accent); }
.staff-empty { margin: 10px 0; font-size: 14px; color: var(--muted); }
.sheet-form { display: grid; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.sheet-form .btn { justify-content: center; }

/* ─────────────────────────────── marketing page ────────────────────────── */

body.marketing { padding-bottom: 0; display: block; }
.site-head, .site-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1040px; margin: 0 auto; padding: 18px 20px;
}
.site-foot { border-top: 1px solid var(--line); margin-top: 48px; color: var(--muted); font-size: 14px; }
.site-foot a { color: var(--accent); }
.brand { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; font-size: 17px; }
.brand img { border-radius: 7px; }

.page { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.hero { padding: 28px 0 8px; max-width: 62ch; }
.hero h1 { margin: 0 0 12px; font-size: clamp(28px, 6vw, 40px); line-height: 1.12; letter-spacing: -0.02em; }
.lede { margin: 0; font-size: 17px; line-height: 1.5; color: var(--muted); }
.trial-line { margin: 14px 0 0; font-size: 14.5px; font-weight: 600; color: var(--accent); }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  margin: 28px 0 18px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  font-weight: 600;
}
.stepper-inline { width: 150px; }

.plan-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.plan-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 20px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.plan-card.is-best { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-card.is-out { opacity: .55; }
.plan-card h2 { margin: 0; font-size: 17px; }
.plan-price { margin: 0; font-size: 15px; color: var(--muted); }
.plan-price strong { font-size: 30px; color: var(--text); letter-spacing: -0.02em; }
.plan-tagline { margin: 0; font-size: 14px; color: var(--muted); }
.plan-features { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.plan-note { margin: 0; font-size: 13px; color: var(--muted); }
.plan-card .btn { margin-top: auto; justify-content: center; text-decoration: none; }
.plan-flag {
  position: absolute; top: -10px; left: 16px;
  padding: 3px 9px; font-size: 12px; font-weight: 700;
  color: var(--accent-text); background: var(--accent); border-radius: 999px;
}

.faq { margin-top: 44px; max-width: 66ch; }
.faq h2 { font-size: 21px; margin: 0 0 4px; }
.faq h3 { font-size: 15.5px; margin: 22px 0 4px; }
.faq p { margin: 0; color: var(--muted); line-height: 1.55; }

/* ───────────────────────────── plan & billing (app) ────────────────────── */

.plan-current { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.plan-current strong { font-size: 19px; }
.plan-current .muted { margin: 0; }
.plan-usage { display: grid; gap: 8px; margin: 14px 0 4px; }
.usage-line { display: grid; gap: 5px; }
.usage-line span { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); }
.meter { height: 7px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); }
.meter.is-full i { background: var(--danger); }
.plan-options { display: grid; gap: 8px; margin-top: 14px; }
.plan-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; text-align: left;
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.plan-option.is-current { border-color: var(--accent); cursor: default; }
.plan-option b { display: block; font-size: 15px; }
.plan-option small { color: var(--muted); font-size: 13px; }
.plan-option .price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.trial-banner {
  margin: 10px 0 0; padding: 9px 11px; font-size: 13.5px;
  color: var(--warn-text); background: var(--warn-bg);
  border: 1px solid var(--warn-line); border-radius: 9px;
}

/* ───────────────────────────── starter library ─────────────────────────── */

.closet-actions { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.closet-actions .btn svg { width: 16px; height: 16px; }

.lib-intro { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); }

.lib-list {
  display: grid; gap: 16px;
  max-height: 50dvh; overflow-y: auto;
  /* Room for the focus ring on the first checkbox, which the scroll box clips. */
  padding: 2px;
}
.lib-group h3 {
  margin: 0 0 4px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.lib-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px; align-items: center;
  padding: 9px 2px; cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.lib-group .lib-row:last-child { border-bottom: 0; }
.lib-row.is-owned { opacity: .5; cursor: default; }
.lib-name { min-width: 0; font-size: 14.5px; }
.lib-name small { color: var(--muted); font-weight: 500; }
.lib-have { display: block; font-size: 11.5px; font-style: normal; color: var(--muted); }
.lib-qty { width: 66px; padding: 7px 6px; text-align: center; font-variant-numeric: tabular-nums; }
.lib-qty:disabled { opacity: .4; }
.lib-par {
  min-width: 5ch; font-size: 12px; text-align: right;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.lib-empty { padding: 22px 0; font-size: 14px; text-align: center; color: var(--muted); }

/* ──────────────────── desktop: tab bar becomes a sidebar ───────────────── */

/*
 * Only the owner app has a .tabbar, and it is the one page with a bare <body>,
 * so scoping on the body classes keeps the staff, cleaner and marketing pages
 * on their own layouts untouched.
 *
 * Grid areas rather than flex ordering: the nav is last in the DOM (correct for
 * a phone, where it reads after the content) but needs to be the left column on
 * a desktop, and named areas move it there without touching the markup.
 */
@media (min-width: 900px) {
  body:not(.staff):not(.cleaner):not(.marketing) {
    display: grid;
    grid-template-columns: 228px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "nav topbar" "nav main";
    min-height: 100dvh;
    padding-bottom: 0;
  }

  .topbar { grid-area: topbar; }
  #main   { grid-area: main; }

  .tabbar {
    grid-area: nav;
    position: sticky; top: 0; align-self: start;
    display: flex; flex-direction: column; gap: 3px;
    height: 100dvh; padding: 14px 12px;
    border-top: 0; border-right: 1px solid var(--line);
  }
  .tab {
    height: auto; padding: 11px 13px;
    grid-auto-flow: column; grid-auto-columns: auto 1fr;
    justify-items: start; align-items: center; gap: 12px;
    font-size: 14.5px; border-radius: 10px;
  }
  .tab.is-active { background: var(--surface-2); }
  .tab .badge { position: static; margin-left: auto; }

  /* Only the owner app earns the wide column; the cleaner screen is a single
     list of tap targets and reads badly stretched across a laptop. */
  body:not(.staff):not(.cleaner) .view { max-width: 1000px; padding: 24px 28px 40px; }
  body.staff .view, body.cleaner .view { max-width: 620px; padding: 24px 20px 40px; }
  .lib-list { max-height: 56dvh; }
}

@media (min-width: 900px) {
  /* .sheet sets an explicit `width`, so widening this one needs `width` too —
     a max-width can't expand a fixed width. The picker is a long list of short
     rows and reads much better with the extra room. */
  #library-dialog { width: min(720px, 92vw); }
}

/* ─────────────────── desktop refinements for the owner app ─────────────── */

@media (min-width: 900px) {
  /*
   * The scanner is 4:3, so a 1000px column makes it 750px tall — most of a
   * laptop screen for a viewfinder nobody uses at a desk. Cap it and let the
   * controls sit beside the frame instead of below it.
   */
  .scanner { max-width: 560px; margin: 0 auto; }
  .scan-status { max-width: 560px; margin-inline: auto; text-align: center; }
  .scan-actions { max-width: 560px; margin-inline: auto; }
  .recent { max-width: 560px; margin-inline: auto; }

  .filters {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .closet-actions { margin-top: -46px; }        /* sit level with the filters */
}

/* Team list rows carry a role chip, so the name must not push it off the row. */
.staff-top { display: flex; align-items: center; gap: 8px; }
.staff-top strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-top .badge-pill { flex: none; }
.staff-top .link-btn { margin-left: auto; flex: none; }
