/* BetaWave Inventory count: Operate surface for one hand on a phone in an aisle.
   Inherits the yellow bar and ink. The hit card is the signature: one big number you can read at arm's length. */

body { background: var(--concrete); padding-bottom: env(safe-area-inset-bottom); }

.cbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 8px max(16px, env(safe-area-inset-left));
  background: var(--yellow); border-bottom: 3px solid var(--ink);
}
.brand { font-family: var(--display); font-weight: 900; font-size: 26px; letter-spacing: 0.02em; line-height: 1; text-decoration: none; }
.cbar-title {
  font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: 0.08em;
  padding: 2px 8px 1px; background: var(--ink); color: var(--yellow); border-radius: 3px;
}
.cbar-link { margin-left: auto; font-weight: 650; color: var(--on-yellow-2); }

.setup, .counting { max-width: 640px; margin: 0 auto; padding: 16px 16px 48px; }

.card {
  background: var(--paper); border-radius: 10px; padding: 16px;
  box-shadow: 0 1px 2px rgba(17, 17, 17, 0.08), 0 4px 14px rgba(17, 17, 17, 0.05);
  margin-top: 14px;
}
.card h2, .list-head h2 {
  margin: 0 0 6px; font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1; text-transform: uppercase;
}
.card-quiet { background: transparent; box-shadow: none; border: 2px dashed var(--concrete-2); }
.card-quiet .btn { margin-top: 12px; }
.muted { color: #5b6066; margin: 0; font-size: 14px; }
.hint { color: #5b6066; font-size: 13px; margin: 10px 0 0; }

.setup-h { margin: 8px 0 6px; font-family: var(--display); font-weight: 900; font-size: clamp(34px, 9vw, 48px); line-height: 0.95; text-transform: uppercase; }
.setup-sub { margin: 0; color: var(--ink-2); max-width: 56ch; }
#paste {
  width: 100%; margin-top: 10px; min-height: 120px; resize: vertical; padding: 10px 12px;
  font-family: var(--mono); font-size: 13px;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--paper);
}
.setup-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.setup-actions .btn[for] { cursor: pointer; }
.import-error { margin: 8px 0 0; color: var(--danger); font-weight: 600; }
.from-app { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--concrete); }
.linkish { padding: 0; border: 0; background: none; font-weight: 650; text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }

/* Camera */
.cam {
  position: relative; overflow: hidden; margin: -16px -16px 12px;
  aspect-ratio: 4 / 3; max-height: 46vh; background: #000;
}
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-frame {
  position: absolute; inset: 18% 10%;
  border: 3px solid var(--yellow); border-radius: 8px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
}
.cam-line { position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: #ff3b30; }
.cam.got .cam-frame { animation: got 420ms var(--ease-out); }
@keyframes got { 0% { border-color: #3ad06b; transform: scale(1.03); } 100% { border-color: var(--yellow); transform: none; } }
.cam-tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 8px; }
.cam-btn {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(17, 17, 17, 0.7); color: #fff; cursor: pointer;
}
.cam-btn svg { width: 22px; height: 22px; }
.cam-btn[aria-pressed="true"] { background: var(--yellow); color: var(--ink); }
.cam-state {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 8px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); color: #fff; font-weight: 650; text-align: center;
}

/* Scan bar */
.scanbar { display: flex; gap: 8px; }
.scanbar input {
  flex: 1; min-width: 0; min-height: 48px; padding: 8px 12px;
  font-family: var(--mono); font-size: 17px;
  border: 2px solid var(--ink); border-radius: var(--radius); background: var(--paper);
}
.scanbar .btn { min-height: 48px; }
.cam-toggle svg, .btn svg { width: 20px; height: 20px; }
.cam-note { margin: 8px 0 0; font-size: 13.5px; color: var(--ink-2); }

/* The hit card */
.hit {
  margin-top: 12px; padding: 16px; border-radius: 10px;
  background: var(--paper); border: 3px solid var(--ink);
}
.hit[data-state="match"] { border-color: var(--ok); }
.hit[data-state="off"] { border-color: #b26b00; }
.hit[data-state="unknown"] { border-color: var(--danger); background: var(--danger-soft); }
.hit.flash { animation: hitflash 500ms var(--ease-out); }
@keyframes hitflash { 0% { background: var(--yellow-soft); } 100% { background: var(--paper); } }
.hit[data-state="unknown"].flash { animation: none; }
.hit-prompt { margin: 0 0 4px; font-family: var(--display); font-weight: 800; font-size: 28px; text-transform: uppercase; line-height: 1; }
.hit-flag { margin: 0; font-weight: 750; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.hit[data-state="unknown"] .hit-flag { color: var(--danger); }
.hit-name { margin: 2px 0; font-size: 21px; line-height: 1.2; overflow-wrap: anywhere; }
.hit-meta { margin: 0; color: #5b6066; font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.hit-count { display: grid; grid-template-columns: 64px 1fr 64px; gap: 10px; align-items: center; margin-top: 12px; }
.step {
  height: 64px; border: 2px solid var(--ink); border-radius: var(--radius); background: var(--paper);
  font-size: 34px; font-weight: 700; line-height: 1; cursor: pointer; touch-action: manipulation;
}
.step:active { background: var(--yellow); }
.step[aria-disabled="true"] { opacity: 0.35; cursor: default; }
.hit-n {
  width: 100%; height: 64px; text-align: center; padding: 0;
  font-family: var(--display); font-weight: 900; font-size: 52px; line-height: 1;
  border: 0; border-bottom: 3px solid var(--ink); border-radius: 0; background: transparent;
  -moz-appearance: textfield; appearance: textfield;
}
.hit-n::-webkit-inner-spin-button, .hit-n::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.hit-var { margin: 10px 0 0; font-weight: 700; text-align: center; min-height: 1.5em; }
.hit[data-state="match"] .hit-var { color: var(--ok); }
.hit[data-state="off"] .hit-var { color: #8a5300; }

.tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.per { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; }
.per input { width: 76px; min-height: 40px; padding: 4px 8px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--paper); }

/* Tally */
.tally { margin-top: 14px; }
.tally-main { margin: 0 0 6px; font-weight: 600; }
.t-short { color: #8a5300; }
.t-over { color: #0b5aa8; }
.tally-bar { height: 8px; background: var(--concrete-2); border-radius: 4px; overflow: hidden; }
.tally-bar span { display: block; height: 100%; width: 0; background: var(--ink); transition: width 200ms var(--ease-out); }

/* List */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list-head h2 { margin: 0; }
.list-head input { width: 46%; min-height: 40px; padding: 6px 10px; border: 1.5px solid var(--line); border-radius: var(--radius); }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 12px -16px 4px; padding: 0 16px 4px; scrollbar-width: none; }
.tab {
  flex: none; min-height: 36px; padding: 0 12px; border-radius: 18px;
  border: 1.5px solid var(--line); background: var(--paper); font-weight: 650; font-size: 14px; cursor: pointer;
}
.tab b { font-variant-numeric: tabular-nums; color: #5b6066; margin-left: 2px; }
.tab[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--yellow); }
.tab[aria-pressed="true"] b { color: var(--yellow-soft); }
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: 1fr auto 76px; gap: 10px; align-items: center;
  width: 100%; min-height: 56px; padding: 8px 4px; text-align: left;
  border: 0; border-bottom: 1px solid var(--concrete); background: none; cursor: pointer;
}
.row:hover { background: #fafaf7; }
.row[aria-current="true"] { background: var(--yellow-soft); }
.row-text { min-width: 0; display: grid; }
.row-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: 13px; color: #5b6066; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-n { font-family: var(--display); font-weight: 800; font-size: 24px; text-align: right; }
.row-n small { font-family: var(--sans); font-weight: 600; font-size: 13px; color: #5b6066; }
.row-var { font-size: 13px; font-weight: 700; text-align: right; }
.row[data-state="todo"] .row-n { color: #8d9297; }
.row[data-state="match"] .row-var { color: var(--ok); }
.row[data-state="off"] .row-var { color: #8a5300; }
.row[data-state="unknown"] .row-meta { color: var(--danger); font-weight: 650; }
.rows-empty { padding: 18px 4px; color: #5b6066; }
.rows-more { margin-top: 10px; }

.finish .check { display: flex; gap: 10px; align-items: center; min-height: 40px; font-weight: 600; }
.finish .check input { width: 20px; height: 20px; accent-color: var(--ink); }
.danger { color: var(--danger); }

@media (min-width: 700px) {
  .cam { margin: 0 0 12px; border-radius: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .hit.flash, .cam.got .cam-frame { animation: none; }
  .tally-bar span { transition: none; }
}

.brand { display: inline-flex; align-items: center; }
.brand-mark { width: 0.86em; height: 0.86em; flex: none; margin-right: 0.32em; }
