﻿:root {
  --dash-bg-0: #060f22;
  --dash-bg-1: #0d1a36;
  --dash-bg-2: #142447;
  --dash-surface: rgba(17, 28, 52, 0.72);
  --dash-surface-strong: rgba(10, 20, 40, 0.82);
  --dash-line: rgba(125, 211, 252, 0.2);
  --dash-line-soft: rgba(148, 163, 184, 0.28);
  --dash-text: #e7eefc;
  --dash-muted: #a1b3d3;
  --dash-brand: #22d3ee;
  --dash-brand-2: #3b82f6;
  --dash-ok: #10b981;
  --dash-warn: #f59e0b;
  --dash-danger: #ef4444;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.dash-body {
  min-height: 100vh;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--dash-text);
  background:
    radial-gradient(1100px 480px at -10% -20%, rgba(34, 211, 238, 0.16), transparent 62%),
    radial-gradient(900px 380px at 110% 120%, rgba(59, 130, 246, 0.14), transparent 60%),
    linear-gradient(180deg, var(--dash-bg-0), var(--dash-bg-1) 48%, var(--dash-bg-2));
  padding: 18px;
}

.dash-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(125, 211, 252, 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(125, 211, 252, 0.04) 1px, transparent 1px);
  background-size: 34px 34px;
}

.dash-shell {
  position: relative;
  z-index: 1;
  max-width: 1500px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
}

.card {
  border: 1px solid var(--dash-line);
  border-radius: 14px;
  background: linear-gradient(170deg, rgba(19, 33, 60, 0.9), var(--dash-surface));
  box-shadow: 0 16px 30px rgba(2, 8, 22, 0.45);
  backdrop-filter: blur(10px);
  padding: 14px;
}

.dash-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

h1, h2 { margin: 0; }
h1 {
  font-size: clamp(1.5rem, 2.7vw, 2.2rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  background: linear-gradient(130deg, #7dd3fc, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 { font-size: 1.08rem; }

.muted {
  color: var(--dash-muted);
  font-size: 0.84rem;
}

.dash-kicker {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--dash-brand);
  font-weight: 700;
}

.top-actions,
.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  border: 1px solid var(--dash-line-soft);
  background: rgba(15, 23, 42, 0.55);
  color: var(--dash-text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: 0.14s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover:not(:disabled) {
  border-color: rgba(34, 211, 238, 0.58);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(125deg, var(--dash-brand), var(--dash-brand-2));
  color: #04243a;
  border-color: transparent;
}

.btn-success { border-color: rgba(16, 185, 129, 0.55); color: #86efac; }
.btn-danger { border-color: rgba(239, 68, 68, 0.55); color: #fca5a5; }
.btn-ghost { background: rgba(15, 23, 42, 0.3); }
.btn.success { border-color: rgba(16, 185, 129, 0.55); color: #86efac; }
.btn.danger { border-color: rgba(239, 68, 68, 0.55); color: #fca5a5; }
.btn.ghost { background: rgba(15, 23, 42, 0.3); }
.btn.small { padding: 6px 10px; font-size: 0.74rem; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  border: 1px solid var(--dash-line);
  border-radius: 12px;
  background: var(--dash-surface-strong);
  padding: 12px;
}

.stat-label {
  display: block;
  margin-bottom: 6px;
  color: var(--dash-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.stat-value {
  display: block;
  font-size: 1.46rem;
  margin-bottom: 4px;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wide { grid-column: 1 / -1; }

.kv-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.kv-item {
  border: 1px solid var(--dash-line);
  border-radius: 10px;
  padding: 10px;
  background: rgba(8, 17, 33, 0.62);
}

.kv-item .k {
  color: var(--dash-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.kv-item .v {
  margin-top: 4px;
  font-size: 0.96rem;
  font-weight: 700;
}

.field-label {
  color: var(--dash-muted);
  font-size: 0.78rem;
}

.form-row {
  display: grid;
  gap: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.split-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--dash-line-soft);
  background: rgba(8, 16, 30, 0.74);
  color: var(--dash-text);
  padding: 9px;
  font-size: 0.82rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.table-wrap {
  border: 1px solid var(--dash-line);
  border-radius: 10px;
  overflow: auto;
  max-height: 440px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.table th,
.table td {
  padding: 9px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  text-align: left;
  font-size: 0.78rem;
  white-space: nowrap;
}

.table th {
  position: sticky;
  top: 0;
  background: rgba(8, 16, 30, 0.96);
  color: #cad7ef;
}

.table tr:hover td {
  background: rgba(59, 130, 246, 0.08);
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.log-box {
  border: 1px solid var(--dash-line);
  border-radius: 10px;
  background: rgba(8, 16, 30, 0.74);
  color: #d0def9;
  min-height: 100px;
  max-height: 350px;
  overflow: auto;
  padding: 10px;
  font-size: 0.8rem;
  white-space: pre-wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
}
.badge.free { color: #7dd3fc; border-color: rgba(125,211,252,.4); background: rgba(14,165,233,.12); }
.badge.paid { color: #86efac; border-color: rgba(134,239,172,.35); background: rgba(34,197,94,.12); }
.badge.admin { color: #fcd34d; border-color: rgba(252,211,77,.35); background: rgba(245,158,11,.12); }
.badge.active { color: #86efac; border-color: rgba(134,239,172,.35); background: rgba(34,197,94,.12); }
.badge.suspended { color: #fcd34d; border-color: rgba(252,211,77,.35); background: rgba(245,158,11,.12); }
.badge.revoked { color: #fca5a5; border-color: rgba(252,165,165,.35); background: rgba(239,68,68,.12); }

.admin-shell [data-tab-panel] { display: none; }
.admin-shell [data-tab-panel].active { display: block; }
.adminx-tab-btn.active {
  border-color: rgba(34, 211, 238, 0.62);
  background: rgba(34, 211, 238, 0.12);
}
tr.selected td { background: rgba(34, 211, 238, 0.12); }

details {
  border: 1px solid var(--dash-line);
  border-radius: 10px;
  background: rgba(8, 16, 30, 0.45);
  padding: 10px;
}

details summary { cursor: pointer; font-weight: 700; }

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  max-width: 460px;
  border: 1px solid var(--dash-line-soft);
  background: rgba(8, 16, 30, 0.95);
  color: #f5f9ff;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 14px 24px rgba(0,0,0,0.28);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 140ms ease, transform 140ms ease;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: rgba(59, 17, 23, 0.95); border-color: rgba(239, 68, 68, 0.5); }

.login-body {
  display: grid;
  place-items: center;
}

.login-wrap {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
}

.login-card {
  border: 1px solid var(--dash-line);
  border-radius: 18px;
  background: linear-gradient(165deg, rgba(19, 33, 60, 0.9), rgba(11, 20, 38, 0.88));
  box-shadow: 0 22px 40px rgba(2, 8, 22, 0.45);
  backdrop-filter: blur(12px);
  padding: 30px;
}

.login-card h1 {
  margin: 10px 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.login-card p {
  margin: 0 0 14px;
  color: var(--dash-muted);
  line-height: 1.56;
}

.login-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.login-note {
  padding: 10px 12px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.08);
}

.login-back {
  display: inline-flex;
  margin-top: 18px;
  color: var(--dash-text);
  text-decoration: none;
  font-weight: 600;
}

.login-back:hover {
  color: var(--dash-brand);
}

.theme-light {
  --dash-bg-0: #eff5ff;
  --dash-bg-1: #dbe8ff;
  --dash-bg-2: #c9dafa;
  --dash-surface: rgba(255, 255, 255, 0.9);
  --dash-surface-strong: rgba(248, 252, 255, 0.96);
  --dash-line: rgba(100, 116, 139, 0.25);
  --dash-line-soft: rgba(100, 116, 139, 0.35);
  --dash-text: #0f172a;
  --dash-muted: #475569;
}

@media (max-width: 1150px) {
  .stats-grid,
  .dash-grid,
  .kv-list,
  .actions-grid,
  .split-two,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body.dash-body { padding: 10px; }
  .dash-top { flex-direction: column; align-items: flex-start; }
  .top-actions,
  .top-actions .btn,
  .tab-row .btn { width: 100%; }
  .card,
  .login-card { padding: 12px; }
}
