/* JTTS Inventory — the catalog's white, black and logo red.
   Layout: one dense row per product (thumb · ID · brand · name · variation chips · total);
   on phones each row becomes two lines (product, then chips). */
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: italic; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-condensed-latin-700-italic.woff2") format("woff2"); }

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --soft: #f4f4f3;
  --line: #e4e3e1;
  --ink: #111111;
  --ink-2: #3a3a3a;
  --muted: #6b6a68;
  --on-ink: #ffffff;
  --red: #e1251b;
  --red-dark: #b81a12;
  --red-soft: #fdeceb;
  --out-bg: #fde8e6;
  --out-line: #f1a39d;
  --out-ink: #b0170f;
  --low-bg: #fff4c7;
  --low-line: #e9c84a;
  --low-ink: #7a5800;
  --pos: #1c7a3c;
  --pending: #1d4ed8;
  --pending-bg: #e8eefc;
  --shadow: 0 10px 30px rgba(17, 17, 17, .12);
  --shadow-up: 0 -6px 20px rgba(17, 17, 17, .08);
  --radius: 10px;
  --topbar-h: 56px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  /* One light look on every device (also when the phone is in dark mode). */
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.4 var(--font);
}
body.has-pending { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
  min-height: 42px; padding: 0 16px;
  border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--ink-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); border-color: var(--red-dark); }
.btn-dark { background: var(--red); border-color: var(--red); color: #fff; }
.btn-dark:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-block { width: 100%; }
.link-btn { border: 0; background: none; padding: 0 2px; color: var(--red); font-weight: 600; text-decoration: underline; cursor: pointer; font-size: 13px; }

/* ---------- Sign in ---------- */
.signin {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 32px 16px;
}
.signin-logo { width: 140px; height: auto; }
.signin-title { margin: 6px 0 0; font: italic 700 34px/1 var(--font-head); text-transform: uppercase; letter-spacing: .02em; }
.signin-store { margin: 0 0 20px; color: var(--muted); }
.signin-form { width: 100%; max-width: 360px; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.field input, .field textarea {
  width: 100%; padding: 10px 12px; font-size: 16px; font-weight: 400;
  border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface);
}
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--ink); }
.demo-role { margin: 0; padding: 10px 12px; border: 1.5px dashed var(--low-line); border-radius: 8px; background: var(--low-bg); display: flex; flex-wrap: wrap; gap: 6px 16px; }
.demo-role legend { padding: 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--low-ink); }
.demo-role label { display: flex; align-items: center; gap: 6px; }
.form-error { margin: 0; color: var(--out-ink); font-weight: 600; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(17, 17, 17, .02);
}
.topbar-logo { height: 36px; width: auto; }
.topbar-title {
  font: italic 700 20px/1 var(--font-head);
  letter-spacing: .03em; text-transform: uppercase;
  border-left: 2px solid var(--ink); padding-left: 12px;
}
.view-toggle { margin-left: auto; display: flex; gap: 2px; padding: 3px; background: var(--soft); border-radius: 999px; }
.view-toggle a { padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; text-decoration: none; color: var(--muted); }
.view-toggle a[aria-current] { background: var(--surface); color: var(--red); box-shadow: 0 1px 3px rgba(17, 17, 17, .15); }
.user { position: relative; }
.user-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--red); color: #fff; font-weight: 700; cursor: pointer; display: grid; place-items: center; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  width: 230px; padding: 10px; display: grid; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.user-name { margin: 0; font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.user-role { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.user-menu button { text-align: left; padding: 9px 8px; border: 0; border-radius: 6px; background: none; cursor: pointer; }
.user-menu button:hover { background: var(--soft); }
@media (max-width: 480px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar-title { display: none; }
}

.proto-note {
  margin: 10px 16px 0; padding: 7px 12px;
  background: var(--low-bg); border: 1px solid var(--low-line); border-radius: 8px;
  color: var(--low-ink); font-size: 13px;
}

/* ---------- Summary + filters ---------- */
.controls {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h)); z-index: 20;
  background: var(--bg);
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  display: grid; gap: 10px;
}
@media (min-width: 900px) {
  .controls { grid-template-columns: auto 1fr; align-items: center; gap: 20px; }
}
/* Phones: the summary and filters scroll away so the list gets the screen. */
@media (max-width: 760px) {
  .controls { position: static; gap: 8px; }
}
.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 6px 10px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface);
  text-align: left;
}
button.stat { cursor: pointer; }
.stat-n { font: 700 22px/1 var(--font-head); font-variant-numeric: tabular-nums; }
.stat-l { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-out { background: var(--out-bg); border-color: var(--out-line); }
.stat-out .stat-n, .stat-out .stat-l { color: var(--out-ink); }
.stat-low { background: var(--low-bg); border-color: var(--low-line); }
.stat-low .stat-n, .stat-low .stat-l { color: var(--low-ink); }
@media (min-width: 900px) { .stat { min-width: 120px; } }

.filters { display: grid; gap: 8px; min-width: 0; }
@media (min-width: 900px) { .filters { grid-template-columns: minmax(200px, 1fr) auto; } }
.search {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  height: 40px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--soft);
}
.search svg { color: var(--muted); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; }
.search:focus-within { box-shadow: 0 0 0 3px var(--red-soft); border-color: var(--red); background: var(--surface); }
.filter-row { display: flex; gap: 8px; min-width: 0; }
.select { flex: 1 1 0; min-width: 0; }
.select select {
  width: 100%; height: 40px; padding: 0 24px 0 12px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 14px; font-weight: 600; text-overflow: ellipsis;
}
.toggle {
  flex: none; display: flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 12px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.toggle-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--muted); }
.toggle[aria-pressed="true"] { background: var(--red-soft); border-color: var(--red); color: var(--red-dark); }
.toggle[aria-pressed="true"] .toggle-dot { background: var(--red); border-color: var(--red); }
.t-short { display: none; }
@media (max-width: 480px) {
  .t-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .t-short { display: inline; }
}
@media (max-width: 340px) {
  .filter-row { flex-wrap: wrap; }
  .toggle { flex: 1 1 100%; justify-content: center; }
}

/* ---------- Groups ---------- */
.groups { padding: 6px 16px 24px; }
.status { padding: 32px 0; text-align: center; color: var(--muted); }
.group { border-bottom: 1px solid var(--line); }
.group-head {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 14px 0 10px; border: 0; background: none; cursor: pointer; text-align: left;
}
.group-title { font: italic 700 22px/1 var(--font-head); text-transform: uppercase; letter-spacing: .02em; }
.group-head::before { content: ""; width: 14px; height: 14px; background: var(--red); transform: skewX(-12deg); flex: none; }
.group-archived .group-head::before { background: var(--muted); }
.group-meta { color: var(--muted); font-size: 13px; font-weight: 600; }
.chev { margin-left: auto; transition: transform .15s; }
.group-head[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.group-empty { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }

/* ---------- Product rows ---------- */
.table { padding-bottom: 8px; }
.row {
  display: grid;
  grid-template-columns: 40px 64px 92px minmax(150px, 230px) minmax(0, 1fr) 48px;
  align-items: center; gap: 4px 12px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.row:not(.row-head):hover { background: #fafafa; }
.row-head { border-top: 0; padding: 0 0 4px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.thumb { width: 40px; height: 40px; border-radius: 6px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.cell-id { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.cell-brand { font-size: 13px; color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; }
.cell-name { font-weight: 700; min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
.cell-chips { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.cell-total { font: 700 20px/1 var(--font-head); }
.cell-total.is-changed { color: var(--pending); }
.total-l { display: none; }
.is-archived .cell-name, .is-archived .cell-brand { color: var(--muted); }

@media (max-width: 760px) {
  .row-head { display: none; }
  .row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-areas: "thumb name total" "chips chips chips";
    gap: 6px 10px; padding: 8px 0;
  }
  .thumb { grid-area: thumb; width: 40px; height: 40px; }
  .thumb:empty { height: 0; width: 0; }
  .row:has(.thumb:empty) { grid-template-columns: 0 minmax(0, 1fr) auto; column-gap: 0; }
  .row:has(.thumb:empty) .cell-name { padding-right: 10px; }
  .cell-id, .cell-brand { display: none; }
  .cell-name { grid-area: name; }
  .cell-name::before {
    content: attr(data-meta); display: block;
    font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 1px;
  }
  .cell-chips { grid-area: chips; }
  .cell-total { grid-area: total; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
  .total-l { display: block; font: 600 10px/1 var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
}

/* ---------- Variation chips ---------- */
.chip {
  display: inline-flex; align-items: stretch;
  min-height: 30px; padding: 0; overflow: hidden;
  border: 1.5px solid var(--line); border-radius: 6px; background: var(--surface);
  font-size: 13px; cursor: pointer; line-height: 1;
}
.chip-l { display: flex; align-items: center; padding: 0 6px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.chip-n {
  display: flex; align-items: center; gap: 3px; justify-content: center;
  min-width: 24px; padding: 0 6px;
  background: var(--soft); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink);
}
.chip-was { font-weight: 500; color: var(--muted); font-size: 12px; }
.chip:hover { border-color: var(--ink); }
.chip-out { border-color: var(--out-line); background: var(--out-bg); }
.chip-out .chip-l { color: var(--out-ink); }
.chip-out .chip-n { background: var(--red); color: #fff; }
.chip-out .chip-was { color: rgba(255, 255, 255, .8); }
.chip-low { border-color: var(--low-line); background: var(--low-bg); }
.chip-low .chip-l { color: var(--low-ink); }
.chip-low .chip-n { background: var(--low-line); color: #2b2000; }
.chip.is-pending { border: 2px solid var(--pending); box-shadow: 0 0 0 2px var(--pending-bg); }
.chip.is-archived { border-style: dashed; opacity: .7; }
.chip.is-dim { opacity: .35; }

/* ---------- Bottom sheets (editor, confirm) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .45); }
.sheet {
  position: fixed; z-index: 60; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(440px, 100%); max-height: 88vh; overflow: auto;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-radius: 16px 16px 0 0; box-shadow: var(--shadow);
  display: grid; gap: 14px;
}
.sheet-wide { width: min(600px, 100%); }
@media (min-width: 761px) {
  .sheet { bottom: auto; top: 50%; transform: translate(-50%, -50%); border-radius: 16px; padding-bottom: 18px; }
}
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-eyebrow { margin: 0; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.sheet-title { margin: 0; font: italic 700 24px/1.1 var(--font-head); text-transform: uppercase; text-wrap: balance; }
.close-btn { width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; background: var(--soft); font-size: 22px; line-height: 1; cursor: pointer; }
.variant-pill { display: inline-block; margin: 0; padding: 2px 8px; border-radius: 5px; background: var(--soft); border: 1px solid var(--line); color: var(--ink); font-weight: 700; font-size: 13px; white-space: nowrap; justify-self: start; }
.stepper { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 10px; }
.step {
  height: 64px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
  font: 700 26px/1 var(--font-head); cursor: pointer;
}
.step:hover:not(:disabled) { border-color: var(--ink-2); }
.step:active:not(:disabled) { background: var(--red-soft); border-color: var(--red); color: var(--red-dark); }
.step:disabled { opacity: .35; cursor: default; }
.step-input {
  width: 100%; height: 64px; text-align: center;
  border: 2px solid var(--line); border-radius: 12px; background: var(--soft);
  font: 700 34px/1 var(--font-head); font-variant-numeric: tabular-nums;
}
.step-input:focus { outline: 0; border-color: var(--red); }
.editor-saved { margin: -4px 0 0; color: var(--muted); font-size: 14px; text-align: center; }
.editor-saved strong { color: var(--pending); }
.threshold { padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.threshold label { font-weight: 700; font-size: 14px; }
.threshold-row { display: flex; gap: 8px; }
.threshold-row input { width: 90px; padding: 8px 10px; font-size: 16px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); }
.hint { margin: 0; color: var(--muted); font-size: 13px; }
.hint:empty { display: none; }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.sheet-actions .btn { flex: 1 1 0; }

.change-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-height: 36vh; overflow: auto; border-top: 1px solid var(--line); }
.change-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.cl-name { min-width: 0; overflow-wrap: anywhere; }
.cl-id { color: var(--muted); font-size: 12px; font-weight: 700; }
.cl-change { white-space: nowrap; }
.neg { color: var(--out-ink); font-weight: 700; }
.pos { color: var(--pos); font-weight: 700; }
@media (max-width: 420px) {
  .change-list li { grid-template-columns: auto minmax(0, 1fr); }
  .cl-name { grid-column: 1 / -1; }
  .cl-change { justify-self: end; }
}
.reasons { margin: 0 0 12px; padding: 0; border: 0; }
.reasons legend { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.reason-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.reason { position: relative; }
.reason input { position: absolute; opacity: 0; inset: 0; }
.reason span {
  display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 4px 8px;
  border: 1.5px solid var(--line); border-radius: 10px; font-weight: 600; text-align: center; cursor: pointer;
}
.reason input:checked + span { border-color: var(--red); background: var(--red-soft); color: var(--red-dark); box-shadow: inset 0 0 0 1px var(--red); }
.reason input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }
#confirmForm { display: grid; gap: 12px; }

/* ---------- Pending bar ---------- */
.pending-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--surface); color: var(--ink);
  border-top: 1px solid var(--line); box-shadow: var(--shadow-up);
}
.pending-count { margin: 0 auto 0 0; font-weight: 700; color: var(--pending); }
@media (max-width: 420px) {
  .pending-bar { flex-wrap: wrap; }
  .pending-count { flex: 1 1 100%; text-align: center; margin: 0; }
  .pending-bar .btn { flex: 1 1 0; }
}

/* ---------- History ---------- */
#historyView { padding: 0 16px 32px; }
.history-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 0 6px; }
.view-title { margin: 0; font: italic 700 28px/1 var(--font-head); text-transform: uppercase; }
.search-small { flex: 1 1 260px; max-width: 420px; }
.h-day { margin-top: 14px; }
.h-date { margin: 0 0 6px; font: 700 15px/1.2 var(--font-head); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.h-row {
  display: grid; grid-template-columns: 76px 80px minmax(0, 1.6fr) minmax(0, .9fr) 120px minmax(0, 1.4fr);
  gap: 4px 12px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px;
}
.h-head { border-top: 0; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding-bottom: 2px; }
.h-time { font-variant-numeric: tabular-nums; color: var(--muted); }
.h-user { font-weight: 600; }
.h-product { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.h-ba { color: var(--muted); font-weight: 400; }
.reason-tag { display: inline-block; padding: 2px 7px; border-radius: 4px; background: var(--soft); font-size: 12px; font-weight: 700; }
.h-note { color: var(--ink-2); }
.h-reason { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .h-head { display: none; }
  .h-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "product change" "var change" "reason reason" "meta meta";
  }
  .h-product { grid-area: product; }
  .h-var { grid-area: var; }
  .h-change { grid-area: change; align-self: start; }
  .h-reason { grid-area: reason; }
  .h-time, .h-user { grid-row: 4; font-size: 12px; color: var(--muted); }
  .h-time { grid-column: 1; }
  .h-user { grid-column: 2; justify-self: end; font-weight: 600; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 70; left: 50%; transform: translateX(-50%);
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  width: max-content; max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: 10px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: 14px; font-weight: 600;
}

/* ---------- Record sale ---------- */
.fab {
  position: fixed; z-index: 44; right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 6px;
  height: 52px; padding: 0 20px 0 16px;
  border: 0; border-radius: 999px; background: var(--red); color: #fff;
  font-weight: 700; font-size: 16px; cursor: pointer; box-shadow: var(--shadow);
}
.fab:hover { background: var(--red-dark); }
.fab svg { width: 20px; height: 20px; stroke-width: 2.6; }
.groups { padding-bottom: 88px; }

.sheet-tall { max-height: 94vh; }
.sale-form { display: grid; gap: 14px; }
.sale-block { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; min-width: 0; }
.sale-block legend { font-weight: 700; font-size: 14px; margin-bottom: 8px; padding: 0; }
.sale-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sale-empty { padding: 12px; border: 1.5px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 14px; text-align: center; }
.sale-line { padding: 10px; border: 1.5px solid var(--line); border-radius: 10px; display: grid; gap: 8px; }
.sl-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.sl-main strong { overflow-wrap: anywhere; }
.sl-stock { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 600; }
.sl-controls { display: flex; align-items: center; gap: 8px; }
.qty { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; }
.qty-btn { width: 38px; height: 36px; border: 0; background: none; font-size: 20px; font-weight: 700; cursor: pointer; }
.qty-btn:disabled { opacity: .3; cursor: default; }
.qty-n { min-width: 22px; text-align: center; font: 700 20px/1 var(--font-head); font-variant-numeric: tabular-nums; }
.price { display: flex; align-items: center; gap: 2px; padding: 0 8px; height: 38px; border: 1.5px solid var(--line); border-radius: 8px; flex: 1 1 0; min-width: 0; max-width: 130px; }
.price span { color: var(--muted); font-weight: 600; }
.price input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; font-variant-numeric: tabular-nums; }
.price:focus-within { border-color: var(--ink); }
.sl-sum { margin-left: auto; font-weight: 700; white-space: nowrap; }
.sl-remove { width: 30px; height: 30px; font-size: 18px; }
.pick-results { display: grid; gap: 6px; }
.pick-row { padding: 8px 10px; border-radius: 10px; background: var(--soft); display: grid; gap: 6px; }
.pick-name { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.pick-price { color: var(--muted); font-weight: 600; font-size: 13px; }
.chip:disabled { cursor: not-allowed; opacity: .55; }
.pay-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 420px) { .pay-options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photos:empty { display: none; }
.photo { position: relative; width: 76px; height: 76px; border-radius: 8px; overflow: hidden; background: var(--soft); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo button { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.photos-big .photo { width: 140px; height: 140px; }
.photo-add { position: relative; justify-self: start; display: inline-flex; align-items: center; overflow: hidden; font-weight: 600; }
.photo-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-add:focus-within { outline: 2px solid var(--red); outline-offset: 2px; }
.sale-total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; border-radius: 10px; background: var(--soft); }
.sale-total span { font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 13px; }
.sale-total strong { color: var(--red); font: 700 28px/1 var(--font-head); font-variant-numeric: tabular-nums; }

/* ---------- Sales (owner) ---------- */
#salesView { padding: 0 16px 32px; }
.sales-period { flex: 0 1 180px; }
.proto-inline { margin: 0 0 12px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 0 16px; }
@media (max-width: 600px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; display: grid; gap: 4px; min-width: 0; }
.kpi-n { font: 700 28px/1 var(--font-head); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-l { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sales-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.panel-wide { grid-column: 1 / -1; }
@media (max-width: 760px) { .sales-grid { grid-template-columns: minmax(0, 1fr); } }
.panel { min-width: 0; }
.panel-title { margin: 0 0 8px; font: italic 700 20px/1.1 var(--font-head); text-transform: uppercase; }
.panel-sub { font: 600 12px/1 var(--font); color: var(--muted); text-transform: none; font-style: normal; margin-left: 4px; }

.wk-chart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.wk-y { display: flex; flex-direction: column; justify-content: space-between; height: calc(160px + 1em); font-size: 11px; line-height: 1; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; transform: translateY(-.5em); }
.wk-plot { position: relative; min-width: 0; }
.wk-grid { position: absolute; inset: 0 0 auto 0; height: 160px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.wk-grid i { display: block; border-top: 1px solid var(--line); }
.wk-cols { position: relative; height: 160px; display: flex; align-items: flex-end; gap: 2px; }
.wk { position: relative; flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline: none; }
.wk-bar { display: block; width: 100%; max-width: 28px; min-height: 0; background: var(--red); border-radius: 4px 4px 0 0; }
.wk:hover .wk-bar, .wk:focus-visible .wk-bar { background: var(--red-dark); }
.wk-tip {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); z-index: 2;
  padding: 5px 8px; border-radius: 6px; background: var(--ink); color: var(--on-ink);
  font-size: 12px; white-space: nowrap; text-align: center; pointer-events: none; visibility: hidden;
}
.wk:hover .wk-tip, .wk:focus-visible .wk-tip { visibility: visible; }
.wk-x { display: flex; gap: 2px; margin-top: 4px; }
.wk-x span { flex: 1 1 0; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: visible; }

.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: r; }
.rank li { display: grid; gap: 4px; counter-increment: r; }
.rank-top { display: flex; gap: 8px; align-items: baseline; }
.rank-name { min-width: 0; overflow-wrap: anywhere; font-weight: 700; flex: 1; }
.rank-name::before { content: counter(r) "."; color: var(--muted); margin-right: 6px; font-variant-numeric: tabular-nums; }
.rank-v { white-space: nowrap; }
.rank-sub { color: var(--muted); font-size: 12px; font-weight: 600; }
.meter { display: block; height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--red); border-radius: 3px; }
.rank-vars { font-size: 12px; color: var(--muted); }

.s-table { border-top: 1px solid var(--line); }
.s-row {
  width: 100%; display: grid;
  grid-template-columns: 110px 70px minmax(0, 1fr) minmax(0, 2fr) 100px 120px 90px;
  gap: 4px 12px; align-items: center; padding: 8px 0;
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font-size: 14px; cursor: pointer;
}
button.s-row:hover { background: var(--soft); }
.s-head { cursor: default; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.s-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.s-id { font-weight: 700; font-size: 13px; }
.s-photo { color: var(--muted); }
.s-cust, .s-items, .s-track { min-width: 0; overflow-wrap: anywhere; }
.s-cust { font-weight: 600; }
.s-total { font-weight: 700; }
.muted { color: var(--muted); }
@media (max-width: 760px) {
  .s-head { display: none; }
  .s-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "cust total" "items items" "meta meta"; }
  .s-cust { grid-area: cust; }
  .s-total { grid-area: total; }
  .s-items { grid-area: items; font-size: 13px; }
  .s-date, .s-id, .s-pay, .s-track { grid-row: 3; font-size: 12px; color: var(--muted); }
  .s-row > .s-date { grid-column: 1; }
  .s-row > .s-id, .s-row > .s-pay, .s-row > .s-track { display: none; }
}
.detail-dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: 14px; }
.detail-dl dt { color: var(--muted); font-weight: 600; }
.detail-dl dd { margin: 0; overflow-wrap: anywhere; }
.view-toggle a { padding: 6px 12px; }
@media (max-width: 400px) { .view-toggle a { padding: 6px 9px; font-size: 13px; } }
