:root,
[data-theme="dark"] {
  --bg: #0b0b15;
  --bg-glow: radial-gradient(circle at 75% 8%, rgba(168, 85, 247, 0.16), transparent 42%),
             radial-gradient(circle at 12% 85%, rgba(236, 72, 153, 0.10), transparent 45%);
  --surface: #121323;
  --surface-2: #191b30;
  --surface-code: #090a14;
  --border: rgba(168, 85, 247, 0.18);
  --border-subtle: rgba(255, 255, 255, 0.07);
  --accent: #a855f7;
  --accent-2: #ec4899;
  --accent-grad: linear-gradient(135deg, #9333ea 0%, #a855f7 55%, #c084fc 100%);
  --logo-grad: linear-gradient(135deg, #e60067 0%, #c026d3 100%);
  --accent-soft: rgba(168, 85, 247, 0.18);
  --text: #f8fafc;
  --text-soft: #cbd5e1;
  --muted: #94a3b8;
  --danger: #ef4444;
  --ok: #22c55e;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  --glow-btn: 0 10px 28px rgba(168, 85, 247, 0.40);
  --radius: 18px;
}

[data-theme="light"] {
  --bg: #f5f6fb;
  --bg-glow: radial-gradient(circle at 80% 5%, rgba(168, 85, 247, 0.10), transparent 40%),
             radial-gradient(circle at 10% 90%, rgba(236, 72, 153, 0.07), transparent 42%);
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --surface-code: #0f1221;
  --border: rgba(124, 58, 237, 0.16);
  --border-subtle: #e5e7f0;
  --accent: #7c3aed;
  --accent-2: #db2777;
  --accent-grad: linear-gradient(135deg, #7c3aed 0%, #9333ea 60%, #a855f7 100%);
  --logo-grad: linear-gradient(135deg, #e60067 0%, #9333ea 100%);
  --accent-soft: rgba(124, 58, 237, 0.11);
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --danger: #dc2626;
  --ok: #16a34a;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
  --glow-btn: 0 10px 24px rgba(124, 58, 237, 0.28);
  --radius: 18px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Vazirmatn", system-ui, -apple-system, sans-serif;
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.7;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.hidden { display: none !important; }
.center { text-align: center; justify-content: center; }
.muted { color: var(--muted); }
.muted-sm { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.full { width: 100%; }
.neon-text {
  background: linear-gradient(135deg, #c084fc 0%, #a855f7 55%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Brand */
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-logo-e {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  background: var(--logo-grad); color: #ffffff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px rgba(230, 0, 103, 0.35);
}
.brand-title { font-weight: 900; font-size: 17px; }
.brand-sub { font-size: 11px; color: var(--muted); }

/* Auth */
.auth-overlay {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card {
  width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; padding: 32px 28px; box-shadow: var(--shadow);
}
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--surface-2);
  padding: 5px; border-radius: 12px; margin: 20px 0;
}
.auth-tabs button {
  background: transparent; border: none; color: var(--muted); padding: 9px; border-radius: 9px;
  font-family: inherit; font-weight: 700; cursor: pointer;
}
.auth-tabs button.active { background: var(--accent-grad); color: #ffffff; }

/* Layout */
.app-shell { display: grid; grid-template-columns: 276px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-inline-end: 1px solid var(--border-subtle);
  padding: 22px 16px; display: flex; flex-direction: column; justify-content: space-between;
}
.nav-list { display: flex; flex-direction: column; gap: 6px; margin-top: 26px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: start;
  background: transparent; border: 1px solid transparent; color: var(--text-soft);
  padding: 11px 14px; border-radius: 13px; font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.24), rgba(168, 85, 247, 0.08));
  border-color: rgba(168, 85, 247, 0.45);
  color: var(--text);
  box-shadow: inset 0 0 18px rgba(168, 85, 247, 0.14);
}
.nav-ic { font-size: 16px; }

.quota-box {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; margin-bottom: 12px;
}
.quota-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.quota-big { font-size: 20px; font-weight: 900; margin-bottom: 8px; }
.badge-neon {
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border);
  font-weight: 800; font-size: 11px; padding: 3px 10px; border-radius: 99px;
}
.quota-bar { height: 7px; background: rgba(148, 163, 184, 0.18); border-radius: 99px; overflow: hidden; }
.quota-fill { height: 100%; background: var(--accent-grad); border-radius: 99px; transition: width 0.3s ease; }
.upgrade-inline-btn {
  width: 100%; margin-top: 12px; padding: 8px; border-radius: 10px;
  background: var(--accent-soft); border: 1px solid var(--border);
  color: var(--accent); font-family: inherit; font-size: 12px; font-weight: 800; cursor: pointer;
}
.upgrade-inline-btn:hover { background: var(--accent-grad); color: #ffffff; }

.user-profile-pill {
  display: flex; align-items: center; gap: 10px; background: var(--surface-2);
  border: 1px solid var(--border-subtle); border-radius: 14px; padding: 10px 12px;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-mini-btn {
  background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 4px 6px; border-radius: 8px;
}
.icon-mini-btn:hover { background: rgba(239, 68, 68, 0.14); color: var(--danger); }

/* Main & Topbar */
.main-content { padding: 20px 28px 34px; overflow-y: auto; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  margin-bottom: 22px; flex-wrap: wrap;
}
.provider-status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 8px 16px; border-radius: 99px; font-family: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; box-shadow: var(--shadow); transition: all 0.2s ease;
}
.provider-status-pill:hover { border-color: var(--accent); transform: translateY(-1px); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.status-label { color: var(--ok); font-size: 12px; }
.status-sep { color: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.util-icon-btn {
  width: 40px; height: 40px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border-subtle); color: var(--text); font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s ease;
}
.util-icon-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* Hero Banner Strip */
.hero-strip {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.hero-title-group { display: flex; align-items: center; gap: 16px; }
.hero-3d-badge {
  width: 56px; height: 56px; border-radius: 18px; background: var(--logo-grad);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 14px 32px rgba(230, 0, 103, 0.35), 0 0 24px rgba(168, 85, 247, 0.28);
  transform: rotate(-4deg);
}
.hero-strip h2 { margin: 0; font-size: 26px; font-weight: 900; }
.hero-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.mini-stat-pill {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--border-subtle); border-radius: 14px; padding: 10px 14px;
}
.mini-stat-pill span { color: var(--accent); font-weight: 900; font-size: 15px; }
.mini-stat-pill strong { display: block; font-size: 12px; font-weight: 800; }
.mini-stat-pill small { display: block; font-size: 11px; color: var(--muted); }

/* Panels & Cards */
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 14px; font-size: 17px; font-weight: 800; }
.card-head-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head-row h3 { margin: 0; }

/* Form & Dropzone */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"], .field select, .field textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border-subtle); color: var(--text);
  border-radius: 12px; padding: 11px 14px; font-family: inherit; font-size: 13px; outline: none; transition: border-color 0.2s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 88px; padding: 14px; border-radius: 14px; text-align: center; cursor: pointer;
  background: var(--surface-2); border: 1.5px dashed var(--border); color: var(--muted);
  transition: all 0.2s ease;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.dz-icon { font-size: 22px; }
.dz-text { font-size: 12px; font-weight: 600; line-height: 1.5; }
.checks-row { display: flex; flex-wrap: wrap; gap: 16px; margin: 12px 0 18px; }
.check-item { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; color: var(--text-soft); }
.check-item input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.img-preview { max-height: 150px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 12px; display: block; }

/* Buttons */
.btn {
  border: none; border-radius: 13px; padding: 12px 18px; font-family: inherit;
  font-size: 14px; font-weight: 800; cursor: pointer; transition: all 0.2s ease;
}
.btn-neon { background: var(--accent-grad); color: #ffffff; box-shadow: var(--glow-btn); }
.btn-neon:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-neon-sm { background: var(--accent-grad); color: #ffffff; padding: 7px 14px; font-size: 12px; border-radius: 10px; box-shadow: 0 6px 16px rgba(168, 85, 247, 0.30); }
.btn-outline-sm {
  background: var(--surface-2); border: 1px solid var(--border-subtle); color: var(--text);
  padding: 7px 13px; font-size: 12px; border-radius: 10px;
}
.btn-outline-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: var(--surface-2); color: var(--text-soft); }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Sub-tabs & Code */
.sub-tabs { display: flex; gap: 6px; margin-bottom: 12px; border-bottom: 1px solid var(--border-subtle); padding-bottom: 10px; }
.sub-tabs button {
  background: transparent; border: none; color: var(--muted); font-family: inherit;
  font-weight: 700; font-size: 13px; padding: 6px 12px; border-radius: 9px; cursor: pointer;
}
.sub-tabs button.active { background: var(--accent-soft); color: var(--accent); }
.sub-panel { display: none; }
.sub-panel.active { display: block; }
.code-box {
  background: var(--surface-code); color: #e2e8f0; border: 1px solid var(--border-subtle);
  border-radius: 14px; padding: 16px; font-size: 12.5px; overflow: auto; max-height: 460px;
  margin: 0; white-space: pre-wrap; word-break: break-word;
}
.rtl-pre { font-family: "Vazirmatn", sans-serif; direction: rtl; line-height: 1.85; }

/* Metrics & UI/UX */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.metric-pill { background: var(--surface-2); border: 1px solid var(--border-subtle); border-radius: 12px; padding: 10px; text-align: center; }
.metric-val { font-size: 18px; font-weight: 900; color: var(--accent); }
.metric-lbl { font-size: 11px; color: var(--muted); }

.score-hero { display: flex; align-items: center; gap: 18px; background: var(--surface-2); border: 1px solid var(--border); padding: 16px; border-radius: 14px; margin-bottom: 14px; }
.score-circle {
  width: 68px; height: 68px; border-radius: 50%; border: 4px solid var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 900; color: var(--accent); flex-shrink: 0;
}
.issue-card { background: var(--surface-2); border-inline-start: 3px solid var(--accent); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.issue-card.critical { border-inline-start-color: var(--danger); }
.issue-card.quick-win { border-inline-start-color: var(--ok); }

/* Providers & Plans */
.providers-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 16px; }
.provider-card { background: var(--surface-2); border: 1px solid var(--border-subtle); border-radius: 16px; padding: 18px; }
.provider-card.active-prov { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.plans-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.plan-card { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: 20px; padding: 24px; display: flex; flex-direction: column; justify-content: space-between; }
.plan-card.featured { border-color: var(--accent); box-shadow: 0 18px 42px rgba(168, 85, 247, 0.16); }
.plan-price { font-size: 26px; font-weight: 900; color: var(--accent); margin: 12px 0; }
.plan-features { list-style: none; padding: 0; margin: 14px 0 22px; }
.plan-features li { padding: 6px 0; font-size: 13px; color: var(--text-soft); border-bottom: 1px dashed var(--border-subtle); }

.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border-subtle); border-radius: 12px; padding: 14px 16px;
}

.error-box { background: rgba(239, 68, 68, 0.14); border: 1px solid rgba(239, 68, 68, 0.45); color: var(--danger); padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 12px; }
.toast {
  position: fixed; bottom: 24px; inset-inline-end: 24px; background: var(--surface); color: var(--text);
  border: 1px solid var(--accent); padding: 12px 18px; border-radius: 13px; font-size: 13px; font-weight: 700;
  z-index: 999; box-shadow: var(--shadow); max-width: 460px;
}

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .grid-2, .providers-grid, .plans-grid, .form-row { grid-template-columns: 1fr; }
}

/* Live Progress Bar & Admin Extras */
.quota-split { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-soft); margin: 6px 0 8px; }
.live-progress {
  margin-top: 14px; padding: 14px 16px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.lp-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 8px; }
.lp-head strong { color: var(--accent); font-size: 15px; }
.lp-track { height: 10px; background: rgba(148, 163, 184, 0.2); border-radius: 99px; overflow: hidden; }
.lp-fill {
  height: 100%; border-radius: 99px; background: var(--accent-grad);
  transition: width 0.35s ease; box-shadow: 0 0 12px rgba(168, 85, 247, 0.55);
}
.inner-panel { background: var(--surface-2); border: 1px solid var(--border-subtle); border-radius: 16px; padding: 18px; }
.inner-panel h4 { margin: 0 0 14px; font-size: 15px; font-weight: 800; }
