/* ============================================================================
   Winn Family T-20 League — Admin Dashboard
   Design system v2. Every class hook matches app.js / forms.js exactly —
   only the look changes. Layout is a left sidebar + a centred content column.

   Section map:
     1. Tokens              7.  Pills / badges
     2. Base / resets       8.  Forms
     3. App shell + sidebar 9.  Dashboard stats
     4. Content + headers   10. Tables
     5. Buttons             11. Toast / login / modal
     6. Cards / lists       12. Feature layouts + responsive
   ========================================================================== */

/* ============================================================================
   1. Tokens
   ========================================================================== */
:root {
  /* Brand — cricket green + gold (matches the public site's identity) */
  --primary:      #14996a;
  --primary-600:  #0f8258;
  --primary-700:  #0a6344;
  --accent:       #f0a92b;
  --accent-600:   #db9316;
  --accent-ink:   #2e1f00;
  --accent-tint:  rgba(240, 169, 43, 0.14);
  --dark:         #08251a;
  --ink-strong:   #08251a;

  /* Neutral surfaces — light + readable, faintest green tint */
  --bg:           #eef3ef;
  --bg-tint-a:    rgba(20, 153, 106, 0.08);
  --bg-tint-b:    rgba(240, 169, 43, 0.07);
  --surface:      #ffffff;
  --surface-2:    #f4f8f5;
  --surface-3:    #e9f1ec;
  --ink:          #12241c;
  --ink-2:        #37503f;
  --muted:        #6a8175;
  --border:       #e2ebe4;
  --border-strong:#cbdad0;

  /* Semantic */
  --danger:      #e0413a;
  --danger-600:  #c5302a;
  --danger-tint: rgba(224, 65, 58, 0.10);
  --success:     #12905a;
  --success-tint:rgba(18, 144, 90, 0.12);
  --warning:     #c07d10;
  --warning-tint:rgba(192, 125, 16, 0.13);

  /* Sidebar — deep cricket green */
  --side-top:    #0f4230;
  --side-bottom: #061a11;
  --side-ink:    #cfe3d7;
  --side-ink-dim:#8db3a0;

  /* Shape + depth */
  --radius:    14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(8, 28, 20, 0.05), 0 1px 3px rgba(8, 28, 20, 0.04);
  --shadow:    0 6px 18px -6px rgba(8, 28, 20, 0.15), 0 2px 6px -2px rgba(8, 28, 20, 0.08);
  --shadow-lg: 0 28px 56px -14px rgba(5, 22, 15, 0.34);
  --ring:      0 0 0 3px rgba(20, 153, 106, 0.22);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Spacing scale (8pt) */
  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem;
  --s5: 1.25rem; --s6: 1.5rem; --s8: 2rem;   --s10: 2.5rem;
}

/* ============================================================================
   2. Base / resets
   ========================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* Fixes phantom empty white cards: `.form`/`.row` set display, which used to
   beat the UA `[hidden]{display:none}`. This keeps hidden things hidden. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
  overflow-x: clip;
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 620px at 100% -8%, var(--bg-tint-a), transparent 60%),
    radial-gradient(920px 520px at -10% 112%, var(--bg-tint-b), transparent 55%);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h2 { font-size: 1.4rem; font-weight: 800; color: var(--dark); letter-spacing: -0.02em; }
h2 small { font-weight: 500; color: var(--muted); font-size: 0.8rem; letter-spacing: 0; }
h3 { letter-spacing: -0.01em; color: var(--dark); }
small { font-size: 0.8rem; }
a { color: var(--primary); text-underline-offset: 2px; }
strong, b { color: var(--dark); }
::selection { background: rgba(20, 153, 106, 0.26); }

/* Shared thin scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ============================================================================
   3. App shell + sidebar
   ========================================================================== */
.app-shell { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh; z-index: 20;
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: 1.15rem 0.85rem 0.9rem;
  color: var(--side-ink);
  background: linear-gradient(198deg, var(--side-top), var(--side-bottom));
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.06), 6px 0 30px -18px rgba(0,0,0,0.55);
}

/* Brand lockup */
.brand { display: flex; align-items: center; gap: 0.7rem; padding: 0.25rem 0.4rem 0.9rem; }
.brand .dot {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto; position: relative;
  background: linear-gradient(135deg, #ffd15a, var(--accent-600));
  box-shadow: 0 8px 18px -5px rgba(240,169,43,0.55), inset 0 1px 0 rgba(255,255,255,0.5);
}
.brand .dot::after {
  content: "🏏"; position: absolute; inset: 0;
  display: grid; place-items: center; font-size: 1.2rem;
}
.brand strong { display: block; color: #fff; font-weight: 750; font-size: 1rem; line-height: 1.2; letter-spacing: -0.01em; }
.brand small { color: var(--side-ink-dim); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* Nav */
.tabs {
  display: flex; flex-direction: column; gap: 0.12rem;
  flex: 1 1 auto; overflow-y: auto;
  padding: 0.35rem 0.1rem; margin: 0 -0.1rem;
}
.tabs::-webkit-scrollbar { width: 8px; }
.tabs::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 8px; }
.tabs button {
  display: flex; align-items: center; gap: 0.7rem; width: 100%; text-align: left;
  background: transparent; color: var(--side-ink); border: 0; cursor: pointer;
  padding: 0.62rem 0.7rem; border-radius: 10px;
  font: inherit; font-size: 0.9rem; font-weight: 550; letter-spacing: -0.005em;
  position: relative;
  transition: background 0.16s ease, color 0.16s ease, transform 0.08s ease;
}
.tabs button .ico {
  font-size: 1.02rem; line-height: 1; width: 1.5rem; text-align: center;
  flex: 0 0 auto; filter: saturate(1.1); opacity: 0.92;
}
.tabs button:hover { background: rgba(255,255,255,0.09); color: #fff; }
.tabs button:hover .ico { opacity: 1; }
.tabs button:active { transform: translateY(1px); }
.tabs button.active {
  background: linear-gradient(100deg, rgba(45,220,149,0.24), rgba(45,220,149,0.06));
  color: #fff; font-weight: 650;
  box-shadow: inset 0 0 0 1px rgba(45,220,149,0.32);
}
.tabs button.active .ico { opacity: 1; }
.tabs button.active::before {
  content: ""; position: absolute; left: -0.1rem; top: 20%; bottom: 20%;
  width: 3px; border-radius: 3px; background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.sidebar-foot { padding: 0.7rem 0.2rem 0.1rem; border-top: 1px solid rgba(255,255,255,0.09); }
.sidebar-foot #topLogout { width: 100%; justify-content: center; }
#publishSiteBtn { background: linear-gradient(180deg, var(--accent), var(--accent-600)); color: var(--accent-ink); font-weight: 750; }
.sidebar .hint { color: var(--side-ink-dim); }

/* Sidebar search — filter the menu instantly (see app.js tab-search). */
.tab-search { padding: 0.1rem 0.3rem 0.55rem; flex: 0 0 auto; position: relative; }
.tab-search::before {
  content: "🔍"; position: absolute; left: 0.85rem; top: 50%; transform: translateY(-58%);
  font-size: 0.8rem; opacity: 0.6; pointer-events: none;
}
.tab-search input {
  width: 100%; padding: 0.5rem 0.7rem 0.5rem 2rem; font: inherit; font-size: 0.85rem;
  color: #fff; background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14); border-radius: 10px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.tab-search input::placeholder { color: var(--side-ink-dim); }
.tab-search input:focus {
  outline: none; border-color: var(--accent); background: rgba(255,255,255,0.13);
}
.tabs .tabs-empty {
  display: none; color: var(--side-ink-dim); font-size: 0.82rem;
  text-align: center; padding: 0.9rem 0.5rem;
}

/* Mobile chrome — a slim top bar with a hamburger, and a scrim behind the
   slide-in drawer. Both are hidden on desktop and switched on under 920px. */
.topbar { display: none; }
.nav-scrim { display: none; }

/* ============================================================================
   4. Content + page headers
   ========================================================================== */
.wrap { max-width: 1120px; margin: 0 auto; padding: 2.2rem 2.2rem 4.5rem; width: 100%; }

.head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.8rem; flex-wrap: wrap;
  margin-bottom: 1.4rem; padding-bottom: 1.05rem;
  border-bottom: 1px solid var(--border);
}
.head h2 { font-size: 1.6rem; }
.head .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Intro paragraph directly under a page — auto-upgraded to an info callout so
   every tab's explanation reads as guidance, not a wall of grey text. */
.tabpane > .hint {
  position: relative;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  padding: 0.85rem 1rem 0.85rem 2.5rem;
  margin-bottom: 1.3rem;
  font-size: 0.86rem; line-height: 1.6;
  box-shadow: var(--shadow-sm);
}
.tabpane > .hint::before {
  content: "ℹ"; position: absolute; left: 0.85rem; top: 0.8rem;
  font-size: 0.95rem; color: var(--accent-600); font-weight: 700;
}
.tabpane > .hint strong { color: var(--dark); }

/* Inline callout box — for warnings/notes inside forms, not just page intros.
   Same shape as the .tabpane > .hint auto-callout above, but usable anywhere. */
.callout {
  position: relative;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  padding: 0.8rem 1rem 0.8rem 2.5rem;
  font-size: 0.85rem; line-height: 1.6;
  box-shadow: var(--shadow-sm);
}
.callout::before {
  content: "ℹ"; position: absolute; left: 0.9rem; top: 0.72rem;
  font-size: 0.95rem; color: var(--accent-600); font-weight: 700;
}
.callout strong { color: var(--dark); }
.callout.danger {
  background: linear-gradient(180deg, var(--surface), var(--danger-tint));
  border-color: rgba(224,65,58,0.3); border-left-color: var(--danger);
  color: var(--danger-600);
}
.callout.danger::before { content: "⚠"; color: var(--danger); }
.callout.danger strong { color: var(--danger-600); }

/* Pane entrance */
.tabpane { animation: paneIn 0.32s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes paneIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Section label between grouped blocks */
.section-label {
  display: flex; align-items: center; gap: 0.55rem;
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); margin: 1.8rem 0 0.85rem;
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ============================================================================
   5. Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  color: #fff; border: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
  padding: 0.6rem 1.2rem; border-radius: 999px;
  font: inherit; font-weight: 650; font-size: 0.9rem; letter-spacing: -0.005em;
  box-shadow: 0 6px 15px -6px rgba(20,153,106,0.5), inset 0 1px 0 rgba(255,255,255,0.18);
  transition: transform 0.08s ease, box-shadow 0.16s ease, filter 0.16s ease;
}
.btn:hover { filter: brightness(1.06); box-shadow: 0 11px 22px -8px rgba(20,153,106,0.55); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: 0 4px 10px -6px rgba(20,153,106,0.5); }
.btn:focus-visible { outline: none; box-shadow: var(--ring), 0 6px 15px -6px rgba(20,153,106,0.5); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; filter: grayscale(0.2); transform: none; box-shadow: var(--shadow-sm); }

.btn.accent {
  background: linear-gradient(180deg, var(--accent), var(--accent-600)); color: var(--accent-ink);
  box-shadow: 0 6px 15px -6px rgba(240,169,43,0.5), inset 0 1px 0 rgba(255,255,255,0.35);
}
.btn.ghost {
  background: var(--surface); color: var(--primary);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm);
}
.btn.ghost:hover { background: var(--surface-2); border-color: var(--primary); color: var(--primary-700); filter: none; }
.btn.danger { background: linear-gradient(180deg, var(--danger), var(--danger-600)); box-shadow: 0 6px 15px -6px rgba(224,65,58,0.45); }
.btn.sm { padding: 0.4rem 0.85rem; font-size: 0.82rem; }
.btn.xs { padding: 0.26rem 0.62rem; font-size: 0.72rem; border-radius: 8px; }

/* ============================================================================
   6. Cards / lists / rows
   ========================================================================== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow-sm);
}
.card > h2:first-child, .card > h3:first-child { margin-bottom: 0.4rem; }

.list { display: flex; flex-direction: column; gap: 0.6rem; }

/* Empty-state: a list whose only child is a hint message */
.list > .hint:only-child {
  text-align: center; padding: 2.4rem 1.5rem;
  background: var(--surface); border: 1px dashed var(--border-strong);
  border-radius: var(--radius); color: var(--muted); font-size: 0.9rem;
}
.list > .hint:only-child::before {
  content: "＋"; display: block; font-size: 1.8rem; color: var(--border-strong);
  margin-bottom: 0.4rem; font-weight: 400;
}

.row {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.9rem 1.1rem; display: flex; justify-content: flex-start; align-items: center;
  gap: 0.9rem; flex-wrap: wrap; box-shadow: var(--shadow-sm);
  transition: box-shadow 0.16s ease, border-color 0.16s ease, transform 0.08s ease;
}
.row:hover { box-shadow: var(--shadow); border-color: var(--border-strong); transform: translateY(-1px); }
.row .info { flex: 1 1 220px; min-width: 200px; }
.row .info > b { display: block; font-weight: 700; color: var(--dark); font-size: 0.98rem; margin-bottom: 0.1rem; }
.row .info > span { display: block; color: var(--muted); font-size: 0.85rem; }
.row .actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-left: auto; }

/* Thumbnails — a consistent visual anchor for every list row */
.thumb {
  flex: 0 0 auto; width: 54px; height: 54px; border-radius: 12px;
  object-fit: cover; background: var(--surface-2);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.thumb-avatar { border-radius: 50%; }
.thumb-badge { object-fit: contain; background: #fff; padding: 5px; }
.thumb-ph {
  display: grid; place-items: center;
  font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1;
  color: hsl(var(--h, 210) 55% 38%);
  background: linear-gradient(150deg, hsl(var(--h, 210) 78% 95%), hsl(var(--h, 210) 68% 86%));
  border-color: hsl(var(--h, 210) 55% 82%);
}
.thumb-ph:not(:empty) { text-shadow: 0 1px 0 rgba(255,255,255,0.5); }

/* Fixture rows — calendar date tile + teams headline */
.date-tile {
  flex: 0 0 auto; width: 58px; padding: 0.4rem 0.2rem 0.45rem;
  display: grid; justify-items: center; gap: 0.05rem; text-align: center;
  border-radius: 12px; line-height: 1;
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  color: #fff; box-shadow: 0 6px 14px -8px rgba(20,153,106,0.6);
}
.date-tile b { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.date-tile small { font-size: 0.68rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.92; }
.date-tile em { font-size: 0.6rem; font-style: normal; opacity: 0.7; }
.date-tile.done { background: linear-gradient(180deg, var(--success), #0d7549); box-shadow: 0 6px 14px -8px rgba(18,144,90,0.6); }
.date-tile.cancelled { background: linear-gradient(180deg, #8a97ac, #6c7a92); box-shadow: none; }

.fx-row .info { min-width: 260px; }
.fx-teams { font-size: 1rem !important; }
.fx-teams b { color: var(--primary-700); font-weight: 800; }
.fx-teams .vs { color: var(--muted); font-weight: 600; font-size: 0.85em; padding: 0 0.15rem; }
.pill-row { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }
.pill-row:empty { display: none; }
.fx-row .match-id { margin-top: 0.4rem; }

/* Fixtures header buttons + grouped list (upcoming prominent, rest collapsed) */
.head-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.fx-next { border-color: var(--success) !important; box-shadow: 0 0 0 1px var(--success), 0 8px 20px -12px rgba(18,144,90,0.55); }
.fx-group { margin-top: 0.9rem; }
.fx-group > summary { font-size: 0.96rem; font-weight: 750; color: var(--muted); padding: 0.5rem 0; }
.fx-group[open] > summary { color: var(--primary); margin-bottom: 0.5rem; }
.fx-group .fx-row { margin-bottom: 0.6rem; }

/* Per-venue ground photos in the Shared fixture info form */
.vp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.8rem; }
.vp-slot { border: 1px solid var(--border); border-radius: 10px; padding: 0.7rem; }
.vp-head { font-weight: 700; margin-bottom: 0.5rem; }
.vp-preview { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; margin-bottom: 0.5rem; display: block; }

/* ============================================================================
   7. Pills / badges
   ========================================================================== */
.pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.24rem 0.62rem; border-radius: 999px; white-space: nowrap;
  background: rgba(20,153,106,0.15); color: var(--primary-700);
  border: 1px solid rgba(20,153,106,0.26);
}
.pill.grey  { background: var(--surface-3); color: var(--muted);   border-color: var(--border-strong); }
.pill.green { background: var(--success-tint); color: var(--success); border-color: rgba(18,144,90,0.25); }
.pill.red   { background: var(--danger-tint);  color: var(--danger-600); border-color: rgba(224,65,58,0.25); }
.pill.amber { background: var(--warning-tint); color: #8a5a0b; border-color: rgba(192,125,16,0.28); }
.pill.blue  { background: rgba(31,97,184,0.12); color: #1c56a3; border-color: rgba(31,97,184,0.24); }
.pill.gold  { background: rgba(201,162,39,0.16); color: #8a6d10; border-color: rgba(201,162,39,0.34); }

/* ============================================================================
   8. Forms
   ========================================================================== */
.form { display: grid; gap: 1.05rem; margin-bottom: 1.4rem; }
.form .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.05rem; }
.form .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.05rem; }
.form .grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; }
@media (max-width: 620px) { .form .grid3 { grid-template-columns: 1fr; } }

label { display: block; font-size: 0.82rem; font-weight: 650; color: var(--ink); margin-bottom: 0.32rem; }

input, select, textarea {
  width: 100%; padding: 0.62rem 0.78rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font: inherit; font-size: 0.92rem; color: var(--ink); background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input::placeholder, textarea::placeholder { color: #97a4ba; }
input:hover, select:hover, textarea:hover { border-color: var(--primary); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); background: #fff; }
textarea { min-height: 160px; resize: vertical; line-height: 1.55; }
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23667791' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2rem;
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--primary); }
input[type="file"] { padding: 0.5rem; background: var(--surface-2); cursor: pointer; }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; font-size: 0.82rem; cursor: pointer;
  margin-right: 0.7rem; padding: 0.35rem 0.8rem; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--primary);
}
input[readonly] { background: var(--surface-2); color: var(--muted); border-style: dashed; }

/* Grouped form sections (match editor + any opt-in form) */
.form-section {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(180deg, #fbfdff, var(--surface-2));
  padding: 1.2rem 1.3rem 1.35rem; box-shadow: var(--shadow-sm);
}
.form-section > * + * { margin-top: 0.95rem; }
.fs-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.98rem; font-weight: 800; color: var(--primary-700); letter-spacing: -0.01em;
  border: 0; border-bottom: 1px solid var(--border); padding: 0 0 0.6rem; margin: 0 0 0.2rem;
}
.fs-title .ico { font-size: 1.05rem; line-height: 1; }

.form-actions {
  display: flex; gap: 0.6rem; flex-wrap: wrap;
  padding-top: 1.15rem; margin-top: 0.2rem; border-top: 1px solid var(--border);
}
.score-box {
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: var(--radius); padding: 1.1rem; display: grid; gap: 0.85rem;
}
.hint { color: var(--muted); font-size: 0.82rem; line-height: 1.55; }
.hint.err { color: var(--danger); font-weight: 600; }
.hint code, p code, li code, .form code {
  background: var(--surface-3); padding: 0.08rem 0.4rem; border-radius: 5px;
  font-family: var(--mono); font-size: 0.86em; color: var(--primary-700);
}

.img-pick { display: flex; gap: 0.55rem; align-items: center; flex-wrap: wrap; }
.img-pick input[type=file] { width: auto; flex: 0 0 auto; border: none; padding: 0; background: none; }
.img-pick #imagePath, .img-pick #videoUrl { flex: 1 1 220px; width: auto; }
.upload-bar { margin-top: 0.6rem; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.upload-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-600)); transition: width 0.2s ease; }
.img-pick .btn { flex: 0 0 auto; }
.img-preview {
  display: block; max-width: 260px; max-height: 160px; margin-top: 0.6rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); object-fit: cover; box-shadow: var(--shadow-sm);
}

/* ============================================================================
   9. Dashboard stats
   ========================================================================== */
.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.8rem;
}
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.3rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(var(--accent), var(--primary));
}
.stat b {
  font-size: 2.2rem; font-weight: 800; line-height: 1; display: block; letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.stat span { color: var(--muted); font-size: 0.8rem; font-weight: 600; margin-top: 0.35rem; display: block; letter-spacing: 0.01em; }

/* ============================================================================
   10. Tables
   ========================================================================== */
table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
th, td { padding: 0.72rem 0.9rem; text-align: left; font-size: 0.9rem; }
thead { background: var(--surface-3); }
thead th {
  font-weight: 750; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--primary-700); border-bottom: 2px solid var(--border-strong);
}
tbody tr { transition: background 0.12s ease; }
tbody tr:nth-child(even) { background: var(--surface-2); }
tbody tr:hover { background: rgba(20,153,106,0.07); }
tbody td { border-top: 1px solid var(--border); color: var(--ink-2); }
tbody td b { color: var(--dark); }
tbody tr:first-child td { border-top: 0; }
td.n, th.n { text-align: center; }
/* Leader row on the league table */
tbody tr:first-child td:first-child { position: relative; font-weight: 800; color: var(--primary); }

/* ============================================================================
   11. Toast / login / modal
   ========================================================================== */
.toast {
  position: fixed; top: 1.1rem; right: 1.1rem; z-index: 999;
  background: linear-gradient(180deg, #14432f, #082016); color: #fff;
  padding: 0.85rem 1.25rem; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-weight: 550; font-size: 0.9rem;
  border: 1px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; gap: 0.5rem;
  animation: toastIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast::before {
  content: "✓"; display: grid; place-items: center; flex: 0 0 auto;
  width: 1.25rem; height: 1.25rem; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 900; font-size: 0.72rem;
}
.toast.err { background: linear-gradient(180deg, var(--danger), var(--danger-600)); }
.toast.err::before { content: "!"; background: #fff; color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

body.locked { overflow: hidden; }
#loginGate {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: radial-gradient(1000px 600px at 50% -10%, rgba(20,153,106,0.45), transparent 60%),
              linear-gradient(180deg, rgba(6,26,17,0.76), rgba(6,26,17,0.88));
  backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
  animation: paneIn 0.3s ease;
}
#loginGate .login-card {
  width: 100%; max-width: 384px; padding: 1.9rem;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border); border-top: 4px solid var(--accent);
}
#loginGate .login-card h2 { font-size: 1.5rem; }
#loginGate label { display: block; margin: 0.75rem 0 0.25rem; font-weight: 650; }
#loginGate input[type="email"], #loginGate input[type="password"] {
  width: 100%; padding: 0.68rem 0.78rem; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font: inherit;
}
#loginGate .login-card .form-actions { margin-top: 1.2rem; border-top: 0; padding-top: 0; }
#loginGate .login-card .form-actions .btn { width: 100%; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 1100;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: linear-gradient(180deg, rgba(6,26,17,0.56), rgba(6,26,17,0.72));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: paneIn 0.22s ease;
}
.modal-card {
  width: 100%; max-width: 460px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: modalPop 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modalPop { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.05rem 1.3rem; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.modal-head h3 { font-size: 1.1rem; font-weight: 800; }
.modal-x {
  width: 30px; height: 30px; border-radius: 8px; border: 0; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 0.95rem; line-height: 1;
  transition: background 0.14s ease, color 0.14s ease;
}
.modal-x:hover { background: var(--surface-3); color: var(--danger); }
.modal-body { padding: 1.3rem; }
.modal-body label { margin-bottom: 0.25rem; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 0.6rem;
  padding: 1rem 1.3rem; border-top: 1px solid var(--border); background: var(--surface-2);
}

/* ============================================================================
   12. Feature layouts (forms.js engine, scorecard, tournaments, website)
   ========================================================================== */
.chk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem 1rem; }
.chk { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; font-size: 0.9rem; margin: 0; cursor: pointer; }
.chk input { width: auto; flex: 0 0 auto; }
.form h3 { font-size: 1.02rem; font-weight: 750; border-bottom: 2px solid var(--border); padding-bottom: 0.4rem; margin-top: 0.6rem; }

details summary {
  cursor: pointer; font-weight: 650; color: var(--dark);
  list-style: none; display: flex; align-items: center; gap: 0.45rem; padding: 0.2rem 0;
}
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "▸"; color: var(--accent-600); font-size: 0.85em; transition: transform 0.15s ease; }
details[open] summary::before { transform: rotate(90deg); }
details ul { margin: 0.5rem 0 0.5rem 1.2rem; }
details li { margin: 0.2rem 0; font-size: 0.9rem; }

#formPicker { width: auto; min-width: 240px; }
.gf-sec { margin-bottom: 0.5rem; }
.gf-static { margin: 0.4rem 0 0.7rem 1.2rem; }
.gf-static li { margin: 0.2rem 0; font-size: 0.92rem; }
.gf-table { margin: 0.5rem 0 0.9rem; }
.gf-row, .gf-head { display: flex; gap: 0.45rem; align-items: center; margin-bottom: 0.4rem; }
.gf-row .gf-cell { flex: 1 1 0; width: auto; text-align: left; padding: 0.5rem; }
.gf-head { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.gf-head span { flex: 1 1 0; }
.gf-row .sc-del { flex: 0 0 auto; }
.gf-table:has(.sc-del) .gf-head::after { content: ''; flex: 0 0 32px; }

.group { margin-bottom: 1.1rem; }
.group-title { font-size: 0.96rem; font-weight: 750; color: var(--primary); margin: 0.7rem 0 0.45rem; }

.scorecard-wrap { display: grid; gap: 0.7rem; }
#scorecard { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.sc-side { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; }
.sc-side h4 { font-size: 0.94rem; font-weight: 750; margin-bottom: 0.6rem; }
.sc-sub { margin-bottom: 0.8rem; }
.sc-head { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0.35rem 0; }
.sc-row { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-bottom: 0.4rem; }
.sc-row select.sc-player { flex: 1 1 130px; min-width: 110px; }
.sc-row input { flex: 0 0 54px; width: 54px; padding: 0.42rem; text-align: center; }
.sc-row input.sc-dismissal { flex: 1 1 130px; width: auto; text-align: left; }
.sc-row .sc-no { display: flex; align-items: center; gap: 0.25rem; font-size: 0.78rem; font-weight: 650; flex: 0 0 auto; margin: 0; white-space: nowrap; }
.sc-row .sc-no input { flex: 0 0 auto; width: auto; }
.sc-row .sc-del { flex: 0 0 auto; }

.tk-enable { display: flex; align-items: center; gap: 0.5rem; font-weight: 650; margin: 0.7rem 0; }
.tk-enable input { width: auto; }
.tk-head { display: flex; gap: 0.35rem; font-size: 0.72rem; color: var(--muted); font-weight: 700; margin-bottom: 0.3rem; }
.tk-head span:nth-child(1) { flex: 1 1 140px; }
.tk-head span:nth-child(2), .tk-head span:nth-child(3) { flex: 0 0 110px; }
.tk-head span:nth-child(4) { flex: 0 0 32px; }
.tk-row .tk-label { flex: 1 1 140px; width: auto; text-align: left; }
.tk-row .tk-price, .tk-row .tk-cap { flex: 0 0 110px; width: 110px; text-align: center; }

.rep { display: flex; flex-direction: column; gap: 0.45rem; margin: 0.45rem 0 0.55rem; }
.rep-row {
  display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.6rem;
}
.rep-row input, .rep-row textarea { width: auto; padding: 0.42rem; }
.rep-row.rep-stack { flex-direction: column; align-items: stretch; }
.rep-row.rep-stack input, .rep-row.rep-stack textarea { width: 100%; }
.rep-row .rep-del { flex: 0 0 auto; margin-left: auto; }
.rep-round { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.8rem; margin-bottom: 0.65rem; background: var(--surface); }
.rep-round-head { display: flex; gap: 0.45rem; align-items: center; margin-bottom: 0.55rem; }
.rep-round-head input { flex: 1 1 auto; font-weight: 650; }
.rep .img-pick { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 0.45rem; }

.match-id { margin-top: 0.45rem; font-size: 0.78rem; color: var(--muted); display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.match-id code { background: var(--surface-3); padding: 0.14rem 0.5rem; border-radius: 6px; font-family: var(--mono); color: var(--primary-700); }

/* ---------- Website tab (homepage images & copy) ---------- */
.ws-slot { display: grid; grid-template-columns: 200px 1fr; gap: 1rem; align-items: start; margin-top: .8rem; }
.ws-preview {
  display: grid; place-items: center; aspect-ratio: 16 / 9;
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: 10px; overflow: hidden;
}
.ws-preview.sm { aspect-ratio: 3 / 2; }
.ws-preview img { width: 100%; height: 100%; object-fit: contain; }
.ws-ph { color: var(--muted); font-size: .8rem; }
.ws-slot-body strong { display: block; margin-bottom: .15rem; }
.ws-slot-body .hint { margin-bottom: .5rem; }
.ws-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; margin: 1rem 0; }
.ws-field { display: grid; gap: .25rem; }
.ws-field > span { font-size: .8rem; font-weight: 650; color: var(--ink-2); }
.ws-replays { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.4rem; margin-top: 1rem; }
.ws-replay { border-top: 1px solid var(--border); padding-top: .6rem; }
.ws-replay .ws-slot { grid-template-columns: 130px 1fr; }
.ws-replay .ws-field { margin-top: .6rem; }
.ws-partners { display: grid; gap: .8rem; }
.ws-partner {
  display: grid; grid-template-columns: 130px 1fr auto; gap: 1rem; align-items: center;
  border: 1px solid var(--border); border-radius: 10px; padding: .7rem; background: var(--surface-2);
}
.ws-partner-fields { display: grid; gap: .4rem; }
.ws-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.ws-actions label.btn { margin: 0; }
.ws-sub-count { margin: .2rem 0 .6rem; color: var(--muted); font-size: .9rem; }
.ws-sub-count strong { color: var(--dark); font-size: 1.1rem; }
.ws-subs { display: grid; gap: .4rem; max-height: 320px; overflow-y: auto; }
.ws-sub { display: grid; grid-template-columns: 1fr auto auto; gap: .8rem; align-items: center; border: 1px solid var(--border); border-radius: 8px; padding: .45rem .7rem; }
.ws-sub-email { font-weight: 650; word-break: break-all; }
.ws-sub-date { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.pill-sent { display: inline-block; background: var(--success-tint); color: var(--success); border: 1px solid rgba(18,144,90,0.25); border-radius: 999px; padding: .25rem .75rem; font-size: .78rem; font-weight: 750; }
#issueForm textarea { width: 100%; font: inherit; line-height: 1.6; }

/* ============================================================================
   Responsive — sidebar becomes a slide-in drawer with a hamburger top bar
   ========================================================================== */
@media (max-width: 920px) {
  .app-shell { display: block; }

  /* Slim sticky top bar (mobile only) */
  .topbar {
    display: flex; align-items: center; gap: 0.7rem;
    position: sticky; top: 0; z-index: 45;
    padding: 0.55rem 0.85rem;
    color: #fff;
    background: linear-gradient(180deg, var(--side-top), var(--side-bottom));
    box-shadow: 0 4px 16px -8px rgba(0,0,0,0.6);
  }
  .menu-toggle {
    flex: 0 0 auto; width: 42px; height: 42px; border: 0; cursor: pointer;
    display: grid; place-items: center; font-size: 1.25rem; line-height: 1;
    color: #fff; background: rgba(255,255,255,0.12); border-radius: 11px;
    transition: background 0.14s ease;
  }
  .menu-toggle:hover { background: rgba(255,255,255,0.2); }
  .topbar-title { font-weight: 750; font-size: 0.98rem; letter-spacing: -0.01em; }
  .topbar-title .tb-emoji { margin-right: 0.35rem; }

  /* The drawer itself */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100dvh;
    width: 284px; max-width: 84vw; z-index: 60;
    transform: translateX(-101%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }
  body.nav-open .sidebar { transform: none; }

  .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(5, 22, 15, 0.55);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
  }
  body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }

  .wrap { padding: 1.5rem 1.1rem 3rem; }
  .head h2 { font-size: 1.35rem; }
}
@media (max-width: 760px) { #scorecard { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  /* Wide data tables scroll horizontally on their own rather than being clipped
     by the page (body uses overflow-x: clip, so tables can't push it wider). */
  .tabpane table {
    display: block; overflow-x: auto; white-space: nowrap;
    -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm);
  }
}
@media (max-width: 620px) {
  .form .grid2, .form .grid4 { grid-template-columns: 1fr; }
  .chk-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .ws-slot, .ws-replay .ws-slot, .ws-partner { grid-template-columns: 1fr; }
  .ws-fields, .ws-replays { grid-template-columns: 1fr; }
}

/* ---------- Modules: the question editor ---------- */
.mod-question {
  border: 1px solid var(--line, #d9d9de);
  border-radius: 10px;
  padding: .85rem .9rem;
  margin: 0 0 .75rem;
  background: rgba(0, 0, 0, .015);
}
.mod-options { margin: .5rem 0 .5rem 1rem; }
.mod-opt-row { align-items: center; }
.mod-correct {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  flex: 0 0 auto;
  font-size: .78rem;
  opacity: .8;
  white-space: nowrap;
}
.mod-qactions { display: flex; gap: .5rem; flex-wrap: wrap; }
.rep-row .mod-rep-del { flex: 0 0 auto; margin-left: auto; }

/* ---- Module lessons editor ---- */
#modLessons { display: flex; flex-direction: column; gap: 0.9rem; margin: 0.4rem 0; }
.mod-lesson { border: 1px solid var(--border); border-left: 3px solid var(--accent, #c8a24a); border-radius: 10px; padding: 0.8rem 0.9rem; background: rgba(0,0,0,0.02); }
.mod-lesson-head { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.5rem; }
.mod-lesson textarea { width: 100%; margin-bottom: 0.5rem; }
.mod-res-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.5rem; }
.mod-res { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.mod-res select { flex: 0 0 auto; }
.mod-res-uplab { cursor: pointer; margin: 0; }

/* ----- Academy reporting & compliance ----- */
.rep-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.7rem; margin: 0.4rem 0 1.2rem;
}
.rep-stat {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  padding: 0.85rem 0.6rem; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2); text-align: center;
}
.rep-stat .rep-ico { font-size: 1.3rem; }
.rep-stat b { font-size: 1.5rem; line-height: 1; }
.rep-stat span:last-child { font-size: 0.78rem; color: var(--muted); }
.rep-h { margin: 1.4rem 0 0.6rem; font-size: 1rem; }
.rep-table {
  width: 100%; border-collapse: collapse; font-size: 0.88rem;
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.rep-table th, .rep-table td {
  padding: 0.5rem 0.65rem; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.rep-table thead th { background: var(--surface-3); font-weight: 600; font-size: 0.8rem; }
.rep-table tbody tr:last-child td { border-bottom: 0; }
.rep-table td { white-space: nowrap; }
.rep-bar {
  display: inline-block; width: 60px; height: 7px; border-radius: 999px;
  background: var(--surface-3); margin-right: 0.4rem; vertical-align: middle;
  overflow: hidden;
}
.rep-bar > i { display: block; height: 100%; width: var(--v, 0%); background: var(--success); }
.rep-compliance { display: block; overflow-x: auto; }
.rep-cell { text-align: center; font-weight: 700; }
.rep-cell.ok { color: var(--success); }
.rep-cell.no { color: var(--muted); }

/* member feedback stars */
.fb-stars { color: #e6b800; letter-spacing: 1px; }

/* ---- Academy sub-tabs ---- */
.subtabs {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin: 0.25rem 0 1.4rem; padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
}
.subtab {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  padding: 0.5rem 0.9rem; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.subtab:hover { background: var(--surface-2); color: var(--ink-strong); }
.subtab.is-active {
  background: rgba(20,153,106,0.12); color: var(--primary-700);
  border-color: var(--primary);
}
.subtab-badge {
  min-width: 1.25rem; height: 1.25rem; padding: 0 0.35rem; border-radius: 999px;
  display: inline-grid; place-items: center; font-size: 0.72rem; font-weight: 800;
  background: var(--surface-3); color: var(--muted);
}
.subtab.is-active .subtab-badge { background: var(--primary); color: #fff; }
.subtab-badge.is-alert { background: var(--danger, #e0413a); color: #fff; }

/* Only the active sub-pane shows. */
.subpane { display: none; }
.subpane.is-active { display: block; }

/* Sub-section header: title + description on the left, actions on the right. */
.sub-head { align-items: flex-start; gap: 1rem; }
.sub-head h3 { margin: 0 0 0.3rem; font-size: 1.25rem; }
.sub-head > div:first-child { flex: 1; min-width: 0; }
.sub-head .hint { margin: 0; max-width: 62ch; }

/* reference-video editor rows */
.mod-refvid { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.5rem; }
.mod-refvid-uplab { cursor: pointer; margin: 0; white-space: nowrap; }
#modRefVideos { margin-bottom: 0.5rem; }

/* ---- Module editor: professional multi-section form ---- */
.mod-editor.card { background: transparent; border: 0; box-shadow: none; padding: 0; }
.mod-editor { display: grid; gap: 1.15rem; }
.mod-editor-head { margin-bottom: 0.2rem; }
.mod-editor-eyebrow { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; color: var(--accent); }
.mod-editor-head h3 { margin: 0.25rem 0 0.3rem; font-size: 1.6rem; }
.mod-editor-sub { margin: 0; color: var(--muted); font-size: 0.9rem; }

.mod-section { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.mod-section-head {
  display: flex; align-items: flex-start; gap: 0.85rem;
  padding: 1rem 1.25rem; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.mod-section-num {
  flex: 0 0 auto; display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 11px;
  font-size: 1.15rem; background: var(--accent-tint); border: 1px solid var(--border-strong);
}
.mod-section-head h4 { margin: 0; font-size: 1.06rem; }
.mod-section-desc { margin: 0.18rem 0 0; font-size: 0.82rem; color: var(--muted); max-width: 74ch; }
.mod-section-body { padding: 1.25rem; display: grid; gap: 0.9rem; }
.mod-section-body > label { display: grid; gap: 0.3rem; }

.mod-uplabel {
  padding: 0.7rem 0.9rem; border: 1px dashed var(--border-strong); border-radius: 10px;
  background: var(--surface-2); font-size: 0.9rem; font-weight: 600;
}
.mod-sublabel { font-weight: 700; font-size: 0.92rem; margin-bottom: -0.2rem; }
.mod-test-settings.grid2 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-top: 0.4rem; }

.mod-form-foot {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: flex-end; gap: 0.7rem; align-items: center;
  padding: 0.9rem 1rem; margin-top: 0.2rem;
  background: linear-gradient(180deg, rgba(0,0,0,0), var(--surface) 55%);
  border-top: 1px solid var(--border); border-radius: 0 0 12px 12px;
}
.mod-form-foot .btn { min-width: 8rem; justify-content: center; }

/* green action button (approve) */
.btn.green { background: linear-gradient(180deg, var(--success), #0d7549); color: #fff; box-shadow: 0 6px 15px -6px rgba(18,144,90,0.5); }
.btn.green:hover { filter: brightness(1.06); }

/* Winn Family Association image slots (upload grid) */
.wfa-slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.wfa-slot { margin: 0; }
.wfa-slot > strong { display: block; margin-bottom: 0.15rem; }
.wfa-slot .hint { margin-bottom: 0.6rem; }
.wfa-slot-preview img { display: block; }

/* ---- Email Members: optional template blocks ------------------------------
   Each <details> is one slot of the branded email (button, detail panel, the
   rest). Collapsed by default so the common case — subject + message — stays
   a two-field form. */
.em-more {
  max-width: 560px; margin: 0.6rem 0 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: 0.7rem 0.9rem;
}
.em-more[open] { background: var(--surface); }
.em-more > summary { margin: 0; }
.em-more[open] > summary { margin-bottom: 0.6rem; }
.em-more label { margin-top: 0.6rem; }
.em-more > .hint { margin: 0.15rem 0 0; }
.em-more .btn.ghost { margin-top: 0.7rem; }
.em-check { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.9rem; }
.em-check input { width: auto; }
.em-detail-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.em-detail-row input { margin: 0; }
.em-detail-del {
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--muted);
  width: 2rem; height: 2rem; line-height: 1; cursor: pointer; font-size: 1rem;
}
.em-detail-del:hover { border-color: #c0392b; color: #c0392b; }
@media (max-width: 560px) {
  .em-detail-row { grid-template-columns: 1fr auto; }
  .em-detail-row input:first-child { grid-column: 1 / -1; }
}

/* ---- Workshop Check-In (QR scanner) ---------------------------------------
   Phone/tablet-first: big tap targets, high-contrast result states, minimal
   chrome. Two columns on wide screens (scanner | today's board), one column
   stacked on a phone. */
.wsci-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, 1fr); gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .wsci-layout { grid-template-columns: 1fr; } }

.wsci-camwrap {
  position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 60vh;
  background: #0a1526; border-radius: var(--radius); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.wsci-camwrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.wsci-camframe {
  position: absolute; inset: 12%; border: 3px solid rgba(255,255,255,0.55); border-radius: 18px;
  pointer-events: none; box-shadow: 0 0 0 999px rgba(0,0,0,0.28);
}
.wsci-cammsg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 1.5rem; color: #dbe6ff; background: rgba(10,21,38,0.92); font-weight: 600;
}
.wsci-camctrls { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-top: 0.8rem; }
.wsci-camctrls .btn { flex: 1 1 auto; min-width: 160px; font-size: 1rem; padding: 0.85rem 1.2rem; }
.wsci-camctrls select { flex: 1 1 220px; }

.wsci-result { margin-top: 1rem; border-radius: var(--radius); padding: 1.2rem 1.3rem; border: 2px solid var(--border-strong); }
.wsci-result.ok { background: var(--success-tint); border-color: var(--success); }
.wsci-result.warn { background: var(--warning-tint); border-color: var(--warning); }
.wsci-result.bad { background: var(--danger-tint); border-color: var(--danger); }
.wsci-result-head { display: flex; align-items: center; gap: 0.6rem; font-size: 1.15rem; font-weight: 900; margin-bottom: 0.5rem; }
.wsci-result.ok .wsci-result-head { color: var(--success); }
.wsci-result.warn .wsci-result-head { color: var(--warning); }
.wsci-result.bad .wsci-result-head { color: var(--danger-600); }
.wsci-result dl { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.8rem; margin: 0 0 0.7rem; font-size: 0.92rem; }
.wsci-result dt { color: var(--muted); font-weight: 650; }
.wsci-result dd { margin: 0; color: var(--ink); font-weight: 600; }
.wsci-result-acts { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.wsci-manual { margin-top: 1.3rem; }
.wsci-manual label { display: block; margin-bottom: 0.35rem; font-weight: 650; font-size: 0.9rem; }
.wsci-manual input { width: 100%; font-size: 1rem; padding: 0.75rem 0.9rem; }
#wsciSearchResults { margin-top: 0.5rem; display: grid; gap: 0.4rem; }
.wsci-searchrow {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
.wsci-searchrow .who { min-width: 0; }
.wsci-searchrow .who b { display: block; }

.wsci-recent { margin-top: 1.3rem; }
.wsci-recent h3, .wsci-today-head h3 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.6rem; }
.wsci-recent-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 0.5rem 0; border-top: 1px solid var(--border); font-size: 0.88rem;
}
.wsci-recent-row:first-child { border-top: 0; }

.wsci-today-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.6rem; }
.wsci-today-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.9rem 1rem; margin-bottom: 0.7rem; background: var(--surface-2); }
.wsci-today-card summary { cursor: pointer; list-style: none; }
.wsci-today-card summary::-webkit-details-marker { display: none; }
.wsci-today-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6rem; }
.wsci-today-counts { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.4rem; }
.wsci-today-attendees { margin-top: 0.7rem; border-top: 1px solid var(--border); padding-top: 0.6rem; display: grid; gap: 0.4rem; }
.wsci-att-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; font-size: 0.86rem; padding: 0.3rem 0; }
.wsci-att-row .who { min-width: 0; }

/* ── Stadium Screen · rotating-panel toggles ─────────────────────────────── */
#stadium .st-panel-bar { display:flex; align-items:center; justify-content:space-between;
  flex-wrap:wrap; gap:.6rem; margin-bottom:.85rem; }
#stadium .st-panel-count { color:var(--muted); font-size:.9rem; }
#stadium .st-panel-count b { color:var(--primary); font-size:1.15rem; }
#stadium .st-panel-actions { display:flex; gap:.5rem; }
#stadium .panel-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(205px,1fr));
  gap:.5rem; margin-bottom:1rem; }
#stadium .panel-toggle { display:flex; align-items:center; gap:.6rem; padding:.55rem .7rem;
  border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--surface);
  cursor:pointer; transition:border-color .15s, background .15s; user-select:none; }
#stadium .panel-toggle:hover { border-color:var(--border-strong); }
#stadium .panel-toggle input { position:absolute; opacity:0; width:0; height:0; pointer-events:none; }
#stadium .panel-toggle .pt-sw { position:relative; flex:none; width:36px; height:20px;
  border-radius:999px; background:#c9d6cd; transition:background .18s; }
#stadium .panel-toggle .pt-sw::after { content:''; position:absolute; top:2px; left:2px;
  width:16px; height:16px; border-radius:50%; background:#fff;
  box-shadow:0 1px 2px rgba(0,0,0,.25); transition:transform .18s; }
#stadium .panel-toggle .pt-name { font-weight:600; font-size:.92rem; color:var(--ink); line-height:1.2; }
#stadium .panel-toggle input:checked ~ .pt-sw { background:var(--primary); }
#stadium .panel-toggle input:checked ~ .pt-sw::after { transform:translateX(16px); }
#stadium .panel-toggle:has(input:checked) { border-color:var(--primary); background:var(--success-tint); }
#stadium .panel-toggle:has(input:not(:checked)) .pt-name { color:var(--muted); }

/* ============================================================
   WFA COMMAND CENTRE  (Winn Family Association governance area)
   Uses the existing green (--primary) + gold (--accent) palette.
   ============================================================ */
.wfa-hero {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1.25rem 1.4rem; margin-bottom: 1.4rem;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(240,169,43,0.22), transparent 55%),
    linear-gradient(135deg, var(--side-top), var(--side-bottom));
  color: #eaf5ee;
  border: 1px solid rgba(240,169,43,0.35);
  box-shadow: var(--shadow);
}
.wfa-hero-badge {
  font-size: 2rem; line-height: 1; width: 60px; height: 60px; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 16px;
  background: rgba(240,169,43,0.16); border: 1px solid rgba(240,169,43,0.4);
}
.wfa-hero-text { flex: 1 1 240px; }
.wfa-hero-text h1 { margin: 0; font-size: 1.5rem; letter-spacing: -0.01em; color: #fff; }
.wfa-hero-text p { margin: .15rem 0 0; color: var(--accent); font-weight: 600; font-size: .92rem; }
.wfa-hero-actions { flex: 0 0 auto; }

.wfa-overview {
  display: grid; gap: .7rem; margin-bottom: 1.2rem;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.wfa-ov {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .85rem .95rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); text-align: left;
  cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s;
}
.wfa-ov:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.wfa-ov:disabled, .wfa-ov.is-static { cursor: default; }
.wfa-ov:disabled:hover, .wfa-ov.is-static:hover { transform: none; box-shadow: var(--shadow-sm); border-color: var(--border); }
.wfa-ov .ov-ico { font-size: 1.35rem; line-height: 1; flex: 0 0 auto; }
.wfa-ov .ov-body { min-width: 0; }
.wfa-ov .ov-num { font-size: 1.5rem; font-weight: 800; line-height: 1; color: var(--ink-strong); }
.wfa-ov .ov-num.muted { color: var(--muted); font-size: 1rem; font-weight: 700; }
.wfa-ov .ov-label { font-size: .78rem; color: var(--ink-2); margin-top: .25rem; }
.wfa-ov.tone-urgent { border-color: rgba(224,65,58,0.4); background: var(--danger-tint); }
.wfa-ov.tone-urgent .ov-num { color: var(--danger-600); }
.wfa-ov.tone-action { border-color: rgba(192,125,16,0.4); background: var(--warning-tint); }

.wfa-quick { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.2rem; }

.wfa-sections {
  display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.wfa-sec {
  display: flex; flex-direction: column; gap: .35rem;
  padding: .95rem 1rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); text-align: left; cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.wfa-sec:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); }
.wfa-sec.is-planned { cursor: default; opacity: .96; }
.wfa-sec.is-planned:hover { transform: none; box-shadow: var(--shadow-sm); border-color: var(--border); }
.wfa-sec .sec-top { display: flex; align-items: center; gap: .55rem; }
.wfa-sec .sec-ico { font-size: 1.3rem; line-height: 1; }
.wfa-sec .sec-title { font-weight: 700; font-size: .96rem; color: var(--ink-strong); flex: 1; }
.wfa-sec .sec-desc { font-size: .8rem; color: var(--muted); line-height: 1.35; }

/* WFA sub-views (Command Centre home + per-subsystem views) */
.wfa-back { margin-bottom: .9rem; }
.wfa-subhead { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.1rem; }
.wfa-subhead .sh-ico {
  font-size: 1.6rem; width: 48px; height: 48px; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 12px;
  background: var(--bg-tint-a); border: 1px solid var(--border);
}
.wfa-subhead h2 { margin: 0; font-size: 1.35rem; }
.wfa-subhead p { margin: .1rem 0 0; color: var(--muted); font-size: .88rem; }
.wfa-tabbar { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.2rem; border-bottom: 1px solid var(--border); padding-bottom: .6rem; }
.wfa-tabbar button {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
  padding: .45rem .85rem; border-radius: 999px; font-weight: 600; font-size: .85rem; cursor: pointer;
}
.wfa-tabbar button:hover { border-color: var(--primary); color: var(--primary-700); }
.wfa-tabbar button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.gov-panel .head { margin-bottom: .8rem; }
.gov-status { font-size: .72rem; font-weight: 700; padding: .12rem .5rem; border-radius: 999px; }

/* WFA subsystem extras */
.wfa-confidential {
  padding: .6rem .8rem; margin-bottom: 1rem; border-radius: var(--radius-sm);
  background: var(--danger-tint); border: 1px solid rgba(224,65,58,0.3);
  color: var(--danger-600); font-size: .82rem; font-weight: 600;
}
.emg-banner {
  padding: 1rem 1.2rem; border-radius: var(--radius); margin-bottom: 1rem;
  border: 1px solid var(--border); background: var(--surface-2);
}
.emg-banner.is-active { background: var(--danger-tint); border-color: var(--danger); }
.emg-banner.is-active h3 { color: var(--danger-600); }
.emg-banner h3 { margin: 0 0 .2rem; }
.an-group { margin-bottom: 1.4rem; }
.an-group > h3 { font-size: .95rem; margin: 0 0 .5rem; color: var(--ink-2); }
.an-tiles { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.an-tile { padding: .8rem .9rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.an-tile b { display: block; font-size: 1.5rem; color: var(--ink-strong); line-height: 1; }
.an-tile span { font-size: .78rem; color: var(--muted); }

/* ============================================================
   WFA COMMAND CENTRE — governing-body redesign
   ============================================================ */
.gov-header {
  display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap;
  padding: 1.5rem 1.6rem;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(240,169,43,0.14), transparent 55%),
    linear-gradient(135deg, var(--side-top), var(--side-bottom));
  color: #eaf5ee; border: 1px solid rgba(240,169,43,0.28); border-bottom: 0;
}
.gov-shield {
  font-size: 1.8rem; width: 64px; height: 64px; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 16px;
  background: linear-gradient(160deg, var(--primary), var(--primary-700));
  border: 1px solid rgba(240,169,43,0.5); box-shadow: 0 8px 20px -8px rgba(0,0,0,.5);
}
.gov-id { flex: 1 1 300px; min-width: 0; }
.gov-ref {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--side-ink-dim); margin-bottom: .3rem;
}
.gov-id h1 { margin: 0; font-size: 1.7rem; letter-spacing: -0.01em; color: #fff; line-height: 1.1; }
.gov-sub { margin-top: .25rem; color: var(--accent); font-weight: 700; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; }
.gov-header-actions { display: flex; align-items: center; gap: .8rem; flex: 0 0 auto; flex-wrap: wrap; }
.gov-status {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: .4rem .7rem; border-radius: 999px; border: 1px solid;
}
.gov-status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.gov-status.is-nominal { color: #7fe0a8; border-color: rgba(127,224,168,.4); background: rgba(127,224,168,.08); }
.gov-status.is-emergency { color: #ff8a84; border-color: rgba(224,65,58,.6); background: rgba(224,65,58,.16); animation: eb-pulse-soft 1.4s ease-in-out infinite; }
@keyframes eb-pulse-soft { 0%,100% { opacity: 1; } 50% { opacity: .7; } }

.gov-nav {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  padding: 0 1.6rem; background: var(--side-bottom);
  border: 1px solid rgba(240,169,43,0.28); border-top: 0; border-bottom: 3px solid var(--accent);
  border-radius: 0 0 2px 2px;
}
.gov-nav-tabs { display: flex; gap: .2rem; flex-wrap: wrap; }
.gov-nav-tabs button {
  background: none; border: 0; color: var(--side-ink-dim); cursor: pointer;
  padding: .85rem .9rem; font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
  border-bottom: 3px solid transparent; margin-bottom: -3px;
}
.gov-nav-tabs button:hover { color: #fff; }
.gov-nav-tabs button.active { color: #fff; border-bottom-color: var(--accent); }
.gov-signed { color: var(--side-ink-dim); font-size: .74rem; }
.gov-signed strong { color: var(--side-ink); }

.wfa-panel { padding-top: 1.4rem; }
.gov-section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  margin: 0 0 .9rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border);
  font-weight: 800; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2);
}
.gov-section-head + .gov-section-head { margin-top: 1.6rem; }
.gov-muted { font-weight: 600; letter-spacing: .04em; color: var(--muted); font-family: var(--mono); font-size: .72rem; }

/* Overview cards — ref code + status accent border */
.wfa-overview { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.wfa-ov { position: relative; flex-direction: column; align-items: stretch; gap: .5rem; border-left: 3px solid var(--border-strong); padding: .95rem 1rem; }
.wfa-ov .ov-top { display: flex; align-items: center; justify-content: space-between; }
.wfa-ov .ov-ico { font-size: 1.15rem; }
.wfa-ov .ov-ref { font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; color: var(--muted); }
.wfa-ov.tone-live { border-left-color: var(--primary); }
.wfa-ov.tone-action { border-left-color: var(--accent-600); background: var(--surface); }
.wfa-ov.tone-urgent { border-left-color: var(--danger); background: var(--surface); }
.wfa-ov.is-zero { background: var(--surface-2); }
.wfa-ov.is-zero .ov-num { color: var(--muted); }
.wfa-ov .ov-num { font-size: 1.9rem; }

/* Section cards — WFA code + Open link */
.wfa-sec { gap: .45rem; }
.wfa-sec .sec-foot { display: flex; align-items: center; justify-content: space-between; margin-top: .45rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.wfa-sec .sec-code { font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; color: var(--muted); }
.wfa-sec .sec-open { font-size: .78rem; font-weight: 700; color: var(--primary-700); }
.wfa-sec.is-planned .sec-open { color: var(--muted); }

/* ============================================================
   WFA AREA — premium polish applied to EVERY sub-view
   (scoped to #wfa; loads last so it wins over globals)
   ============================================================ */

/* --- Sub-view header band (back pill + governing-body banner) --- */
#wfa .wfa-back {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink-2);
  padding: .42rem .85rem; border-radius: 999px; font-weight: 600; font-size: .8rem;
  box-shadow: var(--shadow-sm); margin-bottom: 1rem; transition: all .12s;
}
#wfa .wfa-back:hover { border-color: var(--primary); color: var(--primary-700); transform: translateX(-2px); box-shadow: var(--shadow); }

#wfa .wfa-subhead {
  position: relative; display: flex; align-items: center; gap: 1.1rem;
  padding: 1.35rem 1.5rem; margin-bottom: 1.6rem; border-radius: var(--radius-lg);
  background:
    radial-gradient(140% 180% at 100% 0%, var(--bg-tint-b), transparent 60%),
    linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border); border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
/* Winn Family Association crest — brand mark on every sub-view header. */
#wfa .wfa-subhead { padding-right: 6.8rem; }
#wfa .wfa-subhead::after {
  content: ""; position: absolute; right: 1.3rem; top: 50%; transform: translateY(-50%);
  width: 76px; height: 76px; border-radius: 50%;
  background: url('wfa-crest.png') center / cover no-repeat;
  border: 2px solid var(--border); box-shadow: var(--shadow-sm);
  pointer-events: none;
}
@media (max-width: 640px) {
  #wfa .wfa-subhead { padding-right: 1.5rem; }
  #wfa .wfa-subhead::after { display: none; }
}
#wfa .wfa-subhead .sh-ico {
  font-size: 1.7rem; width: 58px; height: 58px; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 15px;
  background: linear-gradient(160deg, var(--primary), var(--primary-700)); color: #fff;
  border: 1px solid rgba(240,169,43,.35); box-shadow: 0 10px 22px -10px rgba(10,99,68,.7);
}
#wfa .wfa-subhead h2 { margin: 0; font-size: 1.5rem; letter-spacing: -0.01em; color: var(--ink-strong); }
#wfa .wfa-subhead p { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; max-width: 70ch; }

/* --- Section heads inside sub-views (the .head rows) --- */
#wfa .off-panel > .head, #wfa .gov-panel > .head, #wfa .trn-panel > .head,
#wfaDocuments > .head, #wfaSafeguarding > .head, #wfaTasks > .head,
#wfaPermissions > .head {
  align-items: center; margin-bottom: 1rem;
}
#wfa .head h3 { font-size: 1.05rem; letter-spacing: -0.01em; }

/* --- Premium tables everywhere in the WFA area --- */
#wfa table {
  border-collapse: separate; border-spacing: 0; width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
  margin: 0;
}
#wfa thead th {
  background: var(--surface-2); text-align: left;
  text-transform: uppercase; letter-spacing: .06em; font-size: .68rem; font-weight: 800;
  color: var(--muted); padding: .7rem .9rem; border-bottom: 1px solid var(--border); white-space: nowrap;
}
#wfa tbody td { padding: .8rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: .9rem; }
#wfa tbody tr:last-child td { border-bottom: 0; }
#wfa tbody tr { transition: background .12s; }
#wfa tbody tr:hover td { background: var(--surface-2); }
#wfa td .hint { font-size: .78rem; }
#wfa td.nowrap, #wfa th.nowrap { white-space: nowrap; }

/* --- Tab bars: segmented-control feel --- */
#wfa .wfa-tabbar {
  gap: .3rem; padding: .3rem; border-bottom: 0; margin-bottom: 1.4rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  display: inline-flex; flex-wrap: wrap; width: fit-content; max-width: 100%;
}
#wfa .wfa-tabbar button { border: 0; background: none; box-shadow: none; padding: .5rem 1rem; }
#wfa .wfa-tabbar button:hover { background: var(--surface-3); }
#wfa .wfa-tabbar button.active { background: var(--primary); color: #fff; box-shadow: 0 6px 14px -8px rgba(20,153,106,.7); }

/* --- Forms inside sub-views --- */
#wfa .form .card, #wfa .wfa-view > #docForm > .card { border-radius: var(--radius); }
#wfa .head-btns .btn { min-width: 0; }

/* --- Empty-state hints: give the "No X yet" lines room to breathe --- */
#wfa [id$="List"] > .hint:only-child,
#wfa #taskBoard > .hint:only-child,
#wfa #sgList > .hint:only-child {
  display: block; text-align: center; padding: 2.4rem 1rem;
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: var(--radius); color: var(--muted); margin: 0;
}

/* --- Stat tiles (tasks overview / analytics) unified --- */
#wfa .an-tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
#wfa .an-group > h3 { display: flex; align-items: center; gap: .4rem; letter-spacing: .04em; text-transform: uppercase; font-size: .78rem; color: var(--ink-2); border-bottom: 1px solid var(--border); padding-bottom: .4rem; }
#wfa .an-tile { transition: transform .12s, box-shadow .12s; }
#wfa .an-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
#wfa .an-tile b { color: var(--primary-700); }

/* --- Emergency + confidential banners: a touch more premium --- */
#wfa .wfa-confidential { display: flex; align-items: center; gap: .5rem; border-left: 4px solid var(--danger); }
#wfa .emg-banner { border-radius: var(--radius-lg); }

/* --- Links in tables --- */
#wfa td a { color: var(--primary-700); font-weight: 600; text-decoration: none; }
#wfa td a:hover { text-decoration: underline; }

/* Crest emblem in the command-centre header (overrides the gradient tile). */
img.gov-shield-img {
  background: #f4f8f5; padding: 0; object-fit: cover; border-radius: 50%;
  border: 2px solid rgba(240,169,43,.55); box-shadow: 0 8px 20px -8px rgba(0,0,0,.5);
}

/* ============================================================
   WFA SECTIONS GRID — bold, colourful, animated
   ============================================================ */
#wfaSections { grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: .9rem; }

.wfa-sec {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 1.15rem 1.2rem 1rem; border-radius: 16px; gap: .5rem;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform .18s cubic-bezier(.2,.7,.3,1), box-shadow .18s, border-color .18s;
  animation: sec-in .38s both cubic-bezier(.2,.7,.3,1);
}
@keyframes sec-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wfa-sec { animation: none; } }

/* top accent bar + faint radial glow in the section colour */
.wfa-sec::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--sec-accent), color-mix(in srgb, var(--sec-accent) 40%, transparent));
  z-index: 2;
}
.wfa-sec::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--sec-accent) 20%, transparent), transparent 70%);
  opacity: 0; transition: opacity .2s; z-index: 0; pointer-events: none;
}
.wfa-sec:hover {
  transform: translateY(-5px);
  box-shadow: 0 22px 40px -18px color-mix(in srgb, var(--sec-accent) 55%, transparent), var(--shadow);
  border-color: color-mix(in srgb, var(--sec-accent) 55%, var(--border));
}
.wfa-sec:hover::after { opacity: 1; }
.wfa-sec:active { transform: translateY(-2px); }
.wfa-sec > * { position: relative; z-index: 1; }

/* icon in a coloured gradient tile */
.wfa-sec .sec-ico {
  font-size: 1.3rem; width: 46px; height: 46px; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 13px;
  background: linear-gradient(155deg, color-mix(in srgb, var(--sec-accent) 20%, var(--surface)), color-mix(in srgb, var(--sec-accent) 8%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--sec-accent) 32%, transparent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform .18s;
}
.wfa-sec:hover .sec-ico { transform: scale(1.06) rotate(-3deg); }
.wfa-sec .sec-title { font-size: .98rem; font-weight: 800; }
.wfa-sec .sec-desc { color: var(--muted); font-size: .82rem; line-height: 1.4; flex: 1; }
.wfa-sec .sec-foot { border-top: 1px solid var(--border); }
.wfa-sec .sec-open { color: color-mix(in srgb, var(--sec-accent) 78%, var(--ink)); display: inline-flex; gap: .25rem; }
.wfa-sec .sec-arrow { transition: transform .18s; }
.wfa-sec:hover .sec-arrow { transform: translateX(4px); }
.wfa-sec .pill { align-self: flex-start; }

/* Section colour tokens */
.wfa-sec[data-tone="green"]  { --sec-accent: #14996a; }
.wfa-sec[data-tone="gold"]   { --sec-accent: #d89211; }
.wfa-sec[data-tone="red"]    { --sec-accent: #e0413a; }
.wfa-sec[data-tone="blue"]   { --sec-accent: #2f6fd0; }
.wfa-sec[data-tone="violet"] { --sec-accent: #7b5cd6; }
.wfa-sec[data-tone="amber"]  { --sec-accent: #d98a1a; }
.wfa-sec[data-tone="teal"]   { --sec-accent: #0f9d8f; }

/* ============================================================================
 * Official Correspondence composer (WFA sub-view #wfaCorrespondence)
 * ========================================================================== */
.ac-editor { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 1.1rem; align-items: start; }
.ac-form { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.ac-form .card { margin: 0; }
.ac-side { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.ac-block-head { margin-bottom: 0.2rem; }
.ac-block-head .ck { font-weight: 700; color: var(--ink-strong); font-size: 1.02rem; }
.ac-block-body { margin-top: 0.7rem; padding-top: 0.7rem; border-top: 1px dashed var(--border-strong); }
.ac-block-body[hidden] { display: none; }

#wfaCorrespondence .ck { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; }
#wfaCorrespondence .ck .hint { font-weight: 400; }

/* Particulars label/value rows */
.ac-kv { display: grid; grid-template-columns: minmax(0, 0.55fr) minmax(0, 1fr) auto; gap: 0.5rem; margin-bottom: 0.45rem; align-items: center; }
/* Order-of-business items */
.ac-item { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: 0.5rem; margin-bottom: 0.45rem; align-items: center; }
.ac-item-n { font-weight: 700; color: var(--muted); text-align: right; }
.ac-kv input, .ac-item input { margin: 0; }

/* Audiences */
.ac-teams { margin-top: 0.55rem; padding-top: 0.55rem; border-top: 1px dashed var(--border); }
.ac-team-list { margin: 0.4rem 0 0 1.4rem; display: flex; flex-direction: column; gap: 0.3rem; }
.ac-team-list[hidden] { display: none; }
#acAudiences .ck { display: flex; margin-bottom: 0.35rem; }

/* Actions + preview */
.ac-actions-card { display: flex; flex-direction: column; gap: 0.6rem; }
.ac-recipients-line { font-size: 0.95rem; color: var(--muted); }
.ac-recipients-line strong { color: var(--ink-strong); }
.ac-test-row { display: flex; gap: 0.4rem; }
.ac-preview-card { padding: 0; overflow: hidden; }
.ac-preview-head { padding: 0.6rem 0.9rem; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--bg); }
.ac-preview-frame { width: 100%; height: 78vh; border: 0; display: block; background: #e6e1d1; }

@media (max-width: 1000px) {
  .ac-editor { grid-template-columns: 1fr; }
  .ac-side { position: static; }
  .ac-preview-frame { height: 60vh; }
}

/* ============================================================
   FIXTURE COMMUNICATIONS CENTRE (admin/matches → 📧 Fixture Email)
   All new classes here are namespaced fx-comms-* / fx-* to stay clear of the
   rest of the dashboard. Reuses .modal-overlay/.modal-card, .subtabs/.subtab/
   .subpane, .form/.grid2/.grid3/.form-section/.chk, .pill and .btn as-is.
   ============================================================ */
.fx-comms-card { max-width: min(960px, 96vw); width: 100%; max-height: 92vh; display: flex; flex-direction: column; }
.fx-comms-body { overflow-y: auto; flex: 1 1 auto; }
.fx-comms-head { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: space-between; align-items: flex-start; margin-bottom: 0.6rem; }
.fx-comms-title { font-size: 1.05rem; font-weight: 800; }
.fx-comms-headstats { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: flex-start; }
.fx-comms-banner {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: space-between;
  background: var(--warning-tint); border: 1px solid rgba(192,125,16,0.3); color: #8a5a0b;
  border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; margin-bottom: 1rem; font-size: 0.85rem;
}
.fx-comms-tabpane, .fx-comms-body .subpane { margin-top: 0.3rem; }

/* repeatable Content-block / Notice rows (own layout — deliberately not
   .sc-row, which sizes inputs for the scorecard's narrow numeric fields) */
.fx-comms-row { display: flex; gap: 0.5rem; align-items: flex-start; margin-bottom: 0.5rem; }
.fx-comms-row-fields { flex: 1 1 auto; display: grid; gap: 0.4rem; }
.fx-comms-row-fields textarea { min-height: 60px; }
.fx-comms-row-del { flex: 0 0 auto; margin-top: 2px; }

.fx-comms-recip-list {
  display: grid; gap: 0.35rem; max-height: 220px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem;
  background: var(--surface-2); margin: 0.5rem 0;
}
.fx-comms-recip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.85rem; cursor: pointer; }
.fx-comms-recip-row input[type="checkbox"] { width: auto; flex: 0 0 auto; }
.fx-comms-recip-row > span:first-of-type { font-weight: 650; }

.fx-comms-checklist { list-style: none; display: grid; gap: 0.4rem; margin: 0 0 1rem; padding: 0; }
.fx-comms-check { font-size: 0.9rem; }
.fx-comms-check.is-done { color: var(--success); }
.fx-comms-warnbox { display: grid; gap: 0.4rem; }
.fx-comms-warn {
  background: var(--warning-tint); color: #8a5a0b; border: 1px solid rgba(192,125,16,0.28);
  border-radius: var(--radius-sm); padding: 0.5rem 0.7rem; font-size: 0.85rem;
}

.fx-comms-preview-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: space-between; align-items: center; margin-bottom: 0.7rem; }
.fx-comms-toggle { display: flex; gap: 0.35rem; }
.fx-comms-toggle .btn.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.fx-comms-preview-frame {
  display: flex; justify-content: center; padding: 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); overflow-x: auto;
}
.fx-comms-preview-frame iframe { border: 0; background: #fff; box-shadow: var(--shadow-sm); border-radius: 4px; }
.fx-comms-preview-desktop iframe { width: 640px; height: 520px; }
.fx-comms-preview-mobile iframe { width: 380px; height: 560px; }

.fx-comms-stats { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.8rem; }
.fx-comms-stat { flex: 1 1 100px; text-align: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.6rem 0.5rem; }
.fx-comms-stat b { display: block; font-size: 1.15rem; }
.fx-comms-stat span { display: block; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.fx-comms-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.7rem; }
.fx-comms-toolbar select { width: auto; }

.fx-comms-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.fx-comms-table th, .fx-comms-table td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); font-size: 0.85rem; vertical-align: top; }

.fx-comms-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.fx-comms-timeline li { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.88rem; }
.fx-comms-timeline-ico { flex: 0 0 auto; font-size: 1.05rem; }

.fx-comms-foot { flex-wrap: wrap; justify-content: space-between; }
.fx-comms-actionbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; width: 100%; }

@media (max-width: 640px) {
  .fx-comms-card { max-height: 96vh; }
  .fx-comms-stat { flex: 1 1 45%; }
  .fx-comms-toolbar, .fx-comms-preview-bar { flex-direction: column; align-items: stretch; }
  .fx-comms-toolbar select { width: 100%; }
}
