/* ═══════════════════════════════════════
   PAINEL PREMIUM — iGaming API Dashboard
   ═══════════════════════════════════════ */

:root {
  --bg: #f0f4f9;
  --bg-alt: #e8eef5;
  --card: #ffffff;
  --card-hover: #f8fafc;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  /* Brand colors */
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-light: #60a5fa;
  --blue-soft: #eff6ff;
  --blue-glow: rgba(37, 99, 235, 0.15);

  /* Status */
  --success: #059669;
  --success-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --info: #0284c7;
  --info-soft: #f0f9ff;

  /* Glass */
  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.1);

  /* Border radius */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══ DARK THEME ═══ */
[data-theme="dark"] {
  --bg: #0a0f14;
  --bg-alt: #0d141a;
  --card: #111b21;
  --card-hover: #16222a;
  --text: #e8edf2;
  --text-secondary: #94a3b8;
  --muted: #64748b;
  --line: #1e2a33;
  --line-strong: #2a3845;

  --blue: #3b82f6;
  --blue-dark: #2563eb;
  --blue-light: #93c5fd;
  --blue-soft: #0f1d30;
  --blue-glow: rgba(59, 130, 246, 0.12);

  --success: #10b981;
  --success-soft: #0a2018;
  --danger: #ef4444;
  --danger-soft: #200e0e;
  --warning: #f59e0b;
  --warning-soft: #1f1808;
  --info: #38bdf8;
  --info-soft: #0a1a24;

  --glass: rgba(17, 27, 33, 0.82);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.35);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ═══ THEME TOGGLE ═══ */
.theme-toggle {
  width: 40px;
  min-height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--blue);
  cursor: pointer;
  font-size: 18px;
  transition: var(--transition);
}
.theme-toggle:hover {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  transform: rotate(15deg);
}
.auth-theme-toggle {
  position: fixed;
  z-index: 80;
  top: 16px;
  right: 16px;
}

/* ═══ FORM ELEMENTS ═══ */
button, input, select, textarea {
  min-height: 42px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  background: var(--card);
  color: var(--text);
  transition: var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}
input::placeholder {
  color: var(--muted);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 18px;
  border: 1px solid var(--blue);
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  box-shadow: 0 4px 12px var(--blue-glow);
  transition: var(--transition);
  white-space: nowrap;
}
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--blue-glow);
  filter: brightness(1.05);
}
button:active {
  transform: translateY(0);
}

button.btn-danger {
  border-color: var(--danger);
  background: linear-gradient(135deg, #ef4444, var(--danger));
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}
button.btn-danger:hover {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.2);
}

button.btn-neutral {
  border-color: var(--line);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
button.btn-neutral:hover {
  background: var(--card-hover);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

button.btn-success {
  border-color: var(--success);
  background: linear-gradient(135deg, var(--success), #047857);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.15);
}

button.btn-sm {
  min-height: 32px;
  padding: 5px 12px;
  font-size: 12px;
}

button i {
  font-size: 16px;
  line-height: 1;
}

/* ═══ CODE ═══ */
code {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--bg-alt);
  color: var(--text);
  font-size: 12px;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

/* ═══ AUTH PAGES ═══ */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--bg), var(--bg-alt));
}
.auth-card {
  width: min(420px, 100%);
  padding: 48px 28px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-xl);
  animation: fadeUp 0.5s ease;
}
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}
.auth-brand img {
  width: 200px;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  object-fit: contain;
  padding: 14px 20px;
  background: linear-gradient(135deg, #0a2744, #0f3b64);
  box-shadow: 0 12px 30px rgba(10, 39, 68, 0.3);
}
.auth-brand span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.auth-card form {
  display: grid;
  gap: 12px;
}
.auth-card form label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.auth-card form button {
  margin-top: 4px;
  min-height: 46px;
  font-size: 15px;
}
.auth-card form p {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}
.auth-card form p a {
  color: var(--blue);
  font-weight: 600;
}
.auth-card form p a:hover {
  text-decoration: underline;
}

/* ═══ SIDEBAR ═══ */
.sidebar {
  position: fixed;
  inset: 12px auto 12px 12px;
  width: 220px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}
.sidebar:hover {
  box-shadow: var(--shadow-lg);
}
.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.brand img {
  width: 160px;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: linear-gradient(135deg, #0a2744, #0f3b64);
}
.brand small {
  color: var(--blue);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 2px;
}
.sidebar nav {
  display: grid;
  gap: 2px;
  flex: 1;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  transition: var(--transition);
  position: relative;
}
.sidebar nav a:hover {
  background: var(--blue-soft);
  color: var(--text);
}
.sidebar nav a.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}
.sidebar nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--blue);
}
.sidebar nav a i {
  font-size: 18px;
  width: 20px;
  text-align: center;
}
.sidebar nav a.active i {
  color: var(--blue);
}
.sidebar > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  transition: var(--transition);
}
.sidebar > a:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ═══ APP LAYOUT ═══ */
.app {
  margin-left: 244px;
  padding: 12px 16px 32px;
  min-height: 100vh;
  animation: fadeIn 0.3s ease;
}

/* ═══ TOPBAR ═══ */
.topbar {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.topbar > div:first-child strong {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}
.topbar > div:first-child span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-alt);
  font-weight: 700;
  font-size: 12px;
  color: var(--text-secondary);
}
.pill i {
  color: var(--blue);
  font-size: 15px;
}

/* ═══ METRICS CARDS ═══ */
.grid.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.metrics article {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  animation: fadeUp 0.4s ease both;
  position: relative;
  overflow: hidden;
}
.metrics article:nth-child(1) { animation-delay: 0.05s; }
.metrics article:nth-child(2) { animation-delay: 0.1s; }
.metrics article:nth-child(3) { animation-delay: 0.15s; }
.metrics article:nth-child(4) { animation-delay: 0.2s; }
.metrics article:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.metrics article::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--blue-light));
  opacity: 0;
  transition: var(--transition);
}
.metrics article:hover::after {
  opacity: 1;
}
.metrics article > i {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 20px;
}
.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
}

/* ═══ CARDS ═══ */
.card {
  margin-top: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  animation: fadeUp 0.4s ease both;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2 i {
  color: var(--blue);
  font-size: 20px;
}
.card > p {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ═══ QUICK ACTIONS ═══ */
.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.quick a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.quick a:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--blue-glow);
}
.quick a i {
  color: var(--blue);
  font-size: 16px;
}

/* ═══ INFO LIST ═══ */
.info {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 12px;
}
.info dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.info dd {
  margin: 0;
  word-break: break-word;
  font-weight: 500;
}

/* ═══ FORMS ═══ */
.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  align-items: end;
}
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  min-height: 42px;
}
.inline-check input {
  width: 16px;
  height: 16px;
  min-height: auto;
  accent-color: var(--blue);
  cursor: pointer;
}

/* ═══ TABLES ═══ */
.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}
.table-controls .search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.table-controls .search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
  pointer-events: none;
}
.table-controls .search-box input {
  width: 100%;
  padding-left: 36px;
  min-height: 40px;
}
.table-controls .filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.table-controls .filter-group select {
  min-height: 40px;
  min-width: 140px;
  font-size: 12px;
  padding: 6px 10px;
}
.table-controls .table-info {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-left: auto;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead {
  background: var(--bg-alt);
}
th {
  padding: 11px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
  cursor: default;
  user-select: none;
}
th.sortable {
  cursor: pointer;
}
th.sortable:hover {
  color: var(--blue);
}
th.sortable::after {
  content: ' ↕';
  opacity: 0.3;
  font-size: 10px;
}
th.sortable.asc::after {
  content: ' ↑';
  opacity: 1;
  color: var(--blue);
}
th.sortable.desc::after {
  content: ' ↓';
  opacity: 1;
  color: var(--blue);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: var(--blue-soft);
}
tr:active td {
  background: var(--card-hover);
}
.admin-users-table td {
  white-space: nowrap;
}
.admin-users-table td strong,
.admin-users-table td small {
  display: block;
}
.admin-users-table td small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

/* Table pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}
.table-pagination button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  box-shadow: none;
}
.table-pagination button:hover {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: none;
}
.table-pagination button.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.table-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ═══ STATUS BADGES ═══ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 70px;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.status-pending {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid rgba(217, 119, 6, 0.15);
}
.status-approved {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(5, 150, 105, 0.15);
}
.status-rejected {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.15);
}

/* ═══ ALERTS / FLASH ═══ */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  animation: slideDown 0.3s ease;
  border: 1px solid transparent;
}
.alert::before {
  font-family: 'remixicon';
  font-size: 18px;
  line-height: 1;
}
.alert.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.12);
}
.alert.error::before {
  content: '';
}
.alert.success {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(5, 150, 105, 0.12);
}
.alert.success::before {
  content: '';
}
.alert.info {
  background: var(--info-soft);
  color: var(--info);
  border-color: rgba(2, 132, 199, 0.12);
}
.alert.info::before {
  content: '';
}

/* ═══ SECURITY ═══ */
.security-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.security-summary div {
  min-height: 90px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.security-summary div:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.security-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.security-summary strong {
  font-size: 28px;
  line-height: 1;
  color: var(--text);
}
.security-table td {
  vertical-align: top;
}
.security-table td > span,
.security-table td > strong,
.security-table td > code {
  display: block;
  margin-bottom: 3px;
}
.muted {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* ═══ ADMIN BALANCE SUMMARY ═══ */
.admin-balance-summary {
  display: flex;
  flex-wrap: wrap;
  margin: 4px 0 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
}
.admin-balance-summary span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  border-right: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}
.admin-balance-summary span:first-child {
  padding-left: 0;
}
.admin-balance-summary span:last-child {
  border-right: 0;
}
.admin-balance-summary i,
.admin-balance-summary strong {
  color: var(--success);
}

/* ═══ RTP FORM ═══ */
.rtp-form {
  display: grid;
  grid-template-columns: 120px 70px auto;
  gap: 6px;
  align-items: center;
  min-width: 290px;
}
.rtp-form input[type="range"] {
  width: 100%;
  min-height: 24px;
  padding: 0;
  accent-color: var(--blue);
  background: transparent;
  border: none;
  box-shadow: none;
}
.rtp-form input[type="range"]:focus {
  box-shadow: none;
}
.rtp-form input[type="number"] {
  min-height: 32px;
  padding: 4px 8px;
}
.rtp-form button {
  min-height: 32px;
  padding: 6px 10px;
}

/* ═══ BALANCE REQUEST ═══ */
.balance-request-box {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr auto;
  gap: 10px;
  align-items: end;
}
.balance-request-box > label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.balance-request-box > button {
  min-height: 42px;
}
.request-presets {
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: 0;
}
.request-admin-form {
  display: grid;
  grid-template-columns: 100px minmax(140px, 1fr) auto;
  gap: 6px;
  min-width: 380px;
}
.request-admin-form input,
.request-admin-form button {
  min-height: 34px;
}
.request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.request-actions form {
  margin: 0;
}

/* ═══ SALDO PRESETS ═══ */
.saldo-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.saldo-presets button {
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  color: var(--text-secondary);
  box-shadow: none;
  font-size: 12px;
  font-weight: 700;
}
.saldo-presets button:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
  box-shadow: none;
  transform: none;
}

/* ═══ KEYS PAGE ═══ */
.keys {
  display: grid;
  gap: 10px;
}
.keys label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.keys code {
  max-width: none;
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
}

/* ═══ HELP PAGE ═══ */
.help-hero p {
  max-width: 780px;
  margin: 0 0 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.help-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.help-grid div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
}
.help-grid span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.help-grid code {
  max-width: 100%;
  font-size: 11px;
}
.help-section pre {
  overflow-x: auto;
  margin: 10px 0 0;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: #0f172a;
  border: 1px solid #1e293b;
}
.help-section pre code {
  max-width: none;
  padding: 0;
  background: transparent;
  color: #e2e8f0;
  line-height: 1.6;
  white-space: pre;
  font-size: 13px;
}
.steps, .plain-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.help-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.help-tags span {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}
.help-tags code {
  max-width: none;
}

/* ═══ GAMES GRID ═══ */
.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.game {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.game:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.game img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--bg-alt);
}
.game-cover-empty {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--blue-soft), var(--bg-alt));
  color: var(--blue);
  font-size: 36px;
}
.game-cover-empty[hidden] {
  display: none !important;
}
.game strong {
  display: block;
  padding: 10px 12px 2px;
  font-size: 13px;
}
.game span {
  display: block;
  padding: 0 12px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.game a {
  display: flex;
  margin: 8px 12px 12px;
  padding: 8px;
  justify-content: center;
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  gap: 6px;
  transition: var(--transition);
}
.game a:hover {
  filter: brightness(1.1);
  transform: none;
}

/* ═══ CHARTS ═══ */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 12px;
}
.chart-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  animation: fadeUp 0.4s ease both;
}
.chart-card:nth-child(1) { animation-delay: 0.1s; }
.chart-card:nth-child(2) { animation-delay: 0.15s; }
.chart-card:nth-child(3) { animation-delay: 0.2s; }
.chart-card:nth-child(4) { animation-delay: 0.25s; }
.chart-card h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chart-card h3 i {
  color: var(--blue);
}
.chart-card canvas {
  width: 100% !important;
  height: auto !important;
  max-height: 200px;
}

/* ═══ MODAL ═══ */
.user-modal {
  width: min(1100px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.user-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}
.user-modal-form {
  padding: 20px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.modal-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}
.modal-head p {
  margin: 4px 0 0;
  color: var(--blue);
  font-weight: 700;
  font-size: 13px;
}
.modal-close {
  width: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
  box-shadow: none;
  cursor: pointer;
  transition: var(--transition);
}
.modal-close:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}
.modal-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  margin-bottom: 12px;
}
.modal-grid {
  display: grid;
  gap: 12px;
}
.modal-grid.three {
  grid-template-columns: repeat(3, 1fr);
}
.modal-grid.two {
  grid-template-columns: repeat(2, 1fr);
}
.modal-panel label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.modal-panel input {
  width: 100%;
  min-height: 38px;
}
.modal-panel input:read-only {
  opacity: 0.7;
  cursor: default;
}
.modal-section-title {
  margin: 16px 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.modal-section-title i {
  color: var(--blue);
}
.saldo-box {
  display: grid;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  overflow: hidden;
}
.saldo-box span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-secondary);
}
.saldo-box span:last-child {
  border-bottom: 0;
}
.saldo-box strong {
  color: var(--success);
  font-weight: 800;
}
.toggle-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.toggle-grid label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  transition: var(--transition);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.toggle-grid label:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}
.toggle-grid input {
  width: 16px;
  height: 16px;
  min-height: auto;
  accent-color: var(--blue);
  cursor: pointer;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* ═══ EMPTY STATE ═══ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.empty-state i {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.4;
}
.empty-state p {
  font-size: 14px;
  font-weight: 600;
}

/* ═══ NOTE ═══ */
.note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

/* ═══ LOADING ═══ */
.loading-dots::after {
  content: '';
  animation: dots 1.5s infinite;
}
@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* ═══ ANIMATIONS ═══ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══ PAGE TRANSITION ═══ */
.page-enter {
  animation: pageIn 0.35s ease;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ═══ AGENT BREAKDOWN ═══ */
.agent-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.agent-breakdown-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  animation: fadeUp 0.4s ease both;
  cursor: pointer;
}
.agent-breakdown-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--blue);
}
.agent-breakdown-card .agent-bd-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.agent-breakdown-card .agent-bd-avatar {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}
.agent-breakdown-card .agent-bd-head div strong {
  display: block;
  font-size: 13px;
  line-height: 1.2;
}
.agent-breakdown-card .agent-bd-head div small {
  color: var(--muted);
  font-size: 11px;
}
.agent-bd-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.agent-bd-stats span {
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.agent-bd-stats span strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  margin-top: 2px;
}
.agent-bd-stats span .positive { color: var(--success); }
.agent-bd-stats span .negative { color: var(--danger); }

/* Agent detail table */
.agent-detail-table th {
  font-size: 10px;
  white-space: nowrap;
}
.agent-detail-table td {
  vertical-align: middle;
  font-size: 12px;
}
.agent-detail-table td strong {
  display: block;
}
.agent-detail-table td small {
  color: var(--muted);
  font-size: 10px;
}
.agent-detail-table .key-badge {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-alt);
  font-family: monospace;
  font-size: 10px;
}

/* Key usage page */
.key-usage-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.key-usage-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
}
.key-usage-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.key-usage-card strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}
.key-section-title {
  margin: 18px 0 10px;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.key-section-title i {
  color: var(--blue);
}

/* User row highlight by agent */
.user-row-agent {
  border-left: 3px solid transparent;
}
.user-row-agent.a0 { border-left-color: var(--blue); }
.user-row-agent.a1 { border-left-color: var(--success); }
.user-row-agent.a2 { border-left-color: var(--warning); }
.user-row-agent.a3 { border-left-color: var(--danger); }
.user-row-agent.a4 { border-left-color: #8b5cf6; }
.user-row-agent.a5 { border-left-color: #ec4899; }
.user-row-agent.a6 { border-left-color: #14b8a6; }
.user-row-agent.a7 { border-left-color: #f97316; }
.user-row-agent.a8 { border-left-color: #6366f1; }
.user-row-agent.a9 { border-left-color: #84cc16; }

/* Agent filter tabs */
.agent-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.agent-filters button {
  min-height: 32px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
  cursor: pointer;
  transition: var(--transition);
}
.agent-filters button:hover {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: none;
  transform: none;
}
.agent-filters button.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1100px) {
  .chart-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: auto;
    margin: 10px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  .brand {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
  }
  .brand img { width: 100px; }
  .brand small { display: none; }
  .sidebar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
  }
  .sidebar nav a {
    font-size: 12px;
    padding: 8px 10px;
  }
  .sidebar > a {
    display: none;
  }
  .app {
    margin-left: 0;
    padding: 10px;
  }
  .grid.metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .security-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .help-grid {
    grid-template-columns: 1fr;
  }
  .modal-grid.three,
  .modal-grid.two {
    grid-template-columns: 1fr;
  }
  .balance-request-box {
    grid-template-columns: 1fr;
  }
  .request-presets {
    grid-column: auto;
    grid-row: auto;
  }
  .request-admin-form {
    min-width: 280px;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .grid.metrics,
  .security-summary {
    grid-template-columns: 1fr;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }
  .inline-form {
    grid-template-columns: 1fr;
  }
  .table-controls {
    flex-direction: column;
  }
  .table-controls .search-box {
    max-width: none;
  }
  .table-controls .table-info {
    margin-left: 0;
  }
  .auth-card {
    padding: 32px 16px 20px;
  }
}
