:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-contrast: #ffffff;
  --header-bg: #111827;
  --header-link: #e5e7eb;
  --footer-bg: #0f172a;
  --footer-text: #cbd5e1;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #111827;
  --surface-2: #0f172a;
  --text: #e5e7eb;
  --text-muted: #94a3b8;
  --border: #243244;
  --accent: #60a5fa;
  --accent-contrast: #0b1220;
  --header-bg: #030712;
  --header-link: #d1d5db;
  --footer-bg: #020617;
  --footer-text: #94a3b8;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

html,
body {
  height: 100dvh;
  overflow: hidden;
}

body {
  background: linear-gradient(180deg, var(--bg) 0%, var(--surface-2) 100%);
  color: var(--text);
  margin: 0;
}

.app-shell {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-header {
  flex-shrink: 0;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(2, 6, 23, 0.18);
}

.app-header .navbar {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.brand-logo {
  height: 44px;
  width: auto;
  display: block;
}

.app-header .nav-link {
  color: var(--header-link) !important;
  font-weight: 500;
}

.app-header .nav-link:hover {
  color: #ffffff !important;
}

.app-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

.app-footer {
  flex-shrink: 0;
  background: var(--footer-bg);
  color: var(--footer-text);
  border-top: 1px solid var(--border);
}

.footer-link {
  color: var(--footer-text);
  text-decoration: none;
}

.footer-link:hover {
  color: #ffffff;
}

.card,
.table,
.alert,
.form-control,
.form-select,
textarea {
  border-color: var(--border);
}

.form-control,
.form-select,
textarea {
  background: var(--surface);
  color: var(--text);
}

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

.form-control:focus,
.form-select:focus,
textarea:focus {
  background: var(--surface);
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[type="url"],
html[data-theme="dark"] input[type="tel"] {
  color: #ffffff !important;
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #9ca3af !important;
}

html[data-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .form-select:disabled,
html[data-theme="dark"] textarea:disabled,
html[data-theme="dark"] input:disabled {
  color: #d1d5db !important;
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] input:focus {
  color: #ffffff !important;
  caret-color: #ffffff;
}

html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 30px var(--surface) inset !important;
  -webkit-text-fill-color: #ffffff !important;
  box-shadow: 0 0 0 30px var(--surface) inset !important;
}

html[data-theme="dark"] input[type="time"],
html[data-theme="dark"] input[type="datetime-local"],
html[data-theme="dark"] input[type="file"] {
  color: #ffffff !important;
}

input:valid,
textarea:valid,
select:valid {
  background-image: none !important;
}

input:invalid,
textarea:invalid,
select:invalid {
  background-image: none !important;
}

.was-validated .form-control:valid,
.was-validated .form-select:valid,
.form-control.is-valid,
.form-select.is-valid {
  background-image: none !important;
}

.was-validated .form-control:invalid,
.was-validated .form-select:invalid,
.form-control.is-invalid,
.form-select.is-invalid {
  background-image: none !important;
}

html[data-theme="dark"] label,
html[data-theme="dark"] .form-label {
  color: #e5e7eb;
}

.card {
  background: var(--surface);
  box-shadow: var(--shadow);
  border-radius: 12px;
}

.text-muted,
.small {
  color: var(--text-muted) !important;
}

.table {
  color: var(--text);
  --bs-table-color: var(--text);
  --bs-table-bg: var(--surface);
  --bs-table-border-color: var(--border);
  --bs-table-striped-color: var(--text);
  --bs-table-striped-bg: color-mix(in srgb, var(--surface) 86%, var(--surface-2));
  --bs-table-hover-color: var(--text);
  --bs-table-hover-bg: color-mix(in srgb, var(--surface) 78%, var(--surface-2));
  --bs-table-active-color: var(--text);
  --bs-table-active-bg: color-mix(in srgb, var(--surface) 70%, var(--surface-2));
}

.table thead th {
  border-bottom-color: var(--border);
}

.table tbody tr td {
  border-color: var(--border);
}

.btn-primary {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-danger,
.btn-outline-warning {
  border-color: var(--border);
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.dashboard-header {
  padding: 0.5rem 0;
}

.dashboard-stat {
  border: 1px solid #e9ecef;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.375rem 1rem rgba(0, 0, 0, 0.08);
}

.stat-value {
  font-size: clamp(1.35rem, 2.5vw, 1.9rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.quick-action {
  border: 1px solid #e9ecef;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.quick-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.08);
}

.live-scoreboard {
  background: #101010;
  color: #f8f9fa;
  min-height: 60vh;
}

.live-player-card {
  background: #1f1f1f;
  border: 1px solid #2d2d2d;
  border-radius: 12px;
  padding: 1rem;
}

.live-player-name {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.live-player-score {
  font-size: 3rem;
  line-height: 1.1;
  font-weight: 700;
  margin-bottom: 1rem;
}

.timer-value {
  font-size: 2rem;
  font-weight: 700;
}

/* Final overrides against scaffold defaults */
body {
  margin-bottom: 0 !important;
}

.dashboard-stat,
.quick-action {
  border-color: var(--border) !important;
  background: var(--surface) !important;
}

.live-scoreboard {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
}

.live-player-card {
  background: var(--surface) !important;
  border-color: var(--border) !important;
}

html[data-theme="dark"] .stat-value,
html[data-theme="dark"] .h6 {
  color: #ffffff;
}

.home-hero {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: var(--shadow);
}

.page-card {
  border: 1px solid var(--border);
}

.auth-card {
  border: 1px solid var(--border);
  backdrop-filter: blur(2px);
}

.auth-card .form-label {
  font-weight: 600;
}

.section-title {
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.kpi-card .card-body {
  padding: 0.9rem 1rem;
}

.live-item {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.touch-select {
  min-height: 2.35rem;
}

@media (max-width: 991.98px) {
  .home-hero h1 {
    font-size: clamp(1.45rem, 6vw, 2rem);
  }

  .stat-value {
    font-size: 1.35rem;
  }
}

@media (max-width: 767.98px) {
  .home-hero .card-body,
  .card .card-body {
    padding: 0.95rem;
  }

  .list-group-item {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
  }
}

.home-banner {
  display: block;
  width: 100%;
  height: 100px;
  object-fit: cover;
  object-position: center;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}

.dropdown-menu {
  border-color: var(--border);
}

.dropdown-item,
.dropdown-item:focus,
.dropdown-item:hover {
  color: var(--text);
}

.dropdown-item:active {
  color: var(--accent-contrast);
  background-color: var(--accent);
}

/* ============ DROPDOWN USER MENU ============ */
.dropdown-menu-user {
  padding: 0.5rem 0;
  min-width: 180px;
}

.dropdown-menu-user .dropdown-item {
  padding: 0.75rem 1.25rem;
  transition: background-color 0.15s ease;
}

.dropdown-menu-user .dropdown-item:hover {
  background-color: var(--surface-2);
}

.dropdown-menu-user .dropdown-divider {
  margin: 0.35rem 0;
}

.user-avatar-img,
.user-avatar {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  object-fit: cover;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  background: color-mix(in srgb, #ffffff 25%, var(--accent));
  color: #ffffff;
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.avatar-option {
  min-width: 0;
}

.avatar-tile {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.35rem;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
  background: var(--surface);
}

.avatar-tile-img {
  width: 52px;
  height: 52px;
}

.btn-check:checked + .avatar-tile {
  border-color: var(--accent);
  transform: translateY(-1px);
}

html[data-theme="dark"] .user-avatar {
  background: color-mix(in srgb, var(--accent) 65%, #ffffff 10%);
  color: #ffffff;
}

html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .small,
html[data-theme="dark"] .form-label,
html[data-theme="dark"] .table,
html[data-theme="dark"] .table > :not(caption) > * > *,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-title,
html[data-theme="dark"] .card-text,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .dropdown-item,
html[data-theme="dark"] .alert {
  color: var(--text) !important;
}

html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .table,
html[data-theme="dark"] .table > :not(caption) > * > *,
html[data-theme="dark"] .alert,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .btn-outline-secondary,
html[data-theme="dark"] .btn-outline-primary,
html[data-theme="dark"] .btn-outline-danger {
  border-color: var(--border) !important;
}

html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .alert,
html[data-theme="dark"] .table,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
  background-color: var(--surface) !important;
}

html[data-theme="dark"] .table {
  --bs-table-color: var(--text);
  --bs-table-bg: var(--surface);
  --bs-table-border-color: var(--border);
  --bs-table-striped-color: var(--text);
  --bs-table-striped-bg: color-mix(in srgb, var(--surface) 84%, var(--surface-2));
  --bs-table-hover-color: var(--text);
  --bs-table-hover-bg: color-mix(in srgb, var(--surface) 76%, var(--surface-2));
  --bs-table-active-color: var(--text);
  --bs-table-active-bg: color-mix(in srgb, var(--surface) 68%, var(--surface-2));
}

html[data-theme="dark"] a,
html[data-theme="dark"] .btn-link {
  color: #93c5fd;
}

html[data-theme="dark"] a:hover,
html[data-theme="dark"] .btn-link:hover {
  color: #bfdbfe;
}

html[data-theme="dark"] .section-title,
html[data-theme="dark"] .h1,
html[data-theme="dark"] .h2,
html[data-theme="dark"] .h3,
html[data-theme="dark"] .h4,
html[data-theme="dark"] .h5,
html[data-theme="dark"] .h6,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] .stat-value {
  color: #fff !important;
}

@media (min-width: 1200px) {
  .home-primary-grid {
    /* Keep cards inside visible app area; avoid pushing into footer zone */
    height: calc(100dvh - 250px);
    min-height: 0;
  }

  .home-primary-grid > [class*="col-"] {
    display: flex;
    min-height: 0;
  }

  .home-primary-grid .card {
    flex: 1;
    min-height: 0;
  }

  .home-primary-grid .card .card-body {
    overflow-y: auto;
    overflow-x: hidden;
  }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 7, 18, 0.72);
  z-index: 2000;
  pointer-events: none;
}

.loading-overlay.is-visible {
  display: flex;
  pointer-events: all;
  cursor: not-allowed;
}

.loading-overlay-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.loading-overlay-gif {
  width: 192px;
  height: 192px;
  object-fit: contain;
}

.loading-overlay-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.03em;
}

.live-score-card {
  border: 1px solid var(--border);
}

.live-meta-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 0.75rem 0.9rem;
  height: 100%;
}

.match-create-shell {
  max-width: 1320px;
  margin: 0 auto;
}

.match-create-card {
  border: 1px solid var(--border);
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 96%, var(--accent) 4%) 0%, var(--surface-2) 100%);
}

.match-quick-toggle {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.match-mode-toggle {
  border-radius: 0.75rem;
  overflow: hidden;
}

.match-mode-toggle .btn {
  min-width: 150px;
  border-color: var(--border);
  color: var(--text);
  background: transparent;
  font-weight: 600;
}

.match-mode-toggle .btn-check:checked + .btn {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.match-create-players {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.player-slot {
  min-width: 0;
}

.match-create-players.is-1v1 .team2-field {
  display: none;
}

.match-create-players.is-2v2 .slot-1 {
  order: 1;
}

.match-create-players.is-2v2 .slot-3 {
  order: 2;
}

.match-create-players.is-2v2 .slot-2 {
  order: 3;
}

.match-create-players.is-2v2 .slot-4 {
  order: 4;
}

.player-picker-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 0.95rem;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.player-picker-action {
  width: 100%;
}

#playerSearchList .list-group-item {
  border-color: var(--border);
}

html[data-theme="dark"] .player-picker-box {
  background: var(--surface);
}

html[data-theme="dark"] .match-quick-toggle {
  background: color-mix(in srgb, var(--surface) 96%, transparent);
}

@media (max-width: 1199.98px) {
  .match-create-shell {
    max-width: 1080px;
  }
}

@media (max-width: 991.98px) {
  .match-create-players {
    grid-template-columns: 1fr;
  }

  .match-create-players.is-2v2 .slot-1,
  .match-create-players.is-2v2 .slot-2,
  .match-create-players.is-2v2 .slot-3,
  .match-create-players.is-2v2 .slot-4 {
    order: initial;
  }

  .match-mode-toggle {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .match-mode-toggle .btn {
    min-width: 0;
  }
}

.btn-activate-white {
  background-color: #ffffff;
  color: var(--bs-success);
  border-color: var(--border);
}

.btn-activate-white:hover,
.btn-activate-white:focus,
.btn-activate-white:active {
  background-color: #ffffff;
  color: var(--bs-success);
  border-color: var(--border);
}

html[data-theme="dark"] .btn-activate-white {
  background-color: var(--surface);
  color: #22c55e;
  border-color: var(--border);
}

html[data-theme="dark"] .btn-activate-white:hover,
html[data-theme="dark"] .btn-activate-white:focus,
html[data-theme="dark"] .btn-activate-white:active {
  background-color: var(--surface);
  color: #22c55e;
  border-color: var(--border);
}

.match-hero {
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}

.match-hero-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
}

.match-hero-player {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.match-team-avatars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 94px;
}

.match-team-avatar {
  width: 78px;
  height: 78px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface);
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.match-team-avatar-secondary {
  width: 66px;
  height: 66px;
  margin-left: -0.2rem;
}

.match-hero-avatar {
  width: 92px;
  height: 92px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface);
  object-fit: cover;
}

.match-hero-name {
  font-weight: 700;
}

.match-hero-center {
  min-width: 180px;
}

.match-hero-score {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 800;
  line-height: 1;
}

.match-hero-score span {
  opacity: 0.65;
  margin: 0 0.35rem;
}

.match-hero-format {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.match-fact-card {
  border: 1px solid var(--border);
  background: var(--surface);
}

.match-fact-card .fw-semibold {
  min-height: 1.4rem;
}

/* ============ ACCESSIBILITY & FOCUS STATES ============ */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Remove default outline, add better focus state */
.btn:focus,
.form-control:focus,
.form-select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

html[data-theme="dark"] .btn:focus,
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
}

/* ============ BUTTON ENHANCEMENTS ============ */
.btn {
  transition: all 0.2s ease;
  min-height: 2.25rem;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary,
.btn-danger,
.btn-success {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover,
.btn-danger:hover,
.btn-success:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger {
  border-width: 1.5px;
}

.btn-sm {
  min-height: auto;
  font-size: 0.875rem;
}

/* ============ FORM IMPROVEMENTS ============ */
.form-control,
.form-select,
textarea {
  border-width: 1.5px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:is(:valid) {
  border-color: #22c55e;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2322c55e' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
}

.form-control:is(:invalid:not(:placeholder-shown)) {
  border-color: #ef4444;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='12 12 24 24'%3e%3ccircle cx='24' cy='24' r='11' fill='none' stroke='%23ef4444' stroke-width='2'/%3e%3cpath fill='%23ef4444' d='M24 17v5M24 26h.01'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25rem;
  padding-right: 2.75rem;
}

.form-label {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.form-label small {
  font-weight: 400;
  color: var(--text-muted);
}

.form-text {
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

.invalid-feedback {
  display: block;
  font-size: 0.85rem;
  margin-top: 0.35rem;
  color: #ef4444;
  font-weight: 500;
}

/* ============ ALERTS & VALIDATION ============ */
.alert {
  border-radius: 8px;
  border: 1px solid currentColor;
  padding: 1rem;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-success {
  background-color: color-mix(in srgb, #22c55e 10%, var(--surface));
  border-color: #22c55e;
  color: var(--text);
}

html[data-theme="dark"] .alert-success {
  background-color: color-mix(in srgb, #22c55e 15%, var(--surface));
}

.alert-danger {
  background-color: color-mix(in srgb, #ef4444 10%, var(--surface));
  border-color: #ef4444;
  color: var(--text);
}

html[data-theme="dark"] .alert-danger {
  background-color: color-mix(in srgb, #ef4444 15%, var(--surface));
}

.alert-info {
  background-color: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-color: var(--accent);
  color: var(--text);
}

html[data-theme="dark"] .alert-info {
  background-color: color-mix(in srgb, var(--accent) 15%, var(--surface));
}

/* ============ LINK CONSISTENCY ============ */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: color-mix(in srgb, var(--accent) 80%, var(--text));
  text-decoration: underline;
}

a:active {
  color: color-mix(in srgb, var(--accent) 60%, var(--text));
}

html[data-theme="dark"] a {
  color: #93c5fd;
}

html[data-theme="dark"] a:hover {
  color: #bfdbfe;
}

/* ============ PAGE CARDS STYLING ============ */
.page-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.page-card .card-body {
  padding: 1.5rem;
}

@media (max-width: 768px) {
  .page-card .card-body {
    padding: 1rem;
  }
}

/* ============ HEADING HIERARCHY ============ */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  margin-bottom: 0.75rem;
  font-weight: 700;
  color: var(--text);
}

h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h4 { font-size: 1.3rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 0.95rem; }

/* ============ TABLE RESPONSIVENESS ============ */
.table-responsive {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  padding: 0.75rem 1rem;
}

.table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s ease;
}

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

.table td,
.table th {
  vertical-align: middle;
  padding: 1rem;
}

.table-sm td,
.table-sm th {
  padding: 0.75rem;
}

@media (max-width: 768px) {
  .table thead {
    font-size: 0.7rem;
  }

  .table td,
  .table th {
    padding: 0.6rem 0.5rem;
    font-size: 0.875rem;
  }

  .table-sm td,
  .table-sm th {
    padding: 0.5rem 0.35rem;
  }
}

/* ============ ACTION BUTTONS IN TABLES ============ */
.btn-table-action {
  margin: 0 2px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .btn-table-action {
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
  }
}

/* ============ MOBILE ENHANCEMENTS ============ */
@media (max-width: 576px) {
  .btn {
    min-height: 2.5rem;
    padding: 0.65rem 1.2rem;
    font-size: 0.95rem;
  }

  .btn-sm {
    min-height: 2.2rem;
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
  }

  .form-control,
  .form-select {
    font-size: 16px;
    padding: 0.75rem 0.9rem;
    min-height: 2.75rem;
  }

  .form-label {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
  }

  .card-body {
    padding: 1rem;
  }
}
.live-scoreboard-shell {
}

.live-scoreboard-shell h1 {
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.live-scoreboard-shell .small {
  display: block;
  margin-top: 0.25rem;
}

/* ============ LIVE SCOREBOARD EMPTY STATE ============ */
.live-scoreboard-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.live-scoreboard-empty .text-muted {
  font-size: 1rem;
  letter-spacing: 0.3px;
}

/* ============ APP REDESIGN: DRAWER + HOME DASHBOARD ============ */
.app-cyber {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-contrast: #ffffff;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, var(--bg) 0%, var(--surface-2) 100%);
}

html[data-theme="dark"] .app-cyber {
  --bg: #05070f;
  --surface: #090d1a;
  --surface-2: #0d1324;
  --text: #d8e4ff;
  --text-muted: #8797ba;
  --border: #18233f;
  --accent: #00d4ff;
  --accent-contrast: #051018;
  --shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
  background: radial-gradient(circle at 20% 0%, #0c1730 0%, #05070f 35%, #04060d 100%);
}

.drawer-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  height: 100dvh;
}

.app-mobile-topbar {
  display: none;
}

.app-drawer {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 90%, #000 10%);
  min-height: 0;
}

.drawer-brand {
  display: flex;
  align-items: center;
  padding: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.drawer-brand:hover {
  text-decoration: none;
  color: #ffffff;
}

.drawer-brand-mark {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 135px;
  object-fit: cover;
}

.drawer-backdrop {
  display: none;
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 0.8rem;
}

.drawer-link {
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  padding: 0.7rem 0.8rem;
  transition: all 0.18s ease;
}

.drawer-link:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  text-decoration: none;
}

.drawer-link.active {
  color: #ffffff;
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 45%, transparent);
}

.drawer-account {
  margin-top: auto;
  padding: 1rem 0.9rem;
  border-top: 1px solid var(--border);
}

.drawer-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.8rem;
}

.drawer-user-name {
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.drawer-user-role {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.drawer-account-actions {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.app-main {
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.app-content-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.2rem 1.3rem 2rem;
}

.mobile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.mobile-actions .btn,
.mobile-actions form {
  margin: 0;
}

.home-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.home-tab-card {
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--surface) 88%, #000 12%);
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  border-radius: 12px;
  min-height: 82px;
  transition: all 0.2s ease;
}

.home-tab-card:hover {
  transform: translateY(-1px);
}

.home-tab-card.active {
  color: #ffffff;
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

.home-panel {
  display: none;
}

.home-panel.is-active {
  display: block;
}

.home-card {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, #000 8%);
}

.home-card-full-height {
  min-height: 100%;
}

.home-list-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  background: color-mix(in srgb, var(--surface) 82%, #000 18%);
}

.home-list-item + .home-list-item {
  margin-top: 0.6rem;
}

.home-leaderboard {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.home-leaderboard li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0;
}

.home-player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.75rem;
}

.home-player-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.15rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

@media (max-width: 991.98px) {
  .drawer-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    position: relative;
  }

  .app-mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 92%, #000 8%);
    position: sticky;
    top: 0;
    z-index: 1042;
  }

  .app-mobile-brand {
    display: block;
    width: min(46vw, 210px);
  }

  .app-mobile-brand-mark {
    width: 100%;
    height: auto;
    max-height: 42px;
    object-fit: cover;
    display: block;
  }

  .app-drawer {
    border-right: 1px solid var(--border);
    border-bottom: 0;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, 320px);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 1045;
    box-shadow: 0 16px 46px rgba(0, 0, 0, 0.35);
  }

  .drawer-nav {
    flex-direction: column;
    overflow-x: visible;
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
  }

  .drawer-link {
    white-space: normal;
  }

  .drawer-account {
    margin-top: auto;
  }

  body.drawer-open {
    overflow: hidden;
  }

  body.drawer-open .app-drawer {
    transform: translateX(0);
  }

  .drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(3, 7, 18, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1040;
  }

  body.drawer-open .drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 767.98px) {
  .home-switcher {
    grid-template-columns: 1fr;
  }

  .app-content-wrap {
    padding: 1rem 0.85rem 1.3rem;
  }

  .mobile-stack-sm {
    align-items: flex-start !important;
    flex-direction: column;
  }

  .mobile-stack-sm > .btn {
    width: 100%;
  }

  .mobile-actions .btn {
    flex: 1 1 calc(50% - 0.45rem);
  }

  .table-mobile-cards thead {
    display: none;
  }

  .table-mobile-cards,
  .table-mobile-cards tbody,
  .table-mobile-cards tr,
  .table-mobile-cards td {
    display: block;
    width: 100%;
  }

  .table-mobile-cards tbody tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 0.7rem;
    margin-bottom: 0.65rem;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
  }

  .table-mobile-cards tbody tr:last-child {
    margin-bottom: 0;
  }

  .table-mobile-cards td {
    border: 0;
    padding: 0.35rem 0;
    text-align: left !important;
  }

  .table-mobile-cards td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 0.15rem;
  }

  .table-mobile-cards td[data-label="Ações"] {
    margin-top: 0.15rem;
  }

  .table-mobile-cards td[data-label="Ações"]::before {
    margin-bottom: 0.35rem;
  }

  .table-mobile-cards .mobile-actions .btn {
    flex: 1 1 calc(50% - 0.45rem);
  }
}

@media (max-width: 575.98px) {
  .home-player-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-filter-form .col-auto,
  .mobile-filter-form .col {
    width: 100%;
  }

  .mobile-filter-form .btn {
    width: 100%;
  }

  .mobile-actions .btn,
  .table-mobile-cards .mobile-actions .btn {
    flex: 1 1 100%;
  }

  .loading-overlay-box {
    padding: 1.2rem 1rem;
    max-width: calc(100vw - 2rem);
  }

  .loading-overlay-gif {
    width: 140px;
    height: 140px;
  }
}

.admin-shell {
  display: grid;
  gap: 1rem;
}

.admin-head {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.8rem;
}

.admin-title {
  font-size: clamp(1.8rem, 2.8vw, 2.5rem);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: color-mix(in srgb, #ff38da 70%, var(--text));
  text-shadow: 0 0 18px color-mix(in srgb, #ff38da 45%, transparent);
}

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

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.2rem;
}

.admin-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
  padding: 0.5rem 0.6rem;
}

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

.admin-tab.active {
  color: color-mix(in srgb, #ff38da 70%, var(--text));
  border-bottom-color: color-mix(in srgb, #ff38da 80%, var(--accent));
  text-shadow: 0 0 14px color-mix(in srgb, #ff38da 35%, transparent);
}

.admin-panel {
  margin-top: 0.5rem;
}

.admin-kpi-link {
  text-decoration: none;
  color: inherit;
}

.admin-kpi-card {
  border: 1px solid color-mix(in srgb, var(--accent) 65%, var(--border));
  background: color-mix(in srgb, var(--surface) 90%, #000 10%);
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 20%, transparent);
}

.admin-kpi-card.is-hot {
  border-color: color-mix(in srgb, #ff38da 70%, var(--border));
  box-shadow: 0 0 18px color-mix(in srgb, #ff38da 30%, transparent);
}

.admin-kpi-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.admin-card {
  border: 1px solid color-mix(in srgb, var(--border) 85%, var(--accent));
  background: color-mix(in srgb, var(--surface) 92%, #000 8%);
}

.admin-empty-state {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.admin-compact-list li + li {
  margin-top: 0.35rem;
}

.admin-settings-grid {
  display: grid;
  gap: 0.7rem;
}

.admin-setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  border: 1px solid var(--border);
  padding: 0.8rem;
}

@media (max-width: 991.98px) {
  .admin-setting-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
