/* ===== CSS RESET & VARIABLES ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #16a34a;
  --primary-dark: #15803d;
  --primary-light: #dcfce7;
  --accent: #f59e0b;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --info: #3b82f6;
  --info-light: #eff6ff;
  --neutral: #6b7280;
  --neutral-light: #f3f4f6;
  --neutral-dark: #374151;
  --white: #ffffff;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --header-h: 60px;
}

body {
  font-family: var(--font);
  background: #f0fdf4;
  color: var(--neutral-dark);
  min-height: 100vh;
}

/* ===== HEADER ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary);
  color: white;
  height: var(--header-h);
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo { display: flex; align-items: center; gap: .5rem; white-space: nowrap; }
.logo-icon { font-size: 1.4rem; }
.logo-text { font-size: 1.1rem; font-weight: 700; letter-spacing: -.3px; }

.main-nav { display: flex; gap: .25rem; flex: 1; }

.nav-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.8);
  padding: .4rem .9rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 500;
  transition: all .15s;
}
.nav-btn:hover { background: rgba(255,255,255,.15); color: white; }
.nav-btn.active { background: rgba(255,255,255,.2); color: white; }

.header-actions { display: flex; align-items: center; gap: .75rem; margin-left: auto; }

.user-badge {
  background: rgba(255,255,255,.2);
  color: white;
  padding: .25rem .75rem;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--neutral-light); color: var(--neutral-dark); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: #e5e7eb; }
.btn-link { background: none; border: none; padding: 0; color: var(--primary); font-size: .85rem; cursor: pointer; text-decoration: underline; }
.btn-link:hover { color: var(--primary-dark); }
.btn-link:disabled { opacity: .6; cursor: default; }
.btn-outline { background: transparent; color: white; border: 1.5px solid rgba(255,255,255,.6); }
.btn-outline:hover { background: rgba(255,255,255,.15); border-color: white; }
.btn-outline-primary { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline-primary:hover:not(:disabled) { background: var(--primary); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-info { background: #0ea5e9; color: white; }
.btn-info:hover:not(:disabled) { background: #0284c7; }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-xs { padding: .2rem .5rem; font-size: .75rem; }

/* ===== MAIN ===== */
.app-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* ===== VIEWS ===== */
.view { animation: fadeIn .2s ease; }
.view.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.view-header h2 { font-size: 1.4rem; font-weight: 700; color: var(--neutral-dark); }
.view-controls { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* ===== SEARCH INPUTS ===== */
.search-input {
  padding: .38rem .8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  width: 220px;
  background: white;
  transition: border-color .15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}

/* ===== CARDS GRID ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.card-title { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1rem 1.25rem; }
.card-footer {
  padding: .75rem 1.25rem;
  background: var(--neutral-light);
  border-top: 1px solid var(--border);
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
}

/* ===== TAGS / BADGES ===== */
.badge {
  display: inline-block;
  padding: .15rem .6rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-green { background: var(--primary-light); color: var(--primary-dark); }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-red { background: var(--danger-light); color: #991b1b; }
.badge-blue { background: var(--info-light); color: #1e40af; }
.badge-gray { background: var(--neutral-light); color: var(--neutral); }

/* ===== FORM ELEMENTS ===== */
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .85rem; font-weight: 600; color: var(--neutral-dark); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: .5rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: var(--font);
  color: var(--neutral-dark);
  background: white;
  transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-hint { font-size: .8rem; color: var(--neutral); margin-top: .25rem; }
.form-stack { display: flex; flex-direction: column; gap: .85rem; }

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .5rem;
  padding: .5rem;
  background: var(--neutral-light);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  padding: .3rem .5rem;
  border-radius: 4px;
  transition: background .1s;
}
.checkbox-grid label:hover { background: white; }
.checkbox-grid input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); }

/* ===== ADMIN ===== */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}
.admin-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.admin-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.settings-form { display: flex; flex-direction: column; gap: .75rem; }

/* ===== FEATURE TOGGLE SWITCH ===== */
.feature-toggle-row { display: flex; align-items: center; gap: .85rem; padding: .5rem 0; }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0; background: #d1d5db; border-radius: 24px; cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary, #2563eb); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

.admin-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.admin-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .75rem;
  background: var(--neutral-light);
  border-radius: var(--radius);
  font-size: .875rem;
}
.admin-list-item .item-actions { display: flex; gap: .25rem; }
.admin-list-item .color-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--neutral-dark);
  color: white;
  padding: .65rem 1.5rem;
  border-radius: 30px;
  font-size: .9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: opacity .3s;
  white-space: nowrap;
}
.toast.success { background: var(--primary); }
.toast.error { background: var(--danger); }

/* ===== UTILITY ===== */
.hidden { display: none !important; }
.text-muted { color: var(--neutral); font-size: .85rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.gap-1 { gap: .5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--neutral);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: .75rem; }
.empty-state p { font-size: .95rem; }

/* ===== VENUE FILTER ===== */
.venue-filter { display: flex; align-items: center; gap: .5rem; font-size: .85rem; font-weight: 600; }
.venue-filter select { padding: .3rem .6rem; border-radius: var(--radius); border: 1.5px solid var(--border); font-size: .85rem; }

.cal-nav { display: flex; align-items: center; gap: .4rem; }
#weekLabel { font-weight: 600; font-size: .9rem; min-width: 200px; text-align: center; }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  /* ── Page level ─────────────────── */
  body { overflow-x: hidden; }
  :root { --header-h: 92px; }

  /* ── Header: two-row layout ──────
     Row 1: logo (left)  +  header-actions (right)
     Row 2: nav buttons full width                 */
  .app-header     { height: auto; min-height: var(--header-h); }
  .header-inner   { flex-wrap: wrap; padding: .3rem .75rem; gap: .25rem; align-content: center; }
  .logo           { order: 1; flex-shrink: 0; }
  .logo-text      { display: none; }
  .header-actions { order: 2; margin-left: auto; flex-shrink: 0; gap: .4rem; }
  .header-actions .btn { padding: .25rem .55rem; font-size: .8rem; }
  .user-badge     { display: none; }
  .main-nav       { order: 3; width: 100%; flex: none; gap: 0;
                    justify-content: space-evenly;
                    border-top: 1px solid rgba(255,255,255,.15); padding-top: .2rem; }
  .nav-btn        { flex: 1; padding: .3rem .3rem; font-size: .78rem;
                    text-align: center; border-radius: 4px; }

  /* ── Notification panel ─────────── */
  .notif-panel    { top: calc(var(--header-h) + 4px); width: calc(100vw - 1rem); right: .5rem; }

  /* ── Content area ───────────────── */
  .app-main       { padding: .75rem .6rem; }

  /* ── View header ────────────────── */
  .view-header    { gap: .5rem; margin-bottom: .75rem; }
  .view-header h2 { font-size: 1.1rem; }
  .view-controls  { gap: .4rem; }
  .venue-filter label { display: none; }
  #weekLabel      { min-width: 0; font-size: .85rem; }

  /* ── Inputs ─────────────────────── */
  .search-input   { width: 100%; max-width: 200px; }
  .form-row       { grid-template-columns: 1fr; }

  /* ── Grids ──────────────────────── */
  .cards-grid     { grid-template-columns: 1fr; gap: .75rem; }
  .admin-grid     { grid-template-columns: 1fr; }

  /* ── Admin list items ───────────── */
  .admin-list-item { flex-wrap: wrap; }
  .item-actions    { width: 100%; justify-content: flex-end; margin-top: .35rem; }
}

/* ===== FIREBASE LOADING OVERLAY ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(240, 253, 244, 0.92);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.loading-overlay.hidden { display: none; }

.loading-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 3rem;
  text-align: center;
  min-width: 260px;
}
.loading-box.error-box { border-top: 4px solid var(--danger); }

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.loading-message { font-weight: 600; color: var(--neutral-dark); font-size: .95rem; }

/* ===== FORM ERROR (login modal) ===== */
.form-error {
  color: var(--danger);
  font-size: .82rem;
  min-height: 1rem;
  margin-top: -.25rem;
}

/* ===== MULTI-USER ROLE SYSTEM ===== */

/* Pending booking request — dashed orange slot chip */
.slot-chip.pending-request {
  background: #fff7ed;
  border: 1.5px dashed #f97316;
  color: #9a3412;
  cursor: pointer;
}
.slot-chip.pending-request:hover { background: #ffedd5; }

/* Available slot button for logged-in users (request mode) */
.slot-chip.user-can-request {
  background: var(--primary-light);
  color: var(--primary-dark);
  cursor: pointer;
  border: 1.5px solid var(--primary);
}
.slot-chip.user-can-request:hover { background: #bbf7d0; }

/* Warning button (for cancel/reject actions) */
.btn-warning {
  background: #f97316;
  color: white;
}
.btn-warning:hover:not(:disabled) { background: #ea6c0a; }

/* Pending notice inside booking modal */
.pending-notice {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem .9rem;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  font-size: .85rem;
  color: #9a3412;
  font-weight: 600;
  margin-bottom: .5rem;
}

/* Role badges in user management */
.role-badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.role-badge.master { background: #dcfce7; color: #15803d; }
.role-badge.admin  { background: #fef9c3; color: #854d0e; }
.role-badge.user   { background: #eff6ff; color: #1d4ed8; }

/* Badge colour variants */
.badge-amber { background: #fef9c3; color: #854d0e; }
.badge-red   { background: #fee2e2; color: #b91c1c; }

/* School league badges in admin Schools list */
.school-teams { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.school-league-badge { font-size: .73rem !important; }

/* ===== MY SCHOOL VIEW ===== */
.myschool-header {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 0 1rem;
}
.myschool-school-name { font-size: 1.15rem; font-weight: 700; }

.ms-pending-entries-section { margin-bottom: 1.25rem; }
.ms-section-title { font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin: 0 0 .6rem; }
.ms-pending-entry-card { border-left: 3px solid #f59e0b; }
.ms-pending-team-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .25rem 0; }

.myschool-league { margin-bottom: 1.5rem; }

.myschool-standings { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .85rem; }
.myschool-standing-row {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .4rem .6rem; background: var(--neutral-light); border-radius: var(--radius);
  font-size: .875rem;
}
.myschool-pts { font-weight: 700; color: var(--primary); margin-left: auto; }

.myschool-section-label {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--neutral);
  margin: .85rem 0 .4rem; padding-bottom: .2rem;
  border-bottom: 1px solid var(--border);
}

.myschool-fixture {
  display: flex; flex-direction: column; gap: .2rem;
  padding: .55rem .65rem; border-radius: 6px; margin-bottom: .4rem;
  border-left: 4px solid var(--border); background: var(--neutral-light);
}
.myschool-fixture.home-fixture { border-left-color: var(--primary); }
.myschool-fixture.away-fixture { border-left-color: var(--neutral); }

.fixture-meta { display: flex; gap: .75rem; font-size: .78rem; flex-wrap: wrap; }
.fixture-date { font-weight: 600; color: var(--neutral-dark); }

.fixture-score-row {
  display: flex; align-items: center; gap: .5rem;
  font-size: .875rem; flex-wrap: wrap; margin-top: .2rem;
}
.fixture-team { flex: 1; min-width: 0; }
.fixture-team.my-team { font-weight: 700; }
.fixture-score { white-space: nowrap; display: flex; align-items: center; gap: .1rem; }

/* Admin card spanning full grid width */
.admin-card-full  { grid-column: 1 / -1; }
.admin-card-wide  { grid-column: 1 / -1; }

/* Audit log table */
.audit-table-wrap {
  overflow-x: auto;
  margin-top: .5rem;
}
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.audit-table th {
  text-align: left;
  padding: .4rem .75rem;
  background: var(--neutral-light);
  border-bottom: 2px solid var(--border);
  font-weight: 700;
  color: var(--neutral);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.audit-table td {
  padding: .45rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.audit-table tr:last-child td { border-bottom: none; }
.audit-table tr:hover td { background: var(--neutral-light); }
.audit-when { color: var(--neutral); white-space: nowrap; font-size: .78rem; }
.audit-who  { font-weight: 600; white-space: nowrap; }
.audit-cat  { font-size: 1.1rem; text-align: center; }

/* Pending requests list */
.pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .6rem .75rem;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  margin-bottom: .5rem;
  font-size: .875rem;
}
.pending-item .pending-actions { display: flex; gap: .35rem; }
.pending-item .pending-info { display: flex; flex-direction: column; gap: .15rem; }
.pending-item .pending-meta { font-size: .78rem; color: var(--neutral); }

/* User list items */
.user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .55rem .75rem;
  background: var(--neutral-light);
  border-radius: var(--radius);
  margin-bottom: .4rem;
  font-size: .875rem;
}
.user-item .user-info { display: flex; flex-direction: column; gap: .1rem; }
.user-item .user-actions { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.user-item .user-email { font-size: .78rem; color: var(--neutral); }

/* ===== ADMIN SUB-TABS ===== */
.admin-subtabs {
  display: flex;
  gap: .4rem;
  padding: .75rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.admin-subtab {
  padding: .45rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--neutral-light);
  color: var(--neutral-dark);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all .15s;
  flex-shrink: 0;
}
.admin-subtab:hover:not(.active) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.admin-subtab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.admin-tab-panel { padding: 1.25rem 1.5rem; }
.admin-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .6rem;
}
.admin-panel-header h3 { margin: 0; font-size: 1.05rem; }
/* Right-side group: search + action button */
.panel-header-right {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
}

/* Admin module list (leagues/tournaments in admin) */
.admin-module-list { display: flex; flex-direction: column; gap: .75rem; }
.admin-module-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.admin-module-item .module-info { flex: 1; min-width: 0; }
.admin-module-item .module-title { font-weight: 700; font-size: .95rem; margin-bottom: .15rem; }
.admin-module-item .module-meta  { font-size: .8rem; color: var(--neutral); }
.admin-module-item .module-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: flex-start; }

/* Fixture edit info box */
.fixture-edit-info {
  background: var(--neutral-light);
  border-radius: var(--radius);
  padding: .65rem .9rem;
  margin-bottom: 1rem;
  font-size: .88rem;
}
.fixture-edit-info strong { display: block; font-size: .95rem; }

/* Admin-specific card modifications */
.admin-card-wide { grid-column: 1 / -1; }
.admin-card-full { grid-column: 1 / -1; }

/* Two-team stepper inside league modal school selector */
.checkbox-grid.checkbox-grid--teams {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.school-select-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: .3rem !important;
}
.school-has-entry {
  background: #f0fdf4 !important;
  border-radius: 6px;
  outline: 1.5px solid #bbf7d0;
}
.entry-tag {
  display: inline-flex; align-items: center; gap: .2rem;
  font-size: .7rem; font-weight: 600;
  padding: .1rem .4rem; border-radius: 999px;
  white-space: nowrap; flex-shrink: 0;
}
.entry-tag--approved { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.entry-tag--pending  { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.school-check-area {
  display: flex; align-items: center; gap: .4rem;
  flex: 1; min-width: 0; overflow: hidden;
}
.team-stepper {
  display: flex; align-items: center; gap: .2rem; flex-shrink: 0;
}
.stepper-btn {
  width: 20px; height: 20px; border: 1px solid var(--border);
  background: white; border-radius: 3px; cursor: pointer;
  font-size: .9rem; line-height: 1; padding: 0;
  color: var(--neutral-dark); font-weight: 700;
}
.stepper-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.team-count-val {
  min-width: 14px; text-align: center; font-weight: 700;
  font-size: .82rem; color: var(--primary);
}
.stepper-label { font-size: .72rem; color: var(--neutral); }

/* Round label in fixture tables */
.round-label {
  font-weight: 700;
  font-size: .8rem;
  color: var(--neutral);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: .4rem;
  padding: .25rem 0;
  border-bottom: 2px solid var(--border);
}

/* ===== IMPERSONATION BANNER ===== */
.impersonate-banner {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  padding: .55rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: .9rem;
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 90;
}
.btn-exit-impersonate {
  background: rgba(255,255,255,.25);
  color: white;
  border: 1.5px solid rgba(255,255,255,.6);
  padding: .25rem .8rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  transition: background .15s;
}
.btn-exit-impersonate:hover { background: rgba(255,255,255,.4); }

/* Organiser booking hint */
.organiser-hint {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #15803d;
  padding: .45rem .75rem;
  border-radius: var(--radius);
  font-size: .85rem;
  margin-bottom: .25rem;
}

/* League fixture chips are view-only — cursor shows it's not clickable
   but pointer-events must stay enabled so the title tooltip shows on hover */
.slot-chip.league {
  cursor: default;
}

/* ===== SCORE VERIFICATION ===== */
.score-verified {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  font-weight: 600;
  color: #15803d;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 999px;
  padding: .15rem .55rem;
  margin-top: .3rem;
}
.score-unverified {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .3rem;
}
.score-unverified-badge {
  display: inline-flex;
  align-items: center;
  font-size: .78rem;
  font-weight: 600;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  padding: .15rem .55rem;
}

/* ===== FIXTURE CLASH BADGE ===== */
.fixture-clash-badge {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem;
  font-size: .8rem;
  font-weight: 600;
  color: #9a3412;
  background: #fff7ed;
  border: 1.5px dashed #f97316;
  border-radius: var(--radius);
  padding: .35rem .65rem;
  margin-top: .3rem;
}
.fixture-clash-badge .btn { margin-left: auto; }

/* Clashed row highlight in fixtures table */
.fixture-row-clash { background: #fff7ed; }
.fixture-row-clash td { border-bottom-color: #fed7aa; }

/* Fixture highlighted from notification navigation */
@keyframes fixture-pulse {
  0%   { background: #dbeafe; }
  50%  { background: #93c5fd; }
  100% { background: #dbeafe; }
}
.fixture-highlight { animation: fixture-pulse 0.8s ease-in-out 3; }

/* Sub-row under a fixture row (clash/change-request content) */
.fixture-sub-row td {
  padding: .25rem .75rem .5rem;
  background: #fafafa;
}

/* Clash acknowledged badge */
.clash-okayed-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: .15rem .55rem;
  margin-top: .3rem;
}

/* Change request badge */
.change-request-badge {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem;
  font-size: .8rem;
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: .35rem .65rem;
  margin-top: .25rem;
}

/* My School fixture clash highlight */
.myschool-fixture.ms-fixture-clash {
  border-left: 3px solid #f97316;
  background: #fff7ed;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ===== MODAL TABS ===== */
.modal-tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1rem;
}
.modal-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: .5rem .85rem;
  cursor: pointer;
  font-size: .88rem;
  color: var(--neutral);
  font-weight: 500;
  transition: color .15s, border-color .15s;
}
.modal-tab:hover { color: var(--primary); }
.modal-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

/* ===== ADMIN CARD FULL WIDTH ===== */
.admin-card-full { grid-column: 1 / -1; }

/* ===== H/A BALANCE TABLE ===== */
.home-away-balance th, .home-away-balance td {
  padding: .35rem .6rem;
  font-size: .85rem;
}

/* Score inputs — keep padding tight so digits are never clipped */
.score-input {
  padding-left: 4px !important;
  padding-right: 4px !important;
  text-align: center;
  box-sizing: border-box;
}

/* ===== NOTIFICATION BELL + PANEL ===== */

/* Bell button in the header */
.btn-notif {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px 6px;
  color: #fff;
  border-radius: 6px;
  transition: background .15s;
}
.btn-notif:hover { background: rgba(255,255,255,.15); }

/* Unread count badge — red circle on bell */
.notif-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}

/* Floating notification dropdown panel */
.notif-panel {
  position: fixed;
  top: 56px;        /* just below the header */
  right: 1rem;
  width: 340px;
  max-height: 480px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  z-index: 300;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}
.notif-panel-title {
  font-weight: 600;
  font-size: .9rem;
  color: #111827;
}
.notif-mark-all {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .78rem;
  color: #16a34a;
  font-weight: 500;
  padding: 0;
}
.notif-mark-all:hover { text-decoration: underline; }

/* Scrollable list */
.notif-list {
  overflow-y: auto;
  flex: 1;
}

/* Individual notification row */
.notif-item {
  padding: .65rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background .12s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover      { background: #f9fafb; }

/* Unread items get a green left accent */
.notif-item.unread {
  background: #f0fdf4;
  border-left: 3px solid #16a34a;
}
.notif-item.unread:hover { background: #dcfce7; }

.notif-item-title {
  font-size: .85rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: .2rem;
}
.notif-item-body {
  font-size: .8rem;
  color: #6b7280;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: .2rem;
}
.notif-item-time {
  font-size: .72rem;
  color: #9ca3af;
}
.notif-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: .2rem;
}
.notif-item-from {
  font-size: .73rem;
  color: #9ca3af;
  margin-bottom: .1rem;
}
.notif-reply-context {
  font-size: .75rem;
  color: #9ca3af;
  border-left: 3px solid #e5e7eb;
  padding-left: .5rem;
  margin-bottom: .25rem;
  font-style: italic;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.notif-reply-form {
  margin-top: .5rem;
  border-top: 1px solid #f3f4f6;
  padding-top: .5rem;
}
.notif-reply-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: .3rem .5rem;
  font-size: .82rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.4;
}

/* Users role filter chips */
.users-role-filters {
  display: flex;
  gap: .4rem;
  padding: .5rem 0 .75rem;
  flex-wrap: wrap;
}
.role-filter-btn {
  padding: .25rem .75rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: .8rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: background .15s, color .15s, border-color .15s;
}
.role-filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.role-filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.users-school-filter {
  padding: .25rem .5rem;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: .8rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* Read messages divider */
.notif-read-divider {
  padding: .3rem .75rem;
  border-top: 1px solid #f3f4f6;
}
.notif-read-toggle {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: .75rem;
  cursor: pointer;
  padding: .1rem 0;
}
.notif-read-toggle:hover { color: #6b7280; }

/* Empty state */
.notif-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #9ca3af;
  font-size: .88rem;
  font-style: italic;
}

/* Notification composer textarea in admin panel */
#subtab-notifications textarea {
  width: 100%;
  resize: vertical;
  font-family: inherit;
  font-size: .9rem;
}

/* ── Notification Context Modal ───────────────────────────── */
.notif-ctx-school-list {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: .4rem .6rem;
  background: #f9fafb;
}
.notif-ctx-school-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .2rem 0;
  font-size: .88rem;
  cursor: pointer;
  user-select: none;
}
.notif-ctx-school-label input[type="checkbox"] {
  flex-shrink: 0;
}
.notif-ctx-recipients {
  font-size: .82rem;
  color: #6b7280;
  padding: .35rem .5rem;
  background: #f3f4f6;
  border-radius: 5px;
  min-height: 1.6rem;
}

/* ── My School fixture notify button ─────────────────────── */
.ms-notif-section {
  margin-top: .4rem;
  display: flex;
  justify-content: flex-end;
}

/* ── League Entry Deadline row (on league cards) ─────────── */
.entry-deadline-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .4rem;
  font-size: .82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.entry-open-badge {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: #dcfce7;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}
.entry-closed-badge {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

/* ── Pending entries banner (admin/master view on league card) ─ */
.pending-entries-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .5rem;
  padding: .4rem .6rem;
  background: #fffbeb;
  border: 1.5px solid #fcd34d;
  border-radius: 8px;
  font-size: .82rem;
  color: #92400e;
}
.card--has-pending {
  border-color: #fcd34d !important;
  box-shadow: 0 0 0 2px #fde68a55;
}
/* ── Admin league list item: pending highlight ─────────────── */
.admin-module-item--pending {
  border-left: 4px solid #f59e0b;
  background: #fffdf0;
}

/* ── League card: entered team list ──────────────────────── */
.entry-team-list {
  margin-top: .5rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.entry-status-row {
  font-size: .8rem;
  font-weight: 500;
  padding: .2rem .5rem;
  border-radius: 6px;
}
.entry-status--approved {
  background: #dcfce7;
  color: #166534;
}
.entry-status--pending {
  background: #fef9c3;
  color: #854d0e;
}
.entry-status--rejected {
  background: #fee2e2;
  color: #991b1b;
}

/* ── Admin: league entry rows in the entries modal ────────── */
.entry-admin-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem 0;
  border-bottom: 1px solid #f3f4f6;
  flex-wrap: wrap;
}
.entry-admin-row:last-child { border-bottom: none; }
.entry-admin-info { flex: 1; min-width: 0; }
.entry-admin-name {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .9rem;
  flex-wrap: wrap;
}
.entry-admin-meta {
  font-size: .78rem;
  color: #6b7280;
  margin-top: .2rem;
}
.entry-admin-actions {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.entry-move-sel {
  font-size: .78rem;
  padding: .2rem .4rem;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  max-width: 160px;
}

/* ── form-hint-inline (used in league modal deadline label) ── */
.form-hint-inline {
  font-size: .78rem;
  color: #9ca3af;
  font-weight: 400;
}
