@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg:         #090d18;
  --panel:      #0f1623;
  --panel2:     #141d2e;
  --panel3:     #1a2540;
  --text:       #e2e8f8;
  --muted:      #7a89a8;
  --primary:    #6c5dd3;
  --primary2:   #8b7ae0;
  --accent:     #00c9a7;
  --accent2:    #00e8bf;
  --warning:    #ff9f43;
  --danger:     #ff5e7a;
  --success:    #00c9a7;
  --border:     rgba(255,255,255,0.06);
  --border2:    rgba(255,255,255,0.11);
  --shadow:     0 8px 40px rgba(0,0,0,0.45);
  --shadow-sm:  0 2px 12px rgba(0,0,0,0.3);
  --glow:       0 0 60px rgba(108,93,211,0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Background decorative blobs ── */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
body::before {
  width: 700px; height: 700px;
  top: -200px; right: -150px;
  background: radial-gradient(circle, rgba(108,93,211,0.14) 0%, transparent 70%);
}
body::after {
  width: 500px; height: 500px;
  bottom: -100px; left: -100px;
  background: radial-gradient(circle, rgba(0,201,167,0.10) 0%, transparent 70%);
}

a { color: var(--accent); text-decoration: none; }

button, input, select, textarea { font: inherit; }

button {
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  border-radius: 10px;
  padding: 0.72rem 1.4rem;
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  position: relative; z-index: 1;
}
button:hover {
  background: var(--primary2);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(108,93,211,0.35);
}
button:active { transform: translateY(0); }

/* ── Layout ── */
.container {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
}

/* ── Brand Logo ── */
.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand-logo-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}
.brand-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-logo-text .brand-name {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #a78bfa, #00e8bf);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-logo-text .brand-sub {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--muted);
}

/* auth page logo variant */
.auth-brand-logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}
.auth-brand-logo .brand-logo-text .brand-name {
  font-size: 1.3rem;
}
.auth-brand-logo .brand-logo-icon {
  width: 46px;
  height: 46px;
}

/* ── Sidebar ── */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: linear-gradient(180deg, #0d1422 0%, #111929 100%);
  border-right: 1px solid var(--border);
  padding: 0;
  position: fixed;
  inset: 0 auto 0 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  padding: 1.6rem 1.5rem 1.2rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sidebar-brand p {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 1.2rem 1.5rem 0.5rem;
}

nav { padding: 0 0.75rem; flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.78rem 0.9rem;
  border-radius: 10px;
  color: var(--muted);
  margin-bottom: 0.2rem;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
  position: relative;
}
.nav-link:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
.nav-link.active {
  background: rgba(108,93,211,0.18);
  color: #fff;
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}
.nav-link .nav-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  background: rgba(255,255,255,0.04);
  flex-shrink: 0;
}
.nav-link.active .nav-icon {
  background: rgba(108,93,211,0.25);
}

.sidebar-footer {
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.sidebar-footer button {
  width: 100%;
  background: rgba(255,94,122,0.12);
  color: #ff7a93;
  border: 1px solid rgba(255,94,122,0.2);
}
.sidebar-footer button:hover {
  background: rgba(255,94,122,0.22);
  box-shadow: none;
}

/* ── Main content ── */
.main {
  margin-left: 260px;
  padding: 1.75rem 2rem;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Top bar ── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

/* ── Page header ── */
.page-header {
  margin-bottom: 1.75rem;
}
.page-header .breadcrumb {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
}
.page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}
.page-header p {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.85rem;
  background: rgba(108,93,211,0.18);
  border: 1px solid rgba(108,93,211,0.3);
  border-radius: 999px;
  color: var(--primary2);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

/* ── Grid ── */
.grid { display: grid; gap: 1.25rem; }
.flex { display: flex; gap: 1.25rem; }

/* ── Stat grid ── */
.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.stat-card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.4rem 1.5rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 16px 16px 0 0;
}
.stat-card h3 {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.6rem;
}
.stat-card strong {
  font-size: 2.1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  display: block;
}
.stat-card .stat-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.4rem;
}
.stat-card .stat-icon {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(108,93,211,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

/* ── Cards ── */
.card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  position: relative;
}
.card h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.25rem;
}
.card > p {
  font-size: 0.83rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* ── Section header inside card ── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 1rem;
}
.section-header h2 { margin-bottom: 0; }
.section-header p { margin-bottom: 0; }

/* ── Forms ── */
.form-grid { display: grid; gap: 1rem; }

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.input-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.input-group input,
.input-group select,
.input-group textarea {
  width: 100%;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border-radius: 10px;
  padding: 0.78rem 1rem;
  transition: border-color 0.2s, background 0.2s;
  font-size: 0.9rem;
}
.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  outline: none;
  border-color: rgba(108,93,211,0.5);
  background: rgba(108,93,211,0.05);
}
.input-group input::placeholder,
.input-group textarea::placeholder {
  color: rgba(122,137,168,0.5);
}
textarea {
  resize: vertical;
  min-height: 110px;
}
select option { background: var(--panel); }

/* ── Table ── */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
}
.table thead tr {
  border-bottom: 1px solid var(--border2);
}
.table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.table td {
  padding: 0.9rem 1rem;
  color: var(--text);
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.table tbody tr:hover td {
  background: rgba(255,255,255,0.02);
}
.table tbody tr:last-child td { border-bottom: none; }

/* ── Tags / Badges ── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.tag.success  { background: rgba(0,201,167,0.12);  color: #00e8bf; border: 1px solid rgba(0,201,167,0.2); }
.tag.warning  { background: rgba(255,159,67,0.12); color: #ffba7a; border: 1px solid rgba(255,159,67,0.2); }
.tag.danger   { background: rgba(255,94,122,0.12); color: #ff8099; border: 1px solid rgba(255,94,122,0.2); }
.tag.pending  { background: rgba(108,93,211,0.14); color: #a99fe8; border: 1px solid rgba(108,93,211,0.25); }

/* ── Notification banner ── */
.notification-banner {
  background: linear-gradient(135deg, rgba(108,93,211,0.12), rgba(0,201,167,0.08));
  border: 1px solid rgba(108,93,211,0.2);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  display: flex;
  gap: 0.85rem;
  align-items: center;
}
.notification-banner strong { color: #fff; font-size: 0.9rem; }
.notification-banner p { font-size: 0.82rem; color: var(--muted); margin-top: 0.2rem; }

/* ── Monitor banner ── */
.monitor-banner {
  background: rgba(108,93,211,0.1);
  border: 1px solid rgba(108,93,211,0.25);
  border-left: 3px solid var(--primary);
  padding: 1rem 1.2rem;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
}
.monitor-banner strong { color: #fff; }
.monitor-banner p { font-size: 0.83rem; color: var(--muted); margin-top: 0.2rem; }

/* ── Auth page ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
  position: relative;
}
.auth-page::before {
  content: '';
  position: fixed;
  width: 600px; height: 600px;
  top: -150px; right: -100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108,93,211,0.16) 0%, transparent 70%);
  pointer-events: none;
}
.auth-page::after {
  content: '';
  position: fixed;
  width: 400px; height: 400px;
  bottom: -80px; left: -80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,201,167,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.auth-card {
  width: min(480px, 100%);
  background: var(--panel2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 2.25rem;
  box-shadow: var(--shadow), var(--glow);
  position: relative;
  z-index: 1;
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}
.auth-logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.auth-card h1 {
  font-size: 1.55rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.3rem;
}
.auth-card > p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  padding: 3px;
  gap: 3px;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 0.65rem 0;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.tab:hover { color: var(--text); background: rgba(255,255,255,0.04); box-shadow: none; transform: none; }
.tab.active {
  background: var(--panel3);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* ── Copy button ── */
.copy-btn {
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-size: 0.82rem;
}
.copy-btn:hover { background: rgba(255,255,255,0.05); box-shadow: none; color: var(--text); }

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  background: rgba(5,8,18,0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 500;
}
.modal.show { opacity: 1; pointer-events: auto; }
.modal-card {
  width: min(540px, calc(100% - 2rem));
  background: var(--panel2);
  border: 1px solid var(--border2);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: var(--shadow);
}
.modal-card h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }

/* ── Toast ── */
.toast {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  background: var(--panel3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 0.9rem 1.3rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  transition: 0.25s ease;
  z-index: 9999;
  font-size: 0.88rem;
  font-weight: 500;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: rgba(0,201,167,0.35); color: #00e8bf; }
.toast.error   { border-color: rgba(255,94,122,0.35); color: #ff8099; }

/* ── Confetti / Flash overlays ── */
.confetti-overlay,
.flash-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: none;
  z-index: 9998;
}
.confetti-overlay.active, .flash-overlay.active { display: block; }
.confetti-overlay {
  background-image:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,0.7), transparent 10%),
    radial-gradient(circle at 80% 25%, rgba(255,196,0,0.9), transparent 12%),
    radial-gradient(circle at 35% 75%, rgba(108,93,211,0.9), transparent 10%),
    radial-gradient(circle at 72% 70%, rgba(0,201,167,0.8), transparent 12%),
    linear-gradient(180deg, rgba(255,255,255,0.08), transparent 80%);
  animation: confetti 3s ease forwards;
}
@keyframes confetti {
  0%   { opacity: 0; transform: scale(0.85); }
  10%, 85% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.04); }
}
.flash-overlay {
  background: rgba(255,94,122,0.35);
  animation: flashRed 3s ease forwards;
}
@keyframes flashRed {
  0%  { opacity: 0; }
  10% { opacity: 0.85; }
  100%{ opacity: 0; }
}

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 1rem;
  }
  .sidebar-brand { border-bottom: none; padding: 0; }
  nav { padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
  .sidebar-footer { border-top: none; padding: 0; margin: 0; }
  .main { margin-left: 0; padding: 1rem; }
}

/* ── Utility ── */
.text-muted   { color: var(--muted); }
.text-white   { color: #fff; }
.text-success { color: var(--accent2); }
.text-danger  { color: var(--danger); }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }

/* ── Header panel (legacy compat) ── */
.header-panel {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.header-panel h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  margin: 0.3rem 0 0;
}
.header-panel p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}
