/* ============================================================
   JNT Voucher Keys — Theme System v2
   Blue→Purple Gradient · Dark/Light · ID/EN · Sidebar Layout
   Inspired by setorangmail.com design
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  /* Brand — Blue→Purple */
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;

  --purple-50:  #f5f3ff;
  --purple-100: #ede9fe;
  --purple-200: #ddd6fe;
  --purple-300: #c4b5fd;
  --purple-400: #a78bfa;
  --purple-500: #8b5cf6;
  --purple-600: #7c3aed;
  --purple-700: #6d28d9;
  --purple-800: #5b21b6;
  --purple-900: #4c1d95;

  /* Gradient */
  --grad: linear-gradient(135deg, #2563eb, #7c3aed);
  --grad-hover: linear-gradient(135deg, #1d4ed8, #6d28d9);
  --grad-soft: linear-gradient(135deg, rgba(37,99,235,0.1), rgba(124,58,237,0.1));

  /* Status */
  --ok:  #10b981;
  --ok-soft:  #d1fae5;
  --bad: #ef4444;
  --bad-soft: #fee2e2;
  --warn: #f59e0b;
  --warn-soft: #fef3c7;
  --info: #3b82f6;
  --info-soft: #dbeafe;

  /* Accent — uses gradient */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-2: #7c3aed;
  --accent-light: rgba(37,99,235,0.08);

  /* Radius */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 40px rgba(0,0,0,0.12);
  --shadow-glow: 0 8px 25px rgba(37,99,235,0.15);
  --shadow-grad: 0 4px 15px rgba(37,99,235,0.3);
  --shadow-grad-hover: 0 8px 25px rgba(37,99,235,0.45);

  /* Transitions */
  --t-fast: 150ms cubic-bezier(.4,0,.2,1);
  --t-base: 250ms cubic-bezier(.4,0,.2,1);
  --t-slow: 400ms cubic-bezier(.4,0,.2,1);
  --t-bounce: 400ms cubic-bezier(0.175,0.885,0.32,1.275);

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-collapsed: 64px;
  --topbar-h: 56px;
}

/* ---------- Dark Theme (default) ---------- */
[data-theme="dark"] {
  --bg:        #0a0f1a;
  --bg-soft:   #0f1623;
  --card:      #131c2b;
  --card-hover:#172234;
  --line:      #1e2a3d;
  --line-soft: #16202f;
  --txt:       #c8d6e8;
  --txt-strong:#ffffff;
  --txt-heading:#f0f6ff;
  --txt-body:  #c8d6e8;
  --txt-label: #9ab0c8;
  --mut:       #8da3be;
  --mut-soft:  #5a6c85;
  --input-bg:  #0d1521;
  --input-border: #1e2a3d;
  --sidebar-bg: rgba(12,18,29,0.92);
  --sidebar-active: rgba(37,99,235,0.15);
  --sidebar-border: #1a2435;
  --overlay:   rgba(15,23,42,0.65);
  --grad-top:  radial-gradient(1200px 600px at 80% -20%, rgba(37,99,235,0.08) 0%, transparent 50%), radial-gradient(800px 400px at 20% 80%, rgba(124,58,237,0.06) 0%, transparent 50%);
  --ok-soft:  rgba(16,185,129,.12);
  --bad-soft: rgba(239,68,68,.15);
  --warn-soft: rgba(245,158,11,.12);
  --info-soft: rgba(59,130,246,.12);
  --blob-1: radial-gradient(circle, rgba(37,99,235,0.3), rgba(124,58,237,0.1));
  --blob-2: radial-gradient(circle, rgba(124,58,237,0.25), rgba(236,72,153,0.08));
  --blob-3: radial-gradient(circle, rgba(16,185,129,0.15), transparent);
}

/* ---------- Light Theme ---------- */
[data-theme="light"] {
  --bg:        #f1f5f9;
  --bg-soft:   #e6f0fa;
  --card:      #ffffff;
  --card-hover:#f8fafc;
  --line:      #e2e8f0;
  --line-soft: #f1f5f9;
  --txt:       #1e293b;
  --txt-strong:#000;
  --txt-heading:#0f172a;
  --txt-body:  #334155;
  --txt-label: #475569;
  --mut:       #64748b;
  --mut-soft:  #94a3b8;
  --input-bg:  #f8fafc;
  --input-border: #e2e8f0;
  --sidebar-bg: rgba(255,255,255,0.92);
  --sidebar-active: rgba(37,99,235,0.10);
  --sidebar-border: #e2e8f0;
  --overlay:   rgba(15,23,42,0.40);
  --grad-top:  radial-gradient(1200px 600px at 80% -20%, rgba(37,99,235,0.06) 0%, transparent 50%), radial-gradient(800px 400px at 20% 80%, rgba(124,58,237,0.04) 0%, transparent 50%);
  --ok-soft:  #d1fae5;
  --bad-soft: #fee2e2;
  --warn-soft: #fef3c7;
  --info-soft: #dbeafe;
  --blob-1: radial-gradient(circle, rgba(37,99,235,0.12), rgba(124,58,237,0.05));
  --blob-2: radial-gradient(circle, rgba(124,58,237,0.1), rgba(236,72,153,0.03));
  --blob-3: radial-gradient(circle, rgba(16,185,129,0.08), transparent);
}

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

body {
  background: var(--bg);
  color: var(--txt);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--grad-top);
  pointer-events: none;
  z-index: 0;
}

/* Animated background blobs */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: var(--blob-1), var(--blob-2), var(--blob-3);
  background-size: 55vw 55vh, 45vw 45vh, 28vw 28vh;
  background-position: -5% -10%, 105% 110%, 38% 35%;
  background-repeat: no-repeat;
  filter: blur(80px);
  opacity: 0.6;
  animation: moveBlobs 20s infinite alternate ease-in-out;
}

@keyframes moveBlobs {
  0%   { background-position: -5% -10%, 105% 110%, 38% 35%; }
  33%  { background-position: 5% 5%, 90% 90%, 45% 40%; }
  66%  { background-position: -10% 10%, 100% 85%, 30% 30%; }
  100% { background-position: 5% -5%, 95% 100%, 42% 38%; }
}

/* Mesh grid overlay */
.app-shell::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(37,99,235,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,99,235,0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 80%);
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 80%);
}

/* ---------- App Shell: Sidebar + Main ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: auto;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width var(--t-base);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  white-space: nowrap;
}

.sidebar-brand .logo {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37,99,235,0.35);
}

.sidebar-brand .brand-text {
  font-weight: 800;
  font-size: 14px;
  color: var(--txt-heading);
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.sidebar-brand .brand-text small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--txt-label);
  margin-top: 1px;
}

/* Nav items */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--txt);
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: .01em;
  position: relative;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--sidebar-active);
  color: var(--txt-heading);
}

.nav-item.on {
  background: var(--sidebar-active);
  color: var(--blue-500);
  font-weight: 600;
}

[data-theme="light"] .nav-item.on {
  color: var(--blue-700);
  background: rgba(37,99,235,0.12);
}

.nav-item.on::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 0 3px 3px 0;
  background: var(--grad);
}

.nav-item .nav-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.nav-item.on .nav-icon { opacity: 1; }

.nav-item .nav-icon svg {
  width: 20px;
  height: 20px;
}

.nav-item .nav-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item .nav-badge {
  background: var(--bad);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-full);
  min-width: 18px;
  text-align: center;
}

/* Sidebar footer */
.sidebar-foot {
  border-top: 1px solid var(--sidebar-border);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ---------- Main Content ---------- */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--t-base);
  position: relative;
  z-index: 1;
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--sidebar-border);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 12px;
}

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

.topbar-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--txt-heading);
}

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

/* Toggle buttons */
.tog {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  padding: 4px;
  cursor: pointer;
  font-size: 12px;
}

.tog button {
  background: transparent;
  border: none;
  color: var(--mut);
  padding: 5px 10px;
  border-radius: var(--r-full);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all var(--t-fast);
  white-space: nowrap;
}

.tog button.on {
  background: var(--grad);
  color: #fff;
  box-shadow: var(--shadow-grad);
}

/* Theme toggle (icon) */
.theme-tog {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  background: var(--card);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--txt-body);
  transition: all var(--t-fast);
}

.theme-tog:hover {
  color: var(--blue-500);
  border-color: var(--blue-500);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.08);
}

.theme-tog svg { width: 20px; height: 20px; }

/* Mobile menu button */
.menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--grad);
  border: none;
  color: #ffffff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--t-fast);
  box-shadow: var(--shadow-grad);
}
.menu-btn:hover, .menu-btn:active {
  box-shadow: var(--shadow-grad-hover);
  transform: translateY(-1px);
}
.menu-btn svg {
  stroke: #ffffff;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
}

/* Content area */
.content {
  flex: 1;
  padding: 20px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* ---------- Components ---------- */

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  margin-bottom: 14px;
  transition: all var(--t-base);
  box-shadow: var(--shadow-sm);
}

.card:hover { border-color: rgba(37,99,235,0.2); box-shadow: var(--shadow-md); }

/* Section heading */
h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--txt-heading);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

h2 .icon { color: var(--blue-500); }

/* Labels */
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--txt-label);
  margin: 10px 0 5px;
  letter-spacing: .02em;
}

/* Inputs */
input, textarea, select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--input-border);
  background: var(--input-bg);
  color: var(--txt);
  font-size: 13px;
  font-family: inherit;
  transition: all var(--t-fast);
  font-weight: 500;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue-500);
  background: var(--card);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.1);
}

textarea {
  min-height: 100px;
  resize: vertical;
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 12px;
}

/* Row */
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--r-sm);
  padding: 11px 18px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  background: var(--grad);
  color: #fff;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
  box-shadow: var(--shadow-grad);
  position: relative;
  overflow: hidden;
  justify-content: center;
  text-align: center;
}

.btn:hover { background: var(--grad-hover); transform: translateY(-2px); box-shadow: var(--shadow-grad-hover); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn.ghost {
  background: var(--card);
  border: 1.5px solid var(--line);
  color: var(--txt);
  box-shadow: var(--shadow-sm);
}
.btn.ghost:hover { border-color: var(--blue-500); color: var(--blue-500); background: var(--card); box-shadow: 0 0 0 4px rgba(37,99,235,0.08); }

.btn.ok { background: var(--ok); color: #fff; box-shadow: 0 4px 15px rgba(16,185,129,0.3); }
.btn.ok:hover { background: #059669; box-shadow: 0 8px 25px rgba(16,185,129,0.45); }

.btn.acc { background: var(--grad); color: #fff; box-shadow: var(--shadow-grad); }
.btn.acc:hover { background: var(--grad-hover); box-shadow: var(--shadow-grad-hover); }

.btn.bad { background: var(--bad); color: #fff; box-shadow: 0 4px 15px rgba(239,68,68,0.3); }
.btn.bad:hover { background: #dc2626; box-shadow: 0 8px 25px rgba(239,68,68,0.45); }

.btn.cyan { background: var(--blue-600); color: #fff; box-shadow: var(--shadow-grad); }
.btn.cyan:hover { background: var(--blue-700); box-shadow: var(--shadow-grad-hover); }

.btn.warn { background: var(--warn); color: #fff; box-shadow: 0 4px 15px rgba(245,158,11,0.3); }
.btn.warn:hover { background: #d97706; box-shadow: 0 8px 25px rgba(245,158,11,0.45); }

.btn.sm { padding: 7px 12px; font-size: 12px; }
.btn.xs { padding: 5px 9px; font-size: 11px; }

/* Actions */
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* Messages */
.msg {
  font-size: 12px;
  margin-top: 8px;
  color: var(--mut);
  white-space: pre-wrap;
  line-height: 1.5;
}
.msg.ok { color: var(--ok); }
.msg.bad { color: var(--bad); }
.msg.warn { color: var(--warn); }

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--line);
  color: var(--txt-body);
  white-space: nowrap;
}
.pill.ok { color: #fff; border-color: var(--ok); background: var(--ok); }
.pill.bad { color: #fff; border-color: var(--bad); background: var(--bad); }
.pill.warn { color: #000; border-color: var(--warn); background: var(--warn); }
.pill.cyan, .pill.info { color: #fff; border-color: var(--blue-500); background: var(--blue-500); }

/* Stats grid */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
  transition: all var(--t-base);
  box-shadow: var(--shadow-sm);
}

.stat:hover { border-color: rgba(37,99,235,0.2); box-shadow: var(--shadow-glow); transform: translateY(-2px); }

.stat b {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--txt-strong);
  margin-top: 4px;
}

.stat span {
  color: var(--txt-label);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .03em;
  text-transform: uppercase;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th, td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--txt-label);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

tbody tr { transition: background var(--t-fast); }
tbody tr:hover td { background: var(--card-hover); }

/* Scroll */
.scroll {
  overflow: auto;
  max-height: 480px;
  border-radius: var(--r-sm);
}

.scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* Modal */
.modal-bg {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-bg:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: min(440px, 94vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 28px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.2);
  transform: translateY(20px) scale(0.95);
  transition: transform var(--t-bounce);
}

.modal-bg:not(.hidden) .modal {
  transform: translateY(0) scale(1);
}

.modal h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--txt-heading);
  margin-bottom: 10px;
}

.modal p {
  color: var(--txt-body);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.modal .field { margin-top: 12px; }

.modal input, .modal select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--input-border);
  background: var(--input-bg);
  color: var(--txt);
}

.modal .ma {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* Utilities */
.hidden { display: none !important; }
.mono { font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace; font-size: 12px; }
.right { display: flex; gap: 8px; align-items: center; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; }
.sub { color: var(--txt-body); font-size: 12px; line-height: 1.5; }
.step {
  font-size: 11px;
  color: var(--txt-label);
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 8px;
}

/* List */
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  transition: all var(--t-base);
  box-shadow: var(--shadow-sm);
}

.item:hover { border-color: rgba(37,99,235,0.2); box-shadow: var(--shadow-md); }

/* Credit picker */
.credit-pick {
  cursor: pointer;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
  background: var(--card);
  transition: all var(--t-base);
  box-shadow: var(--shadow-sm);
}
.credit-pick.on { border-color: var(--blue-500); background: var(--sidebar-active); box-shadow: var(--shadow-glow); }
.credit-pick.disabled { opacity: .45; cursor: not-allowed; }

/* Auth box */
.authbox { max-width: 400px; margin: 40px auto; }

/* Tabs (old style compat) */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tab {
  padding: 8px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--mut);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all var(--t-fast);
}

.tab:hover { color: var(--txt); border-color: var(--blue-500); }
.tab.on { background: var(--sidebar-active); color: var(--blue-500); border-color: var(--blue-500); }

/* Suggest */
.suggest { position: relative; }
.suggest-box {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  max-height: 200px;
  overflow: auto;
  box-shadow: var(--shadow-md);
}
.suggest-box div {
  padding: 8px 10px;
  cursor: pointer;
  font-size: 12px;
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--t-fast);
}
.suggest-box div:hover { background: var(--card-hover); }

/* Userbar */
.userbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .row-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .menu-btn { display: flex; }
  .row { grid-template-columns: 1fr; }
  .content { padding: 14px; }
  .topbar { padding: 0 12px; }
}

/* ---------- Sidebar overlay (mobile) ---------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

section[id^="p-"]:not(.hidden),
div[id^="tab-"]:not(.hidden),
section[id^="sec-"]:not(.hidden) {
  animation: fadeIn var(--t-base);
}

/* ---------- Loading spinner ---------- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--blue-500);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tooltip ---------- */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: var(--card);
  color: var(--txt);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fast);
  border: 1px solid var(--line);
  z-index: 200;
  box-shadow: var(--shadow-sm);
}
[data-tip]:hover::after { opacity: 1; }
