:root {
  --bg: #f7f5f1;
  --panel: #ffffff;
  --panel-border: #e2ddd3;
  --text: #24282b;
  --text-dim: #6b7280;
  --accent: #0f6e6e;
  --accent-hover: #0c5a5a;
  --accent-tint: rgba(15, 110, 110, .10);
  --ok: #2f9e68;
  --warn: #b8791f;
  --fail: #c53d43;
  --fail-tint: rgba(197, 61, 67, .12);
  --highlight: #8a6d1a;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --font-display: "Dosis", "Century Gothic", ui-rounded, system-ui, sans-serif;
  --font-body: "Dosis", "Century Gothic", ui-rounded, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --tile-min: 152px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181a;
    --panel: #1c2224;
    --panel-border: #2e3538;
    --text: #e8e6e1;
    --text-dim: #9a9a94;
    --accent: #2bb5ac;
    --accent-hover: #3ecac1;
    --accent-tint: rgba(43, 181, 172, .14);
    --ok: #4cbf7d;
    --warn: #d99a3f;
    --fail: #e2696d;
    --fail-tint: rgba(226, 105, 109, .16);
    --highlight: #e0c04a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
    --shadow-md: 0 4px 20px rgba(0,0,0,.45);
  }
}

:root[data-theme="dark"] {
  --bg: #14181a;
  --panel: #1c2224;
  --panel-border: #2e3538;
  --text: #e8e6e1;
  --text-dim: #9a9a94;
  --accent: #2bb5ac;
  --accent-hover: #3ecac1;
  --accent-tint: rgba(43, 181, 172, .14);
  --ok: #4cbf7d;
  --warn: #d99a3f;
  --fail: #e2696d;
  --fail-tint: rgba(226, 105, 109, .16);
  --highlight: #e0c04a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 4px 20px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

html { color-scheme: light dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font-body);
  transition: background .15s ease, color .15s ease;
}

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

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: .01em; }
h1 { font-size: 24px; margin: 0 0 14px; }
h1 > i:first-child { margin-right: 5px; }
h2 { font-size: 17px; margin: 24px 0 8px; color: var(--text); }
h2 .count { color: var(--text-dim); font-weight: 400; font-size: 13px; }

/* Compact "Jobs (N/M) > Runs" style header - both segments are their own
   destination, not a single title with a "see all" afterthought. */
.crumb-heading { display: flex; align-items: baseline; gap: 8px; }
.crumb-heading a { color: var(--text); }
.crumb-heading a:hover { color: var(--accent); }
.crumb-heading i { color: var(--text-dim); font-size: 12px; }

/* ---------- topbar / nav ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-border);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: var(--text);
  margin-right: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-title .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; }
.topbar-title .name-full { display: none; }
.topbar-title .name-short { display: inline; }
@media (min-width: 641px) {
  .topbar-title .name-full { display: inline; }
  .topbar-title .name-short { display: none; }
}

/* Reusable round icon-button pattern - theme toggle, season toggle, and any
   future single-click state-cycling control share this shape. */
.icon-toggle {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text-dim);
  border-radius: 999px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  padding: 0;
  flex-shrink: 0;
}
.icon-toggle:hover { color: var(--accent); border-color: var(--accent); }
.icon-toggle.active { background: var(--accent-tint); color: var(--accent); border-color: var(--accent); }

/* Timezone toggle carries a small abbreviation badge overlaid on the globe
   glyph itself (bottom edge, overlapping the button's own border) so the
   active zone reads at a glance instead of needing a tooltip hover. */
.tz-toggle { position: relative; overflow: visible; }
.tz-toggle .tz-abbr {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1;
  background: var(--panel);
  color: var(--text-dim);
  border: 1px solid var(--panel-border);
  padding: 1px 4px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}

.primary-nav { display: flex; gap: 4px; align-items: center; }
.primary-nav a {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: var(--radius);
  color: var(--text-dim);
}
.primary-nav a.active, .primary-nav a:hover { background: var(--accent-tint); color: var(--accent); text-decoration: none; }

.topbar-spacer { flex: 1; }

.more-menu { position: relative; }
.more-menu summary {
  list-style: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: var(--radius);
  color: var(--text-dim);
  user-select: none;
}
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu summary:hover { background: var(--panel-border); color: var(--text); }
.more-menu[open] summary { background: var(--panel-border); color: var(--text); }
.more-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 10px;
  display: flex;
  gap: 4px;
  min-width: 300px;
  z-index: 20;
}
.more-menu-col { flex: 1; min-width: 140px; }
.more-menu-col-label {
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 4px 9px 6px;
}
.more-menu-panel a {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
}
.more-menu-panel a i { width: 14px; text-align: center; color: var(--text-dim); font-size: 12px; }
.more-menu-panel a:hover, .more-menu-panel a.active { background: var(--accent-tint); color: var(--accent); text-decoration: none; }
.more-menu-panel a:hover i, .more-menu-panel a.active i { color: var(--accent); }

.logout-link { color: var(--text-dim); font-size: 15px; opacity: .5; display: inline-flex; align-items: center; }
.logout-link:hover { opacity: 1; text-decoration: none; }

.content { padding: 18px 18px 38px; max-width: 1180px; margin: 0 auto; }

/* ---------- login ---------- */

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; position: relative; }
.login-box {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px;
  width: 100%;
  max-width: 320px;
}
.login-box .topbar-title { justify-content: center; margin-bottom: 18px; font-size: 22px; }
.login-box input[type=password] {
  width: 100%;
  padding: 10px 12px;
  margin: 14px 0;
  font-size: 16px;
}
.login-box .btn { width: 100%; text-align: center; padding: 10px; }
.login-wrap .icon-toggle { position: absolute; top: 18px; right: 18px; }

/* ---------- Level grid (Home) ---------- */

.sport-group { margin-bottom: 6px; }
.sport-group-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 24px 0 10px;
}
.sport-group-header h2 { margin: 0; }
.sport-group-header h2 i { color: var(--accent); font-size: 0.85em; margin-right: 2px; }

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tile-min), 1fr));
  gap: 8px;
}

.level-tile {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.level-tile:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}
.level-swatch { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.level-code { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--text); }
.level-season-inline { font-family: var(--font-display); font-size: 12px; color: var(--text-dim); font-weight: 600; }

.problem-dot {
  margin-left: auto;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  background: var(--fail);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  flex-shrink: 0;
  cursor: pointer;
}
.problem-dot:hover { filter: brightness(1.15); }

/* "Games today" mode (index.php's games-mode toggle) - the tile itself stays
   exactly as it looks normally (swatch, code, season); only the corner badge
   swaps from the problem count to today's game count, in the same teal
   circle/black text shape so it reads as a mode switch, not a redesign. */
.level-games-count {
  display: none;
  margin-left: auto;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  background: var(--accent);
  color: #000;
  font-size: 10.5px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  flex-shrink: 0;
  cursor: pointer;
}
.level-games-count:hover { filter: brightness(1.1); }
.level-grid.mode-games .level-games-count { display: flex; }
.level-grid.mode-games .problem-dot { display: none; }

/* ---------- stat cards (health strip) ---------- */

.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 9px 13px;
  min-width: 110px;
  flex: 1;
}
.stat-card .num { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.stat-card .label { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.stat-card.ok .num { color: var(--ok); }
.stat-card.fail .num { color: var(--fail); }
.stat-card.warn .num { color: var(--warn); }
a.stat-card { display: block; color: var(--text); }
a.stat-card:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow-sm); }
a.stat-card.active { border-color: var(--accent); background: var(--accent-tint); }

.health-strip { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--panel-border); }
/* Only the strip's very first h2 (Anomalies) sits flush against the
   border-top above - a later h2 (System Health) needs its normal top
   margin back, or it reads as glued to whatever table/row precedes it. */
.health-strip > h2:first-of-type { margin-top: 0; }

/* ---------- level hub ---------- */

.hub-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.hub-swatch { width: 15px; height: 15px; border-radius: 50%; flex-shrink: 0; }
.hub-header h1 { margin: 0; }
.hub-meta { color: var(--text-dim); font-size: 13px; margin: 4px 0 20px; }

.hub-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}
.hub-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
  display: block;
}
.hub-card:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow-md); }
.hub-card .num { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--text); }
.hub-card.has-problems .num { color: var(--fail); }
.hub-card .label { color: var(--text-dim); font-size: 12px; margin-top: 3px; }
.hub-card .arrow { float: right; color: var(--text-dim); }

/* Games/Players/Teams browse row (3 links + 3 season-scoped info cards) -
   flexes across the full row width as 6 even columns, collapsing to 3/3 on
   narrow screens rather than the auto-fill problem-card grid's own sizing. */
.hub-browse-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 18px; }
.hub-browse-row .hub-card.static { cursor: default; }
.hub-browse-row .hub-card.static:hover { border-color: var(--panel-border); box-shadow: var(--shadow-sm); }
@media (max-width: 640px) {
  .hub-browse-row { grid-template-columns: repeat(3, 1fr); }
}

/* Compact one-line alerts (level.php) - the news.php-style problem-dot count
   in a small pill instead of a full hub-card, so a Level with several open
   alert types reads as one scannable row rather than a wall of big cards. */
.problem-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.problem-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.problem-chip:hover { border-color: var(--fail); text-decoration: none; }

.jobs-list, .jobs-list a { font-size: 14px; }

/* ---------- table / badges / buttons (shared, existing pages ride on these) ---------- */

table { width: 100%; border-collapse: collapse; font-size: 13px; }

/* Fixed-width columns (colgroup-driven, per-page) so a table doesn't
   reshuffle horizontally as its data changes between reloads. Paired with
   .truncate on any free-text column (e.g. Message) that could otherwise
   blow the layout out - ellipsis-clips it and the title attribute carries
   the full text as a hover tooltip. */
.fixed-cols { table-layout: fixed; }
.fixed-cols td, .fixed-cols th { overflow: hidden; }
.truncate { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr:target { background: var(--accent-tint); }
th, td { padding: 6px 9px; border-bottom: 1px solid var(--panel-border); text-align: left; vertical-align: middle; }
th { color: var(--text-dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius); margin-top: 10px; }

/* games.php single-game screen - AI content, performances, play-by-play. */
.ai-block {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
  padding: 10px 12px; margin-top: 10px;
}
.ai-block-label { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
/* Click-and-type instead of a separate "edit mode" - looks like plain text
   until focused, so reading several of these back to back doesn't look like
   a form. */
.ai-edit {
  display: block; width: 100%; border: none; background: transparent; color: var(--text);
  font-family: var(--font-body); padding: 2px 0; resize: none; overflow: hidden;
}
.ai-edit-headline { font-weight: 700; margin-bottom: 4px; font-size: 14px; }
.ai-edit-text { font-size: 13px; line-height: 1.5; }
.ai-edit:focus { outline: 1px solid var(--accent); outline-offset: 2px; background: var(--bg); border-radius: 4px; }
tr.team-break td { border-top: 2px solid var(--panel-border); }
tr.pbp-scoring td { font-weight: 700; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-ok { background: rgba(47,158,104,.14); color: var(--ok); }
.badge-fail { background: var(--fail-tint); color: var(--fail); }

/* games.php list view - a Final game with 0 perfs/pbp is exactly the
   "no-exist" issue that prompted adding this column at all, so it needs to
   actually stand out rather than reading as just another dim number. */
a.no-exist { color: var(--fail); font-weight: 600; }
a.no-exist:hover { color: var(--fail); text-decoration: underline; }
.badge-warn { background: rgba(184,121,31,.14); color: var(--warn); }
.badge-dim { background: rgba(107,114,128,.14); color: var(--text-dim); }

.level-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.level-chip .level-swatch { width: 8px; height: 8px; }

.btn {
  display: inline-block;
  padding: 3px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 500;
}
.btn:hover { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-danger { color: var(--fail); }
.btn-danger:hover { background: var(--fail-tint); border-color: var(--fail); color: var(--fail); }

/* archive.php's Save policy/Archive now buttons specifically - the standard
   white-on-teal .btn-primary read as too heavy/bright next to this page's
   compact table rows. */
.btn-compact-dark { color: #000; padding: 2px 8px; }
.btn-compact-dark:hover { color: #000; }

/* Compact icon-only row actions (Problems' dismiss/ok/delete-game trio,
   Attention's AI Suggest wand, and anywhere else a row needs 1-3 quick
   actions without a text label). */
.icon-action {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}
.icon-action:hover { border-color: var(--accent); color: var(--accent); }
.icon-action.ok:hover { border-color: var(--ok); color: var(--ok); }
.icon-action.danger:hover { border-color: var(--fail); color: var(--fail); }
.icon-action:disabled { opacity: .5; cursor: default; }

.note { color: var(--text-dim); font-size: 12px; margin: 6px 0; }

/* Multi-field filter forms (runs.php's Adapter/Level/Status, Teams/Games/
   Players' Level pulldown, actions.php's Level/Action/Priority row) - .note's
   bare "Label: <select>" pairs used to run together with only a single space
   between them and render tiny/grey next to full-size white sibling text;
   now a consistent readable size (not the .form-table label's deliberately
   tiny uppercase treatment), grey, no colon in the markup, 8px between a
   label and its own control, and real breathing room between groups so nothing
   wraps or smashes against its neighbor. */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0 12px; }
.filter-group { display: inline-flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; font-weight: 600; }

/* Same label treatment for a bare inline label sitting directly in front of
   an input inside a table cell (Teams' Nickname/SpRef, Players' Letter/Sort
   By/Height/Weight/Start/End) - these used to have zero gap on either side
   and read as smashed against the input before and after them. */
.inline-label { color: var(--text-dim); font-size: 13px; font-weight: 600; margin: 0 10px; white-space: nowrap; }
.inline-label:first-child { margin-left: 0; }

/* Unifies control height across <select>/<input>/.btn - a <select> and a
   .btn (e.g. the mini-calendar's date trigger) drifted a couple px apart in
   rendered height purely from their different font-sizes/line-heights even
   with matching padding; pinning a shared min-height removes the mismatch
   site-wide instead of hand-tuning padding per element. */
.btn, input[type=text], input[type=number], input[type=date], input[type=password], select {
  min-height: 32px;
}

/* Clickable list rows (Leagues/Players/Venues/Games/News/Problems) - the
   whole row is a navigation target; wireClickableRows() still lets a real
   control inside the row (a link, button, form) take the click first. */
tr[data-href] { cursor: pointer; }
tr[data-href]:hover { background: var(--accent-tint); }

/* Small teal "+" beside a page's <h1>, replacing a full "+ Add X" text link
   on pages that are basically always auto-populated (Leagues/Teams/Games/
   Venues) - present when it's genuinely needed, deliberately unobtrusive
   otherwise. */
.header-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  margin-left: 5px;
  border-radius: 5px;
  color: var(--accent);
  opacity: .7;
  font-size: 11px;
  vertical-align: middle;
}
.header-add:hover { opacity: 1; text-decoration: none; background: var(--accent-tint); }

/* Two-way segmented toggle (Leagues' Leagues/FC switch, FC Munge's GSA/
   SportingLife switch) - replaces a plain text-link pair (which read as
   "tiny and unclear which side is active") with a visibly two-state pill,
   current side unambiguous without having to read the table underneath. */
.toggle-switch { display: inline-flex; background: var(--panel-border); border-radius: 999px; padding: 2px; gap: 2px; }
.toggle-switch a {
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.toggle-switch a:hover { color: var(--text); text-decoration: none; }
.toggle-switch a.active { background: var(--panel); color: var(--accent); box-shadow: var(--shadow-sm); }

.error { color: var(--fail); font-size: 12px; margin: 6px 0; }
.highlight { color: var(--highlight); font-weight: 600; }

.breadcrumb { font-size: 14px; color: var(--text); margin-bottom: 8px; }
.breadcrumb a { color: var(--text); }
.breadcrumb a:hover { color: var(--accent); }

form.inline { display: inline; }

.locked-check { opacity: .5; }

.progress-track {
  background: var(--panel-border);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin: 6px 0;
}
.progress-fill {
  background: var(--accent);
  height: 100%;
  transition: width .4s ease;
}
.progress-label { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* FC Munge's current-candidate name (fcmunge.php) - was riding on the
   shared h2 rule (same size as the page's own "Search" sub-heading, ~30px
   of margin above/below), which undersold it as the page's actual subject. */
.munge-team-name { font-size: 21px; color: var(--text-dim); margin: 0; padding: 15px 0 8px; }

.form-table td { border-bottom: none; padding: 6px 10px; vertical-align: top; }
.form-table td:first-child {
  width: 160px;
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding-top: 10px;
}

input[type=text], input[type=number], input[type=date], input[type=password], select, textarea {
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 5px 7px;
}
textarea { font-family: var(--font-body); }

/* Browser default focus rings run ~4px and stark white/blue - replace with a
   thin 1px accent outline everywhere text entry happens. */
input[type=text]:focus, input[type=number]:focus, input[type=date]:focus, input[type=password]:focus,
select:focus, textarea:focus, .schedule-input:focus, .instasearch:focus {
  outline: 1px solid var(--accent);
  outline-offset: 0;
}

.schedule-input {
  width: 140px;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 4px 6px;
}
.schedule-input::placeholder { color: var(--text-dim); font-style: italic; }

/* Jobs page insta-save feedback - transient text next to the row's own
   Enabled checkbox, one row at a time, no page-wide "saved" banner needed. */
.row-save-status { margin-left: 6px; font-size: 11px; font-weight: 600; }
.row-save-status.pending { color: var(--text-dim); }
.row-save-status.ok { color: var(--ok); }
.row-save-status.err { color: var(--fail); }

/* Insta-save success flash - the checkbox's own wrapper briefly glows teal
   instead of adding "Saved" text next to every row. A box-shadow ring rather
   than a solid fill, and line-height:0 so the wrap wasn't inheriting the
   table's line-height as extra height, both to keep the glow a thin 4px
   ring rather than a chunky block. */
.cb-wrap { display: inline-block; line-height: 0; border-radius: 5px; box-shadow: 0 0 0 0 transparent; transition: box-shadow .25s ease; }
.cb-wrap.flash-ok { box-shadow: 0 0 0 4px var(--accent-tint); transition: box-shadow .05s ease; }

/* Priority click-rotunda (jobs.php) - same cycling-badge idea as the
   timezone toggle, escalating visually from dim to fully-filled teal. */
.priority-btn { cursor: pointer; border: none; font: inherit; }
.priority-btn.priority-low { background: rgba(107,114,128,.14); color: var(--text-dim); }
.priority-btn.priority-normal { background: var(--accent-tint); color: var(--accent); }
.priority-btn.priority-live { background: var(--accent); color: #fff; }

.instasearch-wrap { margin: 4px 0 8px; }
.instasearch {
  width: 100%;
  max-width: 320px;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 7px 11px;
}
.instasearch::placeholder { color: var(--text-dim); }
.instasearch-empty { padding: 12px; color: var(--text-dim); font-size: 12px; }

/* Games page's custom mini calendar (games.php) - replaces a plain
   <input type="date"> so days with games can actually be highlighted. */
.mini-cal-wrap { position: relative; display: inline-block; }
.mini-cal-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 10px;
  width: 240px;
}
.mini-cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 4px; }
.mini-cal-header span { font-family: var(--font-display); font-weight: 600; font-size: 13px; }
.mini-cal-header .icon-toggle { width: 24px; height: 24px; font-size: 11px; flex-shrink: 0; }
/* Month/year click-open pulldowns replacing the plain text label - jumping
   to e.g. last August used to take a dozen clicks through the prev arrow. */
.mini-cal-header select {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  min-height: auto;
  padding: 2px 3px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 4px;
}
.mini-cal-header select:hover { border-color: var(--panel-border); }

/* Prev/next-day arrows flanking the date trigger (games.php) - same
   .icon-toggle shape as everywhere else a single click steps state. */
.date-nav { display: inline-flex; align-items: center; gap: 6px; }

/* Games list's empty-state row ("No games on <date>") - a routine .note is
   too dim/small to read as the page's actual content when it's the only
   thing on screen. */
.empty-state { color: var(--text-dim); font-size: 14px; padding: 10px 0; }
.mini-cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 2px;
}
.mini-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini-cal-day {
  aspect-ratio: 1;
  border: 1px solid transparent;
  background: none;
  color: var(--text);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  position: relative;
}
.mini-cal-day:hover { border-color: var(--accent); }
.mini-cal-day.has-games { background: var(--accent-tint); color: var(--accent); font-weight: 700; }
.mini-cal-day.selected { border-color: var(--accent); background: var(--accent); color: #fff; }

@media (max-width: 860px) {
  .content { padding: 14px; }
  .more-menu-panel { flex-direction: column; min-width: 200px; }
}

@media (max-width: 640px) {
  .topbar { padding: 8px 12px; gap: 8px; }
  .primary-nav a { padding: 6px 9px; font-size: 13px; }
  .level-grid { grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 7px; }
  .level-tile { padding: 7px 9px; }
  th, td { padding: 5px 7px; font-size: 12px; }
  .hub-header { flex-wrap: wrap; }

  /* iOS Safari zooms the whole viewport in on focus for any text input
     under 16px - covers every current input/select/textarea/instasearch
     (and any future one, since it's tag/class based, not a per-page fix)
     without giving up the tighter desktop sizing. */
  input[type=text], input[type=number], input[type=date], input[type=password],
  select, textarea, .schedule-input, .instasearch {
    font-size: 16px;
  }
}
