:root {
  --adm-bg: #090d16;
  --adm-sidebar: #0e1422;
  --adm-card: #131b2e;
  --adm-card-hover: #19233c;
  --adm-border: rgba(255, 255, 255, 0.08);
  --adm-border-hover: rgba(255, 255, 255, 0.16);

  --adm-gold: #f59e0b;
  --adm-gold-light: #fbbf24;
  --adm-green: #10b981;
  --adm-red: #ef4444;
  --adm-blue: #3b82f6;

  --adm-text: #f8fafc;
  --adm-text-muted: #94a3b8;
  --adm-text-dim: #64748b;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-code: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--adm-bg);
  color: var(--adm-text);
  font-family: var(--font-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top App Bar */
.admin-topbar {
  height: 64px;
  background: var(--adm-sidebar);
  border-bottom: 1px solid var(--adm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 500;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand-icon {
  font-size: 20px;
}

.brand-sub {
  color: var(--adm-gold);
  font-size: 13px;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--adm-green);
  font-family: var(--font-code);
  font-weight: 600;
}

.dot-online {
  width: 8px;
  height: 8px;
  background: var(--adm-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--adm-green);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.top-metric {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.metric-label {
  color: var(--adm-text-dim);
}

.text-green { color: var(--adm-green); font-weight: 700; }
.text-gold { color: var(--adm-gold-light); font-weight: 700; }
.text-muted { color: var(--adm-text-muted); }

.admin-user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--adm-border);
  padding: 6px 12px;
  border-radius: 8px;
}

.avatar {
  width: 28px;
  height: 28px;
  background: var(--adm-gold);
  color: #000;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 12px;
  font-weight: 700;
}

.user-role {
  font-size: 10px;
  color: var(--adm-text-dim);
}

/* Layout */
.admin-layout {
  display: flex;
  flex: 1;
}

.admin-sidebar {
  width: 260px;
  background: var(--adm-sidebar);
  border-right: 1px solid var(--adm-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 14px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: var(--adm-text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s;
}

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

.sidebar-item.active {
  background: rgba(245, 158, 11, 0.12);
  color: var(--adm-gold-light);
  font-weight: 600;
  border-left: 3px solid var(--adm-gold);
}

.sidebar-footer {
  border-top: 1px solid var(--adm-border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-link {
  color: var(--adm-text-dim);
  font-size: 12px;
  text-decoration: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color 0.2s;
}

.sidebar-link:hover {
  color: #fff;
}

.admin-main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

/* Tab Contents */
.tab-content {
  display: none;
}

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

.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 20px;
}

.page-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.page-desc {
  color: var(--adm-text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-gold-admin {
  background: var(--adm-gold);
  color: #000;
}

.btn-gold-admin:hover {
  background: var(--adm-gold-light);
  transform: translateY(-1px);
}

.btn-outline-admin {
  background: transparent;
  border: 1px solid var(--adm-border);
  color: #fff;
}

.btn-outline-admin:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 5px;
}

.btn-copy {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--adm-border);
  color: var(--adm-text-muted);
  cursor: pointer;
}

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

/* Stats Cards */
.stats-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--adm-card);
  border: 1px solid var(--adm-border);
  border-radius: 12px;
  padding: 20px;
}

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

.stat-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--adm-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-icon-wrap {
  font-size: 18px;
}

.stat-val {
  font-family: var(--font-code);
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
}

.stat-trend {
  font-size: 12px;
  color: var(--adm-text-dim);
}

.trend-up {
  color: var(--adm-green);
}

/* Panel Box & Tables */
.admin-panel-box {
  background: var(--adm-card);
  border: 1px solid var(--adm-border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 30px;
}

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

.box-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.box-title-group h2 {
  font-size: 16px;
  font-weight: 700;
}

.live-dot-sm {
  width: 8px;
  height: 8px;
  background: var(--adm-red);
  border-radius: 50%;
  animation: pulse-sm 1.5s infinite;
}

@keyframes pulse-sm {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.feed-speed-badge {
  font-size: 11px;
  color: var(--adm-text-dim);
  font-family: var(--font-code);
}

.table-filter-bar {
  padding: 16px 24px;
  border-bottom: 1px solid var(--adm-border);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.table-filter-bar input, .table-filter-bar select {
  padding: 8px 12px;
  background: #090d16;
  border: 1px solid var(--adm-border);
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
}

.table-filter-bar input {
  flex: 1;
  min-width: 220px;
}

.table-container {
  overflow-x: auto;
}

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

.admin-table th {
  background: rgba(0, 0, 0, 0.25);
  color: var(--adm-text-dim);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--adm-border);
}

.admin-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--adm-border);
  color: var(--adm-text);
  font-family: inherit;
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.code-cell {
  font-family: var(--font-code);
  font-size: 12px;
  color: var(--adm-gold-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-status {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-active, .badge-win {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-loss {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-wait {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Games Management Grid */
.games-mgmt-grid, .games-management-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 24px;
}

.game-mgmt-card {
  background: var(--adm-card);
  border: 1px solid var(--adm-border);
  border-radius: 14px;
  padding: 24px;
}

.game-mgmt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.game-mgmt-title {
  font-size: 18px;
  font-weight: 700;
}

.game-mgmt-prov {
  font-size: 12px;
  color: var(--adm-text-dim);
}

.rtp-control-box {
  margin: 18px 0;
  background: rgba(0, 0, 0, 0.3);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--adm-border);
}

.rtp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.rtp-value {
  font-family: var(--font-code);
  font-size: 18px;
  font-weight: 800;
  color: var(--adm-gold-light);
}

.rtp-slider {
  width: 100%;
  accent-color: var(--adm-gold);
}

.bet-limits-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.limit-item label {
  display: block;
  font-size: 11px;
  color: var(--adm-text-dim);
  margin-bottom: 4px;
}

.limit-item input {
  width: 100%;
  padding: 6px 10px;
  background: #090d16;
  border: 1px solid var(--adm-border);
  border-radius: 6px;
  color: #fff;
  font-family: var(--font-code);
  font-size: 13px;
}

.mgmt-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--adm-border);
}

/* Seamless Wallet Tester */
.tester-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 24px;
}

.tester-form-box, .tester-output-box {
  background: var(--adm-card);
  border: 1px solid var(--adm-border);
  border-radius: 14px;
  padding: 24px;
}

.tester-form-box h3 {
  font-size: 16px;
  margin-bottom: 18px;
}

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

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--adm-text-dim);
  font-weight: 600;
  margin-bottom: 6px;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 9px 12px;
  background: #090d16;
  border: 1px solid var(--adm-border);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--adm-gold);
}

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

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
}

.code-block-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--adm-text-dim);
  letter-spacing: 0.5px;
  margin: 12px 0 6px;
}

.code-box {
  background: #090d16;
  border: 1px solid var(--adm-border);
  border-radius: 8px;
  padding: 14px;
  font-family: var(--font-code);
  font-size: 12px;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 240px;
  overflow-y: auto;
}

/* Modals */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.admin-modal-backdrop.is-open {
  display: flex;
}

.admin-modal-card {
  background: var(--adm-card);
  border: 1px solid var(--adm-border);
  border-radius: 14px;
  width: 100%;
  max-width: 500px;
  padding: 28px;
  position: relative;
}

.modal-close-x {
  position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--adm-text-muted);
  font-size: 24px;
  cursor: pointer;
}

.admin-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  border: 1px solid var(--adm-gold);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  display: none;
  z-index: 9999;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

@media (max-width: 860px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--adm-border); }
  .tester-grid { grid-template-columns: 1fr; }
}
