:root {
  --header: #0f172a;
  --header-2: #1e293b;
  --nav: #111827;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --danger: #f43f5e;
  --ok: #10b981;
  --warn: #f59e0b;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  --radius: 14px;
  --font: "Segoe UI", system-ui, sans-serif;
}

[data-theme="super"] {
  --header: #1a0b2e;
  --header-2: #4c1d95;
  --nav: #2e1065;
  --accent: #a855f7;
  --accent-2: #f472b6;
}
[data-theme="reseller"] {
  --header: #0c1929;
  --header-2: #1d4ed8;
  --nav: #1e3a8a;
  --accent: #3b82f6;
  --accent-2: #22d3ee;
}
[data-theme="sub"] {
  --header: #1c1008;
  --header-2: #c2410c;
  --nav: #9a3412;
  --accent: #f59e0b;
  --accent-2: #fb7185;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.panel-body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 400px at 0% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 55%),
    radial-gradient(700px 360px at 100% 0%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 50%),
    var(--bg);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.top-header {
  background: linear-gradient(120deg, var(--header), var(--header-2));
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .85rem 1.35rem;
  gap: 1rem;
}
.top-left { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.logo {
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -.02em;
}
.logo span {
  background: linear-gradient(90deg, var(--accent-2), #fff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.live-pills {
  display: flex; gap: .85rem; flex-wrap: wrap;
  font-size: .86rem; opacity: .92;
}
.user-menu {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  padding: .45rem .85rem;
  border-radius: 999px;
  font-size: .9rem;
  display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15;
}
.user-menu small { opacity: .75; font-size: .72rem; }

.main-nav {
  background: var(--nav);
  display: flex; gap: .1rem; padding: 0 .85rem;
}
.main-nav a {
  color: rgba(255,255,255,.72);
  padding: .75rem 1.05rem;
  font-size: .92rem;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover, .main-nav a.active {
  color: #fff;
  border-bottom-color: var(--accent-2);
  background: rgba(255,255,255,.04);
}

.content { padding: 1.2rem 1.35rem 2rem; max-width: 1500px; margin: 0 auto; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; margin-bottom: 1.1rem;
}
.topbar h1 { margin: 0; font-size: 1.4rem; letter-spacing: -.02em; }
.topbar p { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }

.dash-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .9rem;
  margin-bottom: 1rem;
}
.metric {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  color: #fff;
  padding: 1.05rem 1.1rem;
  min-height: 98px;
  display: flex;
  align-items: center;
  gap: .85rem;
  box-shadow: var(--shadow);
}
.metric::after {
  content: "";
  position: absolute; right: -18px; top: -18px;
  width: 90px; height: 90px; border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.metric-ico {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.18);
  font-size: 1.15rem;
}
.metric-val { font-size: 1.6rem; font-weight: 780; line-height: 1.1; }
.metric-lbl { font-size: .8rem; opacity: .92; margin-top: .25rem; }
.m-purple { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.m-green { background: linear-gradient(135deg, #34d399, #059669); }
.m-blue { background: linear-gradient(135deg, #38bdf8, #2563eb); }
.m-pink { background: linear-gradient(135deg, #fb7185, #e11d48); }
.m-navy { background: linear-gradient(135deg, #818cf8, #4f46e5); }
.m-orange { background: linear-gradient(135deg, #fb923c, #ea580c); }

.status-banner {
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: .55rem;
  color: var(--ok); font-weight: 650;
}
.status-banner .check {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(16,185,129,.12);
  display: grid; place-items: center;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.35fr .95fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.panel-card {
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-card.span-2 { grid-column: 1 / -1; }
.panel-card-h {
  padding: .9rem 1.05rem;
  border-bottom: 1px solid var(--line);
  font-weight: 720;
  font-size: .95rem;
}
.panel-card-b { padding: 1rem 1.05rem; }
.chart-box { height: 260px; }

.loc-list { display: flex; flex-direction: column; gap: .7rem; }
.loc-row {
  display: grid;
  grid-template-columns: 130px 1fr 88px;
  gap: .55rem;
  align-items: center;
  font-size: .88rem;
}
.bar {
  height: 9px; border-radius: 999px; background: #e2e8f0; overflow: hidden;
}
.bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.card-h {
  display: flex; justify-content: space-between; align-items: center;
  padding: .95rem 1.05rem; border-bottom: 1px solid var(--line);
}
.card-h h2 { margin: 0; font-size: 1rem; }
.card-b { padding: 1.05rem; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left; padding: .75rem .9rem;
  border-bottom: 1px solid var(--line); font-size: .9rem;
}
th {
  color: var(--muted); font-size: .74rem;
  text-transform: uppercase; letter-spacing: .04em;
}
tr:hover td { background: #f8fafc; }

.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .55rem; border-radius: 999px;
  font-size: .74rem; font-weight: 650;
}
.badge.ok { background: #d1fae5; color: #047857; }
.badge.warn { background: #fef3c7; color: #b45309; }
.badge.danger { background: #ffe4e6; color: #be123c; }
.badge.muted { background: #eef2ff; color: #4338ca; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  border: 0; cursor: pointer; border-radius: 11px;
  padding: .65rem 1.05rem; font-weight: 680;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 28%, transparent);
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn.ghost {
  background: #fff; color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn.danger {
  background: linear-gradient(135deg, #fb7185, #e11d48);
}
.btn.sm { padding: .38rem .7rem; font-size: .8rem; border-radius: 9px; }

.toolbar { display: flex; gap: .65rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.input, .select {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 11px;
  padding: .7rem .85rem;
  min-width: 220px;
}
.chip {
  display: inline-flex; gap: .35rem; align-items: center;
  background: #fff; border: 1px solid var(--line);
  padding: .42rem .75rem; border-radius: 999px;
  color: var(--muted); font-size: .85rem;
}
.chip b { color: var(--text); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { color: var(--muted); font-size: .85rem; }
.field.full { grid-column: 1 / -1; }

.flash {
  padding: .85rem 1rem; border-radius: 12px; margin-bottom: 1rem;
  border: 1px solid var(--line); background: #fff;
}
.flash.success { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.flash.error { background: #fff1f2; color: #be123c; border-color: #fecdd3; }

.mono { font-family: ui-monospace, Consolas, monospace; font-size: .84rem; }
.muted { color: var(--muted); }

.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    radial-gradient(700px 380px at 15% 10%, rgba(99,102,241,.35), transparent 60%),
    radial-gradient(600px 360px at 90% 80%, rgba(34,211,238,.28), transparent 55%),
    #020617;
}
.login-card {
  width: min(400px, 100%);
  background: rgba(255,255,255,.96);
  border-radius: 20px;
  padding: 1.85rem 1.55rem;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
  color: var(--text);
}
.login-card h1 { margin: 0 0 1rem; font-size: 1.5rem; }
.login-card .brand { display: flex; gap: .75rem; align-items: center; }
.login-card .brand span { color: var(--muted); font-size: .8rem; display: block; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px;
  background: linear-gradient(135deg, #6366f1, #22d3ee);
  color: #fff; display: grid; place-items: center; font-weight: 800;
}
.login-card .field { margin-bottom: .85rem; }
.login-card .btn { width: 100%; margin-top: .35rem; }
.login-card .input { width: 100%; min-width: 0; }

.grid-2-dash {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 1rem;
}
.welcome-block h1 {
  margin: 0 0 1.1rem;
  font-size: 1.75rem;
  letter-spacing: -.02em;
}
.credits-pill {
  background: rgba(34, 211, 238, .15);
  border: 1px solid rgba(34, 211, 238, .35);
  color: #67e8f9;
  padding: .45rem .85rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: .95rem;
}
.is-reseller .top-header {
  background: linear-gradient(120deg, #0b1c2c, #123a56);
}
.is-reseller .main-nav {
  background: #0f2740;
}
.is-reseller[data-theme="sub"] .top-header {
  background: linear-gradient(120deg, #1c1008, #7c2d12);
}
.is-reseller[data-theme="sub"] .main-nav {
  background: #431407;
}
.is-reseller .content {
  background: transparent;
}
.reseller-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.month-pills { display:flex; flex-wrap:wrap; gap:.55rem; }
.month-pill {
  border:1px solid var(--line); background:#fff; color:var(--text);
  border-radius:999px; padding:.65rem 1rem; cursor:pointer; font-weight:650;
}
.month-pill.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color:#fff; border-color:transparent;
}
.bq-toolbar { display:flex; gap:.5rem; margin:.4rem 0 .7rem; flex-wrap:wrap; }
.bq-grid {
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap:.45rem .7rem;
  max-height: 420px;
  overflow:auto;
  padding:.75rem;
  border:1px solid var(--line);
  border-radius:12px;
  background: rgba(0,0,0,.02);
}
.bq-item {
  display:flex;
  align-items:flex-start;
  gap:.45rem;
  font-size:.92rem;
  line-height:1.25;
  cursor:pointer;
}
.bq-item input { margin-top:.15rem; flex-shrink:0; }
@media (max-width: 1100px) {
  .grid-2-dash { grid-template-columns: 1fr; }
  .reseller-metrics { grid-template-columns: 1fr 1fr; }
  .dash-metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .dash-metrics, .reseller-metrics { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .live-pills { display: none; }
}
