/* Monoluck Desk
   Palette: deep-space navy #0A0E1C / panel navy #111A2E / hairline #1E2B47
            cyan accent #6FD3F2 / cyan-bright #A9E7FA / amber warn #F2C46F
            text #DCE6F5 / muted #7A8AA8 */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0A0E1C;
  --panel: #111A2E;
  --line: #1E2B47;
  --accent: #6FD3F2;
  --accent-bright: #A9E7FA;
  --warn: #F2C46F;
  --danger: #F28B82;
  --good: #8FD9A8;
  --text: #DCE6F5;
  --muted: #7A8AA8;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #14203A 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
}

h1, h2, .brand-name, .stat-value {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  letter-spacing: 0.01em;
}

.shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand.center { justify-content: center; margin-bottom: 22px; }
.brand-mark-img {
  width: 46px; height: 46px; border-radius: 50%;
  object-fit: cover;
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #1B3B5C, #0E1B33);
  border: 1px solid var(--accent);
  color: var(--accent-bright);
  display: grid; place-items: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 20px;
}
.brand-name { font-weight: 700; font-size: 17px; color: var(--accent-bright); letter-spacing: 0.12em; text-transform: uppercase; }
.brand-sub { font-size: 10px; color: var(--muted); letter-spacing: 0.28em; text-transform: uppercase; margin-top: 2px; }

nav { display: flex; flex-direction: column; gap: 4px; }
nav a {
  color: var(--muted); text-decoration: none;
  padding: 10px 14px; border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 500;
}
nav a:hover { color: var(--text); background: rgba(111, 211, 242, 0.06); }
nav a.active {
  color: var(--accent-bright);
  background: rgba(111, 211, 242, 0.08);
  border-color: var(--line);
}
nav a:focus-visible, .btn:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.logout-form { margin-top: auto; }

/* ---------- Content ---------- */
.content { flex: 1; padding: 40px 48px; max-width: 1500px; }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 26px; flex-wrap: wrap;
}
h1 { font-size: 34px; color: var(--accent-bright); }
h2 { font-size: 16px; margin-bottom: 14px; }
.sub { color: var(--muted); margin-top: 6px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 22px;
}
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px 18px;
}
.stat-label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 6px; }
.stat-value.small { font-size: 22px; }
.stat-value.accent, .accent { color: var(--accent); }
.stat-value.warn, .warn { color: var(--warn); }
.good { color: var(--good); }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 22px; margin-bottom: 18px;
}

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 10px; border-bottom: 1px solid rgba(30, 43, 71, 0.5); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.inactive-row td { opacity: 0.45; }
.actions { white-space: nowrap; }

/* ---------- Chips ---------- */
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  border: 1px solid var(--line); text-transform: capitalize;
}
.chip.open { color: var(--accent-bright); border-color: var(--accent); }
.chip.shipped { color: var(--text); }
.chip.action_required { color: var(--warn); border-color: var(--warn); }
.chip.ready_for_payment { color: var(--good); border-color: var(--good); }
.chip.paid { color: var(--muted); }

/* ---------- Forms & buttons ---------- */
input {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px 12px; font: inherit;
}
input.mini { width: 92px; }
label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }

.row-form { display: flex; gap: 8px; flex-wrap: wrap; }
.row-form .grow { flex: 1; min-width: 220px; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  background: rgba(111, 211, 242, 0.1); color: var(--accent-bright);
  border: 1px solid var(--accent); border-radius: 8px;
  padding: 9px 16px;
}
.btn:hover { background: rgba(111, 211, 242, 0.2); }
.btn.primary { background: var(--accent); color: #07101F; }
.btn.primary:hover { background: var(--accent-bright); }
.btn.primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.full { width: 100%; margin-top: 14px; }
.btn.danger { color: var(--danger); }
.inline { display: inline; }

/* ---------- Tickets ---------- */
.ticket-head { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.ticket-total { text-align: right; }
.ticket form { margin-top: 14px; }

.note {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px; margin-top: 12px;
}
.note pre { font-family: inherit; white-space: pre-wrap; margin-top: 6px; }
.warn-note { border-color: var(--warn); }

.muted { color: var(--muted); }
.footnote { font-size: 13px; margin-top: 10px; }
code { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font-size: 13px; }
.error { color: var(--danger); margin-bottom: 12px; }

/* ---------- Login ---------- */
.login-body { display: grid; place-items: center; }
.login-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 36px; width: min(380px, 92vw);
}
.login-card input { width: 100%; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .content { padding: 22px 16px; }
  .logout-form { margin-top: 0; margin-left: auto; }
}

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

/* ---------- Comps ---------- */
.tiny { font-size: 11px; margin-top: 4px; }
.comp-settings { margin-top: 6px; }
.comp-settings summary { cursor: pointer; font-size: 12px; }
.small-form { margin-top: 8px; }
.small-form input { font-size: 13px; padding: 6px 9px; }

/* ---------- Mobile: tables become stacked cards ---------- */
.product-name { font-weight: 600; }

@media (max-width: 760px) {
  table.responsive, table.responsive tbody { display: block; width: 100%; }
  table.responsive thead { display: none; }

  table.responsive tr {
    display: block;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
  }
  table.responsive tr.inactive-row { opacity: 0.55; }
  table.responsive tr.inactive-row td { opacity: 1; }

  table.responsive td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-bottom: none;
    padding: 7px 0;
  }
  table.responsive td::before {
    content: attr(data-label);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    flex-shrink: 0;
  }
  table.responsive td[data-label=""]::before { content: none; }

  /* Product name row reads as the card title */
  table.responsive td.cell-product {
    display: block;
    padding-bottom: 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
  }
  table.responsive td.cell-product .product-name { font-size: 16px; }

  /* Hide empty set/type rows so cards stay tight */
  table.responsive td.hide-when-empty:empty { display: none; }

  /* Inputs sized for thumbs */
  table.responsive input.mini { width: 120px; font-size: 16px; }

  /* Action buttons wrap into a tidy row at the bottom of the card */
  table.responsive td.actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    margin-top: 4px;
    border-top: 1px solid var(--line);
    white-space: normal;
  }
  table.responsive td.actions .btn { padding: 9px 14px; }

  /* Timestamp under market price sits below the input, full width */
  table.responsive td .tiny { flex-basis: 100%; text-align: right; }

  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn { width: 100%; text-align: center; }
}

@media (max-width: 760px) {
  /* Inventory: note field gets full width, adjust inputs sit side by side */
  table.responsive td.cell-note { flex-wrap: wrap; }
  table.responsive td.cell-note input { flex: 1 1 100%; font-size: 16px; }
  table.responsive td input[name="delta_ok"],
  table.responsive td input[name="delta_damaged"] { width: 90px; font-size: 16px; }
}

/* ---------- Public seller form ---------- */
.sell-page { max-width: 640px; margin: 0 auto; padding: 24px 16px 120px; }
.sell-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.sell-head h1 { font-size: 26px; }
.sell-head .sub { margin-top: 4px; font-size: 14px; }

.sell-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.sell-row:last-child { border-bottom: none; }
.sell-info { flex: 1; min-width: 0; }
.sell-info .product-name { font-size: 15px; line-height: 1.3; }

.qty-group { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.qty-btn {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(111, 211, 242, 0.1); color: var(--accent-bright);
  border: 1px solid var(--accent); font-size: 20px; line-height: 1; cursor: pointer;
}
.qty-btn:active { background: rgba(111, 211, 242, 0.25); }
.qty-input {
  width: 62px; height: 40px; text-align: center;
  font-size: 16px; /* stops iOS zooming on focus */
}
.full-input { width: 100%; font-size: 16px; }

.sell-footer {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 20px;
  background: var(--panel); border-top: 1px solid var(--line);
}
.sell-footer .btn { padding: 13px 28px; font-size: 16px; }
@media (min-width: 700px) {
  .sell-footer { position: static; border-radius: 12px; border: 1px solid var(--line); margin-top: 16px; }
}

/* ---------- Damage photos ---------- */
.photo-upload { margin-top: 14px; }
.photo-upload input[type="file"] { display: block; margin-top: 6px; color: var(--muted); font-size: 14px; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.photo-grid img {
  width: 92px; height: 92px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line);
}
.photo-grid a:focus-visible img { outline: 2px solid var(--accent); }

.chip.cancelled { color: var(--muted); border-color: var(--line); text-decoration: line-through; }
.close-form { display: flex; gap: 6px; margin-top: 8px; justify-content: flex-end; flex-wrap: wrap; }
.close-form input { font-size: 13px; padding: 5px 10px; max-width: 190px; }
@media (max-width: 760px) {
  .close-form { justify-content: stretch; }
  .close-form input { flex: 1; font-size: 16px; max-width: none; }
}

/* ---------- Ticket editing ---------- */
.ticket-edit { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.ticket-edit .row-form { margin-bottom: 10px; align-items: center; }
.inline-label { margin: 0; align-self: center; font-size: 13px; }
.edit-trail { margin-top: 12px; }
.edit-trail summary { cursor: pointer; font-size: 13px; }
.edit-trail ul { list-style: none; margin-top: 8px; }
.edit-trail li { padding: 5px 0; border-bottom: 1px solid rgba(30,43,71,0.5); font-size: 13px; }
.edit-trail li:last-child { border-bottom: none; }
.correction summary { cursor: pointer; font-size: 13px; }
.correction .row-form { margin-top: 8px; }

.signed-in { margin-bottom: 8px; line-height: 1.4; }
.signed-in a { color: var(--accent); }

.tracking-line { margin-top: 6px; font-size: 14px; }
.tracking-line a { color: var(--accent); text-decoration: none; }
.tracking-line a:hover { text-decoration: underline; }

/* ============================================================
   Polish: gradient headings, logo aura, coin motifs
   ============================================================ */

/* --- Gradient page headings, echoing the MONOLUCK wordmark --- */
h1 {
  background: linear-gradient(100deg, #FFFFFF 0%, #A9E7FA 38%, #4FA8E8 78%, #2E7FD4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(111, 211, 242, 0.35));
  padding-bottom: 2px;
}

/* --- Brand wordmark: silver -> blue, with a gold underline like the logo --- */
.brand-name {
  background: linear-gradient(95deg, #FFFFFF 0%, #CFE9FA 42%, #4FA8E8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.brand-sub {
  background: linear-gradient(90deg, #E8C572 0%, #F5DFA8 50%, #C9A24D 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* --- Logo aura --- */
.brand-mark-img {
  filter: drop-shadow(0 0 10px rgba(79, 168, 232, 0.55)) drop-shadow(0 0 22px rgba(232, 197, 114, 0.22));
  transition: filter 0.4s ease, transform 0.4s ease;
}
.brand-mark-img:hover {
  filter: drop-shadow(0 0 14px rgba(79, 168, 232, 0.8)) drop-shadow(0 0 30px rgba(232, 197, 114, 0.35));
  transform: scale(1.04);
}

/* --- Stat values get a soft glow so numbers feel alive --- */
.stat-value.accent { text-shadow: 0 0 20px rgba(111, 211, 242, 0.4); }
.stat-value.warn { text-shadow: 0 0 20px rgba(242, 196, 111, 0.35); }

/* --- Panels: subtle inner light from the top edge --- */
.panel {
  background:
    linear-gradient(180deg, rgba(111, 211, 242, 0.045) 0%, rgba(111, 211, 242, 0) 120px),
    var(--panel);
}

/* --- Primary buttons: gentle sheen --- */
.btn.primary {
  background: linear-gradient(135deg, #A9E7FA 0%, #6FD3F2 55%, #4FB8E0 100%);
  box-shadow: 0 2px 14px rgba(111, 211, 242, 0.28);
}
.btn.primary:hover {
  background: linear-gradient(135deg, #C4EFFC 0%, #86DDF6 55%, #5FC6E8 100%);
  box-shadow: 0 2px 20px rgba(111, 211, 242, 0.45);
}

/* --- Sidebar active item: gold edge, like the logo ring --- */
nav a.active {
  border-left: 2px solid #E8C572;
  box-shadow: inset 0 0 22px rgba(111, 211, 242, 0.07);
}

/* ============================================================
   Coins — original £ coins in the Monoluck palette
   ============================================================ */

.coin {
  display: inline-block;
  width: 22px; height: 22px;
  vertical-align: -4px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cdefs%3E%3CradialGradient id='g' cx='38%25' cy='32%25'%3E%3Cstop offset='0%25' stop-color='%23FBF0C8'/%3E%3Cstop offset='45%25' stop-color='%23E8C572'/%3E%3Cstop offset='100%25' stop-color='%23A8802F'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='20' cy='20' r='18' fill='url(%23g)'/%3E%3Ccircle cx='20' cy='20' r='14.5' fill='none' stroke='%23F7E4AE' stroke-width='1.6' opacity='.85'/%3E%3Ctext x='20' y='27' font-family='Georgia,serif' font-size='19' font-weight='bold' text-anchor='middle' fill='%238A6420'%3E%C2%A3%3C/text%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 6px rgba(232, 197, 114, 0.5));
}

/* Coins that drift gently in the page background */
.coin-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.coin-field span {
  position: absolute;
  width: 38px; height: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cdefs%3E%3CradialGradient id='g' cx='38%25' cy='32%25'%3E%3Cstop offset='0%25' stop-color='%23FBF0C8'/%3E%3Cstop offset='45%25' stop-color='%23E8C572'/%3E%3Cstop offset='100%25' stop-color='%23A8802F'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='20' cy='20' r='18' fill='url(%23g)'/%3E%3Ccircle cx='20' cy='20' r='14.5' fill='none' stroke='%23F7E4AE' stroke-width='1.6' opacity='.85'/%3E%3Ctext x='20' y='27' font-family='Georgia,serif' font-size='19' font-weight='bold' text-anchor='middle' fill='%238A6420'%3E%C2%A3%3C/text%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.16;
  animation: coin-drift 26s linear infinite, coin-spin 7s ease-in-out infinite;
}
.coin-field span:nth-child(1) { left: 8%;  animation-delay: 0s, -1s;  }
.coin-field span:nth-child(2) { left: 27%; animation-delay: -7s, -3s; width: 26px; height: 26px; }
.coin-field span:nth-child(3) { left: 51%; animation-delay: -13s, -5s; }
.coin-field span:nth-child(4) { left: 72%; animation-delay: -4s, -2s; width: 30px; height: 30px; }
.coin-field span:nth-child(5) { left: 89%; animation-delay: -18s, -6s; }

@keyframes coin-drift {
  from { transform: translateY(105vh); }
  to   { transform: translateY(-12vh); }
}
@keyframes coin-spin {
  0%, 100% { scale: 1 1; }
  50%      { scale: 0.35 1; }
}

/* Content sits above the coin layer */
.shell { position: relative; z-index: 1; }

/* Coin bullet before the money figures on Accounting */
.stat-value.accent::before {
  content: '';
  display: inline-block;
  width: 18px; height: 18px;
  margin-right: 8px;
  vertical-align: -2px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cdefs%3E%3CradialGradient id='g' cx='38%25' cy='32%25'%3E%3Cstop offset='0%25' stop-color='%23FBF0C8'/%3E%3Cstop offset='45%25' stop-color='%23E8C572'/%3E%3Cstop offset='100%25' stop-color='%23A8802F'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='20' cy='20' r='18' fill='url(%23g)'/%3E%3Ccircle cx='20' cy='20' r='14.5' fill='none' stroke='%23F7E4AE' stroke-width='1.6' opacity='.85'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 5px rgba(232, 197, 114, 0.55));
}

/* Respect people who don't want motion */
@media (prefers-reduced-motion: reduce) {
  .coin-field span { animation: none; opacity: 0.12; top: 30%; }
  .brand-mark-img { transition: none; }
}

/* Keep it calmer on phones */
@media (max-width: 760px) {
  .coin-field span:nth-child(n+4) { display: none; }
  h1 { filter: drop-shadow(0 0 12px rgba(111, 211, 242, 0.28)); }
}

/* ============================================================
   More life: shimmer, hover lift, counters, coin burst
   ============================================================ */

/* --- Slow light sweep across page headings --- */
h1 {
  background-size: 220% 100%;
  animation: heading-sheen 9s ease-in-out infinite;
}
@keyframes heading-sheen {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* --- Cards lift and glow on hover --- */
.stat, .panel {
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.stat:hover {
  transform: translateY(-3px);
  border-color: rgba(111, 211, 242, 0.4);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35), 0 0 22px rgba(111, 211, 242, 0.1);
}
.panel.ticket:hover {
  border-color: rgba(111, 211, 242, 0.28);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
}

/* --- Action Required chip gently pulses so it catches the eye --- */
.chip.action_required {
  animation: chip-pulse 2.4s ease-in-out infinite;
}
@keyframes chip-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 196, 111, 0); }
  50%      { box-shadow: 0 0 12px 1px rgba(242, 196, 111, 0.35); }
}

/* --- Coin burst on payday --- */
.burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}
.burst i {
  position: absolute;
  top: 42%;
  left: 50%;
  width: 30px; height: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cdefs%3E%3CradialGradient id='g' cx='38%25' cy='32%25'%3E%3Cstop offset='0%25' stop-color='%23FBF0C8'/%3E%3Cstop offset='45%25' stop-color='%23E8C572'/%3E%3Cstop offset='100%25' stop-color='%23A8802F'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='20' cy='20' r='18' fill='url(%23g)'/%3E%3Ccircle cx='20' cy='20' r='14.5' fill='none' stroke='%23F7E4AE' stroke-width='1.6' opacity='.85'/%3E%3Ctext x='20' y='27' font-family='Georgia,serif' font-size='19' font-weight='bold' text-anchor='middle' fill='%238A6420'%3E%C2%A3%3C/text%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 8px rgba(232, 197, 114, 0.7));
  animation: coin-pop 1.5s cubic-bezier(.17,.67,.4,1) forwards;
}
@keyframes coin-pop {
  0%   { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  12%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--rot)); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  h1 { animation: none; }
  .chip.action_required { animation: none; }
  .stat:hover, .panel.ticket:hover { transform: none; }
  .burst { display: none; }
}

/* --- Clickable dashboard cards --- */
.stat-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  position: relative;
}
.stat-link:hover { border-color: rgba(111, 211, 242, 0.5); }
.stat-link::after {
  content: '→';
  position: absolute;
  top: 14px; right: 16px;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.stat-link:hover::after { opacity: 1; transform: translateX(0); }
.stat-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Signature --- */
.built-by {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: var(--muted);
  opacity: 0.5;
  padding: 26px 16px 20px;
  position: relative;
  z-index: 1;
  transition: opacity 0.3s ease;
}
.built-by:hover { opacity: 0.85; }

/* ============================================================
   Mobile navigation: top bar + bottom tabs + sheets
   ============================================================ */

[hidden] { display: none !important; }

.mobile-top,
.bottom-nav,
.sheet,
.sheet-backdrop { display: none; }

@media (max-width: 760px) {

  /* --- Compact top bar --- */
  .mobile-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--line);
    background: rgba(10, 14, 28, 0.92);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 40;
  }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
  }
  .mobile-brand .brand-mark-img { width: 34px; height: 34px; }
  .mobile-brand .brand-name { display: block; font-size: 14px; font-weight: 700; letter-spacing: 0.12em; }
  .mobile-brand .brand-sub { display: block; font-size: 9px; letter-spacing: 0.24em; text-transform: uppercase; margin-top: 1px; }

  .icon-btn {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 10px;
    width: 40px; height: 40px;
    font-size: 19px;
    cursor: pointer;
  }
  .icon-btn:active { background: rgba(111, 211, 242, 0.12); }

  /* --- Sidebar is desktop-only --- */
  .sidebar { display: none; }
  .shell { flex-direction: column; }
  .content { padding: 18px 16px calc(84px + env(safe-area-inset-bottom)); }

  /* --- Bottom tab bar --- */
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    background: rgba(13, 20, 36, 0.96);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a,
  .bottom-nav button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 9px 2px 10px;
    border: none;
    border-top: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    text-decoration: none;
    font: inherit;
    cursor: pointer;
  }
  .bottom-nav .bn-icon { font-size: 17px; line-height: 1; position: relative; }
  .bottom-nav .bn-label { font-size: 10px; letter-spacing: 0.02em; }
  .bottom-nav a.on,
  .bottom-nav button.on {
    color: var(--accent);
    border-top-color: var(--accent);
    background: linear-gradient(180deg, rgba(111, 211, 242, 0.1), transparent 70%);
  }
  .bn-dot {
    position: absolute;
    top: -3px; right: -7px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--warn);
    box-shadow: 0 0 8px rgba(242, 196, 111, 0.8);
  }

  /* --- Slide-up sheets --- */
  .sheet-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 18, 0.6);
    z-index: 70;
  }
  .sheet:not([hidden]) {
    display: block;
  }
  .sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 80;
    background: var(--panel);
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.24s cubic-bezier(.2,.8,.3,1);
  }
  .sheet.open { transform: translateY(0); }
  .sheet-grip {
    width: 42px; height: 4px;
    border-radius: 99px;
    background: var(--line);
    margin: 4px auto 14px;
  }
  .sheet a {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 13px 4px;
    border-bottom: 1px solid rgba(30, 43, 71, 0.6);
    color: var(--text);
    text-decoration: none;
    font-size: 16px;
  }
  .sheet a:last-of-type { border-bottom: none; }
  .sheet a .muted { font-size: 12px; }
  .sheet-user { font-size: 13px; color: var(--muted); padding: 0 4px 12px; }
  .sheet-logout { margin-top: 14px; text-align: center; }

  /* Signature sits after the content, above the tab bar */
  .built-by { padding: 22px 16px 8px; }

  /* Coins calm down further now the layout is tighter */
  .coin-field span:nth-child(n+3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet { transition: none; }
}

/* Desktop shows the seller in its own column; mobile folds it into the title */
.hide-on-mobile { display: table-cell; }
@media (max-width: 760px) {
  table.responsive td.hide-on-mobile { display: none; }
}

/* ---------- Comps ---------- */
.comp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.comp-title { font-size: 19px; margin-bottom: 2px; }
.comp-stats { margin-bottom: 16px; }

.range-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.range-btn {
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
  text-decoration: none; font-size: 13px; font-weight: 600;
}
.range-btn:hover { color: var(--text); border-color: rgba(111,211,242,0.4); }
.range-btn.on { color: #07101F; background: var(--accent); border-color: var(--accent); }
.chart-toggle { margin-left: auto; }

.chart-wrap {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 6px 4px;
  margin-bottom: 6px;
}
.chart-wrap svg { display: block; }

@media (max-width: 760px) {
  .comp-head { flex-direction: column; align-items: stretch; }
  .comp-head form .btn { width: 100%; }
  .comp-stats { grid-template-columns: 1fr 1fr; }
  .chart-toggle { margin-left: 0; width: 100%; text-align: center; }
}

/* ---------- Sidebar grouping ---------- */
.nav-divider {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.65;
  padding: 16px 14px 6px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}

/* ---------- Supply Vault (buyer-facing) ----------
   Black and gold, matching the Supply Vault logo — deliberately nothing like
   the Monoluck blue, so the two brands never read as related. */
.vault-mark {
  width: 52px; height: 52px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  filter: drop-shadow(0 0 12px rgba(224, 180, 87, 0.35));
}

.vault-theme {
  background:
    radial-gradient(900px 500px at 75% -10%, #1A1611 0%, #0B0B0C 60%);
}
.vault-theme h1 {
  background: linear-gradient(100deg, #FFFFFF 0%, #F0D08A 45%, #C29A3E 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 0 16px rgba(224, 180, 87, 0.28));
}
.vault-theme .panel {
  background: linear-gradient(180deg, rgba(224, 180, 87, 0.05) 0%, rgba(224, 180, 87, 0) 120px), #141416;
  border-color: #2A2620;
}
.vault-theme .sell-row { border-bottom-color: #2A2620; }
.vault-theme .btn.primary {
  background: linear-gradient(135deg, #F0D08A 0%, #E0B457 55%, #C29A3E 100%);
  color: #14100A;
  border-color: #E0B457;
  box-shadow: 0 2px 14px rgba(224, 180, 87, 0.3);
}
.vault-theme .btn.primary:hover {
  background: linear-gradient(135deg, #F7E1AC 0%, #EBC46F 55%, #D2AA4C 100%);
}
.vault-theme .qty-btn {
  background: rgba(224, 180, 87, 0.1);
  color: #F0D08A;
  border-color: #C29A3E;
}
.vault-theme .qty-btn:active { background: rgba(224, 180, 87, 0.24); }
.vault-theme input {
  background: #0B0B0C;
  border-color: #2A2620;
}
.vault-theme .stat-value.accent { color: #E0B457; }
.vault-theme .stat-value.accent::before { display: none; }
.vault-theme .sell-footer {
  background: #141416;
  border-top-color: #2A2620;
}
.vault-theme .warn-note { border-color: #E0B457; }
.vault-theme .warn { color: #F0D08A; }

/* Order statuses */
.chip.pending_payment { color: var(--warn); border-color: var(--warn); }
.chip.shipped { color: var(--good); border-color: var(--good); }

.pack-list { list-style: none; margin-top: 8px; }
.pack-list li { padding: 4px 0; font-size: 15px; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin: 0; color: var(--muted); }
.check-inline input { width: auto; }

.sheet-group {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.7;
  padding: 14px 4px 4px;
  border-top: 1px solid var(--line);
  margin-top: 6px;
}
.sheet-group:first-of-type { border-top: none; margin-top: 0; padding-top: 2px; }

.vault-head-inline { display: flex; align-items: center; gap: 14px; }
.vault-mark.small { width: 42px; height: 42px; border-radius: 10px; }

/* Delivery options on the buyer form */
.ship-option {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 4px; margin: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.ship-option:last-of-type { border-bottom: none; }
.ship-option input { width: auto; accent-color: #E0B457; }
.ship-option span { display: flex; flex-direction: column; gap: 2px; }
.mini-select {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px 12px; font: inherit;
}
.chip.awaiting_quote { color: var(--warn); border-color: var(--warn); }

/* ---------- Parcels ---------- */
.parcels { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.parcel-list { list-style: none; margin: 8px 0; }
.parcel-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; font-size: 14px;
}
.parcel-list a { color: var(--accent); text-decoration: none; }
.parcel-list a:hover { text-decoration: underline; }

/* ---------- Table search ---------- */
.table-search { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.filter-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
}
.filter-input:focus { border-color: var(--accent); outline: none; }
.filter-count { white-space: nowrap; }
@media (max-width: 760px) {
  .filter-input { font-size: 16px; }
}

/* ============================================================
   Action-first home
   ============================================================ */
.greeting { font-size: 30px; }

.work-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.work-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.work-card:hover {
  transform: translateY(-2px);
  border-color: rgba(111, 211, 242, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.work-card.warn { border-color: rgba(242, 196, 111, 0.55); }
.work-card.good { border-color: rgba(127, 224, 176, 0.4); }
.work-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.work-count {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 30px; font-weight: 700; line-height: 1;
  min-width: 40px; text-align: center;
  color: var(--text);
}
.work-count.accent { color: var(--accent); }
.work-count.warn { color: var(--warn); }
.work-count.good { color: var(--good); }

.work-body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.work-label { font-size: 15px; font-weight: 500; }
.work-branch { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.work-go { font-size: 24px; color: var(--muted); line-height: 1; }

.all-clear { text-align: center; padding: 34px 22px; }
.all-clear-mark {
  width: 52px; height: 52px; margin: 0 auto 14px;
  border-radius: 50%;
  border: 2px solid var(--good);
  color: var(--good);
  display: grid; place-items: center;
  font-size: 24px;
}
.all-clear p { color: var(--muted); }

.week-grid { grid-template-columns: repeat(2, 1fr); max-width: 460px; }

/* Branch sheets */
.sheet-brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 600;
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.sheet-brand.cashouts { color: var(--accent-bright); }
.sheet-brand.vault { color: #F0D08A; }
.sheet-brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: rgba(111, 211, 242, 0.12);
  border: 1px solid var(--accent);
  display: grid; place-items: center;
  font-size: 13px;
}
.sheet-brand-img { width: 26px; height: 26px; border-radius: 7px; object-fit: cover; }

/* The fuller breakdown is desktop-only - phones lead with actions */
@media (max-width: 760px) {
  .desk-only { display: none; }
  .greeting { font-size: 25px; }
  .work-card { padding: 14px 15px; gap: 12px; }
  .work-count { font-size: 26px; min-width: 34px; }
  .work-label { font-size: 14px; }
}

.history-toggle { margin-bottom: 18px; }
.history-toggle a { color: var(--accent); }

.profit-panel { border-color: rgba(224, 180, 87, 0.25); }
.profit-panel h2 .muted { font-weight: 400; text-transform: none; letter-spacing: normal; margin-left: 6px; }

/* ---------- Stock adjustment steppers ---------- */
.stepper { display: inline-flex; align-items: center; gap: 5px; flex-wrap: nowrap; }
.step-btn {
  width: 38px; height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(111, 211, 242, 0.07);
  color: var(--accent-bright);
  font-size: 18px; line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.step-btn:active { background: rgba(111, 211, 242, 0.2); }
.step-btn.minus { color: var(--danger); border-color: rgba(242, 139, 130, 0.4); }
.step-btn.minus:active { background: rgba(242, 139, 130, 0.15); }
.step-btn.plus { color: var(--good); border-color: rgba(143, 217, 168, 0.4); }
.step-btn.plus:active { background: rgba(143, 217, 168, 0.15); }

.stepper-input {
  width: 62px;
  min-width: 0; /* without this a number input refuses to shrink in a flex row */
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 4px;
  /* Hide the native spinners - the buttons replace them */
  -moz-appearance: textfield;
}
.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-input.is-negative { color: var(--danger); border-color: rgba(242, 139, 130, 0.5); }
.stepper-input.is-positive { color: var(--good); border-color: rgba(143, 217, 168, 0.5); }





.raise-issue { margin-top: 12px; }
.raise-issue summary { cursor: pointer; font-size: 13px; }
.raise-issue .row-form { margin-top: 8px; }

/* ---------- Top bar actions ---------- */
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions .icon-btn {
  display: grid; place-items: center; text-decoration: none;
}

/* ---------- "Something changed" prompt ---------- */
.refresh-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(74px + env(safe-area-inset-bottom));
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 9px 10px 9px 18px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  font-size: 14px;
  animation: banner-in 0.25s ease;
}
@keyframes banner-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@media (min-width: 761px) {
  .refresh-banner { bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .refresh-banner { animation: none; }
}

/* ---------- Handover / collection ---------- */
.handover { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.handover-row { margin-top: 8px; }
.handover input[type="date"], .handover input[type="time"] {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px 11px; font: inherit;
}
.collection-note { border-color: var(--accent); }
.collection-note p { margin-top: 4px; font-size: 15px; }
.collection-line { margin-top: 6px; font-size: 14px; color: var(--accent); }
.pay-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

@media (max-width: 760px) {
  .handover-row { flex-direction: column; align-items: stretch; }
  .handover-row .btn { width: 100%; }
  .handover input[type="date"], .handover input[type="time"] { font-size: 16px; width: 100%; }
  .pay-actions { flex-direction: column; }
  .pay-actions .btn { width: 100%; }
}

/* ---------- One-tap quick actions ---------- */
.quick-action { margin-bottom: 4px; }
.quick-btn { display: inline-flex; align-items: center; gap: 9px; font-size: 15px; }
.quick-tick { font-size: 17px; line-height: 1; }
.quick-note { margin-bottom: 14px; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed;
  right: 16px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 55;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(17, 26, 46, 0.94);
  backdrop-filter: blur(6px);
  color: var(--accent-bright);
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.to-top:active { background: rgba(111, 211, 242, 0.2); }
@media (min-width: 761px) {
  .to-top { bottom: 24px; right: 24px; }
}

/* ---------- Collapsible cards ---------- */
.card-collapse {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: auto;
  align-self: flex-start;
  flex-shrink: 0;
}
.card-collapse:hover { color: var(--text); }
.panel.ticket.is-collapsed > *:not(.ticket-head) { display: none; }
.panel.ticket.is-collapsed { padding-bottom: 14px; }
.panel.ticket.is-collapsed .ticket-head { margin-bottom: 0; }

@media (max-width: 760px) {
  .quick-btn { width: 100%; justify-content: center; padding: 14px; }
}

/* ---------- Busy state on submit ---------- */
button[disabled] { cursor: default; }
.spinner {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  margin-right: 6px;
  animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; border-right-color: currentColor; opacity: 0.5; }
}

.other-line { margin-bottom: 8px; }
.add-other { margin-top: 4px; }

/* ---------- Sign-offs ---------- */
.signoff-box {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--warn);
  border-radius: 12px;
}
.signoff-box.is-complete { border-color: var(--good); }
.signoff-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.signoff-list { list-style: none; margin: 0 0 10px; }
.signoff-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; font-size: 14px; flex-wrap: wrap;
}
.signoff-tick { color: var(--good); font-size: 15px; }
.signoff-tick.pending { color: var(--muted); }
.signoff-pending { opacity: 0.75; }

@media (max-width: 760px) {
  .signoff-box { padding: 13px; }
  .signoff-box .btn { width: 100%; }
}

/* Expected quantity folds into the product title on mobile */
.expected-inline { display: none; }
@media (max-width: 760px) {
  .expected-inline { display: block; margin-top: 3px; }
}


/* ============================================================
   Steppers on mobile — grid, not flex.
   A grid of [48px | 1fr | 48px] cannot overflow: the middle column
   takes exactly the space left over, however narrow the screen.
   Flex kept overflowing because a number input's intrinsic width
   fights being shrunk.
   ============================================================ */
@media (max-width: 760px) {
  /* Nothing in a responsive table may exceed the card */
  table.responsive,
  table.responsive tbody,
  table.responsive tr,
  table.responsive td {
    max-width: 100%;
    box-sizing: border-box;
  }
  table.responsive tr { width: 100%; }

  /* Label on its own line, controls beneath at full width */
  table.responsive td.stepper-cell {
    display: block;
    padding: 9px 0;
  }
  table.responsive td.stepper-cell::before {
    display: block;
    margin-bottom: 8px;
  }
  table.responsive td.stepper-cell .stepper {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    gap: 8px;
    width: 100%;
    max-width: 100%;
  }
  table.responsive td.stepper-cell .stepper .step-btn {
    width: 100%;
    height: 48px;
    font-size: 21px;
    padding: 0;
  }
  table.responsive td.stepper-cell .stepper .stepper-input {
    width: 100%;
    min-width: 0;
    padding: 13px 4px;
    font-size: 17px;
  }
}

/* ---------- Reverting a ticket a stage ---------- */
.reopen-box {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.reopen-box .footnote { margin: 6px 0 10px; }
.reopen-inline { margin-bottom: 12px; }
@media (max-width: 760px) {
  .reopen-box .btn, .reopen-inline .btn { width: 100%; }
}

/* ============================================================
   Custom confirm dialog — replaces the phone's plain system dialog
   ============================================================ */
.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(4, 8, 18, 0.7);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.confirm-backdrop.open { opacity: 1; }

.confirm-dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 201;
  width: min(400px, calc(100vw - 40px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 22px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%) scale(0.94);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(.2,.8,.3,1);
}
.confirm-dialog.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}
#confirm-message {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 20px;
  white-space: pre-line;
}
.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.confirm-actions .btn { min-width: 84px; }

@media (max-width: 760px) {
  .confirm-dialog {
    left: 16px;
    right: 16px;
    top: auto;
    bottom: calc(24px + env(safe-area-inset-bottom));
    width: auto;
    transform: translateY(16px) scale(1);
  }
  .confirm-dialog.open { transform: translateY(0) scale(1); }
  .confirm-actions { flex-direction: column-reverse; }
  .confirm-actions .btn { width: 100%; padding: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .confirm-backdrop, .confirm-dialog { transition: none; }
}

/* ============================================================
   Page transition feedback
   ============================================================ */
#page-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  box-shadow: 0 0 8px rgba(111, 211, 242, 0.6);
  z-index: 300;
}

/* Soft fade-in so a fresh page doesn't just snap into view */
.content {
  animation: content-fade-in 0.22s ease both;
}
@keyframes content-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .content { animation: none; }
  #page-progress { transition: none !important; }
}

/* ============================================================
   Lucide icons - sized/coloured to sit inside the existing nav.
   createIcons() replaces each <i data-lucide="..."> with an <svg
   class="lucide lucide-{name}">, so the "lucide" class is the
   reliable hook regardless of exact version.
   ============================================================ */
.bn-icon svg.lucide,
.icon-btn svg.lucide {
  width: 19px;
  height: 19px;
  vertical-align: -4px;
  stroke-width: 2;
}
/* Until the CDN script loads (or if it can't), keep the Unicode
   fallback sized sensibly rather than tiny default text */
.bn-icon i[data-lucide],
.icon-btn i[data-lucide] {
  font-style: normal;
  line-height: 1;
}

/* ============================================================
   Toast — a brief confirmation for quick actions
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  z-index: 260;
  max-width: calc(100vw - 40px);
  background: var(--panel);
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 761px) {
  .toast { bottom: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity 0.22s ease; transform: translateX(-50%) !important; }
}

/* ============================================================
   Pull to refresh
   ============================================================ */
#ptr-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  z-index: 250;
}
#ptr-indicator::before {
  content: '↓';
  font-size: 16px;
  line-height: 1;
  transition: transform 0.15s ease;
}
#ptr-indicator.ready { color: var(--accent); }
#ptr-indicator.ready::before { content: '↑'; }
#ptr-indicator.spin::before {
  content: '';
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  color: var(--accent);
}
@media (min-width: 761px) {
  #ptr-indicator { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #ptr-indicator.spin::before { animation: none; opacity: 0.5; }
}

/* ---------- Editable product name (Inventory) ---------- */
.name-view { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rename-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  line-height: 1;
}
.rename-btn:hover { color: var(--accent-bright); }
.rename-form {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.rename-form input[name="name"] { min-width: 180px; }
.rename-settype { width: 130px; }
@media (max-width: 760px) {
  .rename-form { flex-direction: column; }
  .rename-form input, .rename-form .btn { width: 100%; font-size: 16px; }
}

/* ---------- Inventory export/import ---------- */
.page-head-actions { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.import-form { display: inline-block; }
.import-label {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  display: inline-flex;
}
.import-label input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}
.import-hint { margin-top: -8px; margin-bottom: 18px; }
.import-list { list-style: none; }
.import-list li { padding: 5px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.import-list li:last-child { border-bottom: none; }

@media (max-width: 760px) {
  .page-head-actions { width: 100%; }
  .page-head-actions .btn, .page-head-actions .import-form { flex: 1; }
  .import-label { width: 100%; justify-content: center; }
}

/* ============================================================
   Collections widget — so an in-person drop-off can't be missed
   ============================================================ */
.collections-widget {
  background: linear-gradient(160deg, rgba(224, 180, 87, 0.08), rgba(224, 180, 87, 0) 60%), var(--panel);
  border: 1px solid rgba(224, 180, 87, 0.35);
  border-radius: 14px;
  padding: 16px 16px 8px;
  margin-bottom: 20px;
}
.collections-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}
.collections-icon {
  font-size: 17px;
  line-height: 1;
  font-style: normal;
}
.collections-icon svg.lucide { width: 19px; height: 19px; color: #E0B457; }
.collections-head h2 {
  font-size: 15px;
  margin: 0;
  color: #F0D08A;
}
.collections-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }

.collection-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(10, 14, 28, 0.5);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.collection-row:hover { border-color: rgba(224, 180, 87, 0.5); transform: translateY(-1px); }
.collection-row.overdue { border-color: var(--danger); background: rgba(242, 139, 130, 0.06); }

.collection-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(224, 180, 87, 0.12);
  flex-shrink: 0;
}
.collection-row.overdue .collection-date { background: rgba(242, 139, 130, 0.15); }
.collection-day {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #F0D08A;
  text-transform: uppercase;
}
.collection-row.overdue .collection-day { color: var(--danger); }
.collection-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.collection-body { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.collection-body strong { font-size: 14px; }
.collection-go { font-size: 20px; color: var(--muted); line-height: 1; }

@media (max-width: 760px) {
  .collections-widget { padding: 14px 13px 6px; }
  .collection-row { padding: 12px; }
}

/* ============================================================
   Desktop table fix — the product name column had no minimum
   width, so as more columns were added over time (Reserved,
   Free, split Adjust Stock/Damaged, etc), the browser's table
   layout started crushing it down to one word per line to make
   room for the fixed-width inputs and steppers alongside it.
   ============================================================ */
table.responsive td.cell-product {
  min-width: 210px;
}

/* Safety net: if a table still doesn't fit a narrower desktop
   window even with the minimum above, scroll it horizontally
   inside its own panel rather than letting it squash content or
   break the page layout. Harmless when nothing overflows. */
.panel {
  overflow-x: auto;
}

/* ============================================================
   Desktop only: claw back the width the product-name fix used up.
   Giving Product a real minimum meant something else had to give -
   these were sized generously with room to spare, so trim them
   rather than let the whole row spill into horizontal scrolling.
   ============================================================ */
@media (min-width: 761px) {
  table.responsive .step-btn { width: 30px; height: 30px; font-size: 15px; }
  table.responsive .stepper { gap: 4px; }
  table.responsive .stepper-input { width: 46px; padding: 6px 2px; font-size: 14px; }

  /* The note field had no width set at all, so it was taking a
     browser-default ~180px it didn't need for a short reason. */
  table.responsive td.cell-note input {
    width: 140px;
  }

  /* A touch less breathing room per cell, spread across every
     column, adds up without anything feeling cramped. */
  table.responsive td, table.responsive th { padding: 10px 8px; }

  /* 180 still wraps long names onto a tidy two lines - the 210px
     tried to avoid any wrap at all, which cost more than it was
     worth once every other column is accounted for. */
  table.responsive td.cell-product { min-width: 180px; }
}

/* ============================================================
   Pin the row's action button(s) to the visible edge, desktop
   only. Rather than continuing to guess exact column widths that
   need to fit a browser window I can't actually see, this makes
   the one thing that matters - being able to click Apply/Save -
   always visible regardless of how wide the rest of the row is.
   The row can scroll under it if it needs to; the button doesn't.
   ============================================================ */
@media (min-width: 761px) {
  table.responsive td.pinned-action {
    position: sticky;
    right: 0;
    z-index: 5;
    background: var(--panel); /* matches the card the table sits in, not the page behind it */
    box-shadow: -10px 0 14px -10px rgba(0, 0, 0, 0.55);
  }
}

/* ============================================================
   Inventory category groups — collapsed by default, search opens
   whichever ones actually contain a match.
   ============================================================ */
.category-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.category-group summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 18px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
  background: rgba(111, 211, 242, 0.05);
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.category-group summary::-webkit-details-marker { display: none; }
.category-group summary::before {
  content: '▸';
  color: var(--accent);
  font-size: 12px;
  transition: transform 0.15s ease;
  display: inline-block;
}
.category-group[open] summary::before { transform: rotate(90deg); }
.category-group summary:hover { background: rgba(111, 211, 242, 0.1); }
.category-group summary .muted { font-weight: 400; font-size: 13px; }
.category-group table { margin: 0; border-top: 1px solid var(--line); }
.category-group:last-child { margin-bottom: 0; }

@media (max-width: 760px) {
  .category-group summary { padding: 13px 14px; font-size: 14px; }
}

/* ---------- Form fields the app didn't style yet ---------- */
select, textarea {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px 12px; font: inherit;
}
textarea { resize: vertical; min-height: 44px; }

/* ---------- Onboarding admin page ---------- */
.onboarding-form { align-items: flex-start; }
.onboarding-textarea { width: 100%; }
.onboarding-step-card { padding: 16px 18px; margin-bottom: 12px; }
.onboarding-step-order {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(111, 211, 242, 0.1); color: var(--accent);
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.onboarding-step-body { margin: 8px 0 12px; font-size: 13px; }
.onboarding-step-actions { gap: 6px; }


/* ---------- Onboarding walkthrough (bottom card, cards-only - no
   spotlighting) ---------- */
.ob-veil {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(4, 8, 18, 0.28);
}
.ob-card {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 9001;
  background: var(--panel);
  border-top: 1px solid var(--accent);
  border-radius: 18px 18px 0 0;
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -12px 40px -12px rgba(0, 0, 0, 0.6);
  max-height: 46vh;
  overflow-y: auto;
  animation: ob-slide-up 0.26s cubic-bezier(.2,.8,.3,1);
}
@keyframes ob-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.ob-step-label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin-bottom: 6px; }
.ob-title { font-family: 'Space Grotesk', sans-serif; font-size: 17px; font-weight: 700; color: var(--accent-bright); margin-bottom: 6px; }
.ob-body { font-size: 13.5px; color: var(--text); line-height: 1.55; margin-bottom: 14px; }
.ob-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ob-dots { display: flex; gap: 4px; flex-wrap: wrap; max-width: 140px; }
.ob-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--line); }
.ob-dot.on { background: var(--accent); }
.ob-nav { display: flex; gap: 6px; margin-left: auto; }
.ob-btn {
  font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 700;
  border-radius: 9px; padding: 9px 16px; border: none; cursor: pointer;
}
.ob-btn.next { background: var(--accent); color: #07101F; }
.ob-btn.back { background: transparent; border: 1px solid var(--line); color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .ob-card { animation: none; }
}

.ticket-link { color: var(--accent); text-decoration: none; }
.ticket-link:hover { text-decoration: underline; }

/* ---------- Collapsed-by-default ticket cards ---------- */
.ticket-collapse > summary.ticket-summary {
  cursor: pointer;
  list-style: none;
  display: block;
}
.ticket-collapse > summary.ticket-summary::-webkit-details-marker { display: none; }
.ticket-caret {
  display: inline-block;
  color: var(--accent);
  transition: transform 0.15s ease;
  margin-right: 2px;
}
.ticket-collapse[open] > summary.ticket-summary .ticket-caret { transform: rotate(90deg); }
.ticket-actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 14px; }
.update-ticket-row { margin-top: 14px; }

/* ---------- Drop-off calendar ---------- */
.cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.cal-week-label {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 15px;
  color: var(--accent-bright); display: flex; align-items: center; gap: 8px;
  text-align: center;
}
.cal-panel { padding: 0; overflow: hidden; }
.cal-day {
  border-bottom: 1px solid var(--line);
}
.cal-day:last-child { border-bottom: none; }
.cal-day summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 18px;
}
.cal-day summary::-webkit-details-marker { display: none; }
.cal-day[open] summary .ticket-caret { transform: rotate(90deg); }
.cal-day-date {
  font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.cal-day-count { font-size: 12px; color: var(--accent); font-weight: 600; }
.cal-day-empty {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 18px;
}
.cal-day.today, .cal-day-empty.today { background: rgba(111, 211, 242, 0.05); }
.cal-day-items { padding: 0 18px 16px; }
.cal-item {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px;
}
.cal-item:last-child { margin-bottom: 0; }
.cal-item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.cal-item-note { font-size: 13px; margin-bottom: 10px; }

@media (max-width: 760px) {
  .cal-week-label { font-size: 13px; }
  .cal-day summary, .cal-day-empty { padding: 12px 14px; }
  .cal-day-items { padding: 0 14px 14px; }
}
