/* League Office components. Colours come only from tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 14px/1.45 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: absolute; left: 8px; top: -48px; z-index: 100; padding: 10px 14px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.skip-link:focus { top: 8px; text-decoration: none; color: var(--on-accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 700; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row-flex { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tone-ok { color: var(--ok); } .tone-tight { color: var(--tight); } .tone-over { color: var(--over); }
.tone-eaten { color: var(--eaten-text); } .tone-info { color: var(--info); } .tone-muted { color: var(--muted); }

/* ---------- icons ---------- */
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: middle; }
.ico-s { width: 16px; height: 16px; stroke-width: 2; }
.ico-l { width: 22px; height: 22px; stroke-width: 1.8; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; display: flex; }
@media (min-width: 641px) {
  .shell { background: linear-gradient(90deg, var(--nav-bg) 0 239px, var(--line-top) 239px 240px, transparent 240px); }
  .is-commish .shell { background: linear-gradient(90deg, var(--commish-side) 0 239px, var(--line-top) 239px 240px, transparent 240px); }
}
.side {
  width: 240px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 20px 14px; background: var(--nav-bg); border-right: 1px solid var(--line-top);
  display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; color: var(--text); }
.brand:hover { color: var(--text); text-decoration: none; }
.logo {
  width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--on-accent);
  font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-name { font-weight: 800; letter-spacing: -.2px; }
.brand-sub { font-size: 11.5px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav h3 { margin: 0 0 6px; padding: 0 10px; font-size: 10.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .8px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 0 10px; min-height: 38px; border-radius: 9px;
  color: var(--text-2); font-weight: 600; font-size: 13.5px;
}
.nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--selected); color: var(--accent); }
.count { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--violet-bg); color: var(--violet); }
.count.red { background: var(--danger-bg); color: var(--over); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.session-box { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.session-box form { margin: 0; }
.asof-wrap > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.asof-wrap > summary::-webkit-details-marker { display: none; }
.asof-wrap[open] > summary { display: none; }
.board-table tr.mine th, .board-table tr.mine td { background: var(--selected); }
.issue-acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cline.has-split { grid-template-columns: 20px 26px minmax(0, max-content) minmax(0, 1fr) auto; }   /* the name first; the team gets what's left */
.cline-tn { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
@media (max-width: 640px) {
  .row:has(> .issue-acts) { flex-wrap: wrap; }
  .row > .issue-acts { flex-basis: 100%; padding-left: 20px; }
}
.is-commish .side { background: var(--commish-side); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { flex: 1; padding: 28px 32px 48px; min-width: 0; }
.page { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tabbar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.h1 { font-size: 28px; font-weight: 800; letter-spacing: -.6px; line-height: 1.15; }
.sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.sect { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .7px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 640px) {
  .side { display: none; }
  .topbar {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px 10px; position: sticky; top: 0; z-index: 20;
    background: var(--bg); border-bottom: 1px solid var(--line-top);
  }
  .topbar .logo { width: 30px; height: 30px; }
  .topbar .brand-name { font-size: 16px; white-space: nowrap; }
  .topbar .role { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; }
  .topbar-end { margin-left: auto; display: flex; align-items: center; gap: 6px; }
  .is-commish .topbar { background: var(--commish-top); border-bottom-color: var(--commish-line); }
  .content { padding: 14px 16px 24px; }
  /* the tab bar is fixed to the screen, not sticky in the page: phone browsers that
     hide their toolbars or bounce at the end of a page leave a sticky bar floating */
  .main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .page { gap: 12px; }
  .h1 { font-size: 24px; letter-spacing: -.5px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; min-height: var(--tabbar-h);
    border-top: 1px solid var(--line-top); background: var(--nav-bg);
    padding: 4px 4px calc(10px + env(safe-area-inset-bottom));
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 10.5px; font-weight: 600; color: var(--faint); min-height: 48px; position: relative;
  }
  .tab:hover { color: var(--text-2); text-decoration: none; }
  .tab.on { color: var(--accent); }
  .tab .badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--dot-over); color: var(--on-dot); font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
  .hide-phone { display: none !important; }
}
@media (min-width: 641px) { .hide-desktop { display: none !important; } }

/* ---------- cards & rows ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); min-width: 0; }
.card-pad { padding: 14px 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line-soft); }
.card.tinted-over { border-color: var(--over-line); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); color: var(--text); min-width: 0; }
.row:last-child { border-bottom: 0; }
a.row:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.row-title { font-weight: 700; }
.row-meta { font-size: 11.5px; color: var(--muted); }
.row-amt { text-align: right; flex-shrink: 0; }
.row-amt b { font-weight: 800; font-variant-numeric: tabular-nums; display: block; }
.row-amt span { font-size: 11px; color: var(--muted); }
.rank { width: 20px; font-size: 11px; font-weight: 700; color: var(--dim); text-align: right; flex-shrink: 0; }
.edit-row { flex-wrap: wrap; }
.edit-row > .grow { flex: 1 1 200px; }
.edit-inputs { display: flex; gap: 8px; margin-left: auto; align-items: center; flex-wrap: wrap; }
@media (max-width: 640px) { .edit-inputs { width: 100%; margin-left: 42px; } }
.kv > span { min-width: 0; }
.kv > span:last-child { overflow-wrap: anywhere; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.inset { background: var(--surface-inset); border: 1px solid var(--line-soft); border-radius: 12px; }
.inset .kv { padding: 9px 12px; font-size: 12.5px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.two.two-start { align-items: start; }   /* cards of unlike height keep their own height */

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile b { font-size: 22px; font-weight: 800; letter-spacing: -.4px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile span { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tiles.tiles-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { padding: 10px 11px; }
  .tile b { font-size: 16px; letter-spacing: -.3px; }
  .tile span { font-size: 11px; }
}

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: var(--r-chip); white-space: nowrap; line-height: 1.3; }
.chip .ico { width: 12px; height: 12px; stroke-width: 2.4; }
.st-ok { background: var(--ok-bg); color: var(--ok); }
.st-tight { background: var(--tight-bg); color: var(--tight); }
.st-over { background: var(--over-bg); color: var(--over); }
.st-info { background: var(--info-bg); color: var(--info); }
.st-violet { background: var(--violet-bg); color: var(--violet); }
.st-neutral { background: var(--neutral-bg); color: var(--neutral); }
.pos {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; font-size: 10px; font-weight: 800;
  padding: 3px 4px; border-radius: var(--r-tag); color: var(--on-pos); letter-spacing: .3px; flex-shrink: 0; line-height: 1.2;
}
.pos-QB { background: var(--pos-qb); } .pos-RB { background: var(--pos-rb); } .pos-WR { background: var(--pos-wr); }
.pos-TE { background: var(--pos-te); } .pos-K { background: var(--pos-k); } .pos-DEF { background: var(--pos-def); }
.pos-other { background: var(--pos-other); }
.kind { font-size: 10px; font-weight: 800; letter-spacing: .6px; padding: 3px 7px; border-radius: var(--r-tag); flex-shrink: 0; line-height: 1.3; }
.k-trade { background: var(--k-trade-bg); color: var(--k-trade); } .k-drop { background: var(--k-drop-bg); color: var(--k-drop); }
.k-ir { background: var(--k-ir-bg); color: var(--k-ir); } .k-sign { background: var(--k-sign-bg); color: var(--k-sign); }
.k-vio { background: var(--k-vio-bg); color: var(--k-vio); } .k-misc { background: var(--k-misc-bg); color: var(--k-misc); }
.tag { display: inline-block; font-size: 10px; font-weight: 800; padding: 1px 4px; border-radius: 4px; margin-left: 5px; vertical-align: 1px; letter-spacing: .3px; }
.tag-ir { background: var(--k-misc-bg); color: var(--text-2); }
.tag-opt { background: var(--k-trade-bg); color: var(--violet); }
.tag-eat { background: var(--violet-bg); color: var(--eaten-text); }
.tag-trd { background: var(--k-trade-bg); color: var(--text-2); }
.table td small.alt { display: block; font-size: 10.5px; font-weight: 400; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot-over); box-shadow: 0 0 0 3px var(--dot-over-ring); flex-shrink: 0; display: inline-block; }
.dot-ok { background: var(--accent); box-shadow: none; }
.dot-warn { background: var(--seg-adj); box-shadow: none; }
.dot-fail { background: var(--dot-over); box-shadow: none; }
.prov { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--tight-bg); color: var(--tight); white-space: nowrap; }
.approx { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--neutral-bg); color: var(--neutral); white-space: nowrap; }

/* ---------- avatars ---------- */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: var(--avatar-text); flex-shrink: 0; overflow: hidden; background: var(--team, var(--pos-other));
}
/* the photo covers the initials; they show only if it fails to load */
.avatar, .headshot { position: relative; }
.avatar img, .headshot img { position: absolute; inset: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar.lg { width: 52px; height: 52px; font-size: 17px; }
.headshot {
  width: 64px; height: 64px; border-radius: 50%; background: var(--surface-raised); border: 2px solid var(--pos-other);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; color: var(--text-2);
  overflow: hidden; flex-shrink: 0;
}
.headshot img { width: 100%; height: 100%; object-fit: cover; }
.headshot.pos-ring-QB { border-color: var(--pos-qb); } .headshot.pos-ring-RB { border-color: var(--pos-rb); }
.headshot.pos-ring-WR { border-color: var(--pos-wr); } .headshot.pos-ring-TE { border-color: var(--pos-te); }
.headshot.pos-ring-K { border-color: var(--pos-k); } .headshot.pos-ring-DEF { border-color: var(--pos-def); }

/* ---------- cap bar ---------- */
.bar { display: flex; height: 10px; border-radius: 999px; background: var(--seg-track); overflow: hidden; }
.bar.sm { height: 8px; } .bar.lg { height: 12px; }
.bar span { display: block; height: 100%; }
.b-sal { background: var(--seg-salary); } .b-dead { background: var(--seg-dead); } .b-eat { background: var(--seg-eaten); }
.b-adj { background: var(--seg-adj); }
.b-ir { background: repeating-linear-gradient(135deg, var(--seg-ir-a) 0 3px, var(--seg-ir-b) 3px 6px); }
.bar-wrap { position: relative; }
.bar-cap { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-2); border-radius: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.srow { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.srow-h { display: flex; flex-direction: column; gap: 1px; }
.srow.now .srow-h b { color: var(--accent); }
.srow-amt { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 76px; }
.srow-legend { padding: 10px 14px; }
.pos-bar span + span { box-shadow: inset 2px 0 0 var(--surface); }
.pos-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.pos-legend > span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.hbar { height: 8px; border-radius: 999px; background: var(--seg-track); overflow: hidden; flex: 1; min-width: 40px; }
.hbar span { display: block; height: 100%; border-radius: 999px; background: var(--seg-salary); }
.hbar.over span { background: var(--seg-dead); }

/* ---------- cap board: attention list, season table ---------- */
.attention { padding: 4px 0; }
.att-row { display: flex; align-items: baseline; gap: 10px; padding: 8px 14px; font-size: 13px; }
.att-row + .att-row { border-top: 1px solid var(--line-soft); }
.att-row .dot { align-self: flex-start; margin-top: 6px; }
.att-clear .dot { align-self: center; margin-top: 0; }
.att-team { font-weight: 700; flex-shrink: 0; }
.att-team a { color: var(--text); }
.att-text { color: var(--text-2); min-width: 0; }
.att-rule { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.att-clear { align-items: center; color: var(--text-2); }
.att-clear .ico { width: 16px; height: 16px; color: var(--ok); flex-shrink: 0; }
.board-wrap { position: relative; }   /* keeps the cells' sr-only labels inside the scroll box */
.table.board-table { font-size: 12.5px; }
.table.board-table th, .table.board-table td { padding: 8px; }
.board-table tbody th { position: sticky; left: 0; top: auto; z-index: 1; background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--text); border-right: 1px solid var(--line); }
.board-table thead th:first-child { left: 0; z-index: 2; border-right: 1px solid var(--line); }
.board-table .th-group th[colspan] { text-align: center; border-bottom-color: var(--line-soft); padding-bottom: 2px; }
.board-table .th-group th[colspan] + th[colspan] { border-left: 1px solid var(--line-soft); }
.board-table tbody tr:hover th { background: var(--hover); }
.board-table tbody th a.board-team { display: flex; align-items: center; gap: 8px; max-width: 168px; color: var(--text); font-weight: 600; }
.board-table tbody th a.board-team:hover { color: var(--accent); text-decoration: none; }
.board-team .ellipsis { min-width: 0; }
.board-team .dot { margin-left: 2px; }
.board-charge .bar { margin-top: 5px; min-width: 64px; }
.bar.xs { height: 4px; }
.space { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; margin-right: -7px; border-radius: var(--r-chip); font-weight: 700; }
.space .ico, .ico-xs { width: 12px; height: 12px; stroke-width: 2.4; vertical-align: -1px; }
.space-over { background: var(--over-bg); color: var(--over); }
.space-tight { background: var(--tight-bg); color: var(--tight); }
@media (max-width: 640px) { .board-table tbody th a.board-team { max-width: 128px; } .board-team .avatar { display: none; } }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border-radius: 12px; border: 1px solid transparent; font: 700 14px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { color: var(--on-accent); filter: brightness(1.06); }
.btn-ghost { background: var(--control); color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { color: var(--text); border-color: var(--line-hover); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover { color: var(--danger); }
.btn-sm { min-height: 32px; padding: 0 11px; border-radius: 9px; font-size: 12.5px; font-weight: 600; }
.btn-block { width: 100%; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns > .btn { flex: 1 1 auto; min-width: 0; }
.btns > .btn, .btn-wrap { white-space: normal; text-align: center; padding-top: 6px; padding-bottom: 6px; }
.back { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-raised); color: var(--text-2); flex-shrink: 0; }
.back:hover { color: var(--text); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-soft); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--line-hover); }

.seg { display: flex; background: var(--surface-inset); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.seg a, .seg button {
  flex: 1; white-space: nowrap; border: 0; background: transparent; color: var(--muted); font: 600 12.5px var(--font); padding: 8px 6px; border-radius: 8px;
  cursor: pointer; min-height: 36px; text-align: center; display: inline-flex; align-items: center; justify-content: center;
}
.seg a:hover, .seg button:hover { color: var(--text); text-decoration: none; }
.seg .on { background: var(--seg-on); color: var(--text); }

.pills { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pills a, .pills button {
  flex-shrink: 0; border: 1px solid var(--line); background: var(--surface-soft); color: var(--muted); font: 600 12.5px var(--font);
  padding: 0 13px; min-height: 36px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.pills a:hover, .pills button:hover { color: var(--text); text-decoration: none; }
.pills .on { background: var(--pill-on-bg); color: var(--pill-on-text); border-color: var(--pill-on-bg); }
.pills.pills-sm a, .pills.pills-sm button { min-height: 32px; padding: 0 11px; font-size: 12px; }
.pills.pills-sm .on { background: var(--seg-on); color: var(--text); border-color: var(--line-hover); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 0 14px; min-height: 42px; display: flex; align-items: center; color: var(--muted); font-weight: 600; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
@media (max-width: 640px) {
  .tabs { border-bottom: 0; gap: 6px; padding-bottom: 2px; }
  .tabs a { border: 1px solid var(--line); background: var(--surface-soft); border-radius: 999px; min-height: 38px; margin: 0; font-size: 13px; }
  .tabs a.on { background: var(--pill-on-bg); color: var(--pill-on-text); border-color: var(--pill-on-bg); }
}

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 11.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 0 12px; border-radius: 11px; background: var(--surface-soft); border: 1px solid var(--line-strong);
  color: var(--text); font: 500 14px var(--font);
}
.textarea { padding: 10px 12px; min-height: 80px; resize: vertical; }
.select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 13.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 44px; border-radius: 12px; background: var(--surface-soft); border: 1px solid var(--line); color: var(--muted); }
.search input { flex: 1; border: 0; background: transparent; color: var(--text); font: 500 14px var(--font); outline: none; min-width: 0; min-height: 40px; }
.search:focus-within { outline: 2px solid var(--focus); }
.asof { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface-soft); color: var(--text-2); font: 600 12.5px var(--font); padding: 0 10px; min-height: 36px; border-radius: 10px; }
.asof input { border: 0; background: transparent; color: var(--text); font: 600 12.5px var(--font); min-height: 32px; color-scheme: inherit; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--control); color: var(--text); font: 700 19px var(--font); cursor: pointer; }
.stepper button:disabled { opacity: .4; cursor: default; }
.stepper output { min-width: 74px; text-align: center; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- banners, toasts, empty ---------- */
.banner { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border-radius: 12px; background: var(--surface-raised); border: 1px solid var(--line-strong); font-size: 12.5px; color: var(--text-2); }
.banner b { color: var(--text); }
.banner .ico { margin-top: 1px; }
.banner-warn { background: var(--tight-bg); border-color: var(--tight-line); }
.banner-warn .ico { color: var(--tight); }
.banner-over { background: var(--over-bg); border-color: var(--over-line); }
.banner-over .ico { color: var(--over); }
.banner-ok .ico { color: var(--ok); }
.banner-violet { background: var(--violet-bg); border-color: var(--commish-line); }
.banner-violet .ico { color: var(--violet); }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 32px)); }
@media (max-width: 640px) { .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); } .seg a, .seg button { font-size: 12px; padding: 8px 4px; } }
.toast { padding: 12px 14px; border-radius: 12px; background: var(--toast-bg); color: var(--toast-text); font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow); }
.toast a { color: var(--toast-text); text-decoration: underline; margin-left: auto; white-space: nowrap; }
.toast.toast-error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-line); }
.toast.toast-error a { color: var(--danger); }
.empty { padding: 26px 18px; text-align: center; color: var(--muted); font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty .ico { color: var(--faint); width: 26px; height: 26px; }
.empty b { color: var(--text-2); font-size: 14px; }
.empty p { max-width: 420px; line-height: 1.45; }
.skeleton { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.skeleton span { display: block; height: 10px; border-radius: 999px; background: var(--surface-raised); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
.table th { font-size: 11.5px; font-weight: 600; color: var(--muted); position: sticky; top: 0; background: var(--surface); z-index: 1; border-bottom-color: var(--line); }
.table th a { color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover, .table th a.on { color: var(--text); text-decoration: none; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--hover); }
.table td a { color: var(--text); font-weight: 600; }
.table td a:hover { color: var(--accent); }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--line); }

/* ---------- season grid ---------- */
.grid { overflow-x: auto; }
.gr { display: grid; grid-template-columns: minmax(150px, 1.6fr) repeat(var(--cols, 5), minmax(78px, 1fr)); min-width: calc(150px + var(--cols, 5) * 78px); font-size: 12.5px; }
.gr.gr-wide { grid-template-columns: minmax(190px, 2fr) 70px 120px 76px repeat(var(--cols, 5), minmax(86px, 1fr)); min-width: calc(456px + var(--cols, 5) * 86px); font-size: 13px; }
.gr > div { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gr > .l { text-align: left; }
.gr > .pl { position: sticky; left: 0; text-align: left; background: var(--surface); border-right: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; z-index: 1; }
.gr > .pl a { color: var(--text); font-weight: 600; }
.gr > .pl a:hover { color: var(--accent); }
.gr.hd > div { font-size: 11px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.gr.grp > div { background: var(--surface-inset); font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; text-align: left; padding: 6px 10px; }
.gr.tot > div { font-weight: 700; }
.gr.tot.first > div { border-top: 1px solid var(--line); }
.gr:not(.hd):not(.grp):not(.tot):hover > div { background: var(--hover); }
.c-none { color: var(--none); }
.c-ir { color: var(--dim); text-decoration: line-through; }
.c-opt { color: var(--muted); font-style: italic; }
.c-eat { color: var(--eaten-text); }
@media (min-width: 641px) { .gr { font-size: 13px; } .gr > div { padding: 9px 14px; } }

/* ---------- timeline ---------- */
.tl { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.tl:last-child { border-bottom: 0; }
.tl-dot { width: 66px; min-height: 30px; padding: 3px 4px; border-radius: 9px; display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.15; flex-shrink: 0; font-size: 10.5px; font-weight: 800; }
.tl-text { font-weight: 600; font-size: 13.5px; }
.tl.cancelled .tl-text { text-decoration: line-through; color: var(--muted); }
.tl-amt { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- preview diff & rules ---------- */
.diff { display: grid; grid-template-columns: 52px repeat(var(--teams, 2), minmax(0, 1fr)); font-size: 12.5px; }
.diff > div { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); text-align: right; font-variant-numeric: tabular-nums; min-width: 0; }
.diff > div.dy { text-align: left; color: var(--muted); font-weight: 600; }
.diff.hd > div, .diff > .hd { font-size: 11px; color: var(--muted); font-weight: 600; border-bottom-color: var(--line); }
.diff-card { overflow: hidden; }
.diff-card .diff:last-child > div { border-bottom: 0; }
.diff .delta { font-size: 11px; color: var(--muted); margin-left: 4px; }
.rule { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; padding: 8px 14px; border-bottom: 1px solid var(--line-soft); }
.rule:last-child { border-bottom: 0; }
.rule .dot { margin-top: 5px; }
.rule b { width: 52px; flex-shrink: 0; }
.rule span { color: var(--text-2); }
.result { padding: 14px; border-radius: var(--r-card); display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); background: var(--surface); }
.result.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.result.ok > .ico { color: var(--ok); }
.result.bad { background: var(--over-bg); border-color: var(--over-line); }
.result.bad > .ico { color: var(--over); }
.result-title { font-weight: 800; font-size: 15px; }
.result-text { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }

/* trade checker assets */
.side-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.asset { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); min-height: 52px; cursor: pointer; }
.asset:last-child { border-bottom: 0; }
.asset:hover { background: var(--hover); }
.asset input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
.asset-scroll { max-height: 360px; overflow-y: auto; }

/* inbox */
.item-h { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 13px 14px; color: var(--text); list-style: none; cursor: pointer; }
.item-h::-webkit-details-marker { display: none; }
.item-h:hover { background: var(--hover); border-radius: var(--r-card); }
details[open] > .item-h:hover { border-radius: var(--r-card) var(--r-card) 0 0; }
.item-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.done { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-size: 13px; color: var(--ok); }
.sync { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 12.5px; flex-wrap: wrap; }
.role { font-size: 11px; font-weight: 700; color: var(--violet); background: var(--violet-bg); padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.sample { font-size: 11px; font-weight: 600; color: var(--violet); background: var(--violet-bg); padding: 4px 9px; border-radius: 999px; white-space: nowrap; }

/* player page */
.yrs { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.yr { padding: 10px; border-radius: 12px; background: var(--surface-inset); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.yr b { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.yr span { font-size: 11px; color: var(--muted); }
.big-figs { display: flex; gap: 18px; flex-wrap: wrap; }
.big-figs b { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.4px; }
.big-figs span { font-size: 11px; color: var(--muted); }

/* rules page */
.rulebook h2 { font-size: 16px; font-weight: 800; }
.rule-card { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 6px; scroll-margin-top: 80px; }
.rule-card:last-child { border-bottom: 0; }
.rule-card:target { background: var(--selected); }
.rule-id { font-weight: 800; font-size: 12px; letter-spacing: .4px; color: var(--accent); }
.ruling { border-left: 3px solid var(--line-strong); padding: 6px 0 6px 12px; font-size: 12.5px; color: var(--text-2); }
.ruling.provisional { border-left-color: var(--tight); }
.quote { font-size: 12.5px; color: var(--muted); font-style: italic; }

/* dialog / bottom sheet */
dialog.sheet { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); padding: 0; width: min(560px, calc(100% - 24px)); max-height: 86vh; box-shadow: var(--shadow); }
dialog.sheet::backdrop { background: var(--scrim); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.sheet-body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
@media (max-width: 640px) {
  dialog.sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 88vh; }
}

/* error page */
.error-page { max-width: 520px; margin: 8vh auto; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.error-code { font-size: 54px; font-weight: 800; letter-spacing: -2px; color: var(--accent); }

/* login */
.login { max-width: 400px; margin: 10vh auto; display: flex; flex-direction: column; gap: 16px; padding: 0 16px; }

/* styleguide */
.sg-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.sg-swatch { border-radius: 10px; border: 1px solid var(--line); overflow: hidden; font-size: 11px; }
.sg-swatch i { display: block; height: 36px; }
.sg-swatch span { display: block; padding: 6px 8px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Actions page: one row per action on desktop, a card per action on a phone ---------- */
.actions-list { padding: 0; }
.act-group { margin: 0; padding: 10px 16px 6px; font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; background: var(--surface-inset); border-top: 1px solid var(--line); }
.act-group:first-child { border-top: 0; border-radius: var(--r-card) var(--r-card) 0 0; }
.act-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; padding: 14px 16px; border-top: 1px solid var(--line-soft); }
.act-group + .act-row { border-top: 0; }
.act-title { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--text); }
.act-desc { margin: 4px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.act-form { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 10px; }
.act-form .field { flex: 1 1 130px; }
.act-form .field.f-wide { flex: 2 1 180px; }
.act-form .field.f-narrow { flex: 0 1 80px; }
.act-form .input, .act-form .select { min-height: 36px; border-radius: 9px; font-size: 13px; }
.act-form > .btn, .act-form > .btns { margin-top: 22px; }
.act-form > .btn { min-height: 36px; }
@media (max-width: 900px) {
  .actions-list { background: none; border: 0; display: flex; flex-direction: column; gap: 12px; }
  .act-group { background: none; border: 0; padding: 8px 2px 0; }
  .act-row { grid-template-columns: 1fr; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
  .act-group + .act-row { border-top: 1px solid var(--line); }
  .act-form .field, .act-form .field.f-wide, .act-form .field.f-narrow { flex: 1 1 100%; }
  .act-form > .btn, .act-form > .btns { margin-top: 4px; flex: 1 1 100%; }
  .act-form .input, .act-form .select { min-height: 42px; }
}

/* ---------- desktop density: list rows on one line, tighter padding (phone unchanged) ---------- */
.row-body { gap: 2px; }
@media (min-width: 1024px) {
  .page { gap: 14px; }
  .card-pad { padding: 12px 14px; }
  .tiles { gap: 8px; }
  .tile { padding: 10px 14px; }
  .tile b { font-size: 20px; }
  .kv { padding: 7px 14px; }
  .row, .tl { padding: 7px 14px; gap: 10px; }
  .tl { align-items: center; }
  .tl-dot { width: 60px; min-height: 22px; border-radius: 7px; font-size: 10px; }
  .tl-amt { min-width: 72px; text-align: right; }
  .row-body { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 12px; row-gap: 1px; }
  .row-body > :first-child { flex: 0 1 auto; min-width: 0; }
  .row-body > .row-meta, .row-body > .small, .row-body > .muted { flex: 1 1 220px; min-width: 0; }
  .row-amt { display: flex; align-items: baseline; gap: 10px; }
  .row-amt span { order: -1; }
  .row-amt b { min-width: 64px; }
}

/* ---------- traded cap entry: one amount per season ---------- */
.season-amts { display: flex; flex-wrap: wrap; gap: 6px; }
.season-amt { display: flex; flex-direction: column; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); }
.season-amt .input { width: 76px; min-height: 34px; }
.absorb { border-top: 1px solid var(--line-soft); padding: 8px 14px; }
.absorb > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.absorb-body { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }

/* ---------- trade checker: dense rosters, pick chips, summary, traded cap ---------- */
.tpickers { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; }
.tpickers.three { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); }
.tpickers .select { min-height: 38px; font-size: 13.5px; }
.tswap { font-size: 15px; }
.tlayout { display: flex; flex-direction: column; gap: 10px; }
.trosters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: start; }
.tlayout.three .trosters { grid-template-columns: minmax(0, 1fr); }
.troster { overflow: hidden; display: flex; flex-direction: column; }
.troster-h { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); min-width: 0; }
.troster-n { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 12.5px; }
.troster-n .num { font-size: 11px; }
.troster-list { display: flex; flex-direction: column; }
.troster-empty { padding: 10px; margin: 0; }
.trow { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto auto; gap: 6px; align-items: center; padding: 6px 9px; min-height: 34px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; cursor: pointer; }
.trow:has(.trow-to) { grid-template-columns: 26px minmax(0, 1fr) auto auto auto; }
.trow .pos { min-width: 26px; font-size: 10px; padding: 2px 0; }
.trow-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.trow-m { font-weight: 700; }
.trow-y { color: var(--muted); font-size: 11px; min-width: 18px; text-align: right; }
.trow-to { font: inherit; font-size: 11.5px; background: var(--surface-soft); color: var(--text); border: 1px solid var(--line-strong); border-radius: 7px; padding: 2px 4px; }
.trow:hover { background: var(--hover); }
.trow.on, .trow:has(input:checked) { background: var(--accent-tint); box-shadow: inset 3px 0 0 var(--accent); }
.trow:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }
.trow-tc .tag { justify-self: start; }
.tpicks { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 9px; border-top: 1px solid var(--line); }
.tpick { border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 10px; font-size: 11.5px; font-weight: 600; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.tpick select { font: inherit; font-size: 11px; background: none; color: inherit; border: 0; }
.tpick.on, .tpick:has(input:checked) { background: var(--accent-tint); color: var(--accent); border-color: var(--accent); }
.tpick:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.tsum { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.tsum-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tsum-h .sect { margin: 0; }
.tsum-give, .tsum-why { margin: 0; font-size: 13px; }
.tsum-note { margin: 0; font-size: 11px; }
.ctable { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
.ctable th, .ctable td { padding: 5px 4px; text-align: right; white-space: nowrap; }
.ctable thead th { font-size: 11px; font-weight: 600; color: var(--muted); }
.ctable tbody th { text-align: left; width: 38px; }
.ctable tbody tr + tr > * { border-top: 1px solid var(--line-soft); }
.cdelta { display: block; font-size: 10.5px; font-weight: 600; }
.cdelta.up { color: var(--over); } .cdelta.dn { color: var(--ok); }
.tcap { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.tcap .sect, .tcap p { margin: 0; }
.tcap-line { border-top: 1px solid var(--line-soft); padding-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.tcap-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tcap-row .field { flex: 1 1 140px; }
.tcap-row .field.f-wide { flex: 2 1 200px; }
.tcap .select { min-height: 36px; font-size: 13px; }
.tcap-say { margin: 0; font-size: 12.5px; color: var(--ok); background: var(--ok-bg); border-radius: 8px; padding: 6px 9px; }
.troster-find { display: flex; gap: 6px; padding: 8px 9px; border-bottom: 1px solid var(--line); }
.troster-find .input { flex: 1 1 auto; min-width: 0; min-height: 34px; font-size: 13px; }
.troster-find [data-expand] { display: none; }
.tgroup { margin: 0; padding: 5px 9px 3px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: var(--muted); background: var(--surface-soft); border-bottom: 1px solid var(--line-soft); }
.troster.searching .trow[data-name]:not(.match), .troster.searching .tgroup, .troster.searching .trow-tc { display: none; }
@media (max-width: 640px) {
  /* a phone: one team at a time, full width; a list folds to the players picked until it's opened or searched */
  .trosters { grid-template-columns: minmax(0, 1fr); }
  .troster-find [data-expand] { display: inline-flex; flex: none; }
  .troster:not(.open):not(.searching) .trow:not(.on):not(:has(input:checked)):not(:has(select option:checked:not([value=""]))),
  .troster:not(.open):not(.searching) .tgroup { display: none; }
  .troster:not(.open):not(.searching) .troster-empty { display: none; }
}
@media (min-width: 1000px) {
  .tlayout:not(.three) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 10px; align-items: start; }
  .tlayout:not(.three) .trosters { display: contents; }
  .tlayout:not(.three) .troster:nth-child(1) { grid-column: 1; grid-row: 1 / 3; }
  .tlayout:not(.three) .troster:nth-child(2) { grid-column: 3; grid-row: 1 / 3; }
  .tlayout:not(.three) .tsummary { grid-column: 2; grid-row: 1; }
  .tlayout:not(.three) .tcapw { grid-column: 2; grid-row: 2; }
  .tlayout:not(.three) .troster-list { max-height: 640px; overflow-y: auto; }
  .tlayout.three .trosters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- contracts list: one line per contract on a phone, paging ---------- */
.avatar.xs { width: 20px; height: 20px; font-size: 8px; }
.cline { display: grid; grid-template-columns: 20px 26px minmax(0, 1fr) 20px auto; gap: 7px; align-items: center; padding: 7px 12px; min-height: 38px; border-bottom: 1px solid var(--line-soft); color: var(--text); font-size: 13px; }
.cline:last-child { border-bottom: 0; }
.cline:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.cline .pos { min-width: 26px; font-size: 9px; padding: 2px 0; }
.cline-n { display: flex; align-items: center; gap: 4px; min-width: 0; }
.cline-n b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cline-m { display: flex; align-items: baseline; gap: 5px; justify-content: flex-end; min-width: 76px; }
.cline-m b { font-weight: 700; } .cline-m small { color: var(--muted); font-size: 11px; min-width: 16px; text-align: right; }
.show-more { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
/* the contract's shape: cap hit by season and the total, on a second line, aligned down the list */
.cline.has-split { row-gap: 3px; }
.cline-split { grid-column: 3 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; text-align: right; font-size: 11.5px; color: var(--muted); }
.cline-split .on { color: var(--text); font-weight: 700; }
.cline-split .tot { color: var(--text-2); }
.cline-split .tot.on { color: var(--text); }
.cline-head { min-height: 0; padding-top: 6px; padding-bottom: 6px; }
.cline-head .cline-split a { color: var(--text-2); font-size: 11px; font-weight: 600; }
.cline-head .cline-split a.on { color: var(--text); font-weight: 800; }
@media (max-width: 640px) {
  .tiles.tiles-2 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .tiles.tiles-2 .tile { padding: 8px 8px; }
  .tiles.tiles-2 .tile b { font-size: 14px; }
  .tiles.tiles-2 .tile span { font-size: 10px; line-height: 1.25; }
}

/* ---------- trades list: compact blocks ---------- */
.tlines { padding: 0; }
.tline { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "when swing" "sides swing"; gap: 3px 12px; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.tline:last-child { border-bottom: 0; }
.tline.flagged { box-shadow: inset 3px 0 0 var(--over); }
.tline.cancelled .tline-side { text-decoration: line-through; color: var(--muted); }
.tline-when { grid-area: when; font-size: 11.5px; color: var(--text-2); }
.tline-sides { grid-area: sides; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tline-side, .tline-tc, .tline-note { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tline-tc, .tline-note { font-size: 12px; }
.tline-tc { color: var(--eaten-text); }
.tline-swing { grid-area: swing; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12.5px; }
.tline-swing span { display: flex; align-items: center; gap: 5px; }
.tline-swing small { font-size: 10.5px; }
@media (min-width: 1024px) {
  .tline { grid-template-columns: 120px minmax(0, 1fr) auto; grid-template-areas: "when sides swing"; align-items: start; }
}

/* ---------- inbox: trade summary like the checker's ---------- */
.tsum-inset { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.checks-passed { display: flex; align-items: center; gap: 6px; margin: 0; }
.checks-passed .ico { color: var(--ok); }

/* ---------- pending trades and suggested traded cap ---------- */
.tline.pending { box-shadow: inset 3px 0 0 var(--tight); }
.pending-box p { margin: 0; }
.suggest-box { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.suggest-box .sect { margin: 0; }
.suggest-row { display: flex; gap: 10px; align-items: flex-start; border-top: 1px solid var(--line-soft); padding-top: 8px; }
.suggest-row p { margin: 2px 0 0; }

/* ---------- rules, audit, compliance density ---------- */
/* rules: compact cards, rulings behind a toggle */
.rule-card { padding: 10px 14px; gap: 4px; }
.rule-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 10px; flex-wrap: wrap; }
.rule-card p { margin: 0; }
.rule-text { font-size: 13px; line-height: 1.4; }
.rule-meta { display: flex; flex-wrap: wrap; gap: 0 6px; }
.rule-rulings { margin-top: 2px; }
.rule-rulings > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 3px 0; min-height: 24px; }
.rule-rulings > summary::-webkit-details-marker { display: none; }
.rule-rulings > summary:hover { color: var(--text); }
.rr-chev { transition: transform .15s; }
.rule-rulings[open] .rr-chev { transform: rotate(180deg); }
.rr-list { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.rr-list .ruling { padding: 2px 0 2px 10px; }
.rr-id { font-weight: 700; color: var(--text); }
.ruling-card .quote { font-size: 12px; }
@media (min-width: 1024px) {
  .rule-card { padding: 8px 14px; }
  .rule-head .muted { white-space: nowrap; }
}

/* audit log: the table's cells reflow to a two-line list row on a phone */
.au-what .au-src { display: block; }
.au-what { white-space: normal; min-width: 260px; }
.au-why { white-space: normal; min-width: 160px; }
.au-fallback { display: none; }
.audit-row:target td { background: var(--selected); }
@media (max-width: 640px) {
  .audit-table, .audit-table tbody { display: block; }
  .audit-table thead { display: none; }
  .audit-table tr.audit-row { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-areas: "what what what act" "when who why why"; column-gap: 0; row-gap: 2px; padding: 7px 14px; border-bottom: 1px solid var(--line-soft); scroll-margin-top: 70px; }
  .audit-table tr.audit-row:last-child { border-bottom: 0; }
  .audit-table td { display: block; padding: 0; border: 0; white-space: normal; min-width: 0; }
  .audit-table tr.audit-row:hover td { background: none; }
  .audit-table tr.audit-row:target { background: var(--selected); }
  .audit-table tr.audit-row:target td { background: none; }
  .au-what { grid-area: what; font-size: 13px; font-weight: 600; line-height: 1.3; min-width: 0; }
  .au-what .au-src { display: none; }
  .au-act { grid-area: act; align-self: start; padding-left: 10px; }
  .au-when, .au-who, .au-why { font-size: 11.5px; color: var(--muted); min-width: 0; }
  .au-when { grid-area: when; }
  .au-who { grid-area: who; }
  .au-who::before { content: "·"; margin: 0 5px; }
  .au-why { grid-area: why; }
  .au-why::before { content: "·"; margin: 0 5px; }
  .au-fallback { display: inline; }
}

/* compliance: one table on desktop, the grouped list below that */
.issue-view-table { display: none; }
.issue-view-groups { display: contents; }
@media (min-width: 1024px) {
  .issue-view-table { display: block; }
  .issue-view-groups { display: none; }
  .issue-table td { white-space: normal; vertical-align: top; padding: 7px 14px; }
  .issue-table .it-team { white-space: nowrap; }
  .it-teamlink { display: inline-flex; align-items: center; gap: 8px; }
  .issue-table .it-rule { white-space: nowrap; }
  .it-rule .dot { margin-right: 8px; vertical-align: middle; }
  .issue-table .it-act { text-align: right; white-space: nowrap; width: 1%; }
  .issue-table .it-msg { min-width: 320px; }
}

/* ---------- fixes after review ---------- */
/* the base .table td is nowrap and outranks .au-what; long audit titles must wrap, not run under "Undo…" */
.audit-table td.au-what, .audit-table td.au-why { white-space: normal; }
/* trades list: team and what it gets read as one sentence that wraps naturally */
.tline-side { display: block; }
.tline-side .avatar { display: inline-flex; vertical-align: -5px; margin-right: 5px; }
@media (max-width: 1023px) {
  .tline.pending { grid-template-columns: minmax(0, 1fr); grid-template-areas: "when" "sides" "swing"; }
  .tline.pending .tline-swing { align-items: flex-start; }
}

/* ---------- offseason (SPEC §13) ---------- */
.off-row { flex-wrap: wrap; }
.off-row > .row-body { flex: 1 1 200px; }
.off-act { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.off-btns { flex-wrap: nowrap; }
.off-btns > .btn { flex: 0 0 auto; }
.step-head { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.step-head .sect { margin: 0; }
.step-n { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex-shrink: 0;
  border-radius: var(--r-chip); background: var(--control); color: var(--text-2); font-size: 12px; font-weight: 800;
  border: 1px solid var(--line-strong); }
.step-n.step-done { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.step-n.step-blocked { background: var(--over-bg); color: var(--over); border-color: var(--over-line); }
.off-detail { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 12px; border-bottom: 1px solid var(--line-soft); }
.off-row:has(+ .off-detail) { border-bottom: 0; }
div:last-child > .off-detail { border-bottom: 0; }
.bidders { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bidders .chip b { margin-left: 4px; }
@media (max-width: 640px) {
  .off-act { margin-left: 0; width: 100%; }
  .off-btns { width: 100%; }
  .off-btns > .btn { flex: 1 1 0; }
}

/* ---------- design pass: utilities that replace inline styles ---------- */
.gap-0 { gap: 0; } .gap-3 { gap: 3px; } .gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; }
.gap-wrap { flex-wrap: wrap; gap: 6px 16px; }
.ml-auto { margin-left: auto; }
.flex-fill { flex: 1; }
.fill-form { flex: 1 1 auto; display: flex; }
.fill-form > .btn { flex: 1; }
.fit, .rule b.fit { width: auto; }
.inherit-color { color: inherit; }
.hbar-label { width: 40px; }
.hbar-amt { width: 68px; }
.hbar-extra { width: 64px; }
.skeleton .sk-s { width: 30px; } .skeleton .sk-m { flex: 1; } .skeleton .sk-l { width: 60px; }
.static-head { cursor: default; }

/* ---------- commissioner pages: a tinted strip on top of the content, so it is always clear you can write ---------- */
.is-commish .main::before { content: ""; display: block; height: 3px; background: var(--commish-line); }
@media (max-width: 640px) { .is-commish .main::before { display: none; } }   /* the phone top bar is tinted already */

/* ---------- data table: sticky header inside its own scroll box, sticky first column on request ---------- */
@media (min-width: 641px) { .table-wrap.tall { max-height: 78vh; overflow: auto; } }
.table-wrap.tall .table th { z-index: 2; }
.table.sticky-first tbody th, .table.sticky-first tbody td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; border-right: 1px solid var(--line); }
.table.sticky-first thead th:first-child { left: 0; z-index: 3; border-right: 1px solid var(--line); }
.table .wrap-cell { white-space: normal; min-width: 240px; }
.table .wrap-cell.narrow { min-width: 160px; }

/* a table that stacks into one card per row on a phone */
@media (max-width: 640px) {
  .table-stack, .table-stack tbody { display: block; }
  .table-stack thead { display: none; }
  .table-stack tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td { display: block; padding: 0; border: 0; white-space: normal; min-width: 0; text-align: left; overflow-wrap: anywhere; }
  .table-stack tbody tr:hover td { background: none; }
  .table-stack td.c-main { order: -1; flex: 1 0 100%; font-weight: 600; }
  .table-stack td.c-side { font-size: 12px; color: var(--muted); }
  .table-stack td.c-note { flex: 1 0 100%; font-size: 12px; color: var(--muted); }
  .table-stack td.c-act { margin-left: auto; }
  .table-stack td:empty { display: none; }
  .table-stack .wrap-cell { min-width: 0; }
}

/* the copy-to-chat block (weekly summary) */
.copy-block .textarea { min-height: 150px; }
.color-input { width: 64px; padding: 4px; }
