:root {
  --bg: #0a0b14;
  --bg-2: #0f1120;
  --surface: #141729;
  --surface-2: #1a1e35;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eceefa;
  --muted: #9aa0c0;
  --accent: #8b6cff;
  --accent-2: #2dd4ef;
  --grad: linear-gradient(120deg, #8b6cff 0%, #5b8cff 50%, #2dd4ef 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --info: #60a5fa;
  --radius: 14px;
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(139, 108, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(45, 212, 239, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.4em; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1.05rem; }
code, pre { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.88em; }
code { background: var(--surface-2); padding: 0.15em 0.45em; border-radius: 6px; border: 1px solid var(--border); }
pre { white-space: pre-wrap; max-height: 320px; overflow: auto; background: var(--bg-2); padding: 10px; border-radius: 8px; }

.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.container.wide { max-width: 1280px; }
main.container { flex: 1; padding-top: 32px; padding-bottom: 48px; }

.topbar { border-bottom: 1px solid var(--border); background: rgba(10, 11, 20, 0.7); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.03em; }
.brand:hover { text-decoration: none; }
.logo-mark { width: 28px; height: 28px; }
.nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: flex-end; }
.nav a, .nav .link { color: var(--muted); font-size: 0.94rem; }
.nav a:hover, .nav .link:hover { color: var(--text); text-decoration: none; }
.nav a.btn { color: #fff; }

.footer { display: flex; gap: 18px; flex-wrap: wrap; padding: 24px 16px; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--border); }
.footer a { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--grad); color: #fff; border: 0; border-radius: 10px;
  padding: 11px 20px; font: inherit; font-weight: 600; cursor: pointer;
  box-shadow: 0 8px 24px -10px rgba(139, 108, 255, 0.8); transition: transform 0.15s, filter 0.15s;
}
.btn:hover { text-decoration: none; filter: brightness(1.1); transform: translateY(-1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-sm { padding: 7px 14px; font-size: 0.9rem; }
.btn-xs { padding: 4px 10px; font-size: 0.8rem; border-radius: 7px; box-shadow: none; }
.btn-block { width: 100%; }
.btn-ghost { background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: none; }
.btn-danger { background: #b91c1c; box-shadow: none; }
.btn-paypal { background: #ffc439; color: #111; box-shadow: 0 8px 24px -10px rgba(255, 196, 57, 0.6); }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-2); cursor: pointer; }
form.inline { display: inline; }

.card { background: linear-gradient(180deg, var(--surface), var(--bg-2)); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 20px; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid > .card { margin-bottom: 0; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-bottom: 20px; }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.err { color: var(--err); }

.alert { padding: 12px 16px; border-radius: 10px; margin: 0 0 20px; border: 1px solid; }
.alert-error { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.35); color: #fecaca; }
.alert-ok { background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.35); color: #a7f3d0; }
.alert-warn { background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.35); color: #fde68a; }
.alert-info { background: rgba(96, 165, 250, 0.1); border-color: rgba(96, 165, 250, 0.35); color: #bfdbfe; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.08); }
.badge-warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.08); }
.badge-err { color: var(--err); border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.08); }
.badge-info { color: var(--info); border-color: rgba(96, 165, 250, 0.35); background: rgba(96, 165, 250, 0.08); }
.badge-info::before { animation: pulse 1.2s infinite; }
.badge-muted { color: var(--muted); border-color: var(--border-strong); }
@keyframes pulse { 50% { opacity: 0.3; } }

/* Forms */
.form { display: grid; gap: 16px; }
label { display: grid; gap: 6px; font-size: 0.92rem; font-weight: 500; }
label small { color: var(--muted); font-weight: 400; }
input, select {
  font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 11px 13px; width: 100%; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 108, 255, 0.25); }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
label.check input { width: auto; margin-top: 4px; }
.auth { max-width: 440px; margin: 24px auto; }
.auth h1 { margin-bottom: 4px; }
.auth .card { margin-top: 20px; }

/* Services */
.service { color: var(--text); display: grid; gap: 16px; transition: border-color 0.15s, transform 0.15s; }
.service:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-2px); }
.service-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.service-head h3 { word-break: break-all; }
.link-out { color: var(--accent-2); font-size: 0.9rem; }
.specs { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0; margin: 0 0 12px; }
.specs li { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; }
.specs b { font-size: 1.05rem; }
.specs span { color: var(--muted); font-size: 0.8rem; }
.empty { text-align: center; padding: 48px 24px; grid-column: 1 / -1; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 12px 0 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.progress { display: flex; gap: 18px; align-items: center; }
.spinner { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Order */
fieldset { border: 0; padding: 0; margin: 0 0 28px; }
legend { font-weight: 600; margin-bottom: 12px; font-size: 1.05rem; }
.plans { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.plans legend { grid-column: 1 / -1; }
.plan { cursor: pointer; display: block; }
.plan input { position: absolute; opacity: 0; pointer-events: none; }
.plan-body { display: grid; gap: 6px; padding: 18px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); height: 100%; transition: border-color 0.15s, box-shadow 0.15s; }
.plan input:checked + .plan-body { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 108, 255, 0.25); }
.plan input:focus-visible + .plan-body { outline: 2px solid var(--accent-2); }
.plan.disabled { opacity: 0.45; cursor: not-allowed; }
.plan-name { font-weight: 700; font-size: 1.1rem; }
.plan-name em, .pill em { font-style: normal; font-size: 0.72rem; background: var(--grad); color: #fff; padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }
.plan-price { font-size: 1.6rem; font-weight: 700; }
.plan-price small { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.plan-specs { font-size: 0.92rem; }
.slug-input { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-2); overflow: hidden; max-width: 560px; }
.slug-input span { padding: 11px 12px; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.slug-input input { border: 0; border-radius: 0; min-width: 0; }
.slug-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 108, 255, 0.25); }
.durations { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.pill { cursor: pointer; display: inline-block; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span { display: inline-block; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-weight: 500; }
.pill input:checked + span { border-color: var(--accent); background: rgba(139, 108, 255, 0.15); }
.order-total { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.order-total strong { display: block; font-size: 1.8rem; }

/* Tables & admin */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
td.actions { white-space: nowrap; }
td.actions form { margin-right: 4px; }
.stat b { display: block; font-size: 1.8rem; margin-top: 4px; }
.meter { margin-bottom: 14px; }
.meter-label { display: flex; justify-content: space-between; font-size: 0.88rem; color: var(--muted); margin-bottom: 6px; }
.meter-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter-fill { height: 100%; background: var(--grad); border-radius: 999px; }

@media (max-width: 640px) {
  .topbar-inner { height: auto; padding-top: 12px; padding-bottom: 12px; flex-direction: column; align-items: flex-start; }
  .nav { justify-content: flex-start; gap: 14px; }
  .specs { grid-template-columns: 1fr 1fr 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .card { padding: 18px; }
}
