:root {
  --bg: #070b14;
  --surface: rgba(18, 26, 46, 0.72);
  --border: rgba(120, 160, 255, 0.18);
  --text: #e8eeff;
  --muted: #93a0c3;
  --primary: #5b8cff;
  --primary-2: #7c5cff;
  --danger: #ff6b8a;
  --radius: 14px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  font-family: "Vazirmatn", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.bg-grid {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(91, 140, 255, 0.25), transparent),
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: auto, 48px 48px, 48px 48px;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem; border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10;
  background: rgba(7, 11, 20, 0.7);
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 700; }
.brand-icon { color: var(--primary); font-size: 1.4rem; }
.topbar nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; }

.container { width: min(1100px, 92vw); margin: 0 auto; padding: 2rem 0 4rem; }
.footer {
  text-align: center; padding: 1.5rem; color: var(--muted); font-size: .85rem;
  border-top: 1px solid var(--border);
}
.footer code { color: var(--text); }

.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 2rem; align-items: center;
  padding: 2rem 0;
}
@media (max-width: 800px) { .hero { grid-template-columns: 1fr; } }
.eyebrow { color: var(--primary); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .75rem; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: .4rem 0; }
.lead { color: var(--muted); line-height: 1.8; max-width: 52ch; }
.hero-actions { display: flex; gap: .8rem; margin-top: 1.2rem; flex-wrap: wrap; }
.hero-card { padding: 1.5rem; }
.route-list { list-style: none; padding: 0; margin: 0; }
.route-list li { padding: .6rem 0; border-bottom: 1px solid var(--border); color: var(--muted); }
.route-list span {
  display: inline-block; min-width: 5rem; color: var(--text);
  font-family: ui-monospace, monospace; margin-left: .5rem;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .65rem 1.1rem; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; cursor: pointer; font-family: inherit; font-size: .95rem;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
}
.btn-outline { border-color: var(--border); color: var(--text); background: transparent; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-sm { padding: .4rem .75rem; font-size: .85rem; }
.btn-block { width: 100%; }

.auth-card { max-width: 420px; margin: 2rem auto; padding: 2rem; }
.auth-card h2 { margin-top: 0; }
.form label { display: block; margin-bottom: 1rem; color: var(--muted); font-size: .9rem; }
.form input, .form textarea, .form select {
  display: block; width: 100%; margin-top: .35rem; padding: .7rem .85rem;
  border-radius: 10px; border: 1px solid var(--border);
  background: rgba(0,0,0,.25); color: var(--text); font-family: inherit;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: .6rem; }
.checkbox { display: flex !important; align-items: center; gap: .5rem; }

.page-header h1 { margin-bottom: .25rem; }
.muted { color: var(--muted); }
.muted.small { font-size: .85rem; }
.center { text-align: center; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 2rem; }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }
.card { padding: 1.25rem 1.5rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; }
.kv dt { color: var(--muted); }
.code-block {
  display: block; padding: .75rem; background: rgba(0,0,0,.35);
  border-radius: 8px; margin: .5rem 0; font-size: .85rem;
}

.products-section h2 { margin-bottom: 1rem; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.product-card {
  padding: 1.2rem; border-radius: var(--radius);
  border: 1px solid var(--border); background: rgba(255,255,255,.03);
}
.product-card h3 { margin: 0 0 .5rem; }
.product-card .meta { list-style: none; padding: 0; margin: .8rem 0 0; color: var(--muted); font-size: .85rem; }
.product-card .meta li { padding: .2rem 0; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .65rem; text-align: right; border-bottom: 1px solid var(--border); }
.admin-layout { margin-bottom: 1.5rem; padding: 1.5rem; }

.alert { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.alert-error { background: rgba(255,107,138,.15); border: 1px solid rgba(255,107,138,.35); color: #ffb3c4; }
.alert-success { background: rgba(80,200,120,.12); border: 1px solid rgba(80,200,120,.35); color: #b8f0cc; }

.form-input, .form textarea.form-input, .form select.form-input {
  display: block; width: 100%; margin-top: .35rem; padding: .7rem .85rem;
  border-radius: 10px; border: 1px solid var(--border);
  background: rgba(0,0,0,.25); color: var(--text); font-family: inherit;
}
.checkbox-label { display: flex !important; align-items: center; gap: .5rem; flex-direction: row; }
.field-error { display: block; color: #ffb3c4; font-size: .8rem; margin-top: .25rem; }

.admin-tabs {
  display: flex; gap: .5rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.admin-tab {
  padding: .55rem 1.1rem; border-radius: 999px; border: 1px solid var(--border);
  color: var(--muted); font-weight: 600;
}
.admin-tab:hover { color: var(--text); text-decoration: none; }
.admin-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; border-color: transparent;
}
.admin-section { padding: 1.5rem; margin-bottom: 1.25rem; }
.admin-section h2 { margin: 0 0 1rem; font-size: 1.15rem; }
.admin-form label { margin-bottom: .85rem; }
.badge {
  display: inline-block; margin-right: .35rem; padding: .15rem .5rem;
  border-radius: 999px; background: rgba(91,140,255,.2); font-size: .75rem; color: var(--text);
}
.table-wrap { overflow-x: auto; }
.row-sub { color: var(--muted); font-size: .82rem; margin-top: .2rem; }
.row-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; white-space: nowrap; }
.pill {
  display: inline-block; padding: .2rem .55rem; border-radius: 999px;
  font-size: .75rem; background: rgba(255,255,255,.06); color: var(--muted);
}
.pill-ok { background: rgba(80,200,120,.15); color: #b8f0cc; }
.btn-danger {
  background: rgba(255,107,138,.18); border: 1px solid rgba(255,107,138,.4); color: #ffb3c4;
}
.btn-danger:hover { background: rgba(255,107,138,.28); }
.empty-state { padding: 1rem 0; }
.profile-card { margin-bottom: 2rem; }
.profile-layout { align-items: start; }
.profile-layout .full-width { grid-column: 1 / -1; }
.profile-summary-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.profile-summary-head h3 { margin: 0; }
.alert-info {
  background: rgba(91,140,255,.12); border: 1px solid rgba(91,140,255,.35);
  color: #c5d8ff; margin-bottom: 1.25rem;
}
.alert-info a { color: #fff; font-weight: 600; }
.small { font-size: .85rem; }
.service-grid { align-items: start; }
.service-kv { margin-top: .5rem; }
.traffic-big { font-size: 1.5rem; font-weight: 700; margin: .5rem 0; text-align: center; }
.traffic-detail { list-style: none; padding: 0; margin: 1rem 0 0; color: var(--muted); }
.traffic-card { display: flex; flex-direction: column; }
.traffic-chart-wrap { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.traffic-donut {
  --usage: 0;
  position: relative;
  width: 160px;
  height: 160px;
}
.traffic-donut-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.traffic-donut-bg {
  fill: none;
  stroke: rgba(255,255,255,.08);
  stroke-width: 12;
}
.traffic-donut-fill {
  fill: none;
  stroke: url(#trafficGradient);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 289.03;
  stroke-dashoffset: calc(289.03 - (289.03 * var(--usage) / 100));
  transition: stroke-dashoffset .6s ease;
}
.traffic-donut-unlimited .traffic-donut-fill { stroke: url(#trafficGradientUnlimited); }
.traffic-donut-fill-full { stroke-dashoffset: 0; opacity: .35; }
.traffic-donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; pointer-events: none;
}
.traffic-donut-percent { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.traffic-donut-used { font-size: 1rem; }
.traffic-donut-label { font-size: .75rem; color: var(--muted); margin-top: .15rem; }
.traffic-dot {
  display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-left: .35rem;
}
.traffic-dot-up { background: var(--primary); }
.traffic-dot-down { background: var(--primary-2); }
.progress-bar {
  height: 10px; border-radius: 999px; background: rgba(255,255,255,.08);
  overflow: hidden; margin: .75rem 0;
}
.progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}
.subscription-card { margin-top: 1.25rem; }
.sub-qr-wrap {
  display: flex; justify-content: center; margin: 1.25rem 0 0.5rem;
}
.sub-qr-img {
  display: block; background: #fff; padding: 14px; border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.35); max-width: min(100%, 308px); height: auto;
}
.sub-url-hint { margin: 0.75rem 0; word-break: break-all; font-size: 0.8rem; }
.subscription-card .btn-outline { margin-top: 0.5rem; }
.delivery-vars { margin: 1rem 0; padding: 1rem; }
.delivery-vars h3 { margin: 0 0 0.5rem; }
.delivery-vars ul { margin: 0.5rem 0; padding-right: 1.25rem; }
.field-help { display: block; margin-top: 0.25rem; }
.admin-form .full-width { grid-column: 1 / -1; }
.delivery-fieldset {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem 1.25rem; margin-bottom: 1.25rem;
}
.delivery-fieldset legend { padding: 0 0.5rem; font-weight: 600; }
.delivery-form .checkbox-label { flex-direction: row; align-items: center; }

.dashboard-summary { margin-bottom: 1.5rem; align-items: stretch; }
.wallet-summary-card, .wallet-balance-card { text-align: center; }
.wallet-label { color: var(--muted); margin: 0 0 .5rem; font-size: .9rem; }
.wallet-balance {
  font-size: 2rem; font-weight: 700; margin: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wallet-balance-sm { font-size: 1.6rem; text-align: start; margin: .5rem 0; }
.wallet-unit { font-size: .85rem; font-weight: 500; color: var(--muted); -webkit-text-fill-color: var(--muted); }
.wallet-history { margin-top: 1.25rem; }
.tx-credit { color: #6ee7a0; }
.tx-debit { color: var(--danger); }
