/* 50/50 admin (REV 21 + 24): the player site's ocean blue, tuned for work — calm surfaces, big targets, phone first. */

:root {
  --bg: #0a2333;
  --bg-2: #0d2c40;
  --surface: #103449;
  --surface-2: #143d55;
  --line: #1f4a63;
  --line-strong: #2d6080;
  --ink: #f2f8fc;
  --dim: #a9c6d8;
  --faint: #7fa3b8;
  --accent: #5cc8ff;
  --accent-2: #1a7fd0;
  --accent-ink: #04192a;
  --ok: #5ad69a;
  --warn: #ffc15c;
  --bad: #ff8a80;
  --info: #7cc8ff;
  --r: 14px;
  --tap: 44px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(900px 500px at 80% -10%, #1b6d9e40, transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font: 15px/1.45 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
h1 { font-size: 22px; line-height: 1.2; margin: 0; font-weight: 900; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 22px 0 10px; font-weight: 800; color: var(--ink); }
h3 { font-size: 13px; margin: 14px 0 6px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
h1 .sub { font-size: 13px; font-weight: 600; color: var(--faint); letter-spacing: 0; }
code { font: 12px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--dim); word-break: break-all; }
.hint { color: var(--faint); font-size: 13px; margin: 4px 0; }
.err { color: var(--bad); font-size: 13px; margin: 6px 0 0; min-height: 0; }
.err:empty { display: none; }
.err.block { padding: 12px; border: 1px solid var(--bad); border-radius: var(--r); }
.empty { color: var(--faint); padding: 18px 4px; margin: 0; }
.sr, .offscreen { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; left: -9999px; }
.neg { color: var(--bad); }
.pos { color: var(--ok); }

/* ---------- controls ---------- */

button, .btn {
  font: inherit;
  font-weight: 800;
  min-height: var(--tap);
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: linear-gradient(180deg, #6cc6fb, var(--accent-2));
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.15;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: progress; transform: none; }
button.ghost, .btn.ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
button.danger { background: linear-gradient(180deg, #ff8a80, #d9483b); }
button.danger-text { color: var(--bad); border-color: #ff8a8066; }
button.small, .btn.small { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
button.tiny { min-height: 28px; padding: 3px 9px; font-size: 12px; border-radius: 8px; }
button.icon { min-width: 40px; padding: 6px 10px; font-size: 17px; }
button.wide { width: 100%; margin-top: 12px; }

input, select {
  font: inherit;
  font-size: 16px; /* never under 16px: iOS zooms into smaller fields */
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: var(--ink);
}
input:focus, select:focus, button:focus-visible, .row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input::placeholder { color: var(--faint); }

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
  vertical-align: middle;
}
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warn); }
.pill.bad { color: var(--bad); }
.pill.info { color: var(--info); }
.pill.dim { color: var(--faint); }
.hint.warn { color: var(--warn); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
}
.banner { padding: 10px 12px; border-radius: 10px; margin: 10px 0 0; font-weight: 700; }
.banner.bad { background: #ff8a801f; color: var(--bad); border: 1px solid #ff8a8055; }
.ok-line { color: var(--ok); font-size: 13px; margin: 10px 0 0; font-weight: 700; }

/* ---------- top bar + tabs ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: #0a2333f2;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.brand { font: 900 22px/1 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif; color: #fff; text-decoration: none; letter-spacing: .02em; }
.brand i { color: var(--accent); font-style: normal; }
.tag { color: var(--faint); font-weight: 700; }
.spacer { flex: 1; }
.who { color: var(--faint); font-size: 13px; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mode-switch { display: inline-flex; flex: none; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); }
.mode-switch a { padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 800; color: var(--dim); text-decoration: none; line-height: 1.2; }
.mode-switch a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }

.tabs {
  position: sticky;
  top: calc(56px + env(safe-area-inset-top));
  z-index: 19;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 16px 10px;
  background: #0a2333f2;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--dim);
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid var(--line);
}
.tabs a[aria-current="page"] { background: var(--ink); color: var(--accent-ink); border-color: var(--ink); }
.tabs b:empty { display: none; }
.tabs b, .chip b {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
  text-align: center;
}
.tabs b.hot { background: var(--warn); color: #2b1b00; }

/* ---------- layout ---------- */

.app, .gate { max-width: 1120px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }
.gate { display: grid; place-items: center; min-height: 60vh; }
.gate-card { width: min(420px, 100%); display: grid; gap: 10px; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.view > h1 { margin-bottom: 12px; }
.back { display: inline-block; margin-bottom: 10px; font-weight: 800; text-decoration: none; min-height: 32px; }
.search { display: block; margin: 0 0 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters .search { flex: 1 1 220px; }
.filters .select { flex: 0 1 200px; }
.block { margin-top: 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cards { display: grid; gap: 12px; }

/* ---------- players ---------- */

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row.player {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
}
.row.player:hover { border-color: var(--line-strong); }
.row.player.blocked { border-color: #ff8a8055; }
.row .who { max-width: none; color: inherit; font-size: inherit; white-space: normal; }
.row .email { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row small { color: var(--faint); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 2px; }
.row .bal { text-align: right; }
.row .bal b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.row .bal small { display: block; }
.row .give { min-height: 40px; padding: 8px 12px; font-size: 14px; }

.player-head h1 { font-size: 19px; word-break: break-all; }
.ph-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.ph-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.stat { background: var(--bg-2); border-radius: 10px; padding: 8px 10px; }
.stat small { display: block; color: var(--faint); font-size: 12px; }
.stat b { font-size: 15px; font-variant-numeric: tabular-nums; }
.stat.big b { font-size: 22px; color: var(--accent); }
.note { display: block; color: var(--faint); font-size: 12px; font-weight: 400; }

/* ---------- tables (cards on a phone) ---------- */

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--faint); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; background: var(--bg-2); }
tbody tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pcell { display: inline-flex; align-items: center; gap: 8px; }
.stack { display: inline-flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.boxgroup h3 { margin-top: 16px; }

.thumb { flex: none; display: inline-grid; place-items: center; overflow: hidden; border-radius: 8px; background: #ffffff10; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb.xs { width: 28px; height: 28px; border-radius: 6px; }
.thumb.md { width: 44px; height: 44px; }
.thumb.lg { width: 64px; height: 64px; border-radius: 10px; }

/* ---------- shipping ---------- */

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 10px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--line-strong);
  font-size: 14px;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip[aria-pressed="true"] b { background: #04192a33; color: var(--accent-ink); }

.claim-head { display: flex; gap: 12px; align-items: flex-start; }
.claim-title { flex: 1; min-width: 0; display: grid; gap: 2px; }
.claim-title b { font-size: 15px; }
.claim-title small { color: var(--faint); font-size: 12px; }
.size { flex: none; display: grid; justify-items: center; padding: 4px 10px; border-radius: 10px; background: var(--warn); color: #2b1b00; }
.size small { font-size: 10px; font-weight: 800; text-transform: uppercase; }
.size b { font-size: 18px; line-height: 1.1; }
.pipeline { list-style: none; display: flex; gap: 4px; padding: 0; margin: 12px 0 8px; }
.pipeline li {
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--faint);
  padding-top: 8px;
  border-top: 4px solid var(--line-strong);
  border-radius: 2px;
}
.pipeline li.done { color: var(--ok); border-top-color: var(--ok); }
.pipeline li.now { color: var(--ink); border-top-color: var(--accent); }
.claim-who { margin: 6px 0; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; word-break: break-all; }
.address { display: grid; gap: 2px; justify-items: start; margin: 6px 0; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); }
.address .line {
  min-height: 30px;
  padding: 3px 6px;
  margin-left: -6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  text-align: left;
  white-space: normal;
  text-decoration: none;
}
.address .line:hover { background: #ffffff12; }
.address .phone { color: var(--accent); }
.address > button.small { margin-top: 6px; }
.detail { margin: 6px 0 0; font-size: 13px; color: var(--dim); word-break: break-word; }
.mail { margin: 6px 0 0; font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mail.failed { color: var(--bad); font-weight: 700; }
.mail.sent { color: var(--ok); }
.allclear b { font-size: 18px; color: var(--ok); }

/* ---------- dashboard ---------- */

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 2px; align-content: start; }
.tile small { color: var(--faint); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.tile b { font-size: 24px; font-variant-numeric: tabular-nums; }
.tile span { color: var(--dim); font-size: 12px; }
.tile.hot { border-color: #ffc15c88; }
.tile.bad b { color: var(--bad); }
.boxname { font-weight: 700; }

/* ---------- promos ---------- */

.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; margin-bottom: 14px; }
.form-grid h2 { grid-column: 1 / -1; margin: 0; }
.form-grid label { display: grid; gap: 4px; font-size: 13px; color: var(--dim); font-weight: 700; }
.form-grid .span { grid-column: 1 / -1; }
.promo.off { opacity: .75; }
.promo-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.promo .code { display: block; font: 900 22px/1.1 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif; letter-spacing: .04em; }
.promo small { color: var(--faint); }
.linkline { display: flex; align-items: center; gap: 8px; margin: 10px 0; padding: 8px 10px; border-radius: 10px; background: var(--bg-2); }
.linkline code { flex: 1; color: var(--ink); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 0; }
.stats div { background: var(--bg-2); border-radius: 10px; padding: 6px 8px; }
.stats dt { font-size: 11px; color: var(--faint); font-weight: 800; text-transform: uppercase; }
.stats dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- settings + audit ---------- */

.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.setting > div:first-child { flex: 1 1 240px; }
.inline { display: flex; align-items: center; gap: 6px; }
.inline input { width: 110px; }
.prefix, .suffix { color: var(--dim); font-weight: 800; }
/* REV 25: a plain on/off switch (role="switch"; the knob slides, the label says On/Off) */
button.switch { background: var(--bg-2); border: 1px solid var(--line-strong); color: var(--dim); padding: 6px 14px 6px 6px; gap: 10px; border-radius: 999px; min-width: 96px; justify-content: flex-start; }
button.switch .knob { position: relative; width: 46px; height: 28px; border-radius: 999px; background: var(--line-strong); transition: background .15s; flex: none; }
button.switch .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px #0006; }
button.switch[aria-checked="true"] { color: var(--ink); }
button.switch[aria-checked="true"] .knob { background: var(--ok); }
button.switch[aria-checked="true"] .knob::after { transform: translateX(18px); }
@media (prefers-reduced-motion: reduce) { button.switch .knob, button.switch .knob::after { transition: none; } }
.audit.ok { border-color: #5ad69a88; }
.audit.ok b { color: var(--ok); font-size: 18px; }
.audit.bad { border-color: #ff8a8088; }
.audit.bad b { color: var(--bad); font-size: 18px; }
.audit ul { margin: 8px 0 0; padding-left: 18px; color: var(--dim); font-size: 13px; }

/* ---------- the sheet ---------- */

.sheet {
  width: min(520px, 100%);
  max-height: min(92vh, 760px);
  margin: auto auto 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  color: var(--ink);
}
.sheet::backdrop { background: #02101acc; }
.sheet form { display: grid; gap: 12px; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sheet h2 { margin: 6px 0 0; font-size: 18px; word-break: break-word; }
.sheet footer { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.sheet footer button { min-height: 52px; font-size: 16px; }
#sheetBody { display: grid; gap: 12px; }
#sheetBody p { margin: 0; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--dim); font-weight: 700; }
.picks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pick { min-height: 52px; background: var(--bg-2); border: 1px solid var(--line-strong); color: var(--ink); font-size: 16px; padding: 8px 4px; }
.pick[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  width: min(560px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 800;
  box-shadow: 0 10px 30px #0008;
  background: #0f3d26;
  border: 1px solid var(--ok);
  color: #dfffe9;
}
.toast.err { background: #46181a; border-color: var(--bad); color: #ffe1de; }

#printArea { display: none; }

/* ---------- phone ---------- */

@media (max-width: 720px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile b { font-size: 20px; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid label:first-of-type { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .who { display: none; }
  .row .who { display: block; }
  .ph-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ph-stats .stat.big { grid-column: 1 / -1; }

  /* Tables become a stack of small cards, each value labelled. */
  .tablewrap { border: 0; background: transparent; overflow: visible; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin-bottom: 8px; }
  table.stack td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; text-align: right; }
  table.stack td::before { content: attr(data-label); color: var(--faint); font-size: 12px; font-weight: 800; text-align: left; flex: none; }
  table.stack td[data-label=""]::before { content: none; }
  table.stack td > * { min-width: 0; }
  table.stack .stack { align-items: flex-end; }
}

/* The token-mode top bar (50/50 · admin · Live · View site · ↻ · Sign out) is wider than a 390px phone: tighten it so
   the page never scrolls sideways (a wider page makes the phone zoom out and taps land off target). */
@media (max-width: 480px) {
  .top { gap: 6px; padding-left: 12px; padding-right: 12px; }
  .top .tag { display: none; }
  .top button.small, .top .btn.small { padding: 6px 10px; }
  .top button.icon { min-width: 36px; padding: 6px 8px; }
}
@media (max-width: 360px) {
  .top #viewSite { display: none; } /* the smallest phones: Live · ↻ · Sign out still fit */
  .top .brand { font-size: 19px; } /* "WinBidd" is wider than the old mark: Live · Play | Admin · ↻ keep their gutter */
}
/* Rows and tabs are tapped all the time: no grey flash box over them on phones. */
.row, .tabs a, .chip, .pick { -webkit-tap-highlight-color: transparent; }

@media (max-width: 380px) {
  .row.player { grid-template-columns: minmax(0, 1fr) auto; }
  .row.player .give { grid-column: 1 / -1; width: 100%; }
  .picks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-switch a { padding: 6px 10px; }
  .tag { display: none; }
}

/* ---------- packing slip ---------- */

@media print {
  body.printing { background: #fff; color: #000; }
  body.printing > :not(#printArea) { display: none !important; }
  body.printing #printArea { display: block; }
  .slip { font: 14px/1.5 Georgia, 'Times New Roman', serif; color: #000; padding: 24px; max-width: 640px; }
  .slip header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #000; padding-bottom: 12px; margin-bottom: 18px; }
  .slip-brand { font: 900 34px/1 'Arial Narrow', Arial, sans-serif; }
  .slip-brand i { font-style: normal; color: #1a7fd0; }
  .slip header b { display: block; font-size: 18px; text-align: right; }
  .slip header small { display: block; text-align: right; }
  .slip section small { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
  .slip pre { font: 700 17px/1.45 Georgia, serif; margin: 4px 0 18px; white-space: pre-wrap; }
  .slip table { width: 100%; border-collapse: collapse; font-size: 14px; }
  .slip th, .slip td { border: 1px solid #000; padding: 8px; text-align: left; background: #fff; color: #000; }
  .slip .thanks { margin-top: 24px; font-style: italic; }
}
