/* public/assets/css/app.css - Modern Minimal Design System */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,600;1,700&family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,600;1,700&family=Inter:wght@300;400;500;600;700;800&display=swap');

:root, [data-theme="light"] {
  --font-main: 'Be Vietnam Pro', 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Be Vietnam Pro', 'Plus Jakarta Sans', var(--font-main);

  /* Color Palette - Apple / Vercel Neutral Light Mode */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-card-subtle: #f8fafc;
  --bg-sidebar: #ffffff;
  --sidebar-border: #e2e8f0;
  --sidebar-text: #0f172a;
  --sidebar-text-muted: #64748b;
  --sidebar-link: #475569;
  --sidebar-link-hover: #0284c7;
  --sidebar-link-bg-hover: #f1f5f9;
  --sidebar-active-bg: #e0f2fe;
  --sidebar-active-color: #0284c7;
  --sidebar-card-bg: #f8fafc;
  --sidebar-card-border: #e2e8f0;
  --header-bg: rgba(255, 255, 255, 0.85);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;

  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;

  --accent: #10b981;
  --accent-light: #d1fae5;

  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;

  --border: #e2e8f0;
  --border-focus: #38bdf8;
  --border-subtle: rgba(0, 0, 0, 0.06);

  --table-th-bg: #f8fafc;
  --table-tr-hover: #f1f5f9;

  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --input-text: #0f172a;

  --modal-bg: #ffffff;
  --modal-card-bg: #ffffff;

  --badge-wait-bg: #f1f5f9;
  --badge-wait-color: #475569;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 15px rgba(2, 132, 199, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  /* Color Palette - Apple / Linear Dark Mode */
  --bg-app: #090d16;
  --bg-card: #0f172a;
  --bg-card-hover: #1e293b;
  --bg-card-subtle: #131d31;
  --bg-sidebar: #0b1120;
  --sidebar-border: #1e293b;
  --sidebar-text: #f8fafc;
  --sidebar-text-muted: #94a3b8;
  --sidebar-link: #94a3b8;
  --sidebar-link-hover: #38bdf8;
  --sidebar-link-bg-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active-bg: rgba(56, 189, 248, 0.12);
  --sidebar-active-color: #38bdf8;
  --sidebar-card-bg: rgba(255, 255, 255, 0.03);
  --sidebar-card-border: rgba(255, 255, 255, 0.08);
  --header-bg: rgba(15, 23, 42, 0.85);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;

  --primary: #38bdf8;
  --primary-hover: #0284c7;
  --primary-light: rgba(56, 189, 248, 0.15);

  --accent: #10b981;
  --accent-light: rgba(16, 185, 129, 0.15);

  --warning: #fbbf24;
  --warning-light: rgba(245, 158, 11, 0.15);
  --danger: #f87171;
  --danger-light: rgba(239, 68, 68, 0.15);

  --border: #1e293b;
  --border-focus: #38bdf8;
  --border-subtle: rgba(255, 255, 255, 0.08);

  --table-th-bg: #0b1120;
  --table-tr-hover: #1e293b;

  --input-bg: #070c18;
  --input-border: #334155;
  --input-text: #f8fafc;

  --modal-bg: #0f172a;
  --modal-card-bg: #0f172a;

  --badge-wait-bg: #1e293b;
  --badge-wait-color: #94a3b8;

  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.25);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

html, body {
  max-width: 100vw;
  overflow-x: clip;
}

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: clip;
  position: relative;
  align-items: flex-start;
}

/* Sidebar - Soft Modern Aesthetic */
.app-sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  flex-shrink: 0;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  align-self: flex-start;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, background-color 0.25s ease, border-color 0.25s ease;
}

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

/* Sidebar Backdrop (Mobile/Tablet) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.sidebar-backdrop.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  text-decoration: none;
  color: var(--sidebar-text);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--sidebar-text);
}

.sidebar-close-btn {
  display: none;
  background: var(--sidebar-card-bg);
  border: 1px solid var(--sidebar-border);
  color: var(--sidebar-text);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: var(--transition);
}
.sidebar-close-btn:hover {
  background: var(--sidebar-link-bg-hover);
  color: var(--primary);
}

.brand-icon {
  font-size: 26px;
  background: linear-gradient(135deg, #0284c7, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 4px rgba(2, 132, 199, 0.15));
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--sidebar-text);
  line-height: 1.2;
}

.brand-text span {
  font-size: 10.5px;
  color: var(--sidebar-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.nav-menu {
  list-style: none;
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--sidebar-link);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: var(--transition);
}

.nav-item a:hover {
  background: var(--sidebar-link-bg-hover);
  color: var(--sidebar-link-hover);
  transform: translateX(3px);
}

.nav-item.active a {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-color);
  font-weight: 600;
  box-shadow: none;
}

.nav-item.active a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3.5px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}

.nav-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  font-size: 15px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.nav-item a:hover .nav-icon-wrapper {
  transform: scale(1.1);
}

.icon-tournaments { color: #d97706; }
.icon-admin { color: #0284c7; }
.icon-news { color: #0284c7; }
.icon-settings { color: #64748b; }
.icon-pairing { color: #7c3aed; }
.icon-users { color: #0d9488; }
.icon-logout { color: #ef4444; }

[data-theme="dark"] .icon-tournaments { color: #f59e0b; }
[data-theme="dark"] .icon-admin { color: #38bdf8; }
[data-theme="dark"] .icon-news { color: #38bdf8; }
[data-theme="dark"] .icon-settings { color: #94a3b8; }
[data-theme="dark"] .icon-pairing { color: #c084fc; }
[data-theme="dark"] .icon-users { color: #2dd4bf; }
[data-theme="dark"] .icon-logout { color: #f87171; }

.nav-item-logout a {
  color: var(--sidebar-text-muted);
}
.nav-item-logout a:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

/* Sidebar Footer & Account Details */
.sidebar-footer {
  padding: 16px 4px 0;
  margin-top: auto;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-account-card {
  background: var(--sidebar-card-bg);
  border: 1px solid var(--sidebar-card-border);
  border-radius: 12px;
  padding: 12px;
  transition: var(--transition);
}

.account-card-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--sidebar-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.account-card-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--sidebar-text);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-card-role {
  margin-top: 6px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.role-superadmin {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

[data-theme="dark"] .role-superadmin {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.role-manager {
  background: rgba(2, 132, 199, 0.1);
  color: #0369a1;
  border: 1px solid rgba(2, 132, 199, 0.2);
}

[data-theme="dark"] .role-manager {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.sidebar-theme-btn {
  width: 100%;
  justify-content: center;
  background: var(--sidebar-card-bg);
  border: 1px solid var(--sidebar-card-border);
  color: var(--sidebar-text);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}

.sidebar-theme-btn:hover {
  background: var(--sidebar-link-bg-hover);
  border-color: var(--border-focus);
  color: var(--sidebar-text);
}

/* Main Content */
.app-main {
  flex: 1 1 0%;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  min-height: 100vh;
}

.app-header {
  height: 64px;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.header-left {
  display: flex;
  align-items: center;
  min-width: 0;
}

.sidebar-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  cursor: pointer;
  font-size: 17px;
  transition: var(--transition);
  margin-right: 12px;
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.header-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.app-content {
  padding: 28px;
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Cards & Containers */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  margin-bottom: 24px;
  width: 100%;
  box-sizing: border-box;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

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

.card-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.stat-icon.blue {
  background: var(--primary-light);
  color: var(--primary);
}

.stat-icon.green {
  background: var(--accent-light);
  color: var(--accent);
}

.stat-icon.amber {
  background: var(--warning-light);
  color: var(--warning);
}

.stat-icon.red {
  background: var(--danger-light);
  color: var(--danger);
}

.stat-info h3 {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-display);
  line-height: 1.1;
}

.stat-info p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

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

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.table th {
  background: var(--table-th-bg);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
}

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

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

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

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

.badge-live {
  background: #fee2e2;
  color: #dc2626;
  animation: pulse 2s infinite;
}

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

.badge-wait {
  background: var(--badge-wait-bg);
  color: var(--badge-wait-color);
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition);
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

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

.btn-success:hover {
  background: #059669;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--table-tr-hover);
  color: var(--text-main);
}

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

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

.btn-tv {
  background: #0f172a;
  color: #38bdf8;
  border: 1px solid #38bdf8;
}

.btn-tv:hover {
  background: #1e293b;
  color: #7dd3fc;
}

/* Form inputs */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--input-border);
  background-color: var(--input-bg);
  color: var(--input-text);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

/* Alert Notification */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* ==========================================================================
   ADMIN RESPONSIVE TABS & CONTAINER STYLING
   ========================================================================== */
.admin-tab-container {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.admin-tab-container::-webkit-scrollbar {
  display: none;
}

.admin-tab-btn {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  text-decoration: none;
  font-family: inherit;
}
.admin-tab-btn:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.02);
}
[data-theme="dark"] .admin-tab-btn:hover {
  background: rgba(255, 255, 255, 0.04);
}
.admin-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--primary-light);
}

/* ==========================================================================
   TABLE & OVERFLOW CONTAINERS (Zero-Blowout Protection)
   ========================================================================== */
.table-container,
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  position: relative;
}

.table-container::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}
.table-container::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
  background: transparent;
}
.table-container::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.25);
  border-radius: 4px;
}
.table-container::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.45);
}

/* ==========================================================================
   RESPONSIVE GRID UTILITIES
   ========================================================================== */
.grid-responsive-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

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

.grid-responsive-teams {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.grid-responsive-pairing {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 24px;
  align-items: start;
}

.grid-responsive-standings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.grid-responsive-min200 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 12px;
}

.grid-responsive-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.knockout-bracket-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
}

/* ==========================================================================
   COMPREHENSIVE RESPONSIVE BREAKPOINTS (Linear / Stripe Quality)
   ========================================================================== */

/* Laptop & Tablet Landscape (<= 1024px) */
@media (max-width: 1024px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 84vw);
    height: 100%;
    z-index: 1001;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

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

  .sidebar-close-btn {
    display: flex;
  }

  .sidebar-toggle-btn {
    display: inline-flex;
  }

  .app-header {
    padding: 0 20px;
    height: 60px;
  }

  .app-content {
    padding: 20px 18px;
  }

  .grid-responsive-teams {
    grid-template-columns: 1fr;
  }

  .grid-responsive-pairing {
    grid-template-columns: 1fr;
  }

  .grid-responsive-4col {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablet Portrait & Mobile Large (<= 768px) */
@media (max-width: 768px) {
  .app-header {
    padding: 0 14px;
    height: 56px;
  }

  .header-title {
    font-size: 16px;
  }

  .header-actions .btn .btn-text {
    display: none;
  }

  .header-actions .btn {
    padding: 7px 10px;
  }

  .app-content {
    padding: 14px 12px;
  }

  .card {
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
  }

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

  .grid-responsive-2col,
  .grid-responsive-3col,
  .grid-responsive-4col {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .grid-responsive-kpi {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
    gap: 12px;
    margin-bottom: 18px;
  }

  .stat-card {
    padding: 14px 12px;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .stat-info h3 {
    font-size: 20px;
  }

  .stat-info p {
    font-size: 11.5px;
  }

  .admin-tab-btn {
    padding: 8px 12px;
    font-size: 12.5px;
  }

  .table th,
  .table td {
    padding: 10px 12px;
    font-size: 12.5px;
  }
}

/* Mobile Small (<= 480px) */
@media (max-width: 480px) {
  .app-header {
    padding: 0 10px;
  }

  .header-title {
    font-size: 15px;
    max-width: 150px;
  }

  .app-content {
    padding: 12px 8px;
  }

  .card {
    padding: 14px 10px;
  }

  .grid-responsive-kpi {
    grid-template-columns: 1fr;
  }

  .btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .theme-label {
    display: none;
  }
}

/* ==========================================================================
   APP MODERN MODAL & SWEETALERT2 STYLING (Apple / Linear Design System)
   ========================================================================== */

/* SweetAlert2 Backdrop & Container */
.swal2-container.app-swal-container {
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  background: rgba(15, 23, 42, 0.65) !important;
  z-index: 999999 !important;
}

/* SweetAlert2 Popup Card */
.swal2-popup.app-swal-popup {
  border-radius: 24px !important;
  padding: 28px 24px 24px !important;
  background: var(--modal-bg) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
  font-family: var(--font-main) !important;
  max-width: 540px !important;
  width: 92% !important;
  color: var(--text-main) !important;
}

.swal2-title.app-swal-title {
  font-family: var(--font-display) !important;
  font-size: 20px !important;
  font-weight: 800 !important;
  color: var(--text-main) !important;
  padding: 0 !important;
  margin: 12px 0 6px !important;
  letter-spacing: -0.02em !important;
}

.swal2-html-container.app-swal-html {
  font-size: 14px !important;
  color: var(--text-muted) !important;
  line-height: 1.6 !important;
  margin: 8px 0 18px !important;
  text-align: left !important;
}

.swal2-actions.app-swal-actions {
  display: flex !important;
  gap: 10px !important;
  width: 100% !important;
  justify-content: flex-end !important;
  margin: 16px 0 0 !important;
}

.app-swal-btn-cancel {
  background: var(--bg-card-hover) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border) !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  padding: 10px 18px !important;
  border-radius: 12px !important;
  cursor: pointer !important;
  transition: var(--transition) !important;
  text-decoration: none !important;
}
.app-swal-btn-cancel:hover {
  background: var(--border) !important;
  color: var(--text-main) !important;
}

.app-swal-btn-confirm {
  font-weight: 700 !important;
  font-size: 13px !important;
  padding: 10px 22px !important;
  border-radius: 12px !important;
  cursor: pointer !important;
  border: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  transition: var(--transition) !important;
  text-decoration: none !important;
}

.app-swal-btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4) !important;
}
.app-swal-btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.5) !important;
}

.app-swal-btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4) !important;
}
.app-swal-btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #075985) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.5) !important;
}

/* Fallback Standalone Modal */
.app-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.app-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.app-modal-card {
  background: var(--modal-card-bg);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 24px;
  max-width: 520px;
  width: 100%;
  padding: 28px 24px 22px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.92) translateY(12px);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.app-modal-backdrop.active .app-modal-card {
  transform: scale(1) translateY(0);
}

/* Floating Toast Notifications (Top-Right) */
.app-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.app-toast {
  pointer-events: auto;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 700;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  max-width: 380px;
}
.app-toast.show {
  transform: translateX(0);
  opacity: 1;
}
.app-toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.app-toast.success .app-toast-icon { color: #10b981; }
.app-toast.error .app-toast-icon { color: #ef4444; }
.app-toast.warning .app-toast-icon { color: #f59e0b; }
.app-toast.info .app-toast-icon { color: #38bdf8; }

/* ==========================================================================
   THEME TOGGLE BUTTON COMPONENT (Apple / Linear Design System)
   ========================================================================== */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: var(--transition);
  user-select: none;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.theme-toggle-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: var(--text-main);
}

.theme-toggle-btn .theme-icon-sun {
  display: none;
  color: #fbbf24;
  font-size: 15px;
  animation: spinSlow 12s linear infinite;
}

.theme-toggle-btn .theme-icon-moon {
  display: inline-block;
  color: #6366f1;
  font-size: 14px;
}

[data-theme="dark"] .theme-toggle-btn .theme-icon-sun {
  display: inline-block;
}

[data-theme="dark"] .theme-toggle-btn .theme-icon-moon {
  display: none;
}

.theme-toggle-btn .theme-label {
  font-size: 12px;
  font-weight: 700;
}

.theme-toggle-circle {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}