/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:      #5865f2;
  --accent-h:    #4752c4;
  --accent-dim:  rgba(88,101,242,.14);
  --bg:          #f0f2ff;
  --surface:     #ffffff;
  --surface-2:   #f8f9ff;
  --sidebar:     #0d0f20;
  --border:      #e2e6ff;
  --text-1:      #1a1c3a;
  --text-2:      #4a4e78;
  --text-3:      #8b90b8;
  --danger:      #ef4444;
  --success:     #22c55e;
  --warning:     #f59e0b;
  --radius:      8px;
  --radius-lg:   12px;
  font-family: 'Inter', system-ui, sans-serif;
}

body { background: var(--bg); color: var(--text-1); min-height: 100vh; overflow: hidden; }
#app { height: 100vh; }
h1,h2,h3 { font-weight: 700; letter-spacing: -.02em; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── Login ──────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0d0f20 0%, #1a1c3a 100%);
}
.login-card {
  width: 400px; background: #fff; border-radius: 20px; padding: 40px;
  box-shadow: 0 32px 80px rgba(0,0,0,.4);
}
.login-logo {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #7b86ff);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px; box-shadow: 0 4px 16px rgba(88,101,242,.4);
}
.login-logo i { font-size: 24px; color: white; }

/* ── App layout ─────────────────────────────────────────── */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--sidebar);
  display: flex; flex-direction: column; border-right: 1px solid rgba(255,255,255,.05);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px; border-bottom: 1px solid rgba(255,255,255,.05);
}
.sidebar-brand-icon {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg,#5865f2,#7b86ff);
  display: flex; align-items: center; justify-content: center;
}
.sidebar-brand-icon i { font-size: 16px; color: white; }
.sidebar-brand-name { font-size: 14px; font-weight: 700; color: #e8eaff; }
.sidebar-brand-sub  { font-size: 10px; color: #52578a; text-transform: uppercase; letter-spacing: .07em; }

.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav-section { margin-bottom: 20px; }
.nav-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #393e6a; padding: 0 8px; margin-bottom: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
  color: #6b72a8; font-size: 13px; font-weight: 500;
  transition: all .12s; user-select: none;
}
.nav-item i { font-size: 17px; flex-shrink: 0; }
.nav-item:hover { background: rgba(88,101,242,.1); color: #a8b0f0; }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 2px 12px rgba(88,101,242,.4); }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.05); }
.sidebar-user {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 8px; background: rgba(255,255,255,.04); cursor: pointer;
}
.sidebar-user:hover { background: rgba(255,255,255,.07); }
.sidebar-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg,#5865f2,#9b68f7);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
}
.sidebar-uname { font-size: 12.5px; font-weight: 600; color: #c8caf0; flex: 1; }
.sidebar-urole { font-size: 10px; color: #52578a; }

/* ── Main ───────────────────────────────────────────────── */
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 52px; flex-shrink: 0; background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 12px;
}
.topbar-title { font-size: 15px; font-weight: 700; color: var(--text-1); flex: 1; }
.page-content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}

/* ── Stat cards ─────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-val { font-size: 26px; font-weight: 800; color: var(--text-1); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ── Tables ─────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-3); padding: 10px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-2); }
.data-table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
}
.badge-active   { background: rgba(34,197,94,.12); color: #16a34a; border: 1px solid rgba(34,197,94,.25); }
.badge-pending  { background: rgba(245,158,11,.12); color: #b45309; border: 1px solid rgba(245,158,11,.25); }
.badge-suspended{ background: rgba(239,68,68,.12);  color: #dc2626; border: 1px solid rgba(239,68,68,.25); }
.badge-free     { background: rgba(88,101,242,.12); color: var(--accent); border: 1px solid rgba(88,101,242,.25); }
.badge-business { background: rgba(139,92,246,.12); color: #7c3aed; border: 1px solid rgba(139,92,246,.25); }
.badge-enterprise{background: rgba(245,158,11,.12); color: #b45309; border: 1px solid rgba(245,158,11,.25); }
.badge-online   { background: rgba(34,197,94,.12);  color: #16a34a; border: 1px solid rgba(34,197,94,.25); }
.badge-offline  { background: rgba(100,116,139,.12);color: #64748b; border: 1px solid rgba(100,116,139,.25); }

/* ── Forms ──────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .05em; }
.inp {
  width: 100%; height: 38px; padding: 0 11px;
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--radius); color: var(--text-1);
  font-size: 13.5px; font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.inp::placeholder { color: var(--text-3); }
select.inp { cursor: pointer; }
textarea.inp { height: auto; padding-top: 8px; resize: vertical; }

.btn {
  height: 36px; padding: 0 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; border: none; outline: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s; user-select: none; text-decoration: none;
}
.btn i { font-size: 16px; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-h); box-shadow: 0 4px 14px rgba(88,101,242,.4); }
.btn-ghost { background: var(--surface); color: var(--text-2); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: .85; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ── Alerts ─────────────────────────────────────────────── */
.err-alert {
  display: flex; align-items: center; gap: 8px;
  background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.25);
  border-radius: var(--radius); padding: 10px 12px;
  color: #dc2626; font-size: 13px; margin-top: 10px;
}
.ok-alert {
  display: flex; align-items: center; gap: 8px;
  background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.25);
  border-radius: var(--radius); padding: 10px 12px;
  color: #15803d; font-size: 13px; margin-top: 10px;
}

/* ── Key box (registration key display) ──────────────────── */
.key-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1.5px dashed var(--border);
  border-radius: var(--radius); padding: 10px 14px;
  font-family: 'SF Mono', Menlo, monospace; font-size: 15px;
  font-weight: 700; color: var(--accent); letter-spacing: .1em;
}
.key-box i { font-size: 18px; cursor: pointer; color: var(--text-3); }
.key-box i:hover { color: var(--accent); }

/* ── Online dot ─────────────────────────────────────────── */
.online-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.online-dot.on  { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.online-dot.off { background: #94a3b8; }

/* ── App icon preview ───────────────────────────────────── */
.app-icon-preview {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}

/* ── Misc ───────────────────────────────────────────────── */
.muted { color: var(--text-3); font-size: 12px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.flex-center { display: flex; align-items: center; gap: 8px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-header h2 { font-size: 18px; }
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 64px 24px; color: var(--text-3); }
.empty-state i { font-size: 40px; margin-bottom: 10px; opacity: .4; }
