/* Design tokens — green palette matching logo (Inter is loaded via <link> in each page head) */
:root {
  --bg: #f6f8f6;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --subtle: #94a3b8;
  --primary: #15803d;
  --primary-600: #166534;
  --primary-700: #14532d;
  --primary-50: #f0fdf4;
  --primary-100: #dcfce7;
  --primary-ink: #14532d;
  --ring: rgba(21, 128, 61, 0.22);
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --danger: #dc2626;
  --danger-600: #b91c1c;
  --danger-50: #fef2f2;
  --team-green: #16a34a;
  --team-yellow: #facc15;
  --team-yellow-ink: #713f12;
  --skeleton: #e9ede9;
  --shimmer: rgba(255, 255, 255, 0.7);
  --header-bg: rgba(255, 255, 255, 0.82);
  --bar-bg: rgba(255, 255, 255, 0.9);
  --row-border: #eef0f2;
  --zebra: rgba(15, 23, 42, 0.015);
  --hover: rgba(15, 23, 42, 0.05);
  --toast-bg: #0f172a;
  --warn-bg: #fffbeb;
  --warn-border: #fcd34d;
  --warn-text: #b45309;
  /* Excel Good / Neutral / Bad fills, used by the stats reports' Active column */
  --grade-good-bg: #c6efce;
  --grade-good-ink: #006100;
  --grade-mid-bg: #ffeb9c;
  --grade-mid-ink: #9c5700;
  --grade-bad-bg: #ffc7ce;
  --grade-bad-ink: #9c0006;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.16), 0 2px 8px rgba(15, 23, 42, 0.06);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --table-head-bg: #f6f8f6;
  --table-head-text: #475569;
  --tabbar-h: 60px;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  color-scheme: light;
  accent-color: var(--primary);
}

/* Dark theme — data-theme is set in pageHead.php; screen only, so printing always uses the light tokens */
@media screen {
  :root[data-theme="dark"] {
    --bg: #0b1210;
    --bg-elev: #111a17;
    --surface: #121b18;
    --surface-2: #18231f;
    --text: #e6edea;
    --text-2: #c4d0cb;
    --muted: #93a39c;
    --subtle: #6f817a;
    --primary: #22c55e;
    --primary-600: #16a34a;
    --primary-700: #15803d;
    --primary-50: rgba(34, 197, 94, 0.10);
    --primary-100: rgba(34, 197, 94, 0.20);
    --primary-ink: #86efac;
    --ring: rgba(34, 197, 94, 0.35);
    --border: #24322d;
    --border-strong: #34453f;
    --danger: #f87171;
    --danger-50: rgba(248, 113, 113, 0.12);
    --skeleton: #1d2925;
    --shimmer: rgba(255, 255, 255, 0.06);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
    --table-head-bg: #151f1b;
    --table-head-text: #a9b8b1;
    --header-bg: rgba(18, 27, 24, 0.85);
    --bar-bg: rgba(18, 27, 24, 0.92);
    --row-border: #1d2925;
    --zebra: rgba(255, 255, 255, 0.015);
    --hover: rgba(255, 255, 255, 0.06);
    --toast-bg: #24322d;
    --warn-bg: rgba(245, 158, 11, 0.12);
    --warn-border: rgba(245, 158, 11, 0.4);
    --warn-text: #fbbf24;
    --grade-good-bg: rgba(34, 197, 94, 0.18);
    --grade-good-ink: #86efac;
    --grade-mid-bg: rgba(245, 158, 11, 0.18);
    --grade-mid-ink: #fcd34d;
    --grade-bad-bg: rgba(248, 113, 113, 0.18);
    --grade-bad-ink: #fca5a5;
    color-scheme: dark;
  }
  /* The crest's navy outer ring disappears on dark surfaces, so give it a light halo */
  [data-theme="dark"] #profile .logo, [data-theme="dark"] .login-brand img { background: #f9fafb; border-radius: 50%; padding: 2px; box-sizing: content-box; }
  /* Rows with bright team / attendance fills keep dark text */
  [data-theme="dark"] #gameDataTable tbody tr[style*="background"],
  [data-theme="dark"] #editGameTable tbody tr[style*="background"],
  [data-theme="dark"] tbody tr.row-yes, [data-theme="dark"] tbody tr.row-no,
  [data-theme="dark"] tbody tr.row-reserve, [data-theme="dark"] #last50Body tr.row-maybe { color: #0f172a; }
  [data-theme="dark"] tbody tr[style*="background"] .player-id,
  [data-theme="dark"] tbody tr[style*="background"] .save-state { color: #334155; }
  [data-theme="dark"] tbody tr[style*="background"] .btn-ghost.btn-danger { color: #b91c1c; }
}

/* Base */
html { box-sizing: border-box; -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: inherit; }
/* Buttons etc. set display, which would otherwise override the hidden attribute */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font-sans);
  line-height: 1.5;
  color: var(--text);
  background: radial-gradient(1200px 480px at 50% -160px, rgba(21, 128, 61, 0.07), transparent 70%) no-repeat var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; }

/* Layout */
#main, .container {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
}

/* Page entrance animation */
.card-container,
.container,
#main {
  animation: fadeUp .3s ease-out;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Headings */
h1 {
  margin: 0 0 16px;
  font-weight: 700;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--text);
}
h2 {
  margin: 0 0 16px;
  font-weight: 600;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text);
}
h3 {
  margin: 0 0 12px;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

/* Links */
a {
  color: var(--primary);
  text-decoration: none;
  text-underline-offset: 2px;
}
a:hover { text-decoration: underline; }

/* Keyboard focus */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* Card */
.card-container { padding: 12px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card > * + * { margin-top: 12px; }

/* Primary card — green left accent for main content */
.card-primary {
  border-left: 4px solid var(--primary);
}

/* Muted card — subdued for tips/secondary info */
.card-muted {
  background: var(--surface-2);
  box-shadow: none;
}

/* Consistent vertical spacing between cards on containers */
.container .card, .card-container .card { margin-bottom: 16px; }

/* Session banner — frosted sticky header, two rows */
#profile {
  display: flex;
  flex-direction: column;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  #profile { background: var(--surface); }
}

/* Top row: logo, title, user, logout */
#profile .nav-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
}
#profile .brand { display: inline-flex; align-items: center; flex: 0 0 auto; }
#profile .logo {
  height: 36px !important;
  width: 36px !important;
  display: block;
}
#profile .nav-divider { width: 1px; height: 20px; background: var(--border); flex: 0 0 auto; }
#profile .page-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#profile #welcome {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
#profile #welcome:hover, #profile #welcome[aria-current="page"] { color: var(--text); text-decoration: none; }
.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-100);
  color: var(--primary-ink);
  font-size: 12px;
  font-weight: 700;
}
#profile #logout {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease;
}
#profile #logout:hover { background: var(--surface-2); border-color: var(--subtle); }
#profile #theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  box-shadow: none;
  flex: 0 0 auto;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
#profile #theme-toggle:hover { background: var(--surface-2); border-color: var(--subtle); }
#theme-toggle svg { width: 16px; height: 16px; }
#theme-toggle .icon-sun,
[data-theme="dark"] #theme-toggle .icon-moon { display: none; }
[data-theme="dark"] #theme-toggle .icon-sun { display: block; }

/* Bottom row: grouped nav links */
#profile .nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 16px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}
#profile .nav-links::-webkit-scrollbar { display: none; }
.nav-group {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}
.nav-group-label {
  margin-right: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
  white-space: nowrap;
}
#profile .nav-links a {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
#profile .nav-links a:hover { background: var(--primary-50); color: var(--primary-ink); }
#profile .nav-links a.active { background: var(--primary-700); color: #fff; }
@media (max-width: 1200px) {
  .nav-group-label { display: none; }
}

/* Mobile tab bar — shown at ≤768px */
.tabbar { display: none; }

@media (max-width: 768px) {
  /* backdrop-filter would trap the fixed-position nav sheet inside the header */
  #profile {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--surface);
  }
  #profile .nav-top { padding: 10px 14px; gap: 10px; }
  #profile .logo { height: 32px !important; width: 32px !important; }
  #profile .page-title { font-size: 15px; }
  #profile .user-name { display: none; }
  #profile #logout { height: 30px; padding: 0 10px; }
  #profile #theme-toggle { width: 30px; height: 30px; }
  #profile .nav-links { display: none; }

  body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }

  .tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bar-bg);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--border);
  }
  .tabbar .tab {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: var(--tabbar-h);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
  }
  .tabbar .tab:hover { background: none; color: var(--text); text-decoration: none; }
  .tabbar .tab.active,
  .tabbar .tab[aria-expanded="true"] { color: var(--primary-ink); font-weight: 600; }
  .tabbar svg { width: 22px; height: 22px; }

  /* "More" opens the grouped nav as a bottom sheet */
  body.nav-open::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(15, 23, 42, 0.35);
    animation: fadeIn .15s ease-out;
  }
  body.nav-open #profile { z-index: 28; }
  body.nav-open #profile .nav-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 8px);
    max-height: calc(100vh - var(--tabbar-h) - 96px);
    overflow-y: auto;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: sheetUp .2s ease-out;
  }
  body.nav-open .nav-group {
    flex-direction: column;
    align-items: stretch;
    margin: 6px 0 0;
    padding: 6px 0 0;
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  body.nav-open .nav-group-label { display: block; padding: 4px 12px; }
  body.nav-open #profile .nav-links a { height: 44px; padding: 0 12px; font-size: 15px; }
}
@keyframes sheetUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* Forms */
label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="search"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--subtle); }
select:not([multiple]) {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}
textarea { resize: vertical; min-height: 90px; }
input:disabled, select:disabled, textarea:disabled {
  background-color: var(--surface-2);
  color: var(--muted);
  cursor: not-allowed;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring);
}

/* Search input with magnifier icon */
input.input-search {
  width: 240px;
  max-width: 100%;
  padding-left: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 16px;
}

/* Buttons */
button,
input[type="button"],
input[type="submit"],
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  /* Darker primary for sufficient contrast with white text */
  background: var(--primary-700);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .05s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease;
}
button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
.btn:hover { background: var(--primary-600); text-decoration: none; }
button:active,
input[type="button"]:active,
input[type="submit"]:active,
.btn:active { transform: translateY(1px); }
button:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled {
  opacity: .5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Secondary and subtle buttons via attributes so markup stays same */
input[value="refresh"],
input[value="Refresh"],
input[value="Download CSV"],
input[value="Download"],
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
input[value="refresh"]:hover,
input[value="Refresh"]:hover,
input[value="Download CSV"]:hover,
input[value="Download"]:hover,
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--subtle);
}

/* Ghost button — minimal, no border */
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid transparent;
  box-shadow: none;
}
.btn-ghost:hover {
  background: var(--hover);
}

/* Destructive actions */
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost.btn-danger { background: transparent; color: var(--danger); box-shadow: none; }
.btn-ghost.btn-danger:hover { background: var(--danger-50); }

/* Sizes (element-qualified so they beat input[type="button"]) */
.btn.btn-sm, button.btn-sm, input.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn.btn-lg, button.btn-lg, input.btn-lg { padding: 10px 18px; font-size: 15px; border-radius: 10px; }

/* Login card */
#login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: radial-gradient(800px 420px at 50% 0%, rgba(21, 128, 61, 0.10), transparent 70%);
}
#login {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp .3s ease-out;
}
#login h2 { margin: 0 0 12px; text-align: left; background: none; padding: 0; border-radius: 0; }
#login form { display: grid; gap: 14px; }
#login input[type="submit"] { width: 100%; padding: 10px 14px; font-size: 15px; margin-top: 4px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand img { height: 96px; width: 96px; }
#login .login-brand h2 { margin: 14px 0 4px; font-size: 22px; text-align: center; }
.login-brand p { margin: 0; font-size: 14px; }
.form-field label { margin-bottom: 6px; }
.form-error { color: var(--danger); font-size: 13px; font-weight: 500; }
.form-hint { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.form-notice { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--primary-50); color: var(--primary-ink); font-size: 14px; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin: 18px 0 0; font-size: 13px; }
.auth-links > :only-child { margin: 0 auto; }
#login > p:not(.auth-links) { margin: 0 0 12px; }
#login form p { margin: 0; }

/* Public landing page (index.php): about + Facebook group CTA beside the sign-in card */
.landing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  gap: 32px 56px;
  align-items: center;
  max-width: 1080px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px 20px 24px;
}
.landing-hero { color: var(--text-2); animation: fadeUp .3s ease-out; }
.landing-hero > p { margin: 0 0 12px; }
.landing-logo { display: block; width: 88px; height: 88px; margin-bottom: 16px; }
[data-theme="dark"] .landing-logo { background: #f9fafb; border-radius: 50%; padding: 2px; box-sizing: content-box; }
.landing-eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--primary); }
.landing-hero h1 { font-size: clamp(30px, 5vw, 42px); margin-bottom: 12px; }
.landing-hero .landing-lead { font-size: 18px; color: var(--text); margin-bottom: 16px; }
.landing-facts { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 24px; padding: 0; list-style: none; }
.landing-facts li { flex: 1 1 120px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.landing-facts strong { display: block; font-size: 18px; color: var(--primary-ink); }
.landing-facts span { font-size: 13px; color: var(--muted); }
.landing-join h2 { margin-bottom: 6px; }
.landing-join p { margin: 0 0 16px; }
.landing-join a.btn { margin: 0; }
#login.landing-signin h2 { margin-bottom: 4px; }
.landing-footer { grid-column: 1 / -1; text-align: center; font-size: 13px; padding-top: 8px; }
@media (max-width: 860px) {
  .landing { grid-template-columns: minmax(0, 1fr); padding-top: 32px; }
  .landing-signin { max-width: none; }
}

/* Account + admin forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.card .form-grid select { width: 100%; min-width: 0; margin: 0; }
.form-grid .combo { width: 100%; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-grid + .form-actions { margin-top: 16px; }
.card .form-actions .btn, .card .form-actions button { margin: 0; }
.detail-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; margin: 0; }
.detail-list dt { font-size: 12px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
.detail-list dd { margin: 2px 0 0; }

/* Tables */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}
th, td { padding: 10px 12px; vertical-align: middle; }
th {
  text-align: left;
  color: var(--table-head-text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--table-head-bg) !important;
}

/* Crisp modern table look even if inline border styles are set in JS */
table, th, td { border: 0 !important; }
th { border-bottom: 1px solid var(--border) !important; }
td { border-bottom: 1px solid var(--row-border) !important; }
tbody tr:last-child td { border-bottom: 0 !important; }
tbody tr:nth-child(odd) { background: var(--zebra); }
tbody tr:hover { background: var(--primary-50); }
tbody tr.top-rank td:first-child { box-shadow: inset 3px 0 0 var(--primary); }

/* Sticky header for long lists */
th { position: sticky; top: 0; z-index: 1; }
table thead tr:first-child { background: var(--table-head-bg) !important; }
table thead tr:first-child th { color: var(--table-head-text) !important; }

/* Rounded header row for tables */
table thead tr:first-child th:first-child { border-top-left-radius: var(--radius); }
table thead tr:first-child th:last-child { border-top-right-radius: var(--radius); }

/* Table skeleton loader and empty state */
.loading-row td,
.empty-row td {
  text-align: center;
  padding: 32px 12px;
  color: var(--muted);
  font-size: 14px;
}
/* Text stays readable to screen readers; visually replaced by shimmer bars */
.loading-row td,
.skeleton-block {
  position: relative;
  overflow: hidden;
  padding: 18px 16px;
  font-size: 0;
  text-align: left;
}
.loading-row td::before,
.skeleton-block::before {
  content: '';
  display: block;
  height: 92px;
  background:
    linear-gradient(var(--skeleton) 0 0) 0 0 / 100% 16px no-repeat,
    linear-gradient(var(--skeleton) 0 0) 0 38px / 86% 16px no-repeat,
    linear-gradient(var(--skeleton) 0 0) 0 76px / 68% 16px no-repeat;
}
.loading-row td::after,
.skeleton-block::after,
.skeleton-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--shimmer), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* Skeleton tile for stat/record grids */
.record-tile.skeleton-tile {
  position: relative;
  overflow: hidden;
  min-height: 98px;
}
.skeleton-tile::before {
  content: '';
  position: absolute;
  inset: 18px 16px;
  background:
    linear-gradient(var(--skeleton) 0 0) 50% 0 / 45% 26px no-repeat,
    linear-gradient(var(--skeleton) 0 0) 50% 36px / 70% 12px no-repeat,
    linear-gradient(var(--skeleton) 0 0) 50% 54px / 50% 10px no-repeat;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 24px 20px;
  margin-top: 40px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* Sortable headers (uiTableSort in ui.js) */
th.header { cursor: pointer; }
th.header::after { content: " ▲▼"; font-size: 10px; color: var(--muted); }
th.header[aria-sort="ascending"]::after { content: " ▲"; color: var(--primary); }
th.header[aria-sort="descending"]::after { content: " ▼"; color: var(--primary); }

/* Horizontal scroll wrapper for wide tables on small screens */
.table-scroll {
  width: 100%;
  overflow: auto;
  max-height: 75vh;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}

/* Ensure sticky headers stick within scroll container */
.table-scroll thead th,
.table-scroll tr:first-child th { position: sticky; top: 0; z-index: 2; }

#listogames { overflow: auto; max-height: 70vh; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--surface); }
#playersDiv { overflow: visible; }

/* Games: stats reports (layout and colours follow Martin's Excel sheets) */
.report-sheet + .report-sheet { border-top: 1px solid var(--border); }
.report-head { padding: 20px 16px 14px; text-align: center; }
.report-head h2 { margin: 0 0 6px; font-size: 17px; }
.report-desc { max-width: 560px; margin: 0 auto; font-size: 13px; color: var(--text-2); }
.report-updated { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.report-table th, .report-table td { text-align: center; }
.report-table.is-compact th { white-space: nowrap; }
.report-table td.grade-good { background: var(--grade-good-bg); color: var(--grade-good-ink); font-weight: 600; }
.report-table td.grade-mid { background: var(--grade-mid-bg); color: var(--grade-mid-ink); font-weight: 600; }
.report-table td.grade-bad { background: var(--grade-bad-bg); color: var(--grade-bad-ink); font-weight: 600; }
.report-n { display: block; font-size: 11px; line-height: 1.2; color: var(--muted); }

/* Containers nested inside a card stay flat (no card-in-card shadow) */
.card .table-scroll,
.card #listogames,
.card .chart-card { box-shadow: none; }

/* Compact tables on smaller screens */
@media (max-width: 1200px) {
  th, td { padding: 6px 8px; font-size: 13px; }
  #playersDiv input[type="text"],
  #playersDiv select { font-size: 12px; }
}
@media (max-width: 900px) {
  th, td { padding: 4px 6px; font-size: 12px; }
  #playersDiv input[type="text"] { width: 80px !important; }
  #scrollLeft, #scrollRight { display: none; }
}

/* Non-scrolling chart container */
.chart-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}
.chart-card.flush { padding: 0; }
.chart-card canvas { display: block; }
.chart-card .chart-title { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.chart-card.chart-fixed { height: 500px; display: flex; flex-direction: column; }
.chart-card.chart-fixed canvas { flex: 1 1 auto; width: 100% !important; height: auto !important; margin-bottom: 8px; }

/* Charts grid responsive */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
}

@media (max-width: 640px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  /* Friendlier height on mobile */
  .chart-card.chart-fixed { height: 380px; }
}

/* Sub-pixel clipping fix for player profile canvases only */
#pp-goals-line,
#pp-wdl-donut,
#pp-goals-month {
  padding-bottom: 2px; /* prevent axis label clip/overhang without affecting Insights */
  display: block;
}

/* New Game specific */
#gameData h3 { margin-top: 0; color: var(--text); }
input#gameDate { max-width: 220px; display: inline-block; width: auto; }

/* Constrain New Game table width and center */
#gameDataTable { width: 100%; max-width: 1200px; margin: 0; }

/* Score inputs sit inside a −/+ stepper; JS-set inline widths are overridden */
#gameDataTable td input[type="text"],
#editGameTable td input[type="text"] { width: 2.75em !important; padding: 6px 4px; text-align: center; }
#gameDataTable td:nth-child(3),
#editGameTable td:nth-child(3) { white-space: nowrap; }

/* Last 50 attendance radio group */
#last50Table td fieldset {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.02);
}
#last50Table td fieldset input[type="radio"] { width: 18px; height: 18px; margin: 0 6px 0 2px; }

/* Team picker — segmented Green / Yellow toggle (input precedes its label) */
.team-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
}
.team-toggle input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.team-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
  cursor: pointer;
  user-select: none;
  transition: background-color .15s ease, color .15s ease;
}
.team-toggle label::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: .45;
}
.team-toggle label:hover { background: var(--surface-2); color: var(--text); }
.team-toggle input[value="G"]:checked + label { background: var(--team-green); color: #fff; }
.team-toggle input[value="Y"]:checked + label { background: var(--team-yellow); color: var(--team-yellow-ink); }
.team-toggle input:checked + label::before { opacity: 1; }
.team-toggle input:focus-visible + label { box-shadow: 0 0 0 3px var(--ring); }

/* Table row buttons shouldn't inherit the card's control spacing */
.card td > button,
.card td > input[type="button"] { margin-bottom: 0; }

/* Keep action column compact */
#gameDataTable th:last-child,
#gameDataTable td:last-child { width: 140px; text-align: center; }


/* Utilities */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }

/* Quick links grid on home page */
.getting-started-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.gs-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.gs-item:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
  text-decoration: none;
  transform: translateY(-1px);
}
.gs-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-50);
  color: var(--primary-ink);
}
.gs-icon svg { width: 18px; height: 18px; }
.gs-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gs-item strong { font-size: 14px; }
.gs-item .muted { font-size: 13px; line-height: 1.4; }

/* Record Breakers tiles */
.records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.record-tile {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  background: var(--surface-2);
}
.record-tile.loading-tile { grid-column: 1 / -1; padding: 32px; color: var(--muted); }
.record-value { font-size: 28px; font-weight: 700; color: var(--primary); line-height: 1.2; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.record-label { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 4px; }
.record-player { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Head-to-Head bars */
.h2h-names { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 8px; font-size: 14px; }
.h2h-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.h2h-val { width: 50px; font-size: 13px; font-weight: 600; }
.h2h-val.h2h-left { text-align: right; }
.h2h-val.h2h-right { text-align: left; }
.h2h-bar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
  height: 26px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
}
.h2h-bar {
  height: 100%;
  min-width: 2px;
  transition: width .3s ease;
}
.h2h-bar-left { background: var(--primary); border-radius: 6px 0 0 6px; }
.h2h-bar-right { background: #f59e0b; border-radius: 0 6px 6px 0; margin-left: auto; }
.h2h-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  z-index: 1;
  white-space: nowrap;
}

/* Form badges (darker shades keep white text above 4.5:1 contrast) */
.form-badge {
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  margin-right: 2px;
}
.form-w { background: #15803d; }
.form-d { background: #b45309; }
.form-l { background: #b91c1c; }

/* Last 50: row status colors (match New Game green; darker red) */
tbody tr.row-yes { background-color: lightgreen !important; }
tbody tr.row-no  { background-color: #fca5a5 !important; }
tbody tr.row-reserve { background-color: #93c5fd !important; }
/* Keep hover from overriding explicit statuses */
tbody tr.row-yes:hover, tbody tr.row-no:hover, tbody tr.row-reserve:hover { filter: brightness(0.98); }

/* Small screens */
@media (max-width: 640px) {
  #main, .container { margin: 24px auto; padding: 0 16px; }
  h1 { font-size: 26px; }
  h2 { font-size: 18px; }
}

/* Family Tree fullscreen on desktop */
@media (min-width: 641px) {
  body.family-tree .container { max-width: 100%; width: 100%; }
  body.family-tree #tree { height: calc(100vh - 160px) !important; } /* account for header & padding */
}

/* Inline controls spacing inside cards */
.card select,
.card input[type="button"],
.card input[type="submit"],
.card button,
.card a.btn { margin-right: 8px; margin-bottom: 10px; }

/* Ensure controls inside cards are not full width */
.card button,
.card input[type="button"],
.card input[type="submit"],
.card .btn { width: auto; }
.card select { width: auto; min-width: 220px; }

/* Edit Game specific: keep date input compact */
#gameDateEdit { max-width: 220px; }

/* ── Insights sidebar layout ── */
.insights-layout {
  display: flex;
  padding: 16px;
  gap: 20px;
  min-height: calc(100vh - 160px);
}
.insights-sidebar {
  flex: 0 0 200px;
  position: sticky;
  top: 112px;
  align-self: flex-start;
}
.insights-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow-sm);
}
.sidebar-link {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: none;
  box-shadow: none;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  white-space: normal;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.sidebar-link:hover {
  background: var(--primary-50);
  color: var(--primary-ink);
}
.sidebar-link.active {
  background: var(--primary-700);
  color: #fff;
  font-weight: 600;
}
.insights-content {
  flex: 1;
  min-width: 0;
}
.insights-panel {
  display: none;
}
.insights-panel.active {
  display: block;
  animation: fadeUp 0.25s ease;
}

/* Consistent insight section header: title left, controls right */
.insight-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.insight-header h2 { margin: 0; margin-right: auto; white-space: nowrap; }
.insight-header .controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
#leagueSearch { width: 180px; }

/* Mobile nav: dropdown instead of sidebar */
.insights-mobile-nav { display: none; }

/* Mobile: sidebar becomes dropdown */
@media (max-width: 768px) {
  .insights-layout {
    flex-direction: column;
    padding: 10px;
    gap: 12px;
  }
  .insights-sidebar { display: none; }
  .insights-mobile-nav {
    display: block;
    padding: 0 0 4px;
  }
  .insights-mobile-nav select {
    width: 100%;
    padding: 10px 34px 10px 14px;
    font-size: 15px;
    font-weight: 600;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background-color: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
  }
  .insights-content { overflow: hidden; }
  .insights-content .card { overflow-x: auto; }

  /* Chart heights reduced on mobile */
  .insights-panel .chart-card.chart-fixed { height: 300px; }

  /* H2H: stack selects vertically */
  #h2h-result .h2h-row { gap: 4px; }
  #h2h-result .h2h-val { width: 36px; font-size: 12px; }
  #h2h-result .h2h-label { font-size: 10px; }

  /* Record tiles smaller on mobile */
  .records-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
  .record-tile { padding: 12px; }
  .record-value { font-size: 22px; }

  /* League search full width */
  #leagueSearch { width: 100% !important; }

  /* Top scorers min-width override for mobile */
  .insights-panel table[style*="min-width"] { min-width: 0 !important; }

  /* Goal range legend wraps */
  #goal-legend-inline { gap: 8px; font-size: 11px; }
}

/* Top scorers table default min-width */
.top-scorers-table { min-width: 360px; }

/* ── Layout helpers ── */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.toolbar > label { display: inline; margin: 0; }
.toolbar-spacer { flex: 1 1 auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.field-inline { display: inline-flex; align-items: center; gap: 8px; }
.field-inline label { margin: 0; }
.card .toolbar select,
.card .toolbar button,
.card .toolbar input[type="button"],
.card .toolbar input[type="submit"],
.card .toolbar .btn,
.card .card-head button,
.card .card-head .btn { margin: 0; }
.card > .section-desc { margin-top: 0; }
.unconfirmed-signups { margin-top: 12px; }
.unconfirmed-signups summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.unconfirmed-signups .section-desc { margin: 8px 0; font-size: 14px; }
.status-text { font-size: 13px; color: var(--muted); }
.status-text:empty { display: none; }
.link-underline { text-decoration: underline; }
.min-w-640 { min-width: 640px; }
.min-w-680 { min-width: 680px; }
.min-w-760 { min-width: 760px; }
.tree-canvas { height: 70vh; width: 100%; }

/* ── Toasts ── */
.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 12px 12px 14px;
  border-left: 4px solid var(--subtle);
  border-radius: var(--radius);
  background: var(--toast-bg);
  color: #f8fafc;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  animation: toastIn .2s ease-out;
}
.toast-success { border-left-color: #22c55e; }
.toast-error { border-left-color: #ef4444; }
.toast-out { opacity: 0; transform: translateY(6px); transition: opacity .2s ease, transform .2s ease; }
.toast .toast-close {
  margin: -4px -4px -4px auto;
  padding: 0 6px;
  background: none;
  border: 0;
  box-shadow: none;
  color: #94a3b8;
  font-size: 18px;
  line-height: 1;
}
.toast .toast-close:hover { background: none; color: #fff; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ── Install banner (ui.js; touch devices only) ── */
.install-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
  padding: 10px 8px 10px 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  animation: sheetUp .2s ease-out;
}
body.has-install-banner { padding-bottom: 96px; }
.install-banner .install-icon { flex: none; width: 40px; height: 40px; border-radius: 10px; }
.install-banner .install-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.35; color: var(--muted); }
.install-banner .install-text strong { font-size: 14px; color: var(--text); }
.install-banner .install-share-icon { width: 16px; height: 16px; vertical-align: -3px; fill: none; stroke: var(--primary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.install-banner .btn { flex: none; }
.install-banner .install-close {
  flex: none;
  align-self: flex-start;
  margin: -4px 0 0;
  padding: 2px 8px;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--subtle);
  font-size: 20px;
  line-height: 1;
}
.install-banner .install-close:hover { background: none; color: var(--text); }

/* ── Confirm dialog ── */
.ui-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.ui-dialog[open] { animation: dialogIn .18s ease-out; }
.ui-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.ui-dialog form { padding: 22px 22px 18px; }
.ui-dialog-title { margin: 0 0 8px; font-size: 18px; }
.ui-dialog-msg { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; white-space: pre-line; }
.ui-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
/* Add player dialog (Manage Players) */
.add-player-dialog { width: min(520px, calc(100vw - 32px)); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.dialog-head .ui-dialog-title { margin: 0; }
.dialog-close {
  margin: -6px -10px -6px 0;
  padding: 2px 10px;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--subtle);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}
.dialog-close:hover { background: var(--hover); color: var(--text); }
.dialog-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.dialog-fields .dialog-wide { grid-column: 1 / -1; }
.dialog-fields label { margin-bottom: 4px; }
.dialog-fields label .muted { font-weight: 400; }
@media (max-width: 480px) { .dialog-fields { grid-template-columns: minmax(0, 1fr); } }
@keyframes dialogIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* ── New Game: sticky action bar with live team count ── */
.action-bar {
  position: sticky;
  bottom: 16px;
  z-index: 5;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.action-bar-buttons { display: flex; gap: 8px; margin-left: auto; }
#gameReady:not(:empty) { color: var(--warn-text); font-weight: 500; }
.team-count { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.team-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 500;
}
.team-pill strong { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.team-dot { display: inline-block; flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; }
.team-dot-g { background: var(--team-green); }
.team-dot-y { background: var(--team-yellow); box-shadow: inset 0 0 0 1px rgba(113, 63, 18, 0.25); }
.team-vs { font-size: 12px; font-weight: 600; color: var(--subtle); text-transform: uppercase; }
.team-count.is-uneven .team-pill { border-color: var(--warn-border); background: var(--warn-bg); }
.team-count.is-uneven::after { content: 'Uneven'; font-size: 12px; font-weight: 600; color: var(--warn-text); }
.score-tally {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--subtle);
  font-size: 14px;
}
.score-tally-label { margin-right: 2px; font-size: 12px; font-weight: 600; text-transform: uppercase; }
.score-tally strong { color: var(--text); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Home: hero + quick stats ── */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  padding: 28px;
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--surface) 65%);
}
.card.hero > * + * { margin-top: 0; }
.eyebrow {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
}
.hero .hero-title { margin: 0 0 6px; font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -0.025em; }
.hero p { margin: 0; max-width: 56ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card .hero-actions .btn { margin: 0; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.stat-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-sub { font-size: 13px; color: var(--muted); }
.score-line { display: inline-flex; align-items: center; gap: 8px; }
.score-sep { color: var(--subtle); font-weight: 500; }

/* ── Player Profile: hero + KPI tiles ── */
.profile-hero { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 20px; }
.card.profile-hero > * + * { margin-top: 0; }
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #15803d 0%, #14532d 100%);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.profile-hero-main { flex: 1 1 260px; min-width: 0; }
.profile-hero-main h2 { margin: 0 0 8px; font-size: 22px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}
.chip-label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.profile-form { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.form-row { display: flex; gap: 3px; min-height: 22px; }
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-grid .record-tile { background: var(--surface); box-shadow: var(--shadow-sm); }

/* ── Insights helpers ── */
#gvy-tiles { margin-bottom: 16px; }
.h2h-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.h2h-sub { margin-top: 16px; }
.h2h-sub h3 { margin: 12px 0 4px; }
.h2h-sub h3:first-child { margin-top: 0; }
.legend-inline { display: flex; gap: 12px; align-items: center; font-size: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.legend-dot-primary { background: var(--primary); }
.legend-dot-max { background: #0f766e; }
.legend-dot-min { background: #9ca3af; }

/* ── Insights: grouped sidebar, filters, table movement, records podium ── */
.sidebar-group + .sidebar-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.sidebar-group-label { display: block; padding: 6px 12px 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.insights-panel .card + .card { margin-top: 16px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.filter-row select, .insight-header .field-inline select { min-width: 0; margin: 0; }
.move { font-size: 12px; font-weight: 600; white-space: nowrap; }
.move-up { color: var(--primary); }
.move-down { color: var(--danger); }
.move-new { color: var(--warn-text); }
.team-label { display: inline-flex; align-items: center; gap: 6px; }
.record-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.record-podium {
  display: grid;
  gap: 4px;
  margin: 10px 0 0;
  padding: 8px 0 0;
  list-style: none;
  border-top: 1px solid var(--border);
  font-size: 12px;
  text-align: left;
}
.record-podium li { display: flex; align-items: baseline; gap: 6px; }
.podium-place { flex: 0 0 auto; min-width: 2.4em; font-weight: 600; color: var(--muted); }
.podium-names { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.podium-value { flex: 0 0 auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.h2h-sub .table-scroll { margin-top: 4px; }

/* ── Insights: latest game ── */
#latest-body > * + * { margin-top: 14px; }
.match-score { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 20px; font-size: 18px; font-weight: 600; }
.match-side { display: inline-flex; align-items: center; gap: 12px; }
.match-side:last-child { flex-direction: row-reverse; }
.match-total { font-size: 40px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.match-dash { font-size: 28px; color: var(--subtle); }
#latest-body .match-verdict { margin-top: 4px; text-align: center; color: var(--muted); font-weight: 500; }
.match-teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.match-team { padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.match-team h3 { margin: 0 0 8px; font-size: 15px; }
.match-roster { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.match-roster li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.match-player-goals { padding: 1px 8px; border-radius: var(--radius-pill); background: var(--primary-50); color: var(--primary-ink); font-size: 12px; font-weight: 600; white-space: nowrap; }
.match-subhead { margin-bottom: 0; }
#latest-body .highlights { display: grid; gap: 4px; margin-top: 6px; padding-left: 20px; font-size: 14px; }

/* ── Player Profile: period toggle, hero notes, milestones, results ── */
.toolbar .controls { display: flex; flex-wrap: wrap; gap: 6px; }
.profile-note { font-size: 13px; color: var(--text-2); }
.profile-note:empty { display: none; }
.milestone-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.milestone-list > .empty-state { grid-column: 1 / -1; }
.milestone-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.milestone-head .muted { font-size: 13px; }
.progress { height: 8px; margin: 6px 0 4px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface-2); }
.progress > span { display: block; height: 100%; background: var(--primary); }
.milestone-sub { font-size: 12px; }
.result-cell { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
#recentMore { margin: 12px 0 0; }

@media (max-width: 768px) {
  .toast-region {
    left: 16px;
    right: 16px;
    align-items: stretch;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px);
  }
  .toast { max-width: none; }
  .install-banner { left: 8px; right: 8px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 8px); }
  body.has-tabbar.has-install-banner { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 96px); }
  .action-bar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 8px); }
  .action-bar-buttons { width: 100%; margin-left: 0; }
  .action-bar-buttons > * { flex: 1 1 0; }
  .hero { padding: 20px; }
  .hero .hero-title { font-size: 22px; }
  input.input-search { width: 100%; }
  .match-total { font-size: 30px; }
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 1000;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--primary-700);
  color: #fff;
  font-weight: 600;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* Keyboard-sortable headers: keep the focus ring inside the sticky cell */
th[tabindex]:focus-visible { outline-offset: -3px; }

/* ── Searchable select (uiCombobox) ── */
.combo { position: relative; display: inline-block; width: 320px; max-width: 100%; vertical-align: middle; }
.toolbar .combo { flex: 0 1 320px; }
.h2h-controls .combo { width: 240px; }
input.combo-input {
  width: 100%;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}
.combo-native {
  position: absolute !important;
  width: 1px !important;
  min-width: 0 !important;
  height: 1px;
  margin: 0 !important;
  padding: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  pointer-events: none;
}
.combo-list {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  width: max-content;
  min-width: 100%;
  max-width: min(480px, 90vw);
  max-height: 288px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.combo-up .combo-list { top: auto; bottom: calc(100% + 4px); }
.combo-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.combo-option.is-active { background: var(--primary-50); color: var(--primary-ink); }
.combo-option[aria-selected="true"] { font-weight: 600; }
.combo-meta { flex: 0 0 auto; font-size: 12px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.combo-empty { padding: 10px; font-size: 13px; color: var(--muted); }

/* ── Status pills, empty states ── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-saved { background: var(--primary-50); color: var(--primary-ink); }
.status-edited { background: var(--warn-bg); color: var(--warn-text); }
.status-saving { background: var(--surface-2); color: var(--muted); }
.empty-state { margin: 0; padding: 28px 16px; text-align: center; font-size: 14px; color: var(--muted); }

/* ── Player rows: name + id, score stepper, save indicator ── */
.player-name { font-weight: 600; }
.player-id { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stepper { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.stepper > * { flex: 0 0 auto; }
.stepper .stepper-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  box-shadow: none;
  font-size: 16px;
  line-height: 1;
}
.stepper .stepper-btn:hover { background: var(--surface-2); border-color: var(--subtle); }
.card .stepper .stepper-btn { margin: 0; }
.save-state { display: inline-block; min-width: 5em; margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--muted); vertical-align: middle; }
.save-state.is-saved { color: var(--primary-ink); }
.save-state.is-saved::before { content: '\2713\00a0'; }
.save-state.is-error { color: var(--danger); }
/* Admin-only Ability / Effort boxes (Manage Players, New Game) */
input.score-input { width: 5em; min-width: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* ── Player Profile career stats grid ── */
.stat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.stat-list > .empty-state { grid-column: 1 / -1; }
.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.stat-item-label { font-size: 12px; color: var(--muted); }
.stat-item-value { font-size: 18px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* ── Home: recent results strip ── */
.results-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.result-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--subtle);
}
.result-chip.win-g { box-shadow: inset 3px 0 0 var(--team-green); }
.result-chip.win-y { box-shadow: inset 3px 0 0 var(--team-yellow); }
.result-score { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.result-meta { font-size: 12px; color: var(--muted); }

/* ── Team Builder: picker + two team cards, sticky match-up panel on the right ── */
.tb-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas: "picker side" "teams side";
  align-items: start;
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
}
.card-container.tb-layout .card { margin-bottom: 0; }
.tb-picker { grid-area: picker; }
.tb-picker .controls { display: flex; flex-wrap: wrap; gap: 6px; }
.tb-picker .controls > * { margin: 0; }
.tb-teams { grid-area: teams; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.tb-side { grid-area: side; position: sticky; top: 112px; max-height: calc(100vh - 128px); overflow-y: auto; }
.tb-side h2 { margin: 0; }
.tb-team-g { border-top: 4px solid var(--team-green); }
.tb-team-y { border-top: 4px solid var(--team-yellow); }
.tb-count {
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.tb-count.is-short { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn-text); }
.tb-table { table-layout: fixed; min-width: 620px; }
.tb-table th:first-child { width: 30%; }
.tb-table th:nth-child(7) { width: 148px; }
.tb-table th:last-child { width: 88px; }
.tb-table td { font-variant-numeric: tabular-nums; }
.tb-picker .section-desc { margin-bottom: 0; }
.tb-name { display: flex; flex-direction: column; min-width: 140px; }
.tb-meta { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.tb-new {
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 11px;
  font-weight: 600;
}
.tb-form { white-space: nowrap; }
.tb-actions { display: inline-flex; gap: 2px; white-space: nowrap; }
.card .tb-actions button { margin: 0; }
.tb-vs { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; }
.tb-vs-count { font-variant-numeric: tabular-nums; }
.tb-chance { display: flex; height: 14px; overflow: hidden; border-radius: var(--radius-pill); background: var(--surface-2); }
.tb-chance > span { height: 100%; transition: width .3s ease; }
.tb-chance-g { background: var(--team-green); }
.tb-chance-d { background: var(--border-strong); }
.tb-chance-y { background: var(--team-yellow); }
.tb-chance-labels { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tb-verdict { margin: 0; text-align: center; font-weight: 600; color: var(--primary-ink); }
.tb-score { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.tb-score-label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.tb-score-value { display: inline-flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tb-actual { border-style: dashed; background: none; }
.tb-actual-note { font-size: 12px; text-align: center; }
.tb-compare { font-size: 14px; }
.tb-compare th, .tb-compare td { padding: 6px 4px; text-align: center; }
.tb-compare tbody th {
  position: static;
  background: none !important;
  border-bottom: 1px solid var(--row-border) !important;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}
.tb-compare tbody tr:last-child th { border-bottom: 0 !important; }
.tb-compare td { width: 22%; font-variant-numeric: tabular-nums; }
.tb-compare td.tb-better { font-weight: 700; color: var(--primary-ink); }
.tb-compare tr.tb-pos-first > * { border-top: 2px solid var(--border) !important; }
.tb-note { margin: 0; font-size: 13px; color: var(--warn-text); }
.tb-footnote { font-size: 12px; }
#tb-matchup > * + * { margin-top: 12px; }
#tb-matchup > .tb-chance-labels { margin-top: 6px; }
@media (max-width: 1023px) {
  .tb-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "picker" "side" "teams"; }
  .tb-side { position: static; max-height: none; overflow: visible; }
}
@media print {
  .tb-layout { display: block; }
  .tb-actions { display: none; }
}

@media (max-width: 768px) {
  .toolbar .combo { flex: 1 1 100%; }
  .combo-list { width: auto; right: 0; max-width: none; }
  /* Insights cards scroll sideways on mobile, which would clip the H2H dropdowns */
  .insights-content:has(.insights-panel[data-section="h2h"].active),
  .insights-content .insights-panel[data-section="h2h"] .card { overflow: visible; }
  .h2h-controls > div, .h2h-controls .combo { width: 100%; }
}

/* ── Print ── */
@media print {
  .skip-link, #profile, .tabbar, .action-bar, .toast-region, .site-footer, .install-banner,
  .insights-sidebar, .insights-mobile-nav, .toolbar, .hero-actions, .stepper-btn, dialog { display: none !important; }
  body { background: #fff !important; padding: 0 !important; }
  .card-container, .container, #main, .insights-panel.active { animation: none !important; }
  .container, #main { max-width: none; margin: 0; padding: 0; }
  .card, .stat-tile, .chart-card, .table-scroll, #listogames, .record-tile, .result-chip { box-shadow: none !important; break-inside: avoid; }
  .table-scroll, #listogames { max-height: none !important; overflow: visible !important; }
  th { position: static !important; }
  a { color: inherit; text-decoration: none; }
  /* Stats reports: one bordered, centred sheet per page like the Excel PDFs */
  .card:has(.report-sheet), #listogames:has(.report-sheet) { border: 0 !important; padding: 0; }
  .report-sheet { font-family: Verdana, Geneva, sans-serif; }
  .report-sheet + .report-sheet { border-top: 0; break-before: page; }
  .report-head { padding: 0 0 10px; }
  .report-desc, .report-updated { color: #000; }
  #listogames .report-table { width: auto; margin: 0 auto; border-collapse: collapse; font-size: 10.5px; }
  #listogames .report-table th, #listogames .report-table td {
    padding: 1px 12px; font-size: inherit; line-height: 1.35;
    border: 1px solid #000 !important; border-radius: 0 !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  #listogames .report-table th { background: #fff !important; color: #000 !important; font-weight: 400; text-transform: none; letter-spacing: 0; white-space: nowrap; }
  #listogames .report-table th.header::after { content: none; }
  #listogames .report-table.is-compact th, #listogames .report-table.is-compact td { padding: 1px 6px; }
  .report-n { display: inline; margin-left: 3px; font-size: 8px; }
  /* The name search only filters on screen; printed reports always list every row */
  #listogames .report-table tr { display: table-row !important; background: none !important; break-inside: avoid; }
}