/* 下班俱乐部 — all values from tokens.css scales. Grayscale hierarchy first. */
* { box-sizing: border-box; }
html, body { margin: 0; }
html { scrollbar-width: thin; scrollbar-color: var(--border-strong) var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-pill);
  border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
::-webkit-scrollbar-corner { background: var(--bg); }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--font); font-size: var(--text-base); line-height: 1.6;
  -webkit-font-smoothing: antialiased; min-height: 100vh; position: relative;
}
/* 环境光：琥珀夕照 + 冷调夜色，随主题切换 */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(70% 50% at 12% -8%, color-mix(in oklab, var(--accent) 16%, transparent) 0%, transparent 70%),
    radial-gradient(60% 45% at 92% 4%, color-mix(in oklab, var(--pos) 10%, transparent) 0%, transparent 72%);
}
.shell { position: relative; z-index: 1; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---- layout ---- */
.shell { max-width: 1180px; margin: 0 auto; padding: 0 var(--sp-4) var(--sp-8); }
.topbar { position: sticky; top: 0; z-index: 20;
  background: color-mix(in oklab, var(--bg) 86%, transparent); backdrop-filter: blur(14px) saturate(1.25);
  border-bottom: 1px solid transparent; transition: border-color .2s ease, box-shadow .2s ease; }
.topbar.stuck { border-bottom-color: var(--border); box-shadow: 0 6px 20px -12px var(--shadow-strong); }
.bar-inner { max-width: 1180px; margin: 0 auto; padding: var(--sp-4);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.brand { font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.01em; }
.brand small { display: block; font-size: var(--text-xs); font-weight: 400; color: var(--muted); letter-spacing: 0; }
.who { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--text-sm); }
.who .bal { font-weight: 600; }
.avatar { width: 32px; height: 32px; border-radius: var(--r-pill); object-fit: cover; display: inline-block; vertical-align: middle; background: var(--surface-2); }
.avatar.sm { width: 24px; height: 24px; }
.avatar.xs { width: 18px; height: 18px; }
.avatar-fallback { display: inline-flex; align-items: center; justify-content: center; font-size: var(--text-xs); font-weight: 600; color: var(--accent); background: var(--accent-soft); }
.avatar-btn { all: unset; cursor: pointer; border-radius: var(--r-pill); display: inline-flex; transition: box-shadow .15s ease; }
.avatar-btn:hover { box-shadow: 0 0 0 2px var(--accent); }
.mname { display: flex; align-items: center; gap: var(--sp-2); }
.rn { display: inline-flex; align-items: center; gap: var(--sp-2); }
.hname { gap: var(--sp-1); }

/* ---- tabs ---- */
.tabbar { position: sticky; top: var(--bar-h, 68px); z-index: 19;
  background: color-mix(in oklab, var(--bg) 92%, transparent); backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--border); margin-bottom: var(--sp-5); }
.tabs { display: flex; justify-content: flex-start; gap: var(--sp-5); padding-top: 0; padding-bottom: 0; }
.tab { padding: var(--sp-2) 0; font-size: var(--text-sm); font-weight: 500; color: var(--faint);
  background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); }

/* ---- cards ---- */
.card { background: var(--surface); border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--e1); }
.card + .card { margin-top: var(--sp-4); }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.card-h h2 { font-size: var(--text-base); font-weight: 600; margin: 0; }
.card-h .hint { font-size: var(--text-xs); color: var(--muted); }
.section-label { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 var(--sp-3); }

/* ---- stat blocks ---- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.stat .label { font-size: var(--text-sm); color: var(--muted); }
.stat .value { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.02em; margin-top: var(--sp-1); }
.stat .delta { font-size: var(--text-sm); margin-top: var(--sp-1); display: inline-flex; align-items: baseline; gap: var(--sp-1); }
.pos { color: var(--pos); } .neg { color: var(--neg); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-md); font-size: var(--text-sm); font-weight: 500;
  border: 1px solid transparent; transition: box-shadow .15s ease, background .15s ease, transform .1s ease, border-color .15s ease, color .15s ease; }
.btn-primary { background: var(--accent); color: var(--accent-fg); box-shadow: var(--e1); }
.btn-primary:active { box-shadow: none; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: var(--surface); color: var(--fg); border-color: var(--border-strong); }
.btn-tertiary { background: none; color: var(--muted); padding: var(--sp-1) var(--sp-2); }
.btn-tertiary:hover { color: var(--fg); }
.btn-danger { background: none; color: var(--neg); padding: var(--sp-1) var(--sp-2); font-size: var(--text-sm); }
.btn-sm { padding: var(--sp-1) var(--sp-3); font-size: var(--text-sm); }
.btn-block { width: 100%; }

/* ---- forms ---- */
.field { margin-bottom: var(--sp-5); }
.field label { display: block; font-size: var(--text-sm); font-weight: 500; margin-bottom: var(--sp-1); }
.field input, .field select { width: 100%; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg);
  font-size: var(--text-base); box-shadow: inset 0 1px 2px var(--shadow); }
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field .help { font-size: var(--text-sm); color: var(--muted); margin-top: var(--sp-1); }

/* ---- markets ---- */
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-4); }
.rank-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
@media (max-width: 720px) { .rank-grid { grid-template-columns: 1fr; } }
.mcard { position: relative; background: var(--surface); border-radius: var(--r-lg); padding: var(--sp-4);
  box-shadow: var(--e1); border: 1px solid var(--border); transition: box-shadow .18s ease, border-color .18s ease; }
.mcard.has-flow { box-shadow: var(--e2); border-color: var(--accent-line); }
.rank-card { background:
  radial-gradient(120% 80% at 0% 0%, var(--accent-soft) 0%, transparent 60%), var(--surface); }
.mcard .mname { font-weight: 600; font-size: var(--text-base); display: flex; align-items: center; gap: var(--sp-2);
  margin-bottom: 2px; }
.mcard .mname > span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard .msub { font-size: var(--text-xs); color: var(--muted); margin-bottom: var(--sp-3); }
.mk-ico { font-style: normal; font-size: var(--text-base); line-height: 1;
  width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; flex-shrink: 0; }
.mk-ico.first { background: var(--pos-soft); }
.mk-ico.last { background: var(--neg-soft); }
.rank-card .mname { margin-bottom: var(--sp-3); }
.mpool { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.mpool b { font-size: var(--text-xs); font-weight: 600; color: var(--accent); }
.bins { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.bin { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 2px 10px; min-width: 0; isolation: isolate;
  border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2); }
/* 概率填充：从底部升起，越高越可能 */
.pfill { position: absolute; left: 0; right: 0; bottom: 0; z-index: -1;
  height: calc(12% + var(--p, 0) * 88%);
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 26%, transparent),
    color-mix(in oklab, var(--accent) 9%, transparent));
  transition: height .4s cubic-bezier(.2,.8,.2,1); }
.bin .bl { font-size: 10px; color: var(--muted); white-space: nowrap; letter-spacing: -0.02em; }
.bin .bo { font-size: var(--text-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.bin .bamt { font-size: 9px; font-weight: 700; color: var(--accent); line-height: 1.4;
  background: var(--surface); padding: 0 5px; border-radius: var(--r-pill); box-shadow: var(--e1); }
.bin.hot { border-color: var(--accent); }
.bin.hot .bo { color: var(--accent); font-weight: 700; }
.bin.hot .pfill { background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 40%, transparent),
  color-mix(in oklab, var(--accent) 16%, transparent)); }
.bin.mine { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bin.mine::after { content: ""; position: absolute; top: 4px; right: 4px; width: 5px; height: 5px;
  border-radius: 50%; background: var(--accent); }
.mflow { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); opacity: .7;
  border-radius: 0 2px 2px 0; transition: width .3s cubic-bezier(.2,.8,.2,1); }
.bin button { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; }
.bin button:disabled { cursor: not-allowed; opacity: .5; }
.rank-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.rank-row { position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto auto; align-items: center;
  gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); background: var(--surface-2); }
.rank-row .rn { font-weight: 500; display: inline-flex; align-items: center; gap: 6px; min-width: 0;
  position: relative; z-index: 1; }
.rank-row .rn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .ro { font-weight: 600; color: var(--accent); }
.rank-row > button { position: relative; z-index: 1; }
.rank-row.mine { box-shadow: inset 0 0 0 1px var(--accent); }
.rflow { display: inline-flex; align-items: center; gap: 6px; position: relative; z-index: 1; }
.rbar { position: absolute; left: 0; top: 0; bottom: 0; pointer-events: none;
  background: linear-gradient(90deg, var(--accent-soft), transparent); border-right: 2px solid var(--accent);
  transition: width .35s cubic-bezier(.2,.8,.2,1); }
/* 下注人头像堆叠 */
.bstack { display: inline-flex; align-items: center; }
.bstack .avatar { width: 18px; height: 18px; margin-left: -6px; box-shadow: 0 0 0 1.5px var(--surface); }
.bstack .avatar:first-child { margin-left: 0; }
.bmore { font-size: 9px; font-weight: 700; color: var(--muted); margin-left: 3px; }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; }
th { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); text-align: left; padding: var(--sp-2) var(--sp-3); }
td { padding: var(--sp-2) var(--sp-3); font-size: var(--text-sm); border-top: 1px solid var(--border); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:first-child td { border-top: none; }

/* ---- badges / pills ---- */
.pill { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--text-xs); font-weight: 500;
  padding: 2px var(--sp-2); border-radius: var(--r-pill); }
.pill-open { background: var(--pos-soft); color: var(--pos); }
.pill-locked { background: var(--accent-soft); color: var(--accent); }
.pill-settled { background: var(--surface-2); color: var(--muted); }
.pill-void { background: var(--neg-soft); color: var(--neg); }

/* ---- clock-out ---- */
.clock-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: flex-end; }
.clock-row .field { margin-bottom: 0; flex: 1; min-width: 140px; }
.clock-done { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--text-sm); }
.clock-done .big { font-size: var(--text-xl); font-weight: 600; }

/* ---- modal ---- */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center;
  padding: var(--sp-4); z-index: 50; }
.modal { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--e3);
  width: 100%; max-width: 420px; padding: var(--sp-5); }
.modal h3 { margin: 0 0 var(--sp-4); font-size: var(--text-lg); font-weight: 600; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-3); margin-top: var(--sp-5); }

/* ---- toast ---- */
#toast-root { position: fixed; bottom: var(--sp-5); left: 50%; transform: translateX(-50%); z-index: 60;
  display: flex; flex-direction: column; gap: var(--sp-2); align-items: center; }
.toast { background: var(--fg); color: var(--bg); padding: var(--sp-2) var(--sp-4); border-radius: var(--r-pill);
  font-size: var(--text-sm); box-shadow: var(--e2); animation: pop .18s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

/* ---- auth ---- */
.auth-wrap { max-width: 400px; margin: 8vh auto 0; padding: 0 var(--sp-4); }
.auth-card { background: var(--surface); border-radius: var(--r-lg); padding: var(--sp-6); box-shadow: var(--e2); }
.auth-card h1 { font-size: var(--text-xl); font-weight: 600; margin: 0 0 var(--sp-1); }
.auth-card .sub { color: var(--muted); font-size: var(--text-sm); margin: 0 0 var(--sp-5); }
.name-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin-bottom: var(--sp-5); }
.name-opt { padding: var(--sp-3) var(--sp-2); border-radius: var(--r-md); border: 1px solid var(--border-strong);
  background: var(--surface); font-size: var(--text-sm); font-weight: 500; text-align: center; }
.name-opt.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.name-opt:disabled { opacity: .4; cursor: not-allowed; }
.name-opt .tag { display: block; font-size: var(--text-xs); font-weight: 400; color: var(--muted); }

/* ---- empty state ---- */
.empty { text-align: center; padding: var(--sp-7) var(--sp-4); }
.empty .ico { width: 56px; height: 56px; margin: 0 auto var(--sp-4); border-radius: var(--r-pill);
  background: var(--accent-soft); display: grid; place-items: center; font-size: var(--text-xl); }
.empty p { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.empty .title { color: var(--fg); font-weight: 600; font-size: var(--text-base); margin-bottom: var(--sp-1); }

/* ---- misc ---- */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.muted { color: var(--muted); } .sm { font-size: var(--text-sm); } .xs { font-size: var(--text-xs); }
.mt-4 { margin-top: var(--sp-4); } .mb-4 { margin-bottom: var(--sp-4); }
.linkbtn { background: none; border: none; color: var(--accent); font-size: var(--text-sm); font-weight: 500; padding: 0; }
details.day { border-top: 1px solid var(--border); }
details.day summary { cursor: pointer; padding: var(--sp-3) 0; font-weight: 500; font-size: var(--text-sm); list-style: none; display: flex; justify-content: space-between; }
details.day summary::-webkit-details-marker { display: none; }

/* ---- bet chips ---- */
.chips { display: flex; gap: var(--sp-2); margin: calc(-1 * var(--sp-3)) 0 var(--sp-3); }
.chip { padding: var(--sp-1) var(--sp-3); border-radius: var(--r-pill); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--muted); font-size: var(--text-xs); font-weight: 600;
  transition: border-color .15s ease, color .15s ease, background .15s ease; }
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---- clock confirm ---- */
.clock-confirm { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.02em; margin: 0; }

/* ---- leaderboards ---- */
.board-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.board-grid .card + .card { margin-top: 0; }
@media (max-width: 860px) { .board-grid { grid-template-columns: 1fr; } }
.board-list { display: flex; flex-direction: column; gap: var(--sp-1); }
.board-row { display: grid; grid-template-columns: 22px 24px minmax(56px, auto) 1fr auto auto; align-items: center;
  gap: var(--sp-2); padding: var(--sp-2) var(--sp-1); border-radius: var(--r-sm); transition: background .15s ease; }
.board-row:hover { background: var(--surface-2); }
.board-row .bname { font-size: var(--text-sm); font-weight: 500; white-space: nowrap; }
.board-row .bval { font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }
.board-row .bmeta { display: inline-flex; align-items: center; gap: var(--sp-2); justify-content: flex-end; min-width: 64px; }
.medal { width: 20px; height: 20px; border-radius: var(--r-pill); display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff; }
.medal.m1 { background: linear-gradient(140deg, #e8b53a, #b8860b); }
.medal.m2 { background: linear-gradient(140deg, #b9b4ad, #8a857e); }
.medal.m3 { background: linear-gradient(140deg, #c88a52, #96603a); }
.rank-n { width: 20px; text-align: center; font-size: var(--text-xs); color: var(--faint); font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; min-width: 24px; }
.bar i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--accent); opacity: .85; }
.bar i.time { background: linear-gradient(90deg, var(--pos), var(--accent), var(--neg)); }
.trend { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: var(--r-pill); white-space: nowrap; }
.trend.later { color: var(--neg); background: var(--neg-soft); }
.trend.earlier { color: var(--pos); background: var(--pos-soft); }
.trend.flat { color: var(--muted); background: var(--surface-2); }

/* ---- off-work heatmap ---- */
.heat-wrap { overflow-x: auto; overflow-y: hidden; padding-bottom: var(--sp-2);
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.heat-wrap::-webkit-scrollbar { height: 8px; }
.heat-wrap::-webkit-scrollbar-track { background: var(--surface-2); border-radius: var(--r-pill); }
.heat-wrap::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-pill); }
.heat-wrap::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.heat { --cw: 22px; display: flex; flex-direction: column; gap: 4px; width: max-content; }
.hrow { display: grid; grid-template-columns: 96px repeat(var(--cols), var(--cw)); gap: 4px; align-items: center; }
.hname { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 500; color: var(--muted);
  position: sticky; left: 0; background: var(--surface); z-index: 6; padding-right: var(--sp-2); height: var(--cw);
  box-shadow: 8px 0 8px -6px var(--shadow); }
.hname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heat-wrap.scrolled .hname { box-shadow: 10px 0 12px -6px var(--shadow-strong); }
.hhead { height: 20px; margin-bottom: 2px; }
.hcol { all: unset; cursor: pointer; height: 20px; display: grid; place-items: center; border-radius: 4px; }
.hcol span { font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums; line-height: 1; }
.hcol:hover span { color: var(--fg); }
.hcol.on { background: var(--accent-soft); }
.hcol.on span { color: var(--accent); font-weight: 700; }
.hcol.we span { color: var(--accent); opacity: .8; }
.hcell.we { box-shadow: inset 0 0 0 1.5px var(--accent-line); }
.hcell.none.we { box-shadow: inset 0 0 0 1px var(--accent-line); opacity: .55; }
.hcell { all: unset; cursor: pointer; width: var(--cw); height: var(--cw); border-radius: 5px; box-sizing: border-box;
  background: hsl(calc(150 - var(--t) * 130) calc(52% + var(--t) * 22%) calc(62% - var(--t) * 20%));
  transition: transform .12s ease, box-shadow .12s ease; }
.hcell.none { background: transparent; box-shadow: inset 0 0 0 1px var(--border); opacity: .5; }
.hcell:hover { transform: scale(1.18); box-shadow: var(--e2); position: relative; z-index: 3; }
@media (prefers-color-scheme: dark) {
  .hcell { background: hsl(calc(150 - var(--t) * 130) calc(58% + var(--t) * 20%) calc(52% + var(--t) * 8%)); }
  .hcell.none { background: transparent; opacity: .45; }
}
.heat { position: relative; }
.hrow { position: relative; z-index: 1; }
.hband { position: absolute; top: 0; bottom: 0; border-radius: 6px; pointer-events: none;
  background: transparent; box-shadow: inset 0 0 0 2px var(--accent);
  z-index: 4; transition: left .18s cubic-bezier(.2,.8,.2,1), width .18s ease; }
.heat-tip { position: fixed; transform: translate(-50%, -100%); background: var(--fg); color: var(--bg);
  font-size: var(--text-xs); padding: 4px 10px; border-radius: var(--r-sm); white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .12s ease; z-index: 70; box-shadow: var(--e2); font-variant-numeric: tabular-nums; }
.heat-tip.on { opacity: 1; }
.heat-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-3); flex-wrap: wrap; }
.heat-legend { display: flex; align-items: center; gap: 5px; }
.heat-legend .lg { width: 13px; height: 13px; border-radius: 4px;
  background: hsl(calc(150 - var(--t) * 130) calc(52% + var(--t) * 22%) calc(62% - var(--t) * 20%)); }
@media (prefers-color-scheme: dark) {
  .heat-legend .lg { background: hsl(calc(150 - var(--t) * 130) calc(58% + var(--t) * 20%) calc(52% + var(--t) * 8%)); }
}
.heat-legend .lg.none { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }

/* ---- records strip ---- */
.rec-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-4); }
@media (max-width: 700px) { .rec-strip { grid-template-columns: 1fr; } }
.rec { background: var(--surface); border-radius: var(--r-lg); padding: var(--sp-4); box-shadow: var(--e1);
  border-top: 3px solid var(--accent); display: flex; flex-direction: column; gap: 2px; }
.rec-k { font-size: var(--text-xs); color: var(--muted); font-weight: 500; }
.rec-v { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.rec-v small { font-size: var(--text-sm); font-weight: 500; color: var(--muted); margin-left: 2px; }
.rec-w { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); margin-top: var(--sp-1); }

/* ---- daily pnl chart ---- */
.pnl-chart { display: flex; align-items: flex-end; gap: 4px; height: 88px; margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-1); border-bottom: 1px solid var(--border); }
.pnl-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; min-width: 0; }
.pnl-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.pnl-track i { width: 70%; max-width: 18px; border-radius: 3px 3px 0 0; display: block; }
.pnl-track i.up { background: var(--pos); opacity: .85; }
.pnl-track i.down { background: var(--neg); opacity: .85; }
.pnl-col span { font-size: 9px; color: var(--faint); font-variant-numeric: tabular-nums; }
.pnl-col:hover .pnl-track i { opacity: 1; }

/* ---- profit board ---- */
.pnl-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4);
  padding-bottom: var(--sp-4); margin-bottom: var(--sp-3); border-bottom: 1px solid var(--border); }
.pnl-summary > div { display: flex; flex-direction: column; gap: 2px; }
.ps-k { font-size: var(--text-xs); color: var(--muted); }
.ps-v { font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.02em; }
.pnl-head, .pnl-row { display: grid; grid-template-columns: 22px 24px minmax(64px, 1fr) minmax(60px, 1.4fr) 92px 84px 84px;
  align-items: center; gap: var(--sp-2); }
.pnl-head { padding: 0 var(--sp-1) var(--sp-2); font-size: var(--text-xs); color: var(--faint); }
.pnl-head span:nth-child(1) { grid-column: 1 / 4; }
.pnl-head span:nth-child(2) { grid-column: 4 / 6; text-align: right; }
.pnl-head span:nth-child(3), .pnl-head span:nth-child(4) { text-align: right; }
.pnl-row .bval { text-align: right; }
.pnl-bar { position: relative; height: 8px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.pnl-bar b { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--border-strong); }
.pnl-bar i { position: absolute; top: 0; bottom: 0; border-radius: var(--r-pill); }
.pnl-bar i.up { background: var(--pos); }
.pnl-bar i.down { background: var(--neg); }
.rate-cell, .exp-cell { justify-content: flex-end; }
.rate { font-size: var(--text-xs); font-weight: 600; padding: 1px 7px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--muted); }
.rate.pos { background: var(--pos-soft); color: var(--pos); }
.exp { font-size: var(--text-xs); font-weight: 600; padding: 1px 8px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent); }
@media (max-width: 720px) {
  .pnl-head, .pnl-row { grid-template-columns: 20px 22px 1fr 78px 62px; }
  .pnl-bar, .pnl-head span:nth-child(2) { display: none; }
  .pnl-head span:nth-child(1) { grid-column: 1 / 4; }
  .pnl-head span:nth-child(3) { grid-column: 4; }
  .pnl-head span:nth-child(4) { grid-column: 5; }
  .exp-cell { display: none; }
  .pnl-summary { grid-template-columns: 1fr; gap: var(--sp-2); }
  .pnl-summary > div { flex-direction: row; align-items: baseline; justify-content: space-between; }
  .ps-v { font-size: var(--text-base); }
}

/* ---- segmented control ---- */
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-pill); padding: 2px; gap: 2px; }
.seg-b { all: unset; cursor: pointer; padding: 3px 12px; border-radius: var(--r-pill); font-size: var(--text-xs);
  font-weight: 500; color: var(--muted); transition: background .15s ease, color .15s ease; white-space: nowrap; }
.seg-b:hover { color: var(--fg); }
.seg-b.on { background: var(--surface); color: var(--accent); font-weight: 600; box-shadow: var(--e1); }
.day-row .bval small { font-size: 10px; color: var(--muted); margin-left: 3px; font-weight: 500; }
.day-panel { margin-top: var(--sp-4); border-top: 1px solid var(--border); padding-top: var(--sp-4); animation: rise .2s ease; }
.day-head { display: flex; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.day-head b { font-size: var(--text-base); }
.day-row { display: grid; grid-template-columns: 22px 24px 1fr auto auto; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-1); border-radius: var(--r-sm); }
.day-row:hover { background: var(--surface-2); }
.day-row .bname { font-size: var(--text-sm); font-weight: 500; }
.day-row .bval { font-size: var(--text-sm); font-weight: 600; }
.day-row .bmeta { min-width: 72px; text-align: right; font-size: var(--text-sm); }

/* ---- interaction (refactoring-ui §15 + §6.2.2) ---- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.bin button { transition: background .15s ease; border-radius: var(--r-sm); }
.bin:not(.hot):has(button:not(:disabled)):hover { background: var(--accent-soft); border-color: var(--accent-line); }
.bin button:not(:disabled):active { transform: scale(.96); }
.rank-row { transition: background .15s ease; }
.rank-row:hover { background: var(--accent-soft); }
.name-opt { transition: border-color .15s ease, background .15s ease, color .15s ease; }
.name-opt:not(:disabled):hover { border-color: var(--accent); }
.tab { transition: color .15s ease, border-color .15s ease; }
.tab:not(.active):hover { color: var(--muted); }
details.day summary { transition: color .15s ease; }
details.day summary:hover { color: var(--accent); }
.modal-back { animation: fade .2s ease; }
.modal { animation: rise .22s cubic-bezier(.2,.8,.2,1); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.toast { animation: pop .2s ease, fadeout .3s ease 2.3s forwards; }
@keyframes fadeout { to { opacity: 0; transform: translateY(6px); } }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid var(--accent-fg);
  border-top-color: transparent; border-radius: 50%; animation: spin .6s linear infinite; }
.btn-secondary.loading::after, .btn-tertiary.loading::after { border-color: var(--muted); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 640px) {
  .shell { padding: var(--sp-4) var(--sp-3) var(--sp-7); }
  .card { padding: var(--sp-4); }
  .stats { grid-template-columns: 1fr; gap: var(--sp-3); }
  .stat { display: flex; align-items: baseline; justify-content: space-between; }
  .stat .value { font-size: var(--text-xl); }
  .name-grid { grid-template-columns: repeat(2, 1fr); }
  /* 榜单：窄屏隐藏进度条，保留名次/头像/昵称/数值 */
  .board-row { grid-template-columns: 20px 22px minmax(0, 1fr) auto; gap: var(--sp-2); padding: 7px 2px; }
  .board-row .bar { display: none; }
  .board-row .bmeta { grid-column: 1 / -1; justify-content: flex-start; padding-left: 46px; margin-top: -2px; min-width: 0; }
  .board-row .bval { font-size: var(--text-sm); }
  .market-grid { grid-template-columns: 1fr; }
  .rank-row { grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-2); padding: 7px var(--sp-2); }
  .rank-row .rflow { grid-column: 1; grid-row: 2; padding-left: 24px; }
  .rank-row > button { grid-column: 2; grid-row: 1 / span 2; }
  .heat { --cw: 20px; }
  .hrow { grid-template-columns: 84px repeat(var(--cols), var(--cw)); }
}