/* FF Dashboard styles, shared by index.html and admin.html. */
:root {
  --bg: #0f1115; --panel: #171a21; --panel-2: #1e222b; --line: #2a2f3a;
  --text: #e8eaed; --muted: #9aa0a6; --faint: #6b7280;
  --accent: #7aa2ff; --good: #34c27a; --warn: #f0b429; --bad: #f05252; --mine: #c49bff;
  --chip: #232835;
  --QB: #ff7a90; --RB: #34c2a5; --WR: #6ea8ff; --TE: #f0a35e; --K: #b0b8c4; --DEF: #a78bfa;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f7f9; --panel: #ffffff; --panel-2: #f1f3f6; --line: #e2e5ea;
    --text: #15181d; --muted: #5f6672; --faint: #8a919c;
    --accent: #2f5fe0; --good: #16955a; --warn: #b7791f; --bad: #d23434; --mine: #7c4ddb;
    --chip: #eef0f4;
    --QB: #d6365a; --RB: #0f8f78; --WR: #2f6fe0; --TE: #c46a16; --K: #5f6672; --DEF: #6d4ed8;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }

/* Header */
header { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 0 8px; flex-wrap: wrap; }
.top h1 { font-size: 18px; margin: 0; letter-spacing: -.01em; }
.week { color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }
.btn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: none; border: 0; padding: 5px 10px; color: var(--muted); }
.seg button.on { background: var(--panel-2); color: var(--text); }

.leagues { display: flex; gap: 6px; flex-wrap: wrap; padding-bottom: 8px; }
.lchip { display: inline-flex; align-items: center; gap: 6px; background: var(--chip); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 10px 3px 8px; font-size: 12px; max-width: 260px; }
.lchip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lchip .warn { color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--good); } .dot.stale { background: var(--warn); }
.dot.needs_auth, .dot.error { background: var(--bad); }
.dot.loading { background: var(--accent); animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }
.plat { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

nav.tabs { display: flex; gap: 4px; }
nav.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--muted); }
nav.tabs button.on { color: var(--text); border-color: var(--accent); }

/* Filters */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 0; }
.pos { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.pos button { background: var(--chip); border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px; font-size: 12px; font-weight: 600; }
.pos button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.filters input[type=search], .filters select { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.filters input[type=search] { width: 180px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); user-select: none; cursor: pointer; }
.count { color: var(--faint); font-size: 12px; margin-left: auto; }

/* Table */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { position: sticky; top: 0; background: var(--panel-2); font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 600; cursor: pointer; user-select: none; }
th.sorted { color: var(--text); }
th.sorted::after { content: " ▾"; } th.sorted.asc::after { content: " ▴"; }
th:first-child, td:first-child { text-align: left; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--panel-2); }
td.name b { font-weight: 600; }
.sub { color: var(--muted); font-size: 12px; }
.ptag { display: inline-block; min-width: 30px; text-align: center; font-size: 10px; font-weight: 700; border-radius: 4px;
  padding: 1px 4px; color: #fff; margin-right: 6px; vertical-align: 1px; }
.inj { display: inline-block; font-size: 10px; font-weight: 700; color: var(--bad); margin-left: 6px; }
.inj.Q { color: var(--warn); }
.up { color: var(--good); } .down { color: var(--bad); } .muted { color: var(--faint); }
.snaps span { display: inline-block; min-width: 24px; }
.snaps span:last-child { font-weight: 600; }
.avail { display: inline-flex; gap: 3px; align-items: center; }
.avail i { width: 10px; height: 10px; border-radius: 3px; background: var(--line); display: inline-block; }
.avail i.free { background: var(--good); }
.avail i.mine { background: #2f6fe0; }
.avail i.unknown { background: transparent; border: 1px dashed var(--faint); }
.avail em { font-style: normal; color: var(--muted); font-size: 12px; margin-left: 4px; min-width: 26px; text-align: left; }
.more { display: block; margin: 12px auto 24px; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }

/* Drawer */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 9; }
/* The player popup: a centered dialog. Full screen on phones. */
aside.drawer { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(960px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border-radius: 14px;
  border: 1px solid var(--line); box-shadow: 0 24px 70px rgba(0,0,0,.5); background: var(--panel); z-index: 10;
  border-left: 1px solid var(--line); overflow-y: auto; box-shadow: -10px 0 40px rgba(0,0,0,.35); }
.dhead { position: sticky; top: 0; background: var(--panel); padding: 16px 16px 12px; border-bottom: 1px solid var(--line); z-index: 1; }
.dhead { padding-right: 60px !important; }
.dhead h2 { margin: 0; font-size: 20px; }
.dname { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.lgchips { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; justify-content: flex-end; }
/* League availability: free = green on green tint, taken = gray, yours = blue. */
/* League chip: row 1 "Platform | League", then one row per team holding him
   (two in an MFL two-copy league), or "Available". */
.lg { display: inline-flex; flex-direction: column; gap: 1px; font-size: 12px; font-weight: 600; border-radius: 10px;
  padding: 4px 10px; white-space: nowrap; border: 1px solid transparent; line-height: 1.3; }
.lg .lg2 { font-weight: 500; font-size: 11.5px; opacity: .92; }
.lg.free { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.lg.taken { background: #5b616e; color: #fff; }
.lg.mine { background: #2f6fe0; color: #fff; }
.lg.unknown { color: var(--muted); border: 1px dashed var(--faint); }
.bioline { color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.6; }
.bioline .sep { color: var(--faint); margin: 0 2px; }
.bioline .bit { white-space: nowrap; }
.dhead .x { position: absolute; top: 12px; right: 12px; }
.dbody { padding: 16px; }
.dbody h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 20px 0 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.tilegroup { display: grid; grid-template-columns: 74px 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.tilegroup .tg { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tilegroup .tiles { grid-template-columns: repeat(3, 1fr); }
.tile .l small { color: var(--faint); }
/* Ownership row: Redraft (3) | Dynasty (3) | Adds (1), side by side. */
.ownrow { display: grid; grid-template-columns: 3fr 3fr 1fr; gap: 12px; margin-bottom: 12px; }
.ownrow.scoring { grid-template-columns: 2fr 5fr; }
.og .tg { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  margin: 0 0 6px 2px; }
.og .tiles { display: grid; gap: 6px; }
.og .tiles.n3 { grid-template-columns: repeat(3, 1fr); }
.og .tiles.n2 { grid-template-columns: repeat(2, 1fr); }
.og .tiles.n1 { grid-template-columns: 1fr; }
.og .tile { padding: 7px 9px; }
.og .tile .v { font-size: 17px; }
/* Games table: alternate row shading so a row is easy to follow across. */
.stats tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--text) 9%, transparent); }
.stats tbody tr.tot td { background: var(--panel-2); }
.stats tr.future td { color: var(--muted); }
.stats td.pp { font-variant-numeric: tabular-nums; }
th.grp { text-align: center !important; cursor: default; border-bottom: 1px solid var(--line); }
th.ctr, td.ctr { text-align: center; }
.admin h3 { margin-top: 0; }
.admin section + section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.admin .row input[type=text], .admin .row input[type=password], .admin .row select { min-width: 0; }
.admin .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.admin input[type=text], .admin input[type=password], .admin select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; }
/* The help box floats (position: absolute) instead of opening inline. Inline,
   it pushed the page down, which moved the ? out from under the mouse, which
   closed it, which moved the ? back under the mouse: an open/close loop. */
details.tip { display: inline-block; position: relative; vertical-align: middle; }
details.tip > summary { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px;
  border-radius: 50%; border: 1px solid var(--faint); color: var(--muted); font-size: 11px; font-weight: 700;
  cursor: pointer; list-style: none; vertical-align: 1px; margin-left: 4px; user-select: none; }
details.tip > summary::-webkit-details-marker { display: none; }
details.tip[open] > summary { background: var(--accent); border-color: var(--accent); color: #fff; }
.tipbox { position: absolute; top: calc(100% + 4px); left: -8px; z-index: 30; width: min(440px, calc(100vw - 24px));
  box-shadow: 0 12px 34px rgba(0,0,0,.45); text-transform: none; letter-spacing: normal; white-space: normal;
  display: block; margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--text); font-size: 12.5px; line-height: 1.5; font-weight: 400; }
.tipbox ol { margin: 4px 0; padding-left: 18px; }
.tipbox .note { color: var(--muted); margin-top: 6px; }
.tipbox code { font-size: 11.5px; }
.field .flabel { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.banner { background: color-mix(in srgb, var(--warn) 15%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  color: var(--text); border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
/* A divider before each ownership group. */
th.grp.redraft, th.grp.dynasty, .gl { border-left: 1px solid var(--line); }
.tile { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.tile .v { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 11px; color: var(--muted); }
.lrow { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.lrow:last-child { border-bottom: 0; }
.lcard { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 0; }
.lcard select, .lcard input { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.tag { font-size: 12px; font-weight: 600; border-radius: 6px; padding: 1px 8px; }
.tag.free { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.tag.mine { background: color-mix(in srgb, var(--mine) 20%, transparent); color: var(--mine); }
.tag.taken { color: var(--muted); }
.tag.unknown { color: var(--faint); }
.stats { font-size: 13px; }
.stats td, .stats th { padding: 5px 7px; }
.stats tr.tot td { font-weight: 650; background: var(--panel-2); }
.stats tr.dim td { color: var(--faint); }
.stats th { cursor: default; position: static; }
.depth { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.dgroup { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.dgroup b { font-size: 12px; color: var(--muted); }
.dgroup ol { margin: 4px 0 0; padding-left: 20px; }
.dgroup li { padding: 1px 0; }
.dgroup li.me { color: var(--accent); font-weight: 650; }
.dgroup button.link { background: none; border: 0; padding: 0; color: inherit; text-align: left; }
.dgroup button.link:hover { text-decoration: underline; }
.rankline { font-size: 15px; margin: 4px 0 10px; }
/* "Depth Chart" in the header line, and the chart it opens on hover or tap. */
.dclink { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: 3px; }
.dclink:hover, .dclink[aria-expanded="true"] { text-decoration-style: solid; }
.depthpop { position: fixed; z-index: 12; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,.5); padding: 12px 14px 14px; overflow-y: auto; }
.depthpop h3 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
svg.spark { width: 100%; height: 72px; display: block; margin-bottom: 8px; }

/* Settings */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 16px 0; }
.card h2 { font-size: 15px; margin: 0 0 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row input[type=text], .row input[type=password], .row select { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.row input[type=text] { flex: 1; min-width: 220px; }
.status-ok { color: var(--good); } .status-bad { color: var(--bad); } .status-warn { color: var(--warn); }
.teams label { display: flex; gap: 8px; align-items: center; padding: 5px 0; }
.err { color: var(--bad); margin-top: 8px; }
.help { color: var(--muted); font-size: 13px; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; width: min(340px, 100%); }
.login input { width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; margin: 12px 0; }

@media (max-width: 640px) {
  .hide-sm { display: none; }
  .admin .grid2 { grid-template-columns: 1fr; }
  aside.drawer { left: 0; top: 0; transform: none; width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; border: 0; }
  .tilegroup { grid-template-columns: 1fr; }
  .ownrow, .ownrow.scoring { grid-template-columns: 1fr; }
  .filters input[type=search] { width: 100%; }
  .filters select { flex: 1 1 40%; min-width: 0; }
  .top h1 { font-size: 16px; }
  .top .spacer { display: none; }
  th, td { padding: 7px 7px; }
}

/* Links styled as buttons (⚙ Admin, ← Dashboard) look like the other buttons. */
a.btn { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; }
.admin input[type=email] { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; }
.helprow { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: flex-start; }
