/* Whatnot Sales: phone-first dashboard, styled after Shopify's admin (Polaris). */
:root {
  --canvas: #f1f1f1;
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --text: #303030;
  --subdued: #616161;
  --faint: #8a8a8a;
  --border: #e3e3e3;
  --primary: #303030;
  --on-primary: #ffffff;
  --up: #29845a;
  --down: #c5280c;
  --live: #e51c00;
  --focus: #005bd3;
  --shadow: 0 1px 0 rgba(26, 26, 26, .07), 0 1px 0 0 rgba(204, 204, 204, .5) inset, 0 -1px 0 0 rgba(0, 0, 0, .17) inset, -1px 0 0 0 rgba(0, 0, 0, .13) inset, 1px 0 0 0 rgba(0, 0, 0, .13) inset;
  --radius: 12px;
  --tabs-h: 60px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #1a1a1a; --surface: #262626; --surface-2: #2e2e2e; --text: #e3e3e3; --subdued: #b5b5b5; --faint: #8a8a8a;
    --border: #3a3a3a; --primary: #f1f1f1; --on-primary: #1a1a1a; --up: #4fbf87; --down: #ff8a70; --focus: #7cb2ff;
    --shadow: 0 0 0 1px #343434 inset;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--text);
  font: 400 14px/1.45 Inter, -apple-system, "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num, .metric .v, .row .r, .live-row .r { font-variant-numeric: tabular-nums; }
.muted { color: var(--subdued); font-size: 12px; }
code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* sign in / set up */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; display: grid; gap: 14px; }
.login-card h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.login-card .sub { margin: -6px 0 4px; color: var(--subdued); }
.login-card label { display: grid; gap: 6px; font-weight: 550; font-size: 13px; }
input[type=email], input[type=password], input[type=search], input[type=number], select {
  width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 9px 11px; min-height: 40px;
}
button.primary { background: var(--primary); color: var(--on-primary); border: 0; border-radius: 8px; padding: 10px 14px; font-weight: 600; min-height: 42px; }
button.wide { width: 100%; margin-top: 12px; }
.error { color: var(--down); margin: 0; }
.link { border: 0; background: none; color: var(--focus); font-weight: 550; padding: 6px 2px; }

/* app frame */
#app { max-width: 760px; margin: 0 auto; padding: 0 12px calc(var(--tabs-h) + 24px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 5; background: var(--canvas); padding: calc(10px + env(safe-area-inset-top)) 0 10px; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.top h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.015em; }
.pill { border: 0; background: var(--surface); box-shadow: var(--shadow); border-radius: 999px; padding: 7px 12px; font-weight: 550; font-size: 13px; max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; box-shadow: 0 0 0 1px var(--border) inset; }
.seg button { border: 0; background: transparent; border-radius: 8px; padding: 7px 4px; font-weight: 550; font-size: 13px; color: var(--subdued); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

.tab { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; } /* long names must not widen the page */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 14px 12px; min-width: 0; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-h h2 { margin: 0; font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.foot { text-align: center; margin: 4px 0; }

/* live now: the one loud element */
.live { padding-bottom: 6px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(229, 28, 0, .5); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(229, 28, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(229, 28, 0, 0); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.live-list { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -14px; padding: 2px 14px 8px; scrollbar-width: none; }
.live-list::-webkit-scrollbar { display: none; }
.live-row { scroll-snap-align: start; flex: 0 0 auto; min-width: 150px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface); text-align: left; }
.live-row .n { display: flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.live-row .r { display: flex; gap: 12px; margin-top: 6px; font-size: 12px; color: var(--subdued); }
.live-row .r b { color: var(--text); font-size: 15px; font-weight: 650; display: block; }

/* metrics */
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.metric .k { color: var(--subdued); font-size: 13px; font-weight: 500; }
.metric .v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; line-height: 1.2; }
.metric .d { font-size: 12px; font-weight: 550; margin-top: 2px; display: inline-flex; align-items: center; gap: 3px; }
.d.up { color: var(--up); } .d.down { color: var(--down); } .d.flat { color: var(--faint); }
@media (min-width: 600px) { .metrics { grid-template-columns: repeat(4, 1fr); } }

/* charts */
.chart { position: relative; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart text { fill: var(--faint); font-size: 10px; font-family: inherit; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ln.warm { stroke-dasharray: 3 3; opacity: .55; }
.chart .guide { stroke: var(--faint); stroke-dasharray: 2 3; }
.chart .gift { stroke-width: 1.5; opacity: .9; }
.chart .raid { stroke: var(--text); stroke-dasharray: 3 3; opacity: .35; stroke-width: 1; }
.chart .mk { font-size: 9px; font-weight: 600; }
.card-h .muted { margin-left: auto; text-align: right; }
.expand { border: 0; background: transparent; color: var(--subdued); padding: 4px; margin: -4px -6px -4px 0; display: grid; place-items: center; align-self: center; }
.expand svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 11.5px; color: var(--faint); }
.key span, .tip .tmk { display: inline-flex; align-items: center; gap: 6px; }
.k-gift { display: inline-block; width: 2px; height: 12px; background: var(--subdued); flex: none; }
.k-raid { display: inline-block; width: 0; height: 12px; border-left: 2px dashed var(--subdued); flex: none; }
.tip .tmk { color: var(--subdued); font-size: 11.5px; white-space: normal; }

/* full-screen chart */
.fs { position: fixed; inset: 0; z-index: 25; background: var(--canvas); display: flex; flex-direction: column; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)); }
.fs-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.fs-top h2 { margin: 0; font-size: 17px; font-weight: 650; }
.fs-btns { display: flex; gap: 6px; flex: none; }
.fs-ctl { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips .lbl { font-size: 12px; color: var(--subdued); margin-right: 2px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.chip.on .k-raid { border-color: var(--on-primary); }
.chip.off { opacity: .45; text-decoration: line-through; }
.chip:disabled { opacity: .4; }
.fs { touch-action: pan-x pan-y; }
.fs-plot { flex: 1; min-height: 180px; display: flex; gap: 6px; }
.fs-xrow { padding-left: 30px; }
.rbar { position: relative; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; touch-action: none; user-select: none; -webkit-user-select: none; }
.rbar.rh { height: 30px; }
.rbar.rv { width: 24px; flex: none; }
.rbar .rsel { position: absolute; background: color-mix(in srgb, var(--focus) 28%, transparent); border: 1.5px solid var(--focus); border-radius: 7px; }
.rbar.rh .rsel { top: -1px; bottom: -1px; } .rbar.rv .rsel { left: -1px; right: -1px; }
.rbar .rgrip { position: absolute; background: var(--focus); border-radius: 4px; }
.rbar.rh .rgrip { top: 5px; bottom: 5px; width: 8px; } .rbar.rh .ra { left: 2px; } .rbar.rh .rb { right: 2px; }
.rbar.rv .rgrip { left: 5px; right: 5px; height: 8px; } .rbar.rv .ra { bottom: 2px; } .rbar.rv .rb { top: 2px; }
.rbar.drag .rsel { background: color-mix(in srgb, var(--focus) 40%, transparent); }
.fs-chart { flex: 1; min-width: 0; touch-action: pan-x pan-y; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); user-select: none; -webkit-user-select: none; }
.fs-chart svg { height: 100%; }
.fs-chart text { font-size: 11px; }
.fs-hint { margin: 0; font-size: 11.5px; }
@media (orientation: landscape) and (max-height: 500px) { .fs-hint { display: none; } .fs { gap: 6px; } }
.chart .empty { fill: var(--faint); font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 12px; color: var(--subdued); }
.legend i, .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tip { position: absolute; top: 0; z-index: 3; pointer-events: none; background: var(--surface); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.18), 0 0 0 1px var(--border); min-width: 150px; }
.tip .t { color: var(--subdued); margin-bottom: 4px; }
.tip div { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tip b { margin-left: auto; padding-left: 10px; font-variant-numeric: tabular-nums; }
.tip .tot { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; font-weight: 600; }

/* lists */
.rows { display: grid; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; }
.rows > .row:first-child { border-top: 0; }
.row .l { flex: 1; min-width: 0; }
.row { min-width: 0; }
.row .l .a { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .l .b { color: var(--subdued); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .r { text-align: right; font-weight: 600; white-space: nowrap; }
.row .r small { display: block; color: var(--subdued); font-weight: 400; font-size: 12px; }
.row.off { opacity: .45; }
.bar { height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 2px; }
.thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex: none; }
.check { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--faint); display: grid; place-items: center; flex: none; }
.row.sel .check { background: var(--primary); border-color: var(--primary); }
.row.sel .check::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--on-primary); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }

/* screenshots */
.filters { display: flex; gap: 8px; align-items: center; }
.filters select { width: auto; flex: 1; }
.inline { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; color: var(--subdued); }
.inline input { width: 72px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.shot { position: relative; aspect-ratio: 16 / 10; border: 0; padding: 0; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot span { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.66); color: #fff; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 6px; font-variant-numeric: tabular-nums; }

/* bottom tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-top: 1px solid var(--border); padding: 4px 0 calc(4px + env(safe-area-inset-bottom)); }
.tabs button { border: 0; background: none; display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 550; color: var(--faint); padding: 6px 0; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--text); }

/* bottom sheets */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet-body { width: min(560px, 100%); max-height: 80dvh; overflow: auto; background: var(--surface); border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet-body.tall { max-height: 92dvh; }
.p-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 4px 0 12px; }
.p-sub { margin: 14px 0 4px; font-size: 13px; font-weight: 650; }

/* full-screen viewer */
.viewer { position: fixed; inset: 0; z-index: 30; background: #000; color: #fff; overflow-y: auto; overscroll-behavior: contain; }
.viewer .v-top { position: sticky; top: 0; z-index: 2; background: #000; }
.v-top { display: flex; justify-content: space-between; align-items: center; padding: calc(10px + env(safe-area-inset-top)) 14px 8px; font-size: 13px; color: #c9c9c9; }
.v-btn { border: 0; background: rgba(255,255,255,.14); color: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 550; }
.v-stage { position: relative; display: flex; align-items: center; justify-content: center; touch-action: pan-y; background: #0b0b0b; overflow: hidden; }
.v-stage img { display: block; width: 100%; max-height: 62vh; object-fit: contain; user-select: none; -webkit-user-drag: none; transform-origin: 0 0; will-change: transform; }
.viewer.zoomed .v-nav { display: none; }
.viewer.zoomed .v-stage { touch-action: none; cursor: grab; }
.v-nav { position: absolute; top: 0; bottom: 0; width: 22%; border: 0; background: none; color: #fff; display: grid; align-content: center; justify-items: center; gap: 4px; opacity: .85; }
.v-nav.prev { left: 0; } .v-nav.next { right: 0; }
.v-nav span { font-size: 44px; line-height: 1; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.v-nav small { font-size: 11px; color: #c9c9c9; text-shadow: 0 1px 4px #000; }
.v-nav:disabled { opacity: .15; }
.v-cap { padding: 12px 16px 4px; display: grid; gap: 4px; font-size: 13px; color: #d4d4d4; }
.v-bids { padding: 4px 16px calc(24px + env(safe-area-inset-bottom)); color: #d4d4d4; font-size: 13px; }
.v-muted { color: #9a9a9a; font-size: 12.5px; }
.v-sec { margin: 16px 0 6px; font-size: 13px; font-weight: 650; color: #fff; }
.v-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.v-stats > div { background: #161616; border-radius: 10px; padding: 8px 10px; }
.v-stats .k { font-size: 11.5px; color: #9a9a9a; }
.v-stats .v { font-size: 16px; font-weight: 650; color: #fff; font-variant-numeric: tabular-nums; }
.bidchart { position: relative; background: #121212; border-radius: 10px; padding: 6px 4px 2px; touch-action: pan-y; }
.bidchart svg { display: block; width: 100%; height: auto; overflow: visible; }
.bidchart .grid { stroke: #2a2a2a; }
.bidchart text { fill: #8a8a8a; font-size: 10px; font-family: inherit; }
.bidchart .step { fill: none; stroke: #e3e3e3; stroke-width: 1.6; stroke-linejoin: round; opacity: .75; }
.bidchart .sel { fill: none; stroke-width: 2; }
.bidchart .tip { background: #1f1f1f; color: #e3e3e3; box-shadow: 0 4px 16px rgba(0,0,0,.5), 0 0 0 1px #333; }
.bidders { display: grid; gap: 6px; }
.bidder { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 4px 8px; text-align: left; border: 0; background: #161616; color: #e3e3e3; border-radius: 10px; padding: 8px 10px; }
.bidder b { font-weight: 600; } .bidder > span:last-child { grid-column: 2 / -1; color: #9a9a9a; font-size: 12px; }
.bidder .won { justify-self: start; background: #12915a; color: #fff; border-radius: 999px; font-size: 10.5px; font-weight: 650; padding: 1px 7px; }
.bidtable { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.bidtable th { text-align: left; color: #8a8a8a; font-weight: 500; padding: 4px 6px; border-bottom: 1px solid #2a2a2a; }
.bidtable td { padding: 6px; border-bottom: 1px solid #1c1c1c; white-space: nowrap; }
.bidtable .num { text-align: right; } .bidtable .g { color: #8a8a8a; }
.bidtable a { color: #e3e3e3; }
.v-cap .it { color: #fff; font-size: 15px; font-weight: 600; }
.v-cap .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.v-cap a { color: #fff; }
@media (hover: none) { .v-nav small { display: none; } }

/* rolling numbers */
/* every rolling number uses the same line height as its rolling box, so digits stay level */
[data-roll] { line-height: 1.2; }
.rc { display: inline-block; height: 1.2em; line-height: 1.2em; vertical-align: top; }
.roll { overflow: hidden; }
.rs { display: flex; flex-direction: column; animation: rollIn .55s cubic-bezier(.22, .9, .3, 1) both; }
.rs > span { display: block; height: 1.2em; }
@keyframes rollIn { from { transform: translateY(-1.2em); } to { transform: translateY(0); } }
.rflash { animation: rflash 1.2s ease-out; }
@keyframes rflash { 0%, 30% { color: var(--up); } 100% { color: inherit; } }
@media (prefers-reduced-motion: reduce) { .rs, .rflash { animation: none; } }
.p-stores { margin-top: 8px; }
.p-stores .chip b { font-weight: 650; }
.chip.dim { opacity: .55; }
.chip.on .dot { box-shadow: 0 0 0 2px var(--on-primary); }
.p-hint { margin: 6px 0 0; }
.thumb.none { display: grid; place-items: center; font-size: 10px; color: var(--faint); text-align: center; line-height: 1.2; }
.top-sort { margin: 2px 0 6px; }
.row.cust .rank { width: 22px; flex: none; text-align: right; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.sdots { display: inline-flex; gap: 3px; margin-left: 4px; vertical-align: middle; }
.more { width: 100%; border: 0; background: var(--surface-2); color: var(--text); border-radius: 8px; padding: 10px; margin-top: 8px; font-weight: 550; }
.foot-note { margin: 10px 0 0; }

/* loading: a bar across the top, faded content, shimmering placeholders */
body::before { content: ''; position: fixed; z-index: 40; top: 0; left: 0; right: 0; height: 3px; pointer-events: none; opacity: 0; transition: opacity .2s;
  background: linear-gradient(90deg, transparent 0, var(--focus) 30%, var(--focus) 50%, transparent 80%) 0 0 / 50% 100% no-repeat; }
body.loading::before { opacity: 1; animation: loadbar 1.1s ease-in-out infinite; }
@keyframes loadbar { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.tab, #liveCard { transition: opacity .25s; }
body.loading .tab:not([hidden]), body.stale .tab:not([hidden]) { opacity: .45; }
.skel { display: grid; }
.sk-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--border); }
.sk-l { flex: 1; display: grid; gap: 7px; }
.sk { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 60%, var(--subdued)) 45%, var(--surface-2) 65%) 0 0 / 300% 100%; animation: shimmer 1.2s linear infinite; }
.sk-thumb { width: 52px; height: 52px; border-radius: 8px; flex: none; }
.sk-a { height: 12px; width: 70%; } .sk-b { height: 10px; width: 45%; } .sk-r { width: 54px; height: 14px; flex: none; }
.v-dark .sk-row { border-color: #1c1c1c; } .v-dark .sk { --surface-2: #1a1a1a; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
@media (prefers-reduced-motion: reduce) { body.loading::before, .sk { animation: none; } }
