/* ============================================================
   STMS — Sports Tournament Management System
   Design System & Component Library
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  /* Brand */
  --navy: #0D1B2A;
  --navy-mid: #1A2D42;
  --navy-light: #243B55;
  --blue: #1565C0;
  --blue-mid: #1976D2;
  --blue-light: #42A5F5;
  --accent: #FF6B35;
  --accent-gold: #FFB800;

  /* Status */
  --green: #2E7D32;
  --green-l: #4CAF50;
  --red: #C62828;
  --red-l: #EF5350;
  --orange: #E65100;
  --orange-l: #FF9800;

  /* Neutrals */
  --bg: #F4F6FA;
  --bg-card: #FFFFFF;
  --border: #E2E8F0;
  --text: #1A202C;
  --text-2: #4A5568;
  --text-3: #718096;

  /* Typography */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Sizing */
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 12px rgba(0, 0, 0, .06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .12);

  --transition: 0.2s ease;
}

/* ── Reset ──────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
}

/* ── App Layout ─────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  transition: transform var(--transition);
  scrollbar-width: thin;
  scrollbar-color: var(--navy-light) var(--navy);
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--navy-light);
  border-radius: 4px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-icon {
  font-size: 28px;
  line-height: 1;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  display: block;
}

.brand-sub {
  font-size: .65rem;
  color: rgba(255, 255, 255, .5);
  display: block;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.sidebar-close {
  display: none;
  color: rgba(255, 255, 255, .5);
  font-size: 1.1rem;
  margin-left: auto;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, .04);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--blue-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-name {
  font-size: .85rem;
  font-weight: 600;
}

.user-role {
  font-size: .72rem;
  color: rgba(255, 255, 255, .5);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .7);
  font-size: .875rem;
  transition: all var(--transition);
  position: relative;
  margin-bottom: 2px;
}

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

.nav-item.active {
  background: var(--blue);
  color: #fff;
}

.nav-item i {
  width: 18px;
  text-align: center;
  font-size: .9rem;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, .08);
  padding: 10px;
}

.nav-logout {
  color: rgba(255, 100, 100, .7) !important;
}

.nav-logout:hover {
  background: rgba(255, 80, 80, .1) !important;
  color: #ff8080 !important;
}

/* ── Main Content ────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}

.topbar-toggle {
  color: var(--text-2);
  font-size: 1.1rem;
  display: none;
}

.topbar-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  flex: 1;
  color: var(--text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  background: var(--bg);
  font-size: .95rem;
  transition: all var(--transition);
  position: relative;
}

.topbar-btn:hover {
  background: var(--border);
  color: var(--text);
}

.topbar-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: var(--red-l);
  color: #fff;
  border-radius: 50%;
  font-size: .6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Page Content ────────────────────────────────────────── */
.page-content {
  padding: 24px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-left h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.page-header-left p {
  font-size: .875rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

.card-sm {
  padding: 16px;
}

.card-flush {
  padding: 0;
  overflow: hidden;
}

/* ── Stat Cards ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-color, var(--blue));
}

.stat-card.green {
  --accent-color: var(--green-l);
}

.stat-card.orange {
  --accent-color: var(--orange-l);
}

.stat-card.red {
  --accent-color: var(--red-l);
}

.stat-card.gold {
  --accent-color: var(--accent-gold);
}

.stat-icon {
  font-size: 1.4rem;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(21, 101, 192, 0.1);
  color: var(--blue);
}

.stat-card.green .stat-icon {
  background: rgba(46, 125, 50, .1);
  color: var(--green-l);
}

.stat-card.orange .stat-icon {
  background: rgba(230, 81, 0, .1);
  color: var(--orange-l);
}

.stat-card.red .stat-icon {
  background: rgba(198, 40, 40, .1);
  color: var(--red-l);
}

.stat-card.gold .stat-icon {
  background: rgba(255, 184, 0, .1);
  color: var(--accent-gold);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.stat-label {
  font-size: .8rem;
  color: var(--text-3);
  font-weight: 500;
}

.stat-delta {
  font-size: .75rem;
  color: var(--green-l);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--transition);
  line-height: 1;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: #0D47A1;
}

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

.btn-success:hover {
  background: #1B5E20;
}

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

.btn-danger:hover {
  background: #B71C1C;
}

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

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

.btn-secondary {
  background: var(--bg);
  color: var(--text-2);
  border: 1px solid var(--border);
}

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

.btn-outline {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--blue);
}

.btn-outline:hover {
  background: var(--blue);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: .8rem;
}

.btn-lg {
  padding: 13px 28px;
  font-size: 1rem;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn:disabled {
  opacity: .5;
  pointer-events: none;
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: .01em;
}

.form-label .required {
  color: var(--red-l);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, .12);
}

.form-control.is-invalid {
  border-color: var(--red-l);
}

.form-control::placeholder {
  color: var(--text-3);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

select.form-control {
  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='%23718096' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-hint {
  font-size: .76rem;
  color: var(--text-3);
  margin-top: 4px;
}

.form-error {
  font-size: .76rem;
  color: var(--red-l);
  margin-top: 4px;
}

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

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

@media (max-width: 640px) {

  .form-grid,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ── Tables ──────────────────────────────────────────────── */
.table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

.table th {
  background: var(--bg);
  padding: 11px 14px;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: .05em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

.table tbody tr:hover {
  background: var(--bg);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}

.badge-primary {
  background: rgba(21, 101, 192, .12);
  color: var(--blue);
}

.badge-success {
  background: rgba(46, 125, 50, .12);
  color: var(--green);
}

.badge-danger {
  background: rgba(198, 40, 40, .12);
  color: var(--red);
}

.badge-warning {
  background: rgba(230, 81, 0, .12);
  color: var(--orange);
}

.badge-info {
  background: rgba(2, 132, 199, .12);
  color: #0284C7;
}

.badge-secondary {
  background: var(--bg);
  color: var(--text-3);
  border: 1px solid var(--border);
}

.badge-dark {
  background: var(--navy-mid);
  color: #fff;
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert i {
  font-size: 1rem;
  margin-top: 1px;
  flex-shrink: 0;
}

.alert-success {
  background: rgba(46, 125, 50, .1);
  color: var(--green);
  border-left: 4px solid var(--green-l);
}

.alert-danger {
  background: rgba(198, 40, 40, .1);
  color: var(--red);
  border-left: 4px solid var(--red-l);
}

.alert-warning {
  background: rgba(230, 81, 0, .1);
  color: var(--orange);
  border-left: 4px solid var(--orange-l);
}

.alert-info {
  background: rgba(21, 101, 192, .1);
  color: var(--blue);
  border-left: 4px solid var(--blue-mid);
}

/* ── Tabs ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 18px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.tab-pane {
  display: none;
}

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

/* ── Modal ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition);
}

.modal-backdrop.open .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.modal-close {
  color: var(--text-3);
  font-size: 1.1rem;
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Search / Filter bar ─────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-bar .form-control {
  width: auto;
  flex: 1;
  min-width: 160px;
}

.search-input {
  position: relative;
}

.search-input i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
}

.search-input input {
  padding-left: 36px;
}

/* ── QR Card ─────────────────────────────────────────────── */
.qr-card {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 28px;
  max-width: 380px;
  position: relative;
  overflow: hidden;
}

.qr-card::after {
  content: '🏆';
  position: absolute;
  right: -10px;
  bottom: -10px;
  font-size: 80px;
  opacity: 0.07;
}

.qr-reg-number {
  font-family: 'Courier New', monospace;
  font-size: .85rem;
  color: var(--blue-light);
  letter-spacing: .08em;
  margin-bottom: 8px;
}

.qr-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.qr-meta {
  font-size: .8rem;
  color: rgba(255, 255, 255, .6);
  margin-bottom: 20px;
}

.qr-code-box {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 12px;
  width: fit-content;
  margin-bottom: 16px;
}

.qr-sport-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, .12);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: .8rem;
}

/* ── Status Timeline ─────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--border);
}

.timeline-dot.done {
  background: var(--green-l);
  box-shadow: 0 0 0 2px var(--green-l);
}

.timeline-dot.current {
  background: var(--blue-mid);
  box-shadow: 0 0 0 2px var(--blue-mid);
  animation: pulse 1.5s infinite;
}

.timeline-dot.rejected {
  background: var(--red-l);
  box-shadow: 0 0 0 2px var(--red-l);
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 0 2px var(--blue-mid);
  }

  50% {
    box-shadow: 0 0 0 5px rgba(25, 118, 210, .2);
  }
}

.timeline-content {}

.timeline-title {
  font-weight: 600;
  font-size: .9rem;
}

.timeline-sub {
  font-size: .78rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--text-3);
  margin-bottom: 20px;
}

.breadcrumb a {
  color: var(--blue);
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb .sep {
  color: var(--border);
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 16px 0;
}

.page-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--text-2);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

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

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

/* ── Toast Notifications ─────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  font-size: .875rem;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 340px;
  border-left: 4px solid var(--blue);
  animation: slideInRight 0.3s ease;
}

.toast.success {
  border-left-color: var(--green-l);
}

.toast.error {
  border-left-color: var(--red-l);
}

.toast.warning {
  border-left-color: var(--orange-l);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: .4;
}

.empty-state h3 {
  font-size: 1rem;
  color: var(--text-2);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: .875rem;
}

/* ── Upload Zone ─────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--blue-mid);
  background: rgba(25, 118, 210, .04);
}

.upload-zone i {
  font-size: 2rem;
  color: var(--text-3);
  margin-bottom: 8px;
}

.upload-zone p {
  font-size: .875rem;
  color: var(--text-3);
}

/* ── Meal scanner ────────────────────────────────────────── */
.scanner-frame {
  position: relative;
  aspect-ratio: 1;
  max-width: 320px;
  margin: 0 auto;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}

.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-corners {
  width: 200px;
  height: 200px;
  position: relative;
}

.scanner-corners::before,
.scanner-corners::after,
.scanner-corners span::before,
.scanner-corners span::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: #fff;
  border-style: solid;
}

.scanner-corners::before {
  top: 0;
  left: 0;
  border-width: 3px 0 0 3px;
}

.scanner-corners::after {
  top: 0;
  right: 0;
  border-width: 3px 3px 0 0;
}

.scanner-corners span::before {
  bottom: 0;
  left: 0;
  border-width: 0 0 3px 3px;
}

.scanner-corners span::after {
  bottom: 0;
  right: 0;
  border-width: 0 3px 3px 0;
}

/* ── Charts / Progress ───────────────────────────────────── */
.progress {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--blue-mid);
  border-radius: 4px;
  transition: width .6s ease;
}

.progress-bar.green {
  background: var(--green-l);
}

.progress-bar.orange {
  background: var(--orange-l);
}

.progress-bar.red {
  background: var(--red-l);
}

/* ── Public landing ──────────────────────────────────────── */
.public-layout {
  min-height: 100vh;
}

.pub-nav {
  background: var(--navy);
  color: #fff;
  padding: 0 40px;
  height: 68px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.pub-nav .nav-brand {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
}

.pub-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pub-nav-links a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .75);
  font-size: .875rem;
  transition: all var(--transition);
}

.pub-nav-links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}

.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 40%, var(--blue) 100%);
  color: #fff;
  padding: 100px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, .12);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: .8rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 20px;
}

.hero h1 span {
  color: var(--accent-gold);
}

.hero p {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, .75);
  max-width: 560px;
  margin: 0 auto 32px;
}

.hero-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.sports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.sport-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 12px;
  text-align: center;
  transition: all var(--transition);
  cursor: default;
}

.sport-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--blue-light);
}

.sport-card .emoji {
  font-size: 2rem;
  margin-bottom: 8px;
}

.sport-card .name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
}

.sport-card .type {
  font-size: .7rem;
  color: var(--text-3);
}

.section {
  padding: 64px 40px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.section-sub {
  color: var(--text-3);
  margin-bottom: 40px;
}

/* ── 100% RESPONSIVE SYSTEM & MOBILE SIDEBAR OVERHAUL ─────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9998;
}

@media (max-width: 1024px) {
  :root {
    --sidebar-w: 270px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 9999;
    transform: translateX(-100%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.open {
    transform: translateX(0) !important;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  .topbar-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    cursor: pointer;
  }

  .overlay {
    display: block;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
  }

  .sidebar-close {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
  }

  /* Auto-collapse multi-column inline grids */
  div[style*="grid-template-columns: 1.6fr 1.2fr"],
  div[style*="grid-template-columns: 1.6fr 1fr"],
  div[style*="grid-template-columns: 2fr 1.1fr"],
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns: repeat(4, 1fr)"],
  div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  .page-content {
    padding: 16px !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  .topbar {
    padding: 0 16px !important;
  }

  .page-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .page-header div[style*="display:flex"] {
    width: 100% !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
  }

  .section {
    padding: 40px 16px !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  /* Responsive Form Grids */
  form[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .filter-bar {
    flex-direction: column !important;
  }

  .card {
    padding: 16px !important;
    border-radius: 12px !important;
  }
}

/* ── Utility ─────────────────────────────────────────────── */
.d-flex {
  display: flex;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

.align-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.flex-wrap {
  flex-wrap: wrap;
}

.mt-1 {
  margin-top: 4px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-3 {
  margin-top: 12px;
}

.mt-4 {
  margin-top: 16px;
}

.mt-6 {
  margin-top: 24px;
}

.mt-8 {
  margin-top: 32px;
}

.mb-1 {
  margin-bottom: 4px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 12px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mb-6 {
  margin-bottom: 24px;
}

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

.text-right {
  text-align: right;
}

.text-muted {
  color: var(--text-3);
}

.text-small {
  font-size: .8rem;
}

.text-bold {
  font-weight: 600;
}

.w-100 {
  width: 100%;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 640px) {

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ── Print QR ────────────────────────────────────────────── */
@media print {

  .sidebar,
  .topbar,
  .btn,
  .no-print {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .page-content {
    padding: 0 !important;
  }

  .qr-card {
    box-shadow: none;
    border: 2px solid #000;
  }
}