:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 18px;
}

/* Header & Navigation */
.topbar {
  background: #0f172a;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  font-size: 30px;
  background: rgba(255, 255, 255, 0.1);
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
}

.brand h1 {
  font-size: 1.15rem;
  font-weight: 700;
}

.brand .subtitle {
  font-size: 0.78rem;
  color: #94a3b8;
}

.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
}

.live-dot-nav {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  display: inline-block;
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.25); }
}

/* Main Content */
.main-content {
  padding-top: 24px;
  padding-bottom: 60px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.admin-subpanel {
  display: none;
}

.admin-subpanel.active {
  display: block;
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.card-header h3 {
  margin-bottom: 0;
}

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .two-col-grid {
    grid-template-columns: 1fr;
  }
}

/* Stats Bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.stat-card.is-clickable {
  cursor: pointer;
}

.stat-card.is-clickable:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.stat-card.is-active {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16);
}

.stat-card .stat-val {
  font-size: 1.5rem;
  font-weight: 800;
}

.stat-card .stat-lbl {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Match Cards Grid */
.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}

.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}

.match-card.is-live {
  border-color: #fca5a5;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.12);
}

.match-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.82rem;
}

.match-sport {
  font-weight: 600;
  color: var(--text);
}

.match-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.match-team {
  text-align: center;
}

.match-team .name {
  font-weight: 700;
  font-size: 0.98rem;
  margin-bottom: 4px;
}

.match-team.winner .name {
  color: var(--success);
}

.match-score-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 10px;
  font-size: 1.5rem;
  font-weight: 800;
}

.match-score-box .sep {
  color: var(--muted);
  font-size: 1rem;
}

.match-footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #334155;
}

.badge-live {
  background: #fee2e2;
  color: #dc2626;
}

.badge-upcoming {
  background: #fef3c7;
  color: #b45309;
}

.badge-finished {
  background: #dcfce7;
  color: #15803d;
}

.badge-info {
  background: #dbeafe;
  color: #1d4ed8;
}

/* Forms & Inputs */
.select-input,
.text-input {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
  color: var(--text);
  width: 100%;
}

.controls-row .select-input {
  width: auto;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: #334155;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

/* Buttons */
.btn {
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-warning:hover {
  background: #b45309;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-outline {
  background: #fff;
  border-color: #cbd5e1;
  color: var(--text);
}

.btn-outline:hover {
  background: var(--surface-alt);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.full-width {
  width: 100%;
}

.chip-btn {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  margin: 2px;
}

.chip-btn:hover {
  background: #dbeafe;
}

/* Pill Tabs */
.pill-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.pill-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--surface-alt);
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.data-table tr:hover td {
  background: #f8fafc;
}

/* Bracket */
.bracket-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bracket-round-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.bracket-match {
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--surface-alt);
  margin-bottom: 8px;
}

.bracket-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-weight: 600;
}

/* Auth & User Banners */
.auth-card {
  max-width: 520px;
  margin: 10px auto;
}

.demo-hint {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.82rem;
  color: #0369a1;
  margin-bottom: 14px;
}

.user-banner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
}

/* Referee Console */
.ref-match-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 500px;
  overflow-y: auto;
}

.ref-match-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.ref-match-item:hover,
.ref-match-item.selected {
  border-color: var(--primary);
  background: #eff6ff;
}

.scoreboard-console {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  background: #0f172a;
  color: #fff;
  padding: 20px;
  border-radius: 12px;
  margin-top: 12px;
}

.team-box {
  text-align: center;
}

.team-box .team-name {
  font-weight: 700;
  font-size: 0.98rem;
  margin-bottom: 8px;
}

.big-score {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 12px;
}

.score-btns {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.score-btns button {
  padding: 6px 10px;
  border-radius: 6px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
}

.btn-score-minus { background: #475569; }
.btn-score-plus { background: #2563eb; }
.btn-score-plus2 { background: #16a34a; }
.btn-score-plus3 { background: #d97706; }

.vs-divider {
  font-weight: 800;
  color: #64748b;
}

.console-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.console-actions .btn {
  flex: 1;
}

.console-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Utilities */
.hidden {
  display: none !important;
}

.empty-state {
  text-align: center;
  padding: 30px;
  color: var(--muted);
}

.toast {
  position: fixed;
  top: 84px;
  right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  z-index: 10000;
  font-weight: 600;
  font-size: 0.9rem;
  max-width: 420px;
}

.toast.error {
  background: var(--danger);
}

.toast.success {
  background: var(--success);
}

.code-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
}

.conflict-banner {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #c2410c;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Mobile & Tablet Responsive Enhancements */
@media (max-width: 640px) {
  .container {
    padding: 0 12px;
  }

  .topbar-inner {
    gap: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .nav-tabs {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 0.84rem;
  }

  .controls-row {
    width: 100%;
  }

  .controls-row .select-input,
  .controls-row .btn {
    flex: 1 1 100%;
    width: 100%;
  }

  .stats-bar {
    grid-template-columns: 1fr 1fr;
  }

  .card {
    padding: 14px;
  }

  .scoreboard-console {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .score-btns button {
    min-width: 48px;
    min-height: 44px;
    font-size: 1rem;
  }

  .console-actions .btn {
    flex: 1 1 100%;
  }

  .toast {
    top: 76px;
    left: 12px;
    right: 12px;
    bottom: auto;
    max-width: none;
    text-align: center;
  }
}

/* ==================== CERTIFICATE (เกียรติบัตร) ==================== */
.certificate-sheet {
  --cert-scale: 1;
  --cert-gap-scale: 1;
  --cert-font: "Sarabun", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--cert-font);
  background: #fffdf7;
  border: 10px double #b45309;
  outline: 3px solid #1e3a8a;
  outline-offset: -18px;
  border-radius: 8px;
  padding: 42px 36px;
  text-align: center;
  color: #1e293b;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  position: relative;
  overflow: hidden;
}

.certificate-sheet.custom-bg {
  border: 1px solid var(--border);
  outline: none;
  background-color: #fff;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.certificate-sheet.print-only {
  background: #fff;
  border: 1px dashed #cbd5e1;
  outline: none;
  box-shadow: none;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media print {
  .certificate-sheet.print-only {
    border: none !important;
  }
}

.cert-emblem {
  font-size: calc(3rem * var(--cert-scale, 1));
  margin-bottom: calc(6px * var(--cert-gap-scale, 1));
}

.cert-title {
  font-size: calc(2rem * var(--cert-scale, 1));
  font-weight: 800;
  color: #1e3a8a;
  letter-spacing: 1px;
  margin-bottom: calc(6px * var(--cert-gap-scale, 1));
}

.cert-subtitle {
  font-size: calc(1rem * var(--cert-scale, 1));
  color: #475569;
  margin-bottom: calc(18px * var(--cert-gap-scale, 1));
}

.cert-recipient {
  font-size: calc(1.75rem * var(--cert-scale, 1));
  font-weight: 800;
  color: #0f172a;
  border-bottom: 2px dashed #cbd5e1;
  display: inline-block;
  padding: 4px 28px;
  margin-bottom: calc(8px * var(--cert-gap-scale, 1));
}

.cert-school {
  font-size: calc(1.15rem * var(--cert-scale, 1));
  font-weight: 700;
  color: #1d4ed8;
  margin-bottom: calc(16px * var(--cert-gap-scale, 1));
}

.cert-award-box {
  display: inline-block;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1.5px solid #d97706;
  color: #92400e;
  padding: 8px 24px;
  border-radius: 999px;
  font-size: calc(1.15rem * var(--cert-scale, 1));
  font-weight: 800;
  margin-bottom: calc(14px * var(--cert-gap-scale, 1));
}

.cert-detail {
  font-size: calc(1.05rem * var(--cert-scale, 1));
  color: #334155;
  margin-bottom: calc(6px * var(--cert-gap-scale, 1));
}

.cert-date {
  font-size: calc(0.92rem * var(--cert-scale, 1));
  color: #64748b;
  margin-top: calc(14px * var(--cert-gap-scale, 1));
  margin-bottom: calc(20px * var(--cert-gap-scale, 1));
}

.cert-sign {
  margin-top: calc(14px * var(--cert-gap-scale, 1));
  display: inline-block;
  min-width: 260px;
}

.cert-sign-img {
  display: block;
  margin: 0 auto -6px;
  max-height: 90px;
  object-fit: contain;
  pointer-events: none;
}

.certificate-sheet.is-single-line .cert-recipient,
.certificate-sheet.is-single-line .cert-school,
.certificate-sheet.is-single-line .cert-detail {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.cert-sign-line {
  border-top: 1px solid #475569;
  padding-top: 6px;
  font-size: 0.92rem;
  font-weight: 600;
}

.cert-batch-print {
  display: none;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 8mm;
  }
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    height: auto !important;
  }
  .topbar,
  .section-header,
  .cert-controls,
  .toast,
  #staffChatFab,
  #staffChatModal,
  .tab-panel:not(#tab-cert) {
    display: none !important;
  }
  .main-content {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }
  .cert-layout {
    display: block !important;
  }
  body.batch-printing #certificatePreview {
    display: none !important;
  }
  body.batch-printing .cert-batch-print {
    display: block !important;
  }
  .certificate-sheet {
    position: static !important;
    width: 100% !important;
    height: 185mm !important;
    min-height: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    page-break-after: always;
    break-after: page;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .certificate-sheet:last-child {
    page-break-after: auto;
    break-after: auto;
  }
}


/* Quick time preset chips in Admin match form */
.quick-time-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-btn {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.chip-btn:hover {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}

.chip-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.chip-btn.chip-clear {
  color: var(--danger);
  border-color: #fecaca;
  background: #fef2f2;
}

/* ==================== NOTIFICATION BELL & MATCH FINISH TOAST ==================== */
.notif-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.notif-bell-btn {
  position: relative;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.18s;
}

.notif-bell-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.notif-bell-btn.has-unread .notif-bell-icon {
  animation: notifBellRing 0.8s ease-in-out;
}

@keyframes notifBellRing {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(15deg); }
  40% { transform: rotate(-12deg); }
  60% { transform: rotate(8deg); }
  80% { transform: rotate(-5deg); }
}

.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid #0f172a;
}

.notif-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 360px;
  max-height: 440px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.24);
  z-index: 120;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notif-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.9rem;
}

.notif-clear-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

.notif-clear-btn:hover {
  background: #eff6ff;
}

.notif-list {
  overflow-y: auto;
  max-height: 380px;
}

.notif-item {
  width: 100%;
  text-align: left;
  background: #fff;
  border: none;
  border-bottom: 1px solid #f1f5f9;
  padding: 11px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.15s;
}

.notif-item:hover {
  background: #f8fafc;
}

.notif-item.is-unread {
  background: #f0fdf4;
  border-left: 4px solid #16a34a;
}

.notif-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--muted);
}

.notif-new-pill {
  background: #16a34a;
  color: #fff;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
}

.notif-item-score {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

.notif-item-winner {
  font-size: 0.78rem;
  color: #15803d;
  font-weight: 600;
}

.notif-empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.match-finish-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10001;
  width: 340px;
  max-width: calc(100vw - 24px);
  background: linear-gradient(135deg, #064e3b, #0f172a);
  color: #fff;
  border: 1px solid rgba(52, 211, 153, 0.45);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  animation: matchToastIn 0.25s ease-out;
}

@keyframes matchToastIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.match-finish-toast-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  color: #6ee7b7;
  margin-bottom: 4px;
}

.match-finish-toast-sport {
  font-size: 0.8rem;
  color: #cbd5e1;
  margin-bottom: 4px;
}

.match-finish-toast-teams {
  font-size: 0.96rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.match-finish-toast-winner {
  font-size: 0.8rem;
  color: #fde68a;
  font-weight: 600;
}

.match-card.notif-highlight {
  outline: 3px solid #16a34a;
  box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.18);
  transition: box-shadow 0.3s ease;
}

@media (max-width: 640px) {
  .brand {
    flex: 1;
    min-width: 0;
  }

  .notif-wrapper {
    order: 2;
  }

  .nav-tabs {
    order: 3;
  }

  .notif-popover {
    position: fixed;
    top: 64px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 70vh;
  }

  .match-finish-toast {
    left: 12px;
    right: 12px;
    bottom: 14px;
    width: auto;
  }

  #staffChatFab {
    bottom: 68px !important;
    right: 14px !important;
  }

  #staffChatToggleBtn {
    width: 46px;
    height: 46px;
    padding: 0 !important;
    border-radius: 50% !important;
    justify-content: center;
    font-size: 1.25rem !important;
    position: relative;
    opacity: 0.94;
  }

  .staff-chat-label {
    display: none;
  }

  #staffChatBadge {
    position: absolute;
    top: -4px;
    right: -4px;
    border: 2px solid #fff;
  }

  #staffChatModal {
    bottom: 124px !important;
    right: 12px !important;
  }
}

@media print {
  .notif-wrapper,
  .match-finish-toast,
  .nav-tabs,
  #staffChatFab,
  .back-to-top-btn {
    display: none !important;
  }
}

/* ==================== TRACK & FIELD (RUNNING) ==================== */
.track-console-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #f8fafc;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.track-lanes-table th,
.track-lanes-table td {
  padding: 8px 6px;
  vertical-align: middle;
  font-size: 0.84rem;
}

.track-lane-badge {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
}

.track-lane-row.is-dq {
  background: #fef2f2;
  opacity: 0.85;
}

.track-lane-row.is-qualified {
  background: #f0fdf4;
}

.track-public-lanes {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 10px 0;
}

.track-public-lane {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.84rem;
}

.track-public-lane.is-winner {
  background: #fefce8;
  border-color: #fde047;
}

.track-public-lane.is-qualified {
  background: #f0fdf4;
  border-color: #86efac;
}

.track-public-lane.is-dq {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

/* ==================== ANNOUNCEMENT, CHECKIN & OFFICIAL REPORT ==================== */
.announcement-bar {
  background: linear-gradient(90deg, #b91c1c, #ea580c);
  color: #fff;
  padding: 11px 16px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 6px 18px rgba(185, 28, 28, 0.28);
}

.announcement-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  color: #b91c1c;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
  flex-shrink: 0;
  animation: announcePulse 2.2s ease-in-out infinite;
}

.announcement-text {
  color: #fff;
  font-weight: 700;
  line-height: 1.45;
}

@keyframes announcePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.checkin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  background: #f8fafc;
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.official-report-print {
  display: none;
}

@media print {
  body.printing-official-report > *:not(main),
  body.printing-official-report main > *:not(#officialReportPrintArea) {
    display: none !important;
  }

  body.printing-official-report #officialReportPrintArea {
    display: block !important;
    padding: 16px;
    color: #000;
    background: #fff;
  }

  .official-report-print h2,
  .official-report-print h3 {
    margin: 14px 0 8px;
    color: #000;
  }

  .official-report-print table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 14px;
    font-size: 12px;
  }

  .official-report-print th,
  .official-report-print td {
    border: 1px solid #334155;
    padding: 6px 8px;
    text-align: left;
  }

  .official-report-print th {
    background: #f1f5f9 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* ==================== LIVE SCHOOL SEARCH SUGGESTIONS ==================== */
.live-suggest-wrap {
  position: relative;
}

.live-suggest-list {
  position: absolute;
  top: calc(100% - 4px);
  left: 0;
  right: 0;
  z-index: 60;
  background: #ffffff;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  max-height: 220px;
  overflow-y: auto;
}

.live-suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid #f1f5f9;
  padding: 8px 12px;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--text, #0f172a);
}

.live-suggest-item:last-child {
  border-bottom: none;
}

.live-suggest-item:hover {
  background: #eff6ff;
  color: var(--primary, #1d4ed8);
}

/* ==================== VISUAL TOURNAMENT BRACKET TREE ==================== */
.bracket-tree-scroll {
  overflow-x: auto;
  padding: 8px 4px 14px;
}

.bracket-tree {
  display: flex;
  align-items: stretch;
  gap: 28px;
  min-width: max-content;
}

.bracket-round-col {
  display: flex;
  flex-direction: column;
  min-width: 245px;
  max-width: 270px;
}

.bracket-round-col .bracket-round-title {
  text-align: center;
  background: #eff6ff;
  color: var(--primary);
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.84rem;
}

.bracket-round-matches {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  flex: 1;
  gap: 14px;
}

.bracket-node {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

.bracket-node.is-live {
  border-left-color: #dc2626;
  background: #fff5f5;
}

.bracket-node.is-finished {
  border-left-color: #16a34a;
}

.bracket-node-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.bracket-team-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.85rem;
}

.bracket-team-row + .bracket-team-row {
  border-top: 1px dashed #e2e8f0;
  margin-top: 2px;
  padding-top: 5px;
}

.bracket-team-row.is-winner {
  background: #f0fdf4;
  color: #166534;
  font-weight: 700;
}

.bracket-team-row.is-loser {
  color: #94a3b8;
  text-decoration: line-through;
}

.bracket-team-row.is-tbd {
  color: #64748b;
  font-style: italic;
}

.bracket-score-pill {
  font-weight: 800;
  min-width: 22px;
  text-align: right;
}

.bracket-third-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

/* ==================== ALIGNED STANDINGS TABLES ==================== */
.standings-table {
  table-layout: fixed;
  width: 100%;
  min-width: 540px;
}

.standings-table th:nth-child(1),
.standings-table td:nth-child(1) {
  width: 42px;
  text-align: center;
}

.standings-table th:nth-child(2),
.standings-table td:nth-child(2) {
  width: auto;
  word-break: break-word;
}

.standings-table th:nth-child(3),
.standings-table td:nth-child(3),
.standings-table th:nth-child(4),
.standings-table td:nth-child(4),
.standings-table th:nth-child(5),
.standings-table td:nth-child(5),
.standings-table th:nth-child(6),
.standings-table td:nth-child(6) {
  width: 58px;
  text-align: center;
}

.standings-table th:nth-child(7),
.standings-table td:nth-child(7) {
  width: 72px;
  text-align: center;
}

.standings-table th:nth-child(8),
.standings-table td:nth-child(8) {
  width: 64px;
  text-align: center;
}

/* ==================== PROMINENT MATCH ORDER BADGE ==================== */
.match-order-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #1e3a8a;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.match-order-badge.is-live {
  background: #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.28);
}

/* ==================== MOBILE & TABLET UX REFINEMENTS ==================== */
.adm-track-lane-grid {
  display: grid;
  grid-template-columns: 54px 1fr 1fr;
  gap: 8px;
  align-items: center;
}

@media screen and (max-width: 640px) {
  .adm-track-lane-grid {
    grid-template-columns: 54px 1fr;
    gap: 6px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #e2e8f0;
  }

  .adm-track-lane-grid .adm-lane-athlete {
    grid-column: 1 / -1;
  }

  .track-lanes-table th:first-child,
  .track-lanes-table td:first-child {
    position: sticky;
    left: 0;
    background: #ffffff;
    z-index: 2;
    box-shadow: 2px 0 6px rgba(15, 23, 42, 0.06);
  }

  .track-lanes-table .track-lane-row.is-dq td:first-child {
    background: #fef2f2;
  }

  .track-lanes-table .track-lane-row.is-qualified td:first-child {
    background: #f0fdf4;
  }

  .track-lanes-table input[type="text"],
  .track-lanes-table input[type="number"],
  .track-lanes-table select {
    min-height: 38px;
    font-size: 0.9rem;
  }

  .pill-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
    padding-bottom: 4px;
  }

  .pill-tabs::-webkit-scrollbar {
    display: none;
  }

  .pill-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .certificate-sheet {
    padding: 20px 14px;
    outline-offset: -10px;
    border-width: 6px;
  }

  .cert-title {
    font-size: calc(1.35rem * var(--cert-scale, 1));
  }

  .cert-recipient {
    font-size: calc(1.2rem * var(--cert-scale, 1));
  }
}

@media screen and (max-width: 480px) {
  .match-teams {
    gap: 6px;
  }

  .match-team .name {
    font-size: 0.88rem;
    word-break: break-word;
  }

  .match-score-box {
    font-size: 1.2rem;
    padding: 4px 10px;
    gap: 6px;
  }
}

/* ==================== QUICK FILTER PILLS ==================== */
.quick-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 8px;
  border-radius: 10px;
}

.quick-sub-pills .pill-btn {
  font-size: 0.8rem;
  padding: 5px 11px;
  background: #ffffff;
  border-color: #cbd5e1;
}

.quick-sub-pills .pill-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* ==================== MOBILE BOTTOM NAV & UX POLISH ==================== */
@media screen and (max-width: 640px) {
  .topbar {
    position: relative;
  }

  .topbar-inner {
    padding-top: 8px;
    padding-bottom: 8px;
    gap: 8px;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
    font-size: 22px;
    border-radius: 10px;
  }

  .brand h1 {
    font-size: 1rem;
  }

  .brand .subtitle {
    font-size: 0.72rem;
  }

  .main-content {
    padding-top: 14px;
    padding-bottom: 112px;
  }

  .nav-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    background: #ffffff;
    border-top: 1px solid #cbd5e1;
    box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.12);
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
  }

  .nav-btn {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
    font-size: 0.8rem;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .nav-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
  }

  .nav-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
  }

  .data-table th,
  .data-table td {
    padding: 8px 6px;
    font-size: 0.82rem;
  }

  .table-wrap {
    border-right: 3px solid rgba(37, 99, 235, 0.14);
  }
}

/* Prevent iOS Safari auto-zoom on form focus */
@media screen and (max-width: 768px) {
  .select-input,
  .text-input {
    font-size: 16px;
  }
}

/* Tablet / iPad Portrait nav optimization */
@media screen and (min-width: 641px) and (max-width: 960px) {
  .topbar-inner {
    gap: 8px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .nav-tabs {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 7px 11px;
    font-size: 0.84rem;
  }
}

/* Back to Top Floating Button */
.back-to-top-btn {
  position: fixed;
  left: 16px;
  bottom: 24px;
  z-index: 880;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #cbd5e1;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.back-to-top-btn:hover {
  transform: translateY(-2px);
}

@media screen and (max-width: 640px) {
  .back-to-top-btn {
    left: 14px;
    bottom: 68px;
  }
}

/* ==================== BIG SPORT EXPLORER CARDS (DRILL-DOWN) ==================== */
.sport-card-explorer {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px;
}

.sport-explorer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.sport-explorer-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
}

.sport-big-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px;
}

.sport-big-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.sport-big-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

.sport-big-card.is-active {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.sport-big-card.is-boy {
  border-color: #93c5fd;
  background: #eff6ff;
}

.sport-big-card.is-girl {
  border-color: #f9a8d4;
  background: #fdf2f8;
}

.sport-big-card-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: #0f172a;
  line-height: 1.25;
}

.sport-big-card-sub {
  font-size: 0.76rem;
  color: #64748b;
  margin-top: 3px;
  font-weight: 600;
}

.sport-big-card-icon {
  font-size: 1.65rem;
  flex-shrink: 0;
}

@media screen and (max-width: 640px) {
  .sport-big-cards-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .sport-big-card {
    padding: 10px 11px;
  }

  .sport-big-card-title {
    font-size: 0.85rem;
  }

  .sport-big-card-icon {
    font-size: 1.4rem;
  }
}

/* ==================== GOLD MEDAL SUMMARY BANNER CARD ==================== */
.medal-summary-banner-card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  text-align: left;
  padding: 13px 16px;
  margin-bottom: 12px;
  border-radius: 14px;
  border: 1.5px solid #f59e0b;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.14);
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.medal-summary-banner-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.22);
}

.medal-summary-banner-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: #92400e;
}

.medal-summary-banner-sub {
  font-size: 0.82rem;
  font-weight: 600;
  color: #78350f;
  margin-top: 3px;
}

.medal-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #d97706;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ==================== MEDAL PODIUM TOP 3 CARDS ==================== */
.medal-podium-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.medal-podium-card {
  border-radius: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.medal-podium-card.rank-1 {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #f59e0b;
}

.medal-podium-card.rank-2 {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-color: #94a3b8;
}

.medal-podium-card.rank-3 {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-color: #fb923c;
}

.medal-podium-rank {
  font-size: 0.82rem;
  font-weight: 800;
  color: #475569;
}

.medal-podium-card.rank-1 .medal-podium-rank { color: #b45309; }
.medal-podium-card.rank-3 .medal-podium-rank { color: #c2410c; }

.medal-podium-school {
  font-size: 1.04rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
}

.medal-podium-counts {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.88rem;
  font-weight: 700;
}

.medal-podium-total {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.08);
  padding: 2px 8px;
  border-radius: 999px;
  color: #1e293b;
}

@media screen and (max-width: 720px) {
  .medal-podium-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== SCHOOL SPORT PICKER TRIGGER & MODAL ==================== */
.ath-sport-picker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1.5px solid #cbd5e1;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.ath-sport-picker-trigger:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.ath-sport-picker-trigger-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.ath-sport-picker-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.ath-sport-picker-title {
  font-size: 0.96rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
}

.ath-sport-picker-sub {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  margin-top: 2px;
}

.ath-sport-picker-modal-card {
  max-width: 780px;
  width: 100%;
  max-height: 88vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.3);
}

.ath-sport-picker-body {
  overflow-y: auto;
  max-height: 65vh;
  padding-right: 2px;
}

/* ==================== OFFICIAL PHAKDI CHUMPHON CERTIFICATE MODE ==================== */
.certificate-sheet.official-phakdi {
  background-color: #ffffff;
  background-image: url('./cert-template-phakdi.jpg?v=20261204a');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid var(--border);
  outline: none;
  border-radius: 8px;
  padding: 0;
  aspect-ratio: 1024 / 724;
  width: 100%;
  min-height: 0;
  position: relative;
  display: block;
  container-type: inline-size;
}

.certificate-sheet.official-phakdi > div {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.certificate-sheet.official-phakdi .cert-emblem,
.certificate-sheet.official-phakdi .cert-title,
.certificate-sheet.official-phakdi .cert-subtitle,
.certificate-sheet.official-phakdi .cert-school,
.certificate-sheet.official-phakdi .cert-event-line,
.certificate-sheet.official-phakdi .cert-date,
.certificate-sheet.official-phakdi .cert-sign-line,
.certificate-sheet.official-phakdi .cert-sign .muted {
  display: none !important;
}

.certificate-sheet.official-phakdi .cert-recipient {
  position: absolute;
  top: 42.5%;
  left: 12%;
  width: 76%;
  margin: 0;
  padding: 0;
  text-align: center;
  font-size: calc(3.85cqw * var(--cert-scale, 1));
  font-weight: 800;
  color: #0b4a9f;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.certificate-sheet.official-phakdi .cert-award-box {
  position: absolute;
  top: 50.5%;
  left: 33.4%;
  width: 35.6%;
  height: 7.2%;
  margin: 0;
  padding: 0 1cqw;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #ffffff !important;
  font-size: calc(2.45cqw * var(--cert-scale, 1));
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.certificate-sheet.official-phakdi .cert-sport-line {
  position: absolute;
  top: 61.1%;
  left: 10%;
  width: 80%;
  margin: 0;
  padding: 0;
  text-align: center;
  font-size: calc(1.92cqw * var(--cert-scale, 1));
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.certificate-sheet.official-phakdi .cert-sign {
  position: absolute;
  top: 79.2%;
  left: 36%;
  width: 30%;
  height: 9.5%;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.certificate-sheet.official-phakdi .cert-sign-img {
  max-height: 100%;
  object-fit: contain;
}

@media print {
  .certificate-sheet.official-phakdi {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1024 / 724 !important;
    max-height: 192mm !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
