/* ============================================================
   Poly Sniper dashboard V2 — app-level styles on top of the DS kit.
   Login / boot / toasts / modal scaffolding (kit.css covers the pages).
   ============================================================ */

:root {
  --dashboard-surface: #fff;
  --dashboard-divider: #e6e5e1;
  --dashboard-control-border: #d5d3cf;
  --dashboard-hover: #f4f3f0;
  --dashboard-ink: #37352f;
  --dashboard-muted: #65645f;
  --dashboard-positive: #24734d;
  --dashboard-danger: #a83232;
  --dashboard-primary: #255a45;
  --dashboard-primary-hover: #204e3c;
  --runner-stop: #faecec;
  --runner-stop-hover: #f5dfdf;
}
[data-theme="dark"] {
  --dashboard-surface: #191919;
  --dashboard-divider: #373735;
  --dashboard-control-border: #64635f;
  --dashboard-hover: #292928;
  --dashboard-ink: #e7e6e3;
  --dashboard-muted: #afaeaa;
  --dashboard-positive: #72c699;
  --dashboard-danger: #f28e86;
  --dashboard-primary-hover: #2d6951;
  --runner-stop: #392828;
  --runner-stop-hover: #472f2f;
}

@font-face {
  font-family: "Geist";
  src: url("/brand/geist-counterpoint-700.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  unicode-range: U+43, U+65, U+69, U+6E-70, U+72, U+74-75;
}
.product-brand {
  display: flex; align-items: center; gap: .45em;
  margin: 0; color: inherit; white-space: nowrap;
  font: 700 1.375rem/1.15 "Geist", var(--font-sans);
  letter-spacing: -.035em;
}
.product-brand-mark {
  width: 1.25em; height: 1.25em; flex: none; background-color: currentColor;
  mask: url("/brand/counterpoint.png") center / contain no-repeat;
}

/* ---- Boot + Login ---- */
:is(.login-shell, .boot-shell) {
  min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center;
  background: var(--dashboard-canvas);
}
.login-shell { padding: 24px; color: var(--dashboard-ink); }
.login-panel {
  width: min(100%, 384px);
  padding: 30px 32px 32px;
  background: var(--dashboard-surface);
  border: 1px solid var(--dashboard-divider);
  border-radius: 8px;
}
.login-brand { padding-bottom: 24px; margin-bottom: 20px; border-bottom: 1px solid var(--dashboard-divider); }
.login-brand .product-brand { justify-content: center; font-size: clamp(21px, 8.5vw, 28px); }
.login-form { display: grid; gap: 14px; }
.login-field { display: grid; gap: 6px; }
.login-label { font-size: 14px; font-weight: var(--fw-semibold); }
.login-input {
  height: 36px; min-width: 0; padding: 0 10px;
  border: 1px solid var(--dashboard-divider); border-radius: 5px;
  background: var(--dashboard-hover); color: var(--dashboard-ink);
  font: 14px/1 var(--font-sans);
}
.login-input:focus-visible, .login-form .ps-btn:focus-visible {
  outline: 2px solid var(--dashboard-positive); outline-offset: 2px;
}
.login-error { margin: 0; font-size: 13px; color: var(--dashboard-danger); }
.login-form .ps-btn.dashboard-primary-action.v-primary { width: 100%; height: 36px; margin-top: 4px; }
.login-form .ps-btn .ps-spinner {
  border-color: rgb(255 255 255 / 45%); border-top-color: #fff;
}
@media (max-width: 420px) {
  .login-shell { padding: 16px; }
  .login-panel { padding: 24px; }
}

/* ---- Spinner ---- */
.ps-spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--dashboard-divider);
  border-top-color: var(--dashboard-positive); display: inline-block;
  animation: psspin 0.7s linear infinite;
}
.ps-spinner.sm { width: 15px; height: 15px; border-width: 2px; }
@keyframes psspin { to { transform: rotate(360deg); } }

/* ---- Toasts ---- */
.toast-stack {
  position: fixed; right: 16px; bottom: 16px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100% - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border-radius: 6px;
  background: var(--dashboard-surface); border: 1px solid var(--dashboard-control-border);
  font-size: 13px; color: var(--dashboard-ink);
  animation: toastIn var(--dur-base) var(--ease-out);
}
.toast .t-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--dashboard-muted); }
.toast.err .t-dot { background: var(--dashboard-danger); }
.toast.ok .t-dot { background: var(--dashboard-positive); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Modal scaffolding (follow detail / wallet follows) ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 150;
  display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(20px, 8dvh, 72px) 20px 24px; overflow: hidden;
  background: rgb(34 32 28 / 25%);
  animation: overlayIn var(--dur-fast) var(--ease-out);
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  display: flex; flex-direction: column; width: 100%; max-width: 880px; max-height: 100%;
  background: var(--dashboard-surface); color: var(--dashboard-ink);
  border: 1px solid var(--dashboard-divider); border-radius: 10px;
  box-shadow: 0 6px 26px rgb(0 0 0 / 10%);
}
.modal-head {
  display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--dashboard-divider);
}
.modal-title { font: var(--fw-semibold) 16px / var(--lh-snug) var(--font-sans); margin: 0; letter-spacing: var(--ls-title); }
.modal-title-logo { width: 36px; height: 36px; object-fit: contain; flex: none; display: block; }
.modal-title-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: var(--sp-3); transition: color var(--dur-fast) var(--ease-out); }
.modal-title-link:hover { color: var(--accent); }
.modal-title-link [data-lucide] { width: 16px; height: 16px; color: var(--text-tertiary); flex: none; transition: color var(--dur-fast) var(--ease-out); }
.modal-title-link:hover [data-lucide] { color: var(--accent); }
.modal-close {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 30px; height: 30px; border: 0; border-radius: 5px; cursor: pointer;
  background: var(--dashboard-hover); color: var(--dashboard-muted);
}
.modal-close:hover { color: var(--dashboard-ink); }
.modal-body { display: flex; flex-direction: column; min-height: 0; padding: 0 20px 16px; }
/* small inline helper */
.inline-spin-row { display: inline-flex; align-items: center; gap: var(--sp-2); }

/* ---- Overview ---- */
body.dashboard-canvas:has(.overview-scroll) { height: 100dvh; min-height: 100dvh; }
#root:has(.overview-scroll), .app-shell:has(.overview-scroll) { height: 100dvh; }
.page-scroll.overview-scroll {
  --overview-chart-height: clamp(188px, 30dvh, 286px);
  padding: 24px clamp(20px, 3.2vw, 48px) 20px;
  background: var(--dashboard-surface);
  color: var(--dashboard-ink);
  scrollbar-color: var(--dashboard-control-border) transparent;
}
.overview-page { max-width: 1120px; gap: 0; }
.overview-page h2 { margin: 0; font: var(--fw-semibold) 20px/1.25 var(--font-sans); }
.overview-page .pnl-up { color: var(--dashboard-positive); }
.overview-page .pnl-down { color: var(--dashboard-danger); }
.overview-page :is(svg, button):focus-visible { outline: 2px solid var(--dashboard-ink); outline-offset: 2px; }

.ov-profit-metrics {
  display: grid; grid-template-columns: minmax(0, 1.45fr) repeat(3, minmax(0, 1fr));
  margin: 0; padding-bottom: 14px; border-bottom: 1px solid var(--dashboard-divider);
}
.ov-profit-metrics > div { min-width: 0; padding-inline: 18px; }
.ov-profit-metrics > div:first-child { padding-inline-start: 0; }
.ov-profit-metrics > div:last-child { padding-inline-end: 0; }
.ov-profit-metrics > div + div { border-inline-start: 1px solid var(--dashboard-divider); }
.ov-profit-metrics dt, .ov-win-total span { color: var(--dashboard-muted); font-size: 13px; }
.ov-profit-metrics dd {
  margin: 6px 0 0; font: var(--fw-semibold) 22px/1.2 var(--font-sans);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.ov-profit-value { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 10px; }
.ov-profit-value > strong { font-size: 26px; font-weight: var(--fw-bold); }
.ov-roi { font-size: 13px; }

.ov-profit-chart { padding-block: 16px 14px; border-bottom: 1px solid var(--dashboard-divider); }
.ov-profit-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 8px; }
.ov-profit-head h2 { font-size: 24px; }
.ov-profit-head .ps-segmented { gap: 4px; padding: 0; border: 0; background: transparent; }
.ov-profit-head .ps-segmented .ps-segmented-opt {
  height: 32px; padding: 0 12px; border-bottom: 1px solid transparent; border-radius: 0;
  background: transparent; box-shadow: none; color: var(--dashboard-muted); font-weight: var(--fw-medium);
}
.ov-profit-head .ps-segmented .ps-segmented-opt.active {
  color: var(--dashboard-ink); font-weight: var(--fw-semibold); border-bottom-color: currentColor;
}
.ov-profit-head .ps-segmented .ps-segmented-opt:hover { color: var(--dashboard-ink); background: var(--dashboard-hover); }

.ov-chart, .ov-chart-empty { height: var(--overview-chart-height); }
.ov-chart { position: relative; min-width: 0; }
.ov-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ov-chart text { fill: var(--dashboard-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ov-chart-grid, .ov-chart-zero { stroke: var(--dashboard-divider); }
.ov-chart-grid { stroke-dasharray: 2 4; }
.ov-chart-crosshair { stroke: var(--ov-line); stroke-opacity: .45; stroke-dasharray: 3 4; }
.ov-chart-tooltip {
  position: absolute; top: 12px; display: grid; gap: 4px; padding: 6px 10px;
  border: 1px solid var(--dashboard-control-border); border-radius: 5px;
  background: var(--dashboard-surface); color: var(--dashboard-muted); font-size: 12px;
  white-space: nowrap; pointer-events: none;
}
.ov-chart-empty { display: grid; place-items: center; color: var(--dashboard-muted); }

.ov-support-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; padding-top: 16px; }
.ov-win-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.ov-win-total > strong { color: var(--dashboard-positive); font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ov-win-row {
  display: grid; grid-template-columns: minmax(84px, .8fr) 3.5ch minmax(18px, 1fr) max-content;
  align-items: center; gap: 8px; min-height: 36px; border-bottom: 1px solid var(--dashboard-divider);
}
.ov-win-game { display: flex; align-items: center; gap: 6px; font-weight: var(--fw-semibold); font-size: 13px; white-space: nowrap; }
.ov-win-pct, .ov-win-counts { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.ov-win-counts { color: var(--dashboard-muted); }
.ov-win-bar { height: 5px; border-radius: var(--r-pill); background: var(--dashboard-divider); overflow: hidden; }
.ov-win-bar[style] { background: color-mix(in srgb, var(--dashboard-danger) 55%, var(--dashboard-surface)); }
.ov-win-bar[style]::before {
  content: ""; display: block; width: var(--win-share); height: 100%;
  background: color-mix(in srgb, var(--dashboard-positive) 85%, var(--dashboard-surface));
}

.ov-twostat { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 16px 0; }
.ov-twostat > .ps-stat + .ps-stat { border-inline-start: 1px solid var(--dashboard-divider); padding-inline-start: 16px; }
.overview-page .ov-twostat .ps-stat .ps-stat-label { color: var(--dashboard-muted); letter-spacing: normal; font-size: 13px; }
.overview-page .ov-twostat .ps-stat .ps-stat-value { color: var(--dashboard-positive); font-size: 24px; }
.ov-link-num {
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; cursor: pointer;
}
.ov-link-num:hover { text-decoration: underline; }
.health-panel { border-top: 1px solid var(--dashboard-divider); }
.hp-row { display: flex; align-items: center; gap: 8px; min-height: 38px; padding-block: 6px; }
.hp-row + .hp-row { border-top: 1px solid var(--dashboard-divider); }
.hp-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--dashboard-muted); }
.hp-dot.ok { background: var(--dashboard-positive); }
.hp-dot.warn { background: var(--status-warn); }
.hp-ico { width: 15px; height: 15px; color: var(--dashboard-muted); flex: none; }
.hp-name { font-size: 13px; font-weight: var(--fw-medium); white-space: nowrap; }
.hp-chip {
  font-size: 11px; font-weight: var(--fw-semibold); padding: 2px 6px; border-radius: 5px;
  white-space: nowrap; color: var(--dashboard-muted); background: var(--dashboard-hover);
}
.hp-chip.t-up { color: var(--dashboard-positive); background: color-mix(in srgb, var(--dashboard-positive) 14%, var(--dashboard-surface)); }
.hp-chip.t-warn { color: var(--status-warn); background: var(--status-warn-soft); }
.hp-spacer { flex: 1; }
.hp-detail { font-size: 12px; color: var(--dashboard-muted); text-align: right; }

@media (min-width: 881px) and (max-height: 700px) {
  .page-scroll.overview-scroll {
    --overview-chart-height: clamp(160px, 27.5dvh, 216px);
    padding-block: 16px 14px;
  }
  .ov-support-grid { padding-top: 12px; }
  .ov-win-total { margin-block: 8px 5px; }
  .ov-win-row { min-height: 31px; }
}
@media (max-width: 880px) {
  .page-scroll.overview-scroll {
    --overview-chart-height: clamp(120px, 20dvh, 176px);
    padding: 8px 14px 12px;
  }
  .overview-page h2 { font-size: 17px; }
  .ov-profit-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: 0; }
  .ov-profit-metrics > div { padding: 5px 0 5px 12px; }
  .ov-profit-metrics > div:nth-child(odd) { border-inline-start: 0; padding-inline-start: 0; padding-inline-end: 8px; }
  .ov-profit-metrics > div:nth-child(n+3) { border-top: 1px solid var(--dashboard-divider); }
  .ov-profit-metrics dt { font-size: 12px; }
  .ov-profit-metrics dd { margin-top: 3px; }
  .ov-profit-metrics dd, .ov-profit-value > strong { font-size: 17px; }
  .ov-roi { font-size: 12px; line-height: 1.15; }
  .ov-profit-chart { padding-block: 8px 6px; }
  .ov-profit-head { margin-bottom: 4px; }
  .ov-profit-head .ps-segmented { margin-inline-start: auto; }
  .ov-profit-head .ps-segmented .ps-segmented-opt { height: 30px; padding-inline: 7px; font-size: 12px; }
  .ov-chart text { font-size: 11px; }
  .ov-support-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; padding-top: 10px; }
  .ov-ops { border-top: 1px solid var(--dashboard-divider); padding-top: 8px; }
  .ov-win-total { margin: 5px 0 3px; }
  .ov-win-total > strong, .overview-page .ov-twostat .ps-stat .ps-stat-value { font-size: 20px; }
  .ov-win-row { grid-template-columns: 76px 3.5ch minmax(12px, 1fr) max-content; gap: 5px; min-height: 25px; }
  .ov-win-game { gap: 4px; font-size: 12px; }
  .ov-twostat { margin-block: 6px 7px; }
  .ov-twostat > .ps-stat { gap: 2px; }
  .hp-row { gap: 5px; min-height: 27px; padding-block: 3px; }
}
@media (max-width: 640px) {
  .ov-profit-value { display: grid; gap: 2px; }
}
@media (max-width: 880px) and (max-height: 700px) {
  .page-scroll.overview-scroll {
    --overview-chart-height: clamp(110px, 17.7dvh, 124px);
    padding-block: 6px 8px;
  }
  .ov-profit-metrics > div { padding-block: 4px; }
  .ov-profit-chart { padding-block: 7px 5px; }
}

/* ---- Topbar actions and status ---- */
.topbar .topbar-actions .ps-btn {
  height: 30px; gap: 6px; padding: 0 9px; border-radius: 5px;
  font-size: 13px; color: var(--dashboard-ink); background: transparent;
  box-shadow: none; backdrop-filter: none;
}
.topbar-actions .ps-btn svg { width: 14px; height: 14px; flex: none; }
.topbar .topbar-actions .ps-btn:hover { background: var(--dashboard-hover); }
.topbar .topbar-actions .v-danger { color: var(--dashboard-danger); background: var(--runner-stop); }
.topbar .topbar-actions .v-danger:hover { background: var(--runner-stop-hover); }
.ps-btn.dashboard-primary-action.v-primary {
  height: 30px; gap: 6px; padding: 0 9px; border-radius: 5px;
  color: #fff; background: var(--dashboard-primary); border-color: transparent;
  box-shadow: none; backdrop-filter: none;
}
.ps-btn.dashboard-primary-action.v-primary:hover { background: var(--dashboard-primary-hover); filter: none; }
.topbar .topbar-actions .ps-btn:disabled {
  color: var(--dashboard-muted); background: var(--dashboard-hover);
  border-color: var(--dashboard-divider); opacity: .7;
}
.topbar :is(.ps-btn, .tb-tip):focus-visible { outline: 2px solid var(--dashboard-ink); outline-offset: 2px; }
.topbar-actions .ps-statuspill {
  padding: 0; gap: 6px; border: 0; font-weight: var(--fw-medium);
  background: transparent; color: var(--dashboard-muted);
}
.topbar-actions .ps-statuspill.live { background: transparent; color: var(--dashboard-positive); }
.topbar-actions .ps-statuspill .ps-status-dot { width: 7px; height: 7px; background: currentColor; }
.topbar-actions .ps-statuspill.live .ps-status-dot { background: currentColor; box-shadow: none; animation: none; }

.tb-tip { position: relative; display: inline-flex; }
.tb-tip.disabled::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  width: max-content; max-width: min(240px, calc(100vw - 108px));
  padding: 6px 10px; border-radius: 5px;
  background: var(--dashboard-surface); color: var(--dashboard-ink);
  border: 1px solid var(--dashboard-control-border);
  font: var(--fw-medium) var(--fs-footnote)/1.2 var(--font-sans);
  visibility: hidden; pointer-events: none;
}
.tb-tip.disabled:is(:hover, :focus)::after { visibility: visible; }

/* Strategy overview band now holds only the pipeline summary (action buttons removed) */

/* ---- Watched events ---- */
.events-page { gap: 16px; }
.events-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; }
.events-toolbar .ps-tabs { gap: 16px; border-color: var(--dashboard-divider); }
.events-toolbar .ps-tabs .ps-tab { padding: 10px 2px; color: var(--dashboard-muted); font-size: 13px; white-space: nowrap; }
.events-toolbar .ps-tabs .ps-tab.active { color: var(--dashboard-ink); }
.events-toolbar .ps-tab .ps-tab-count { color: var(--dashboard-muted); }
.events-toolbar .ps-tab.active .ps-tab-count { color: var(--dashboard-ink); }
.events-toolbar .ps-tab.active::after { height: 1px; background: var(--dashboard-ink); }
.events-toolbar .filter-group label { color: var(--dashboard-muted); letter-spacing: normal; }
.events-toolbar .ps-select {
  height: 30px; padding-inline-start: 10px; border-radius: 5px; color: var(--dashboard-ink);
  background-color: var(--dashboard-hover); border-color: var(--dashboard-divider);
}

.events-table-scroll { container-type: inline-size; scrollbar-color: var(--dashboard-control-border) transparent; }
.ps-table.events-table { table-layout: fixed; min-width: 870px; }
.events-table .watched-event-col { width: 320px; }
.events-table .watched-matchup-col { width: 23%; }
@container (width < 1040px) {
  .events-table .watched-time-col { width: 160px; }
}
.ps-table.events-table :is(th, td) { padding: 9px 10px; border-color: var(--dashboard-divider); }
.ps-table.events-table th { background: var(--dashboard-hover); color: var(--dashboard-muted); letter-spacing: normal; }
.events-table :is(th, td):nth-child(2) { text-align: center; }
.ps-table.events-table tbody tr:last-child td { border-bottom: 1px solid var(--dashboard-divider); }
.events-table td { font-size: 13px; }
.events-table td .muted { color: var(--dashboard-muted); }
.events-table td .pnl-up.strong { color: var(--dashboard-positive); }
.events-table td .pnl-down.strong { color: var(--dashboard-danger); }

.watched-event-title { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; }
.watched-event-name {
  display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--dashboard-ink); font-weight: var(--fw-semibold); text-decoration: none;
}
a.watched-event-name:hover { text-decoration: underline; text-underline-offset: 2px; }
.watched-event-more {
  display: none; position: absolute; inset-inline-end: 0;
  width: 28px; height: 28px; align-items: center; justify-content: center; padding: 0;
  border: 0; border-radius: 5px; background: var(--dashboard-hover); color: var(--dashboard-ink);
  cursor: pointer; font: var(--fw-semibold) 15px/1 var(--font-sans);
}
.watched-event-tooltip {
  position: fixed; z-index: 70; width: max-content; max-width: min(320px, calc(100vw - 16px));
  padding: 6px 9px; border: 1px solid var(--dashboard-control-border); border-radius: 5px;
  background: var(--dashboard-surface); color: var(--dashboard-ink);
  box-shadow: 0 3px 10px rgb(0 0 0 / 10%); font-size: 12px; overflow-wrap: anywhere;
}

.watched-matchup {
  display: grid; justify-items: center; gap: 2px; line-height: 1.25;
  font-weight: var(--fw-semibold); overflow-wrap: anywhere;
}
.watched-team-a { color: #a14831; }
.watched-team-b { color: #19716b; }
[data-theme="dark"] .watched-team-a { color: #f1957c; }
[data-theme="dark"] .watched-team-b { color: #67bdb3; }
.watched-vs {
  position: relative; isolation: isolate; display: inline-block; width: 32px; height: 22px;
  color: var(--dashboard-ink); font-family: "Arial Black", system-ui, sans-serif; font-weight: 900; line-height: 1;
}
.watched-vs > span, .watched-vs::before, .watched-vs::after { position: absolute; }
.watched-vs > span:first-child { left: 4px; top: 0; font-size: 18px; }
.watched-vs > span:last-child { right: 4px; bottom: 0; font-size: 15px; }
.watched-vs::before, .watched-vs::after {
  content: ""; z-index: 1; left: 50%; top: 50%; height: 24px;
  transform: translate(-50%, -50%) rotate(27deg);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.watched-vs::before { width: 5px; background: var(--dashboard-surface); }
.watched-vs::after { width: 1.8px; background: currentColor; }

.watched-event-times {
  display: grid; grid-template-columns: 4em minmax(0, 1fr); gap: 3px 4px;
  font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.watched-event-times > span:nth-child(odd) { color: var(--dashboard-muted); }
:is(.events-table, .wallet-follows-table) .ps-badge { padding: 0 7px; border-radius: 5px; }
:is(.events-table, .wallet-follows-table) .ps-badge.t-up {
  color: var(--dashboard-positive); background: color-mix(in srgb, var(--dashboard-positive) 12%, var(--dashboard-surface));
}
.events-table .ps-badge.t-accent { color: var(--dashboard-danger); background: var(--runner-stop); }
:is(.events-table, .wallet-follows-table) .ps-badge.t-warn { color: #805617; background: #f7eed9; }
[data-theme="dark"] :is(.events-table, .wallet-follows-table) .ps-badge.t-warn { color: #e3b675; background: #352d20; }
.event-follow-count { color: var(--dashboard-positive); font-weight: var(--fw-bold); }

@media (max-width: 640px), (hover: none) {
  .watched-event-title { padding-inline-end: 32px; }
  .watched-event-title:has(.watched-event-more) .watched-event-name { text-overflow: clip; }
  .watched-event-more { display: inline-flex; }
}
@media (max-width: 640px) {
  .events-toolbar { gap: 5px 8px; }
  .events-toolbar .ps-tabs { gap: 8px; }
  .events-toolbar .filter-group { margin-inline-start: auto; }
  .ps-table.events-table { min-width: 725px; }
  .events-table .watched-event-col { width: 248px; }
  .events-table .watched-matchup-col { width: 24%; }
  .events-table .watched-time-col { width: 150px; }
  .events-table .watched-status-col { width: 86px; }
  .watched-event-times { grid-template-columns: 3.7em minmax(0, 1fr); }
}

/* Follow list */
.follows-page .events-toolbar .ps-btn {
  height: 30px; border: 1px solid var(--dashboard-divider); border-radius: 5px;
  background: var(--dashboard-hover); color: var(--dashboard-ink);
}
.follows-page .events-toolbar .ps-btn:hover { border-color: var(--dashboard-control-border); }
.ps-table.follows-table { min-width: 1020px; }
.follows-table .follow-matchup-col { width: 17%; }
.follows-table .follow-time-col { width: 15%; }
.follows-table .follow-market-col { width: 13%; }
.follows-table .follow-pnl-col { width: 9%; }
.ps-table.follows-table :is(th, td):last-child:not(.empty-cell) { text-align: end; padding-inline-end: 16px; }
.ps-table.follows-table tbody tr.clickable:hover { background: var(--dashboard-hover); }
.follow-event-trigger {
  padding: 0; border: 0; background: transparent; text-align: start;
  font-size: inherit; font-family: inherit; cursor: pointer;
}
.follow-market-status { display: grid; justify-items: start; gap: 4px; }
.follow-market-status > strong { font-weight: var(--fw-semibold); }
.follow-market-status .evt-status { flex-flow: row wrap; align-items: center; gap: 5px; }
.events-table.follows-table .ps-badge.t-accent { color: var(--dashboard-muted); background: var(--dashboard-hover); }
.follows-table .ps-badge.t-down { color: var(--dashboard-danger); background: var(--runner-stop); }
.follow-list-summary { display: grid; gap: 3px; color: var(--dashboard-muted); line-height: 1.35; font-size: 12px; }
.follow-list-summary strong { color: var(--dashboard-ink); font-weight: var(--fw-semibold); white-space: nowrap; }
.follow-team-counts, .follow-team-count { display: flex; align-items: baseline; min-width: 0; }
.follow-team-counts { gap: 5px; }
.follow-team-count strong { flex: none; }
.follow-team-label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: var(--fw-semibold); }
.follow-pnl-value { font-weight: var(--fw-semibold); white-space: nowrap; }
.follows-table .pnl-up { color: var(--dashboard-positive); }
.follows-table .pnl-down { color: var(--dashboard-danger); }

@media (max-width: 640px) {
  .ps-table.follows-table { min-width: 920px; }
  .follows-page .events-toolbar .filter-group { margin-inline-start: 0; }
}

/* Follow details */
.follow-detail-modal { max-width: 1180px; }
.follow-detail-heading {
  display: flex; align-items: center; justify-content: space-between;
  flex: 1 1 auto; flex-wrap: wrap; gap: 10px 20px; min-width: 0;
}
.follow-detail-event { display: flex; align-items: center; gap: 10px; flex: 1 1 430px; min-width: 0; }
.follow-detail-event > div:last-child { min-width: 0; }
.follow-detail-event .modal-title { overflow-wrap: anywhere; letter-spacing: normal; }
.follow-detail-heading .modal-title-link { gap: 7px; }
.follow-detail-heading .modal-title-link:hover { color: var(--dashboard-positive); }
.follow-detail-heading .modal-title-link svg { color: var(--dashboard-muted); }
.follow-detail-market { color: var(--dashboard-muted); font-size: 12px; }
.follow-detail-matchup {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px 10px; max-width: 100%;
  padding-inline-start: 14px; border-inline-start: 1px solid var(--dashboard-divider);
}
.follow-detail-teams { display: flex; align-items: center; gap: 6px; min-width: 0; }
.follow-detail-teams .watched-vs { flex: none; }
.follow-quote-label { color: var(--dashboard-muted); font-size: 12px; }
.follow-quote-side { display: flex; align-items: baseline; gap: 5px; min-width: 0; font-size: 13px; }
.follow-quote-team {
  max-width: 15ch; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-weight: var(--fw-semibold);
}
.follow-quote-side strong { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); }
.follow-quote-side .muted { color: var(--dashboard-muted); }
:is(.wallet-grid-scroll, .wallet-follows-scroll) {
  width: 100%; min-height: 0; overflow: auto; overscroll-behavior: contain;
  scrollbar-gutter: stable; scrollbar-color: var(--dashboard-control-border) transparent;
}
.wallet-block-list {
  display: grid; min-width: 834px;
  grid-template-columns: 36px 46px 134px minmax(164px, 1fr) 126px 144px 104px 80px;
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.wallet-block-list :is(.wallet-grid-head, .wallet-block, .wallet-block-head, .wallet-legs,
    .wallet-legs-content, .wallet-trades, .wallet-trade-row) {
  display: grid; grid-column: 1 / -1; grid-template-columns: subgrid;
}
.wallet-block-list .wallet-legs[hidden] { display: none; }
.wallet-grid-head, .wallet-block-head, .wallet-trade-row {
  align-items: center; border-bottom: 1px solid var(--dashboard-divider);
}
.wallet-grid-head > *, .wallet-block-head > *, .wallet-trade-row > * { min-width: 0; }
.wallet-grid-head, .wallet-trade-head { color: var(--dashboard-muted); font-size: 12px; font-weight: var(--fw-semibold); }
.wallet-grid-head { min-height: 37px; }
.wallet-grid-head > :first-child { grid-column: 1 / 5; padding-inline-start: 36px; }
.wallet-block-head { min-height: 48px; cursor: pointer; }
.wallet-block.is-open .wallet-block-head, .wallet-block-head:focus-within {
  background: var(--dashboard-hover); border-radius: 5px;
}
@media (hover: hover) {
  .wallet-block-head:hover { background: var(--dashboard-hover); border-radius: 5px; }
}
.wallet-toggle-cell { justify-self: center; }
.wlb-toggle {
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 5px; background: transparent; color: var(--dashboard-muted); cursor: pointer;
}
.wlb-toggle:focus-visible, .wallet-grid-scroll:focus-visible { outline: 2px solid var(--dashboard-ink); outline-offset: -2px; }
.wlb-toggle .wlb-chev { width: 16px; height: 16px; transform: rotate(-90deg); transition: transform 120ms ease-out; }
.wallet-block.is-open .wlb-chev { transform: none; }
.wallet-block-head .ps-wallet { display: inline-grid; grid-template-columns: 11ch 22px; font-size: 12px; }
.wallet-block-head .ps-wallet-addr:hover { color: var(--dashboard-positive); }
.wallet-block-head .side-chips { gap: 4px; padding-inline-end: 10px; }
.wallet-block-head .side-chip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.wallet-block-head .side-chip::before { flex: none; }
.wallet-metric { font-weight: var(--fw-semibold); white-space: nowrap; }
.wallet-block-list .pnl-up { color: var(--dashboard-positive); }
.wallet-block-list .pnl-down { color: var(--dashboard-danger); }
.wlb-cnt {
  justify-self: start; padding: 2px 6px; border-radius: 4px;
  background: var(--dashboard-hover); color: var(--dashboard-muted); font-size: 11px; white-space: nowrap;
}
.wlb-cnt span { color: var(--status-warn); }

.wallet-legs-content { padding-block: 10px 6px; }
.wallet-trade-row { min-height: 60px; }
.wallet-trade-head { min-height: 33px; border: 0; border-radius: 5px; background: var(--dashboard-hover); }
.wallet-trade-row > :first-child { grid-column: 2 / 4; }
.wallet-trade-row > :nth-child(2) { grid-column: 4; padding-inline-end: 8px; }
.wallet-trade-row > :nth-child(3) { grid-column: 5; }
.wallet-trade-row > :nth-child(4) { grid-column: 6; }
.wallet-trade-row > :nth-child(5) { grid-column: 7; }
.wallet-trade-direction { display: grid; justify-items: start; gap: 3px; padding: 6px 8px 6px 0; }
.wallet-trade-team { display: block; max-width: 100%; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leg-dir { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 12px; font-weight: var(--fw-semibold); }
.leg-dir.buy { background: var(--dashboard-hover); color: var(--dashboard-muted); }
.leg-dir.sell { background: #f7eed9; color: #805617; }
[data-theme="dark"] .leg-dir.sell { background: #352d20; color: #e3b675; }
.trade-value-pair { display: grid; gap: 2px; line-height: 1.3; }
.trade-value-pair > span { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.trade-value-pair strong { font-weight: var(--fw-semibold); }
.trade-value-label, .trade-value-source { color: var(--dashboard-muted); }
.trade-value-label, .trade-price-difference { font-size: 11px; }
.trade-price-difference { font-weight: var(--fw-semibold); }
.wallet-trade-empty, .wallet-trade-pager { grid-column: 1 / -1; }
.wallet-trade-empty { padding: 14px; }
.wallet-trade-pager .pager { padding-block-start: 8px; }

@media (max-width: 1000px) {
  .follow-detail-matchup { padding-inline-start: 0; border: 0; }
}
@media (max-width: 640px) {
  .modal-overlay { padding: 12px 8px; }
  .modal-head { padding: 12px; }
  .modal-body { padding: 0 12px 10px; }
  .follow-detail-modal .modal-head { align-items: flex-start; padding: 12px; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .wlb-toggle .wlb-chev { transition: none; }
}

/* Leaderboard wallet history */
.wallet-follows-modal .pager { flex: none; margin-block-start: 10px; }
.ps-table.wallet-follows-table {
  --wallet-event-width: 360px;
  width: 100%; min-width: calc(var(--wallet-event-width) + 396px); table-layout: fixed; font-size: 13px;
}
.wallet-event-col { width: var(--wallet-event-width); }
.wallet-side-col { width: 140px; }
.wallet-status-col { width: 96px; }
.wallet-price-col { width: 72px; }
.ps-table.wallet-follows-table :is(th, td) { padding: 9px 10px; border-color: var(--dashboard-divider); }
.ps-table.wallet-follows-table th {
  position: sticky; top: 0; z-index: 1;
  background: var(--dashboard-hover); color: var(--dashboard-muted); letter-spacing: normal;
}
.wallet-follows-table :is(th, td):nth-child(n+4):not(.empty-cell) { text-align: end; white-space: nowrap; }
.wallet-follows-table .muted { color: var(--dashboard-muted); }
.wallet-follows-table .pnl-up { color: var(--dashboard-positive); }
.wallet-follows-table .pnl-down { color: var(--dashboard-danger); }
.wallet-follows-table .t-neutral { color: var(--dashboard-muted); background: var(--dashboard-hover); }
.wallet-follows-side { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) {
  .ps-table.wallet-follows-table { --wallet-event-width: 204px; min-width: calc(var(--wallet-event-width) + 364px); }
  .wallet-side-col { width: 108px; }
}

/* System settings */
.page-scroll.settings-scroll {
  container: settings / inline-size;
  padding: clamp(24px, 3.6vw, 52px) clamp(16px, 2.3vw, 36px);
  background: var(--dashboard-surface); color: var(--dashboard-ink);
  scrollbar-color: var(--dashboard-control-border) transparent;
}
.system-settings-page {
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  gap: 24px;
  min-height: 100%;
}
.system-panel, .system-parameter-form { min-width: 0; margin: 0; }
.strategy-settings-panel {
  padding-inline-start: 24px;
  border-inline-start: 1px solid var(--dashboard-divider);
}
.system-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 12px; margin-block-end: 34px;
}
.system-panel-head h2 { margin: 0; font-size: 26px; line-height: 1.3; font-weight: var(--fw-bold); }
.system-panel-head .ps-btn.dashboard-primary-action { height: 35px; padding-inline: 16px; font-size: 13px; }
.system-panel-head .ps-btn.dashboard-primary-action:disabled {
  opacity: 1; background: var(--dashboard-hover); color: var(--dashboard-muted);
}
.system-panel h3, .system-panel h4 { margin: 0; font-weight: var(--fw-semibold); }
.system-panel h3 { font-size: 16px; line-height: 1.35; }
.system-panel h4 { font-size: 14px; }
.system-group-head, .collection-settings-section > h3 {
  padding-block-end: 10px; border-bottom: 1px solid var(--dashboard-divider);
}
.system-field-hint, .system-form-message { margin: 0; color: var(--dashboard-muted); font-size: 12px; }
.system-form-message { margin-block-start: 12px; }
.system-form-message.pnl-down { color: var(--dashboard-danger); }
.system-load-error { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding-block: 16px; }

.collection-settings-thresholds {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px clamp(14px, 2vw, 28px);
  padding-block: 24px 26px;
}
.collection-setting {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(54px, 44%); align-items: center; gap: 8px;
}
.collection-setting label, .collection-schedule-heading h3 { font-size: 14px; font-weight: var(--fw-semibold); }
.collection-schedule-section {
  display: grid; justify-items: start; gap: 12px; padding-block-start: 24px;
  border-top: 1px solid var(--dashboard-divider);
}
.collection-schedule-heading, .collection-schedule-controls, .collection-schedule-value {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
}
.collection-schedule-heading { gap: 20px; }
.collection-schedule-value { color: var(--dashboard-muted); font-size: 12px; }
.collection-schedule-value input.ps-select { width: 108px; padding-inline: 10px; }
.collection-setting-value, .cfg-inline .num-field, .cfg-entry-control .num-field,
.collection-schedule-value input.ps-select, .system-panel .ps-btn.collection-cycle-trigger {
  box-sizing: border-box; min-width: 0; height: 36px;
  border: 1px solid var(--dashboard-divider); border-radius: 7px;
  background: var(--dashboard-hover); color: var(--dashboard-ink);
  font-size: 14px; box-shadow: none;
}
.collection-setting-value {
  display: flex; align-items: center; padding-inline-end: 10px; gap: 4px;
}
.collection-schedule-controls .collection-setting-value { width: 112px; }
.collection-setting-value > span, .system-panel .num-field .nf-unit { color: var(--dashboard-muted); font-size: 12px; white-space: nowrap; }
.collection-setting-value input {
  width: 100%; min-width: 0; padding: 6px 0 6px 10px;
  border: 0; outline: 0; background: transparent; color: var(--dashboard-ink);
  font: inherit; font-variant-numeric: tabular-nums; appearance: textfield;
}
.collection-setting-value input::-webkit-inner-spin-button { appearance: none; }
.system-panel .collection-setting-value:focus-within, .system-panel .num-field:focus-within {
  border-color: var(--dashboard-positive);
}
.system-panel :is(button, input[type="time"]):focus-visible { outline: 2px solid var(--dashboard-positive); outline-offset: 2px; }
.system-panel .ps-btn.collection-cycle-trigger { min-inline-size: 136px; font-weight: var(--fw-medium); }
.system-panel .ps-btn.collection-cycle-trigger:hover:not(:disabled) {
  background: var(--dashboard-hover); border-color: var(--dashboard-control-border);
}
.system-panel .split-menu-chevron { border: 0; background: none; }
.app-shell > #collection-cycle-menu {
  background: var(--dashboard-surface); border-color: var(--dashboard-divider); border-radius: 6px;
  backdrop-filter: none; box-shadow: 0 3px 10px rgb(0 0 0 / 10%);
}
#collection-cycle-menu button { color: var(--dashboard-ink); }
#collection-cycle-menu button:is(:hover, :focus-visible) { background: var(--dashboard-hover); }
#collection-cycle-menu button[aria-checked="true"] > svg { color: var(--dashboard-positive); }

.cfg-editor { border: 0; padding: 0; margin: 0; min-width: 0; }
.cfg-editor:disabled { opacity: .65; }
.cfg-group + .cfg-group, .follow-game-scope { margin-block-start: 33px; }
.cfg-setting-group {
  display: grid; grid-template-columns: minmax(128px, 22%) minmax(0, 1fr);
  align-items: start; gap: 5px 12px; padding-block-start: 16px;
}
.cfg-setting-group h4 { align-self: start; padding-block-start: 8px; }
.cfg-setting-group > .system-field-hint { grid-column: 2; }
.cfg-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; min-width: 0; }
.cfg-entry-controls { display: grid; gap: 10px; }
.cfg-entry-control {
  display: grid; grid-template-columns: max-content max-content max-content;
  align-items: center; gap: 12px; color: var(--dashboard-muted); font-size: 13px;
}
.cfg-entry-control .num-field { background: var(--dashboard-surface); }
.system-panel .num-field { padding-inline: 10px; }
.system-panel .num-field input { color: var(--dashboard-ink); font-size: 14px; font-weight: var(--fw-medium); text-align: start; }
.system-panel .num-field.is-disabled { opacity: 1; background: var(--dashboard-hover); }
.system-panel .num-field.is-disabled input { color: var(--dashboard-muted); }
.cfg-inline .ps-segmented { padding: 2px; background: var(--dashboard-hover); border-color: var(--dashboard-divider); }
.cfg-inline .ps-segmented-opt { padding-inline: 19px; color: var(--dashboard-muted); font-size: 13px; }
.cfg-inline .ps-segmented-opt.active { background: var(--dashboard-primary); color: #fff; box-shadow: none; }
.system-panel .ps-switch .ps-switch-track {
  width: 42px; height: 24px; background: var(--dashboard-control-border); box-shadow: none;
}
.system-panel .ps-switch.on .ps-switch-track { background: var(--dashboard-primary); }
.system-panel .ps-switch .ps-switch-thumb {
  inset: 3px auto auto 3px; width: 18px; height: 18px; box-shadow: 0 1px 2px rgb(0 0 0 / 20%);
}
.system-panel .ps-switch.on .ps-switch-thumb { transform: translateX(18px); }
.follow-game-scope .system-group-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; }
.fgs-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(16px, 3vw, 42px); }
.fgs-option {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--dashboard-divider); font-size: 14px;
}
.fgs-option .ps-gameicon { border: 0; background: transparent; }
.fgs-option > span:nth-child(2) { overflow-wrap: anywhere; }

@container settings (width < 940px) {
  .system-settings-page { grid-template-columns: minmax(0, 1fr); gap: 28px; min-height: 0; }
  .strategy-settings-panel { padding: 24px 0 0; border-inline-start: 0; border-top: 1px solid var(--dashboard-divider); }
}
@container settings (width < 410px) {
  .system-panel-head { margin-block-end: 18px; }
  .system-panel-head h2 { font-size: 22px; }
  .collection-settings-thresholds { grid-template-columns: minmax(0, 1fr); gap: 8px; padding-block: 14px 18px; }
  .collection-setting { grid-template-columns: minmax(0, 1fr) 88px; }
  .collection-schedule-section { padding-block-start: 16px; }
  .cfg-setting-group { grid-template-columns: minmax(0, 1fr); }
  .cfg-setting-group h4 { padding-block-start: 0; }
  .cfg-setting-group > .system-field-hint { grid-column: 1; }
  .cfg-inline .ps-segmented-opt { padding-inline: 12px; }
}
@container settings (width < 310px) {
  .fgs-options { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Progress mask (sampling / stopping — response-driven) ---- */
.mask-overlay {
  position: fixed; inset: 0; z-index: 240;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgb(0 0 0 / 28%);
  animation: overlayIn var(--dur-fast) var(--ease-out);
}
.mask-card {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 6px 10px;
  width: 100%; max-width: 320px; padding: 18px 16px;
  background: var(--dashboard-surface); color: var(--dashboard-ink);
  border: 1px solid var(--dashboard-control-border); border-radius: 7px;
}
.mask-icon {
  display: flex; align-items: center; justify-content: center; color: var(--dashboard-muted);
}
.mask-icon .ps-spinner { width: 15px; height: 15px; border: 2px solid var(--dashboard-divider); border-top-color: currentColor; }
.mask-icon.done { color: var(--dashboard-positive); }
.mask-icon.err { color: var(--dashboard-danger); }
.mask-title { grid-column: 2 / -1; font: var(--fw-semibold) 15px/1.25 var(--font-sans); }
.mask-hint { grid-column: 2 / -1; font-size: 13px; color: var(--dashboard-muted); text-wrap: pretty; }
.mask-bar { grid-column: 1 / 3; margin-top: 6px; height: 4px; border-radius: var(--r-pill); background: var(--dashboard-divider); overflow: hidden; }
.mask-bar-fill {
  display: block; height: 100%; border-radius: var(--r-pill);
  background: var(--dashboard-muted); width: 0; transition: width 0.4s var(--ease-out);
}
.mask-bar-fill.filling { transition: width 3s cubic-bezier(0.16, 0.84, 0.36, 1); }
.mask-bar-fill.err { background: var(--dashboard-danger); }
.mask-pct { margin-top: 6px; font-size: 12px; color: var(--dashboard-muted); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  :is(.mask-overlay, .mask-icon .ps-spinner, .toast) { animation: none; }
  .mask-bar-fill.filling, .mask-bar-fill { transition: none; }
}

/* 列表卡(flush Card)统一工具栏内距:顶部收窄,左右保持,各视图一致 */
.card-toolbar { padding: var(--sp-3) var(--sp-6); }

.collection-feedback { color: var(--text-secondary); font-size: var(--fs-footnote); }
.collection-feedback.pnl-down { color: var(--pnl-down); }
.wallet-rank { color: var(--text-secondary); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; }

.page-scroll:is(.leaderboard-scroll, .events-scroll, .follows-scroll) {
  padding: 24px clamp(16px, 2.6vw, 40px);
  background: var(--dashboard-surface); color: var(--dashboard-ink);
  scrollbar-color: var(--dashboard-control-border) transparent;
}
.leaderboard-page { gap: 16px; }
.leaderboard-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  padding-bottom: 16px; border-bottom: 1px solid var(--dashboard-divider);
}
.collection-trigger { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.collection-trigger .collection-start { min-width: 70px; }
.collection-trigger .collection-start[aria-busy="true"] { opacity: 1; }
.collection-start .ps-spinner.sm {
  flex: none; width: 16px; height: 16px;
  border-color: color-mix(in srgb, currentColor 40%, transparent); border-top-color: currentColor;
}
@media (prefers-reduced-motion: reduce) {
  .collection-start .ps-spinner { animation: none; }
}
.collection-last-run {
  display: flex; align-items: center; gap: 4px; white-space: nowrap;
  color: var(--dashboard-muted); font-size: 12px; font-variant-numeric: tabular-nums;
}

.leaderboard-table-scroll { scrollbar-color: var(--dashboard-control-border) transparent; }
.ps-table.leaderboard-table { min-width: 960px; }
.ps-table.leaderboard-table :is(th, td) {
  text-align: center; padding: 10px 8px; border-color: var(--dashboard-divider);
}
.ps-table.leaderboard-table th { background: var(--dashboard-hover); color: var(--dashboard-muted); letter-spacing: normal; }
.ps-table.leaderboard-table tbody tr:last-child td { border-bottom: 1px solid var(--dashboard-divider); }
.ps-table.leaderboard-table tbody tr.clickable:hover { background: var(--dashboard-hover); }
.leaderboard-table .cell-stack { align-items: center; }
.leaderboard-table :is(.muted, .wallet-rank, .fav-btn:not(.on)) { color: var(--dashboard-muted); }
.leaderboard-table .strong { color: var(--dashboard-ink); }
.leaderboard-table .num { white-space: nowrap; }
.leaderboard-page .pnl-up, .ps-table.leaderboard-table .pnl-up.strong { color: var(--dashboard-positive); }
.leaderboard-page .pnl-down, .ps-table.leaderboard-table .pnl-down.strong { color: var(--dashboard-danger); }
.leaderboard-record { color: var(--dashboard-muted); white-space: nowrap; }
.leaderboard-table .leaderboard-scope { width: 72px; }
.leaderboard-games { display: inline-flex; vertical-align: middle; isolation: isolate; }
.leaderboard-games .ps-gameicon.sz-sm {
  width: 22px; height: 22px; border-radius: 4px;
  background: var(--dashboard-surface); border-color: var(--dashboard-control-border);
}
.leaderboard-games .ps-gameicon + .ps-gameicon { margin-inline-start: -11px; }
.leaderboard-games .ps-gameicon img { width: 82%; height: 82%; }
.leaderboard-table .wallet-action-trigger.ps-iconbtn {
  width: 30px; height: 30px; padding: 0; border: 0; border-radius: 5px;
  background: var(--dashboard-hover); color: var(--dashboard-muted); backdrop-filter: none;
}
.leaderboard-table .wallet-action-trigger:is(:hover, [aria-expanded="true"]) {
  background: color-mix(in srgb, var(--dashboard-ink) 13%, var(--dashboard-surface));
  color: var(--dashboard-ink);
}
.wallet-action-trigger svg { width: 17px; height: 17px; }
:is(.leaderboard-page, .events-page, .wallet-follows-modal) :is(button, a, select, [tabindex="0"]):focus-visible {
  outline: 2px solid var(--dashboard-ink); outline-offset: -2px;
}
:is(.leaderboard-page, .events-page, .wallet-follows-modal) .pager { gap: 8px; padding-top: 0; flex-wrap: wrap; }
:is(.leaderboard-page, .events-page, .wallet-follows-modal) .pager-nav { flex-wrap: wrap; margin-inline-start: auto; }
:is(.leaderboard-page, .events-page, .wallet-follows-modal) .pager-range,
:is(.leaderboard-page, .events-page, .wallet-follows-modal) .pager-range em { color: var(--dashboard-muted); }
:is(.leaderboard-page, .events-page, .wallet-follows-modal) .pg-btn { min-width: 28px; height: 28px; border-radius: 5px; color: var(--dashboard-muted); }
:is(.leaderboard-page, .events-page, .wallet-follows-modal) .pg-btn.is-active { background: var(--dashboard-hover); color: var(--dashboard-ink); box-shadow: none; }
:is(.leaderboard-page, .events-page, .wallet-follows-modal) .pg-btn:hover:not(:disabled) { background: var(--dashboard-hover); color: var(--dashboard-ink); }

.collection-backtest {
  display: flex; align-items: center; gap: 10px; margin-inline-start: auto;
  max-width: 100%;
}
.collection-backtest-title {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 12px; font-weight: var(--fw-semibold);
}
.collection-backtest-title svg { width: 14px; height: 14px; color: var(--dashboard-muted); }
.collection-backtest dl { display: grid; grid-template-columns: repeat(4, max-content); gap: 10px; margin: 0; }
.collection-backtest dl > div { border-inline-start: 1px solid var(--dashboard-divider); padding-inline-start: 10px; }
.collection-backtest dt { color: var(--dashboard-muted); white-space: nowrap; font-size: 11px; }
.collection-backtest dd { margin: 1px 0 0; font-size: 14px; font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .collection-backtest { margin-inline-start: 0; }
}
@media (max-width: 640px) {
  .page-scroll:is(.leaderboard-scroll, .events-scroll, .follows-scroll) { padding: 12px; }
  .leaderboard-actions { padding-bottom: 10px; }
  .collection-backtest {
    flex: 0 0 100%; flex-direction: column; align-items: stretch;
    gap: 6px; padding-top: 8px; border-top: 1px solid var(--dashboard-divider);
  }
  .collection-backtest dl { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .collection-backtest dl > div:nth-child(odd) { border-inline-start: 0; padding-inline-start: 0; }
  .collection-backtest dl > div:nth-child(n+3) { padding-top: 4px; border-top: 1px solid var(--dashboard-divider); }
  .leaderboard-table .wallet-action-trigger.ps-iconbtn { width: 44px; height: 44px; }
}
.ps-btn.split-menu-trigger.sz-sm { padding: 0; gap: 0; overflow: hidden; }
.split-menu-trigger > span:first-child { padding-inline: var(--sp-2); }
.ps-btn.collection-cycle-trigger { justify-content: space-between; }
.split-menu-chevron {
  align-self: stretch; display: grid; place-items: center; width: 20px;
  background: rgba(255,255,255,.10); border-inline-start: 1px solid rgba(255,255,255,.25);
}
.split-menu-trigger[aria-expanded="true"] .split-menu-chevron svg { transform: rotate(180deg); }
.collection-cycle-trigger .split-menu-chevron { width: 24px; }
.collection-cycle-trigger .split-menu-chevron svg { width: 12px; height: 12px; }
.app-shell > .split-menu-popup {
  position: fixed; z-index: 65; display: grid; gap: 2px;
  box-sizing: border-box; width: 132px; max-width: calc(100vw - 16px); padding: 4px;
  border: 1px solid var(--border-hairline); border-radius: var(--r-md);
  background: color-mix(in srgb, var(--surface-solid) 90%, transparent);
  backdrop-filter: var(--blur-thick); box-shadow: var(--shadow-lg), var(--inner-highlight);
  transform-origin: top right; animation: split-menu-reveal 140ms ease-out;
}
.split-menu-popup[data-opens-up="true"] { transform-origin: bottom right; }
.split-menu-popup button {
  display: flex; align-items: center; gap: var(--sp-2); min-height: 34px; padding: 4px var(--sp-2);
  border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--text-primary); font: inherit; font-size: var(--fs-subhead); text-align: start;
  cursor: pointer;
}
.split-menu-popup button:hover, .split-menu-popup button:focus-visible {
  outline: none; background: var(--surface-inset);
}
.split-menu-popup button[role="menuitemradio"] { justify-content: space-between; }
.split-menu-popup button[aria-checked="true"] > svg { color: var(--accent); }
.app-shell > #wallet-action-menu {
  border-color: var(--dashboard-control-border); border-radius: 5px;
  background: var(--dashboard-surface); backdrop-filter: none;
  box-shadow: 0 3px 12px rgb(0 0 0 / 12%);
}
#wallet-action-menu button { color: var(--dashboard-ink); border-radius: 4px; }
#wallet-action-menu button:is(:hover, :focus-visible) { background: var(--dashboard-hover); }
#wallet-action-menu .wallet-action-destructive { color: var(--dashboard-danger); }
#wallet-action-menu .wallet-action-destructive:is(:hover, :focus-visible) { background: var(--runner-stop); }
@media (max-width: 640px) {
  #wallet-action-menu button { min-height: 44px; }
}
.split-menu-popup button:disabled { opacity: .55; cursor: wait; }
@keyframes split-menu-reveal { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .app-shell > .split-menu-popup { animation: none; } }
.modal-compact-empty { margin-top: var(--sp-4); padding: var(--sp-4); border-radius: var(--r-md); background: var(--surface-inset); color: var(--text-tertiary); font-size: var(--fs-footnote); text-align: center; }

@media (max-width: 720px) {
  .topbar { padding-inline: 12px; }
  .topbar-actions { gap: 8px; }
  .topbar-actions .ps-status-extra { display: none; }
}

@media (max-width: 640px) {
  :root { --page-pad: var(--sp-4); --gutter: var(--sp-4); }
  .topbar-title { display: none; }
}
