/* ── Reseller Panel Design System 2026 ── */
:root {
  --brand: #FFCB08;
  --brand-dim: rgba(255, 203, 8, 0.12);
  --brand-glow: rgba(255, 203, 8, 0.35);
  --surface-0: #080b12;
  --surface-1: #0f1117;
  --surface-2: #161b27;
  --surface-3: #1e2535;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.1);
  --text-muted: #94a3b8;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --shadow-card-hover: 0 12px 40px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Ambient background ── */
body.panel-body {
  background: var(--surface-1);
  color: #e2e8f0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.panel-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 10% -10%, rgba(255, 203, 8, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 90% 110%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(15, 17, 23, 0) 0%, var(--surface-1) 100%);
}

.panel-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

.panel-app {
  position: relative;
  z-index: 1;
}

/* ── Sidebar ── */
.panel-sidebar {
  background: linear-gradient(180deg, rgba(22, 27, 39, 0.92) 0%, rgba(15, 17, 23, 0.96) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--border-subtle) !important;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.2);
}

.panel-sidebar-logo {
  background: linear-gradient(135deg, var(--brand) 0%, #e5b700 100%);
  box-shadow: 0 4px 20px var(--brand-glow);
}

.panel-nav-link {
  position: relative;
  border: 1px solid transparent;
  transition: all var(--transition);
}

.panel-nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-subtle);
  transform: translateX(-2px);
}

.panel-nav-link.is-active {
  background: linear-gradient(90deg, rgba(255, 203, 8, 0.14) 0%, rgba(255, 203, 8, 0.04) 100%);
  border-color: rgba(255, 203, 8, 0.22);
  color: var(--brand) !important;
  box-shadow: 0 0 20px rgba(255, 203, 8, 0.08);
}

.panel-nav-link.is-active::before {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--brand);
  border-radius: 4px 0 0 4px;
  box-shadow: 0 0 12px var(--brand-glow);
}

.panel-wallet-chip {
  background: linear-gradient(135deg, rgba(255, 203, 8, 0.08) 0%, rgba(22, 27, 39, 0.6) 100%);
  border: 1px solid rgba(255, 203, 8, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ── Topbar ── */
.panel-topbar {
  background: rgba(22, 27, 39, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle) !important;
}

.panel-main {
  scroll-behavior: smooth;
}

/* ── Cards (auto-enhance existing Tailwind patterns) ── */
main .bg-dark-800.border.border-dark-600.rounded-2xl,
.panel-card {
  background: linear-gradient(155deg, rgba(30, 37, 53, 0.55) 0%, rgba(22, 27, 39, 0.85) 100%) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: var(--border-subtle) !important;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

main a.bg-dark-800.border.rounded-2xl:hover,
main .bg-dark-800.border.border-dark-600.rounded-2xl:hover {
  box-shadow: var(--shadow-card-hover);
}

main .bg-dark-800.border.border-dark-600.rounded-xl {
  border-color: var(--border-subtle) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* ── Forms ── */
main input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]),
main select,
main textarea,
.panel-input {
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

main input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
main select:focus,
main textarea:focus {
  outline: none !important;
  border-color: rgba(255, 203, 8, 0.45) !important;
  box-shadow: 0 0 0 3px rgba(255, 203, 8, 0.1) !important;
}

/* ── Buttons ── */
main button.bg-brand,
main a.bg-brand,
main .brand-gradient,
.panel-btn-primary {
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

main button.bg-brand:hover,
main a.bg-brand:hover,
.panel-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px var(--brand-glow);
}

main button.bg-brand:active,
main a.bg-brand:active {
  transform: translateY(0);
}

/* ── Tables ── */
main table {
  border-collapse: separate;
  border-spacing: 0;
}

main thead th {
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

main tbody tr {
  transition: background var(--transition);
}

main tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* ── Badges & pills ── */
main .rounded-full.text-xs,
main .rounded-full.text-\[10px\] {
  backdrop-filter: blur(4px);
}

/* ── Mobile bottom nav ── */
.panel-mobile-nav {
  background: rgba(22, 27, 39, 0.88) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle) !important;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.25);
}

.panel-mobile-nav a.text-brand {
  position: relative;
}

.panel-mobile-nav a.text-brand::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--brand-glow);
}

/* ── Modal ── */
#_confirmModal .relative.bg-dark-800 {
  background: linear-gradient(160deg, rgba(30, 37, 53, 0.95) 0%, rgba(22, 27, 39, 0.98) 100%) !important;
  backdrop-filter: blur(24px);
  border-color: var(--border-strong) !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  animation: panelModalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes panelModalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Toast ── */
#toastContainer > div {
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* ── Scrollbar ── */
.panel-main::-webkit-scrollbar,
.panel-sidebar::-webkit-scrollbar {
  width: 5px;
}

.panel-main::-webkit-scrollbar-thumb,
.panel-sidebar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--brand), rgba(255, 203, 8, 0.4));
  border-radius: 10px;
}

/* ── Login page ── */
.login-page {
  background: var(--surface-0);
  min-height: 100vh;
}

.login-glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
}

.login-glow-1 {
  top: -120px;
  right: -80px;
  background: rgba(255, 203, 8, 0.25);
}

.login-glow-2 {
  bottom: -100px;
  left: -60px;
  background: rgba(99, 102, 241, 0.2);
}

.login-card {
  background: linear-gradient(160deg, rgba(30, 37, 53, 0.7) 0%, rgba(15, 17, 23, 0.95) 100%);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.login-accent {
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--brand), #ff9800, var(--brand), transparent);
}

/* ── Page enter animation ── */
@keyframes panelFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-main > * {
  animation: panelFadeUp 0.35s ease-out both;
}

/* ── Stat cards accent glow ── */
main .rounded-2xl .absolute.inset-x-0.top-0.h-0\.5 {
  box-shadow: 0 0 12px currentColor;
  opacity: 0.9;
}

/* ── Responsive touch targets ── */
@media (max-width: 640px) {
  .panel-nav-link {
    min-height: 44px;
  }
  main .grid.grid-cols-2 {
    gap: 0.625rem;
  }
}

/* ── Dividers & borders ── */
main .divide-dark-700 > :not([hidden]) ~ :not([hidden]) {
  border-color: rgba(255, 255, 255, 0.04);
}

main .border-dark-600,
main .border-dark-500,
main .border-dark-700 {
  border-color: rgba(255, 255, 255, 0.06) !important;
}

main .border-b.border-dark-600 {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
}

/* ── Section headers inside cards ── */
main .border-b.border-dark-600.px-5.py-4 {
  background: rgba(255, 255, 255, 0.02);
}

/* ── Select & option dark ── */
main select option {
  background: #161b27;
  color: #e2e8f0;
}

/* ── Code / mono blocks ── */
main pre,
main code.font-mono {
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Full-screen modals (teleport to body) ── */
.panel-modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw;
  min-height: 100dvh;
  z-index: 200;
}

body:has(.panel-modal-backdrop[x-cloak]) {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
