/* Buff's Drafts dashboard.
 *
 * One stylesheet, no build step, no framework: this is served from source on a
 * 2 GB droplet. Everything below is either a token or a component, in that
 * order, so a colour is changed in one place rather than forty.
 *
 * The three third-party pieces are served from node_modules by src/vendor.js:
 * Inter here, Lucide's icons and Chart.js from app.js.
 */

/* Inter, as one variable font: every weight from 100 to 900 in 47 KB, which is
 * less than a single static cut of most families. `swap` so the page renders in
 * the fallback immediately rather than holding text back for a webfont. */
@font-face {
  font-family: 'InterVariable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/vendor/inter.woff2') format('woff2');
}

:root {
  /* Layered surfaces rather than one flat grey. Depth is what tells a reader
     which box sits on top of which, without drawing a border around each. */
  --bg: #0a0c10;
  --surface: #12151b;
  --raised: #171b22;
  --hover: #1c212a;
  --line: #232833;
  --line-soft: #1a1f27;

  --text: #e9edf3;
  --muted: #8e99a8;
  --faint: #5c6674;

  --accent: #4da3ff;
  --accent-soft: rgba(77, 163, 255, 0.14);
  --good: #3ddc84;
  --good-soft: rgba(61, 220, 132, 0.14);
  --warn: #ffb020;
  --warn-soft: rgba(255, 176, 32, 0.14);
  --bad: #ff5f5f;
  --bad-soft: rgba(255, 95, 95, 0.14);

  --r-sm: 7px;
  --r: 11px;
  --r-lg: 16px;

  --rail: 232px;
  --top: 56px;
  --page: 1240px;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.28);
  --font: 'InterVariable', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  /* Inter's own opinion of itself: contextual alternates on, and the slashed
     zero and disambiguated 1/I/l that make an id or a rating unambiguous. */
  font-feature-settings: 'cv05' 1, 'cv08' 1, 'ss03' 1, 'calt' 1;
}

/* Digits that line up column to column. A ladder where 1487 and 998 wander
   sideways is a ladder that is hard to scan. */
.num, .elo-val, table td.num, table th.num, .stat-v, .kv-v { font-variant-numeric: tabular-nums; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent-soft); }

/* --- shell ------------------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  grid-template-rows: var(--top) 1fr;
  grid-template-areas: "brand topbar" "rail main";
  min-height: 100%;
}

.brand {
  grid-area: brand;
  /* Sticky like the top bar beside it. Without this the league's name scrolled
     away while the bar it sits in stayed, leaving a notch in the header. */
  position: sticky;
  top: 0;
  z-index: 21;
  /* Its own height, rather than whatever the grid row happens to be. The two
     bars used to be sized purely by the `var(--top)` track, so any layout that
     re-tracked the grid collapsed them. */
  min-height: var(--top);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(150deg, var(--accent), #2b6fbf);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: #06121f;
  flex: none;
}

.brand-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar {
  grid-area: topbar;
  min-height: var(--top);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}

.crumb { font-weight: 600; font-size: 14px; }
.spacer { flex: 1; }

/* The season is the frame every number on the page sits in, so it travels in
   the top bar rather than being repeated under each heading. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--raised);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.pill b { color: var(--text); font-weight: 600; }
.pill.warn { border-color: rgba(255, 176, 32, 0.4); background: var(--warn-soft); color: var(--warn); }

/* A dot that says the page is refreshing itself, so a stale number is never
   mistaken for a live one. */
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.55);
}
.live-dot.beat { animation: beat 1.1s ease-out; }
@keyframes beat {
  from { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.55); }
  to { box-shadow: 0 0 0 9px rgba(61, 220, 132, 0); }
}

.who {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 6px 0 10px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--raised);
  font-size: 12px;
}
.who-name { color: var(--muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-out {
  color: var(--faint);
  border-left: 1px solid var(--line);
  padding-left: 8px;
  padding-right: 4px;
}
.who-out:hover { color: var(--bad); text-decoration: none; }

/* --- rail -------------------------------------------------------------- */

.rail {
  grid-area: rail;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: var(--top);
  /* Exactly the height of what is left of the window, not the height of its own
     contents. `align-self: start` made the box hug nine nav items and stop
     there, leaving the page background showing below it as a ragged edge. */
  height: calc(100vh - var(--top));
  overflow-y: auto;
}

.rail-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--faint);
  padding: 14px 10px 6px;
}
.rail-label:first-child { padding-top: 2px; }

.rail button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.rail button:hover { background: var(--hover); color: var(--text); }
.rail button[aria-selected="true"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.rail button[aria-selected="true"] svg { color: var(--accent); }
.rail svg { width: 16px; height: 16px; flex: none; color: var(--faint); }

.rail-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 100px;
  background: var(--raised);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}
.rail-badge.live { background: var(--good-soft); border-color: transparent; color: var(--good); }
.rail-badge.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }

.rail-foot { margin-top: auto; padding: 10px; color: var(--faint); font-size: 11.5px; }

/* --- main -------------------------------------------------------------- */

main {
  grid-area: main;
  padding: 22px 24px 80px;
  min-width: 0;
}
.page { max-width: var(--page); margin: 0 auto; }

.head { margin-bottom: 18px; }
.head h1 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.head .sub { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; }

.sect {
  margin: 26px 0 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--faint);
}
.sect:first-child { margin-top: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.card + .card { margin-top: 12px; }
.card-pad { padding: 16px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; }
.card-head .sub { color: var(--muted); font-size: 12px; }

.empty {
  padding: 34px 16px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}
.empty-sm { padding: 20px 16px; }

/* --- stats ------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 13px 14px;
}
.stat-k {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-bottom: 5px;
}
.stat-v { display: block; font-size: 23px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.stat-v.warn { color: var(--warn); }
.stat-v.good { color: var(--good); }
.stat-foot { display: block; margin-top: 4px; font-size: 11.5px; color: var(--faint); }

/* --- tables ------------------------------------------------------------ */

.scroll-x { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  position: sticky;
  top: 0;
  text-align: left;
  padding: 9px 14px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  background: var(--raised);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--hover); }
td.num, th.num { text-align: right; }
td.muted { color: var(--faint); }
td.wrap { white-space: normal; }

.rank { color: var(--faint); font-variant-numeric: tabular-nums; width: 44px; }
.rank.top { color: var(--accent); font-weight: 600; }
.player { font-weight: 500; }
.streak-hot { color: var(--good); font-weight: 500; }
.streak-cold { color: var(--bad); }

/* The bar is scaled across the visible spread, not from zero: from zero every
   player is a near-full bar and the ladder looks like a tie. */
.elo-cell { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.elo-bar {
  width: clamp(60px, 22vw, 220px);
  height: 5px;
  border-radius: 100px;
  background: var(--line);
  overflow: hidden;
}
.elo-bar i { display: block; height: 100%; background: linear-gradient(90deg, #2b6fbf, var(--accent)); border-radius: 100px; }
.elo-val { font-weight: 600; min-width: 40px; text-align: right; }

/* --- tags -------------------------------------------------------------- */

.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--raised);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.tag.live { background: var(--good-soft); border-color: transparent; color: var(--good); }
.tag.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.tag.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.tag.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.tag.win { background: var(--good-soft); border-color: transparent; color: var(--good); }
.tag.loss { background: var(--bad-soft); border-color: transparent; color: var(--bad); }

.delta { font-variant-numeric: tabular-nums; font-weight: 500; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }

/* --- overview ---------------------------------------------------------- */

.cols {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: start;
}

/* The live queue, which is the one thing on this dashboard that changes while
   you are looking at it. Each position gets a card: who has it, and how many
   seats are still open. "We need a goalie" is the question this answers. */
.slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  padding: 14px;
}

.slot {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--raised);
  padding: 10px;
  min-height: 78px;
}
.slot.full { border-color: rgba(61, 220, 132, 0.32); background: var(--good-soft); }
.slot.open { border-style: dashed; }

.slot-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 7px;
}
.slot-pos { font-weight: 600; font-size: 12px; letter-spacing: 0.04em; }
.slot-count { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.slot.full .slot-count { color: var(--good); }
.slot-name { font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-open { font-size: 12px; color: var(--faint); font-style: italic; }

.fillbar { height: 4px; background: var(--line); border-radius: 100px; overflow: hidden; margin: 0 16px 14px; }
.fillbar i { display: block; height: 100%; background: var(--good); border-radius: 100px; transition: width 0.35s ease; }

/* A warning is a call to act, so it carries the fix as well as the fact. */
.warns { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.warn-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 13px;
  border-radius: var(--r);
  border: 1px solid rgba(255, 176, 32, 0.28);
  background: var(--warn-soft);
  font-size: 13px;
}
.warn-row svg { width: 16px; height: 16px; color: var(--warn); flex: none; margin-top: 1px; }
.warn-row b { font-weight: 500; }
.warn-row .hint { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.mini { display: flex; flex-direction: column; }
.mini-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  cursor: pointer;
}
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover { background: var(--hover); }
.mini-rank { width: 18px; color: var(--faint); font-variant-numeric: tabular-nums; font-size: 12px; }
.mini-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-meta { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }

/* --- drawer ------------------------------------------------------------ */
/* Player and game detail. A modal would hide the list you came from; a drawer
   keeps it, so you can walk down a ladder without navigating back each time. */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
  /* Animated FROM transparent, not TO it. The resting state is the visible one,
     so an animation that never runs leaves the scrim correct rather than
     invisible — see the note on .drawer below. */
  animation: fade 0.16s ease;
}
@keyframes fade { from { opacity: 0; } }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 41;
  display: flex;
  flex-direction: column;
  /* Animated FROM off-screen, not TO on-screen.
     Written the other way round the resting state was `translateX(100%)` and
     the animation's `forwards` fill was the only thing bringing the panel into
     view — so anywhere the animation did not run, the drawer opened entirely
     off the right-hand edge with no error and nothing to see. A background tab
     throttles animations, and reduced-motion cuts them to almost nothing. The
     element's own styles put it where it belongs; the animation only decides
     how it got there. */
  animation: slide 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes slide { from { transform: translateX(100%); } }

.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.drawer-head .sub { color: var(--muted); font-size: 12px; }
.drawer-body { overflow-y: auto; padding: 16px; flex: 1; }

.x {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--raised);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
  flex: none;
}
.x:hover { background: var(--hover); color: var(--text); }

/* The widest thing a cell holds is a record — 31-12-3, seven characters of
   tabular figures. Sized under that, auto-fit packed four columns into a phone
   and the record wrapped mid-value as "31-" over "12-3". */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kv-cell { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; }
.kv-k { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); margin-bottom: 3px; }
.kv-v { display: block; font-size: 17px; font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }

.teamgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .teamgrid { grid-template-columns: 1fr; } }
.team-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  background: var(--raised);
  font-size: 12px;
  font-weight: 600;
}
.team-head.won { background: var(--good-soft); color: var(--good); }
.team-body { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r-sm) var(--r-sm); }
.team-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.team-row:last-child { border-bottom: 0; }
.team-pos { width: 26px; color: var(--faint); font-size: 11px; font-weight: 600; flex: none; }
.team-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.team-name:hover { color: var(--accent); }

/* --- transcript -------------------------------------------------------- */

.msg {
  display: grid;
  grid-template-columns: 48px 108px 1fr;
  gap: 10px;
  padding: 5px 0;
  font-size: 13px;
  align-items: baseline;
}
.msg-at { color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.msg-who { color: var(--accent); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-text { color: var(--text); overflow-wrap: anywhere; }
.msg-att { margin-left: 6px; font-size: 12px; }
@media (max-width: 560px) { .msg { grid-template-columns: 44px 1fr; } .msg-who { grid-column: 2; } .msg-text { grid-column: 2; } }

/* --- controls ---------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #04121f;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn.ghost { background: var(--raised); border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 27px; padding: 0 10px; font-size: 12px; }

.search {
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  width: 100%;
  max-width: 320px;
}
.search:focus { outline: none; border-color: var(--accent); }
.search::placeholder { color: var(--faint); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }

/* A segmented control, for filters with a handful of options. Cheaper to read
   than a dropdown you have to open to discover what is in it. */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--raised); overflow: hidden; }
.seg button {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  padding: 0 12px;
  height: 30px;
  cursor: pointer;
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--hover); color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

kbd {
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--raised);
  padding: 1px 5px;
  font: 11px var(--mono);
  color: var(--muted);
}

/* --- settings ---------------------------------------------------------- */

.cfg-layout { display: grid; grid-template-columns: 178px minmax(0, 1fr); gap: 20px; align-items: start; }

/* 58 settings is a scroll you get lost in. The jump list is what makes it a
   document you can navigate rather than one you have to read. */
.cfg-nav { position: sticky; top: calc(var(--top) + 16px); display: flex; flex-direction: column; gap: 1px; }
.cfg-nav button {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  cursor: pointer;
  border-left: 2px solid transparent;
}
.cfg-nav button:hover { background: var(--hover); color: var(--text); }
.cfg-nav button[aria-current="true"] { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); }

/* The jump sidebar becomes the dropdown in the toolbar. This override has to
   sit AFTER the rules above: both are a single class deep, so which one applies
   is decided by source order — and it used to come first, which meant the
   sidebar was never actually hidden and overlapped the form on every phone. */
@media (max-width: 900px) {
  .cfg-layout { grid-template-columns: 1fr; }
  .cfg-nav { display: none; }
}

.cfg-group { margin-bottom: 16px; scroll-margin-top: calc(var(--top) + 14px); }
.cfg-group > h2 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
}
.cfg-body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }

.cfg-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 20px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  align-items: start;
}
.cfg-row:last-child { border-bottom: 0; }
.cfg-row.wide { grid-template-columns: 1fr; }
.cfg-row.changed { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
@media (max-width: 700px) { .cfg-row { grid-template-columns: 1fr; gap: 8px; } }

.cfg-label { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 500; }
.cfg-help { color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.45; }
.cfg-key { color: var(--faint); font: 11px var(--mono); margin-top: 5px; }
.cfg-control { display: flex; flex-direction: column; gap: 6px; }
.cfg-meta { min-height: 0; }

.dot-changed { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }

.cfg-input {
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.cfg-input:focus { outline: none; border-color: var(--accent); }
textarea.cfg-input { font: 12px/1.5 var(--mono); min-height: 96px; resize: vertical; }
textarea.cfg-input.bad { border-color: var(--bad); }

.cfg-select {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.cfg-select:focus { outline: none; border-color: var(--accent); }

.with-unit { display: flex; align-items: center; gap: 7px; }
.with-unit .cfg-input { flex: 1; }
.unit { color: var(--faint); font-size: 12px; }

.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track {
  width: 34px;
  height: 20px;
  border-radius: 100px;
  background: var(--line);
  position: relative;
  transition: background 0.15s;
  flex: none;
}
.toggle .track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(14px); background: #06121f; }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle-state { font-size: 12.5px; color: var(--muted); }

.reset {
  border: 0;
  background: none;
  color: var(--faint);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  padding: 0;
  text-align: left;
}
.reset:hover { color: var(--accent); }
.reset:disabled { color: var(--accent); cursor: default; }

/* Fixed, because the change you made is at the top of a long page and the
   button that saves it must not be at the bottom. */
.savebar {
  position: fixed;
  left: calc(var(--rail) + 24px);
  right: 24px;
  bottom: 18px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--raised);
  box-shadow: var(--shadow);
  max-width: var(--page);
  margin: 0 auto;
}
.savebar .count { flex: 1; font-size: 13px; color: var(--muted); }
@media (max-width: 780px) { .savebar { left: 12px; right: 12px; } }

.note-ok { margin-top: 10px; color: var(--good); font-size: 13px; }
.note-bad { color: var(--bad); font-size: 13px; }

/* --- sign-in gate ------------------------------------------------------ */

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 30px;
  text-align: center;
  box-shadow: var(--shadow);
}
.gate-card h1 { margin: 0 0 4px; font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.gate-sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.gate-msg { margin-bottom: 16px; }
.gate-help { color: var(--muted); font-size: 12.5px; line-height: 1.55; margin: 0 0 20px; }
.gate-btn { width: 100%; height: 38px; }
.signin { padding: 26px; text-align: center; }

/* --- responsive -------------------------------------------------------- */

@media (max-width: 1080px) { .cols { grid-template-columns: 1fr; } }

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-areas: "brand" "topbar" "rail" "main";
    /* Four areas need four tracks. Left at the base rule's `var(--top) 1fr`,
       the 1fr landed on the TOPBAR — which grew to a third of the screen of
       empty space with one breadcrumb centred in it — and main dropped into an
       implicit auto track below. The content row is main, and it is last. */
    grid-template-rows: auto auto auto 1fr;
  }
  .brand { border-right: 0; }
  .rail {
    position: static;
    /* The base rule gives the rail the full height of the window so its column
       reaches the bottom of the page. Here it is a horizontal strip, and that
       height would make it a full-screen block with nine buttons across the top
       of it. `max-height: none` used to do this job; the base rule sets
       `height` now, so this has to reset the same property. */
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .rail-label, .rail-foot { display: none; }
  .rail button { width: auto; white-space: nowrap; }
  /* The badges stay. They are the only thing on the rail that says something
     needs attention — three applications waiting, EA stats failing — and
     hiding them on the phone hid it from the person most likely to be on one.
     `margin-left: auto` pushed them to the end of a full-width button; in a
     row they sit against the label. */
  .rail-badge { margin-left: 0; }
  main { padding: 16px 14px 90px; }
  .who-name { display: none; }
  .crumb { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* A component that sets its own display wins against the browser's rule for
   [hidden], so every one of these boxes rendered as an empty pill or badge the
   moment it was hidden. Declared once, at the end, so it beats them all. */
[hidden] { display: none !important; }

/* --- public and player mode ---------------------------------------------- */
/* §20.1 and §20.2 wear the same design system but not the admin rail: a visitor
   has no admin screens to move between, and a rail of things they cannot open
   is worse than no rail at all. */

.public-nav { display: none; gap: 2px; margin-left: 6px; }
.public-nav a {
  padding: 5px 10px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 13px;
}
.public-nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.public-nav a[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

body.public .rail { display: none; }
body.public .shell { grid-template-columns: var(--rail) 1fr; }
body.public .public-nav { display: flex; }
/* The crumb would only repeat the page title below it once the nav is there. */
body.public .crumb { display: none; }
body.public main { grid-column: 1 / -1; }
body.public .savebar { left: 24px; }

/* An admin sees the rail; a player never does, so their brand block is just a
   name and the grid has no second column to leave room for. */
body.not-admin .shell { grid-template-columns: var(--rail) 1fr; }

@media (max-width: 760px) {
  body.public .shell { grid-template-columns: 1fr; }
  .public-nav a { padding: 5px 8px; font-size: 12.5px; }
}

/* --- queueing from the browser (§20.2) ----------------------------------- */

.slot-btn {
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.12s, background 0.12s;
}
.slot-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--hover); }
.slot-btn:disabled { cursor: not-allowed; opacity: 0.65; }
/* The position you personally hold, so "am I in?" is answered by looking. */
.slot-btn.held { border-color: var(--accent); background: var(--accent-soft); }
.slot-btn.held::after { content: "tap to leave"; display: block; margin-top: 5px; font-size: 11px; color: var(--accent); }
.slot-name.me { color: var(--accent); font-weight: 600; }

.warn-row.bad { border-color: rgba(255, 95, 95, 0.32); background: var(--bad-soft); }
.warn-row.bad svg { color: var(--bad); }

/* --- admin actions (§20.3) ----------------------------------------------- */

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--raised);
}
.action-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.action-label {
  min-width: 74px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
}
.action-controls { display: flex; align-items: center; gap: 7px; flex: 1; flex-wrap: wrap; }
.action-controls .cfg-select { width: auto; min-width: 92px; }
.action-controls .cfg-input { flex: 1; min-width: 90px; }
.action-status:empty { display: none; }
.action-status { font-size: 12.5px; }

/* A ban is not the same kind of button as "Apply", and should not look like it. */
.btn.danger { background: var(--bad); color: #1a0505; }
.btn.danger:hover { filter: brightness(1.08); }

/* --- branding image fields (§20.4) --------------------------------------- */

.img-field { display: flex; flex-direction: column; gap: 8px; }
.img-preview {
  width: 100%;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--raised);
  display: grid;
  place-items: center;
  overflow: hidden;
  /* A chequerboard, so a transparent PNG reads as transparent rather than as
     the same colour the panel happens to be today. */
  background-image: linear-gradient(45deg, var(--line) 25%, transparent 25%),
    linear-gradient(-45deg, var(--line) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--line) 75%),
    linear-gradient(-45deg, transparent 75%, var(--line) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}
.img-preview img { max-height: 62px; max-width: 100%; object-fit: contain; }
.img-none { color: var(--faint); font-size: 12px; font-style: italic; }
.img-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.img-file { font-size: 12px; color: var(--muted); max-width: 100%; }
.img-file::file-selector-button {
  margin-right: 8px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.img-file::file-selector-button:hover { background: var(--hover); }

/* The uploaded mark, once there is one. */
.brand-img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.crest { margin-bottom: 14px; }
.crest img { max-height: 64px; max-width: 260px; object-fit: contain; }
.page-foot {
  max-width: var(--page);
  margin: 40px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--faint);
  font-size: 12px;
}

/* --- charts --------------------------------------------------------------- */

.chart-box {
  position: relative;
  padding: 14px 14px 10px;
}
/* Chart.js sizes itself from its parent, so the canvas must not also be sized
   by content — otherwise the two disagree and it grows on every redraw. */
.chart-box canvas { position: absolute; inset: 14px 14px 10px; }

/* --- refinements the real typeface allows --------------------------------- */
/* Inter is a tighter face than the system stack it replaces, so the display
   sizes want negative tracking and the small caps want a touch more. */

.head h1 { letter-spacing: -0.025em; }
.stat-v, .kv-v { letter-spacing: -0.03em; }
.brand-name { letter-spacing: -0.015em; }
thead th, .stat-k, .sect, .rail-label, .kv-k { letter-spacing: 0.075em; }
.drawer-head h2 { letter-spacing: -0.02em; }

/* Who did a thing, trailing the thing itself. Secondary weight, because the
   action is what a reader scans for and the name is the follow-up. */
.mini-by {
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
  font-weight: 400;
}

.guild-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 3px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--raised);
  vertical-align: middle;
}
.guild-chip img { width: 18px; height: 18px; border-radius: 50%; display: block; }
.guild-chip b { font-weight: 600; }

/* --- narrow viewports ----------------------------------------------------- */
/* A grid item's default `min-width: auto` means it refuses to shrink below its
   content. The rail is a horizontal scroller full of nowrap buttons, so on a
   phone it pushed the whole grid 38px wider than the screen and `overflow-x`
   never engaged — the PAGE scrolled sideways instead of the rail. */

.shell > * { min-width: 0; }

/* Same rule, one level down. A `1fr` grid track does not stop its item growing:
   the item's own `min-width: auto` means "at least as wide as my content", so a
   wide table or a row of position cards pushes the column — and the page —
   past the edge of the screen. Every container that holds page content has to
   opt out of that explicitly. */
main,
.page,
.cols > *,
.card,
.card-head,
.mini-row,
.team-row,
.action-row,
.cfg-row > *,
.drawer-body > * { min-width: 0; }

/* And the flex children inside those rows, which have the same default. */
.mini-name,
.team-name,
.card-head h3,
.action-controls { min-width: 0; }

@media (max-width: 760px) {
  .rail {
    /* Now that the track can shrink, this actually scrolls. */
    min-width: 0;
    max-width: 100%;
    gap: 4px;
    /* Nothing to catch the scroll on a trackpad-less device otherwise. */
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .rail button { flex: none; }

  .topbar {
    /* The season and live pills are context, not controls: they go first when
       there is no room, rather than pushing Sign out off the screen. */
    gap: 6px;
    padding: 0 12px;
  }
  #season-pill { display: none; }
  .brand { padding: 0 12px; }
  .brand-name { font-size: 13px; }

  .who { padding: 0 4px 0 8px; }
  .who-out { padding-left: 6px; padding-right: 2px; }

  /* One stat per row reads better than four squeezed to 80px each. */
  .stats { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 8px; }
  .stat { padding: 11px 12px; }
  .stat-v { font-size: 20px; }

  .slots { grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: 6px; padding: 10px; }
  .head h1 { font-size: 19px; }
  .drawer { width: 100%; }
  .kv { grid-template-columns: repeat(auto-fit, minmax(116px, 1fr)); }
}

/* Tables are the one thing that cannot usefully reflow — a 7-column ladder at
   390px would be unreadable at any font size — so they scroll inside their own
   card. `.scroll-x` already does that; this stops the card fighting it. */
.card > .scroll-x { max-width: 100%; }

@media (max-width: 420px) {
  main { padding: 12px 10px 80px; }
  .cols { gap: 10px; }
  .card + .card { margin-top: 10px; }
  .toolbar { gap: 6px; }
  .search { max-width: none; }
  /* The keyboard hint is not useful without a keyboard. */
  .toolbar .pill { display: none; }
}

/* A person, rather than the eighteen digits that identify them. */
.person {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 4px;
  border: 1px solid transparent;
  border-radius: 100px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
}
.person img { width: 18px; height: 18px; border-radius: 50%; display: block; }
.person b { font-weight: 600; }
/* An id the bot has never seen keeps its number, and says so by looking unlike
   the ones it could resolve. */
.person.unknown {
  background: var(--raised);
  border-color: var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}
.person.unknown b { font-weight: 400; }

/* The settings jump list, in the control that fits a phone. */
.cfg-jump {
  display: none;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  max-width: 180px;
}
.cfg-jump:focus { outline: none; border-color: var(--accent); }
@media (max-width: 900px) { .cfg-jump { display: block; } }

/* --- keyboard --------------------------------------------------------------
   Every control that can be reached by tab has to say so when it is. The
   browser default outline is invisible against these surfaces. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.rail button:focus-visible,
.seg button:focus-visible,
tbody tr:focus-visible { outline-offset: -2px; }

/* --- list fields (ids, names) --------------------------------------------- */

.list-field { display: flex; flex-direction: column; gap: 8px; }
.list-field .chips { margin-bottom: 0; }

.list-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 3px 3px 9px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--raised);
  font: 11.5px var(--mono);
  color: var(--text);
}
.list-x {
  width: 17px;
  height: 17px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--faint);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.list-x:hover { background: var(--bad-soft); color: var(--bad); }

/* A list chip the caller could put a name to. */
.list-chip.named {
  padding-left: 4px;
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
  font: 12px var(--font);
  font-weight: 600;
}
.list-chip img { width: 18px; height: 18px; border-radius: 50%; display: block; }
.list-chip.named .list-x { color: var(--accent); opacity: 0.65; }
.list-chip.named .list-x:hover { opacity: 1; }

.picker { display: flex; flex-direction: column; gap: 6px; }
.picker .cfg-select { width: 100%; }

/* --- map fields (per-tier settings) --------------------------------------- */

.map-field { display: flex; flex-direction: column; gap: 8px; }
.map-rows { display: flex; flex-direction: column; gap: 6px; }
.map-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 24px; gap: 6px; align-items: center; }
.map-row .cfg-input, .map-row .cfg-select { width: 100%; min-width: 0; }
.map-field .btn { align-self: flex-start; }
@media (max-width: 700px) {
  .map-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 24px; }
}

/* --- record tables (brackets, servers, awards) ----------------------------- */

.records-field { display: flex; flex-direction: column; gap: 10px; }
.records { display: flex; flex-direction: column; gap: 6px; }

.records-head,
.records-row {
  display: grid;
  grid-template-columns: var(--track);
  gap: 6px;
  align-items: center;
}
.records-head span {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: var(--faint);
  padding-left: 2px;
}
.records-row .cfg-input,
.records-row .cfg-select { width: 100%; min-width: 0; }
.records-field .btn { align-self: flex-start; }

/* Five columns will not fit a phone, so each row becomes its own stack with
   the column names carried on the placeholders instead of a header. */
@media (max-width: 700px) {
  .records-head { display: none; }
  .records-row {
    grid-template-columns: minmax(0, 1fr) 24px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--raised);
  }
  .records-row > .list-x { grid-row: 1; grid-column: 2; }
  .records-row > :not(.list-x) { grid-column: 1; }
}

/* --- the top bar at narrow widths ----------------------------------------- */
/* Flex children default to `min-width: auto` too, so the public nav refused to
   shrink and pushed the identity chip off the right-hand edge. The nav is the
   part that can usefully scroll; the sign-out is the part that must stay
   reachable, so the nav gives way and the chip does not. */

.public-nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.public-nav::-webkit-scrollbar { display: none; }
.who { flex: none; }
.crumb { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 520px) {
  /* On a phone the live pill is the first thing to go: it repeats what the
     Overview says, and Sign out has nowhere else to live. */
  #live-pill { display: none; }
  .topbar { padding: 0 10px; gap: 4px; }
  .public-nav { gap: 0; }
}

/* Numeric columns hug their content so the name column absorbs the slack.
   Left to themselves the browser shares the spare width evenly, which spreads
   four two-digit numbers across half a screen and leaves the names cramped. */
table th.num, table td.num { width: 1%; }

/* The public pages are read, not operated. A ladder row 1200px wide makes the
   eye travel from a name to its numbers across most of a monitor; the admin
   screens earn their width by putting a chart or a second column in it. */
body.public .page { max-width: 1000px; }
body.public .page-foot { max-width: 1000px; }

/* --- the accent colour ---------------------------------------------------- */

.colour-field { display: flex; align-items: center; gap: 8px; }
.colour-swatch {
  width: 40px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--raised);
  cursor: pointer;
  flex: none;
}
.colour-swatch::-webkit-color-swatch-wrapper { padding: 3px; }
.colour-swatch::-webkit-color-swatch { border: 0; border-radius: 4px; }
.colour-hex { font: 12px var(--mono); text-transform: lowercase; }

/* A second line inside a cell: the headline number, then the working. */
.muted-note { display: block; margin-top: 3px; color: var(--faint); font-size: 11px; }

/* --- the rail as a horizontal strip --------------------------------------- */
/* Nine items do not fit a phone, so it scrolls. A bare scrollbar track across
   the top of the page is both ugly and easy to miss, so it is thinned down and
   a fade at the right edge says there is more that way. */

@media (max-width: 760px) {
  .rail {
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
    /* Fades out over the last 24px, and only while there is something to
       scroll to — a mask on a strip that fits would clip the last item. */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
    padding-right: 24px;
  }
  .rail::-webkit-scrollbar { height: 4px; }
  .rail::-webkit-scrollbar-thumb { background: var(--line); border-radius: 100px; }
  .rail::-webkit-scrollbar-track { background: transparent; }
}

/* --- searchable pickers --------------------------------------------------- */
/* A native <select> cannot be searched, cannot show a role's colour, and orders
   eighty roles however Discord felt like. */

.picker2 { position: relative; width: 100%; min-width: 0; }

.picker2-trigger {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  height: 32px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.picker2-trigger:hover { background: var(--hover); }
.picker2-trigger[aria-expanded="true"] { border-color: var(--accent); }

.picker2-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker2-label.empty { color: var(--faint); }
.picker2-label.missing { color: var(--bad); font: 11.5px var(--mono); }
.picker2-caret { color: var(--faint); font-style: normal; font-size: 11px; flex: none; }
.picker2-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.picker2-glyph { font-size: 15px; line-height: 1; flex: none; }

.picker2-pop {
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.picker2-search {
  width: 100%;
  height: 34px;
  padding: 0 11px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.picker2-search:focus { outline: none; }
.picker2-list { max-height: 260px; overflow-y: auto; padding: 4px; }

.picker2-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
}
/* `active` follows the keyboard, `on` marks what is currently set — they are
   different things and a picker that conflates them cannot be driven by arrow
   keys without lying about the selection. */
.picker2-item.active { background: var(--hover); }
.picker2-item.on { color: var(--accent); font-weight: 600; }
.picker2-hint { margin-left: auto; color: var(--faint); font-size: 11px; flex: none; }
.picker2-none { padding: 14px 10px; text-align: center; color: var(--faint); font-size: 12.5px; }

/* Inside a record row the popover must escape the row's own bounds. */
.records-row, .map-row { position: relative; }

.unit-select { width: auto; min-width: 92px; flex: none; }

/* The duration box wraps so its warning sits under the control, not beside it. */
.with-unit { flex-wrap: wrap; }
.with-unit .cfg-help { flex-basis: 100%; margin-top: 2px; }
