@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #0a0f1e;
  --bg2: #111827;
  --bg3: #1a2235;
  --bg4: #1f2d42;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text: #e8edf5;
  --text2: #8b97b0;
  --text3: #5a6680;
  --accent: #00d4aa;
  --accent2: #0099ff;
  --accent3: #7c5cfc;
  --danger: #ff4d6d;
  --warning: #ffb347;
  --success: #00d4aa;
  --info: #0099ff;
  --sidebar-w: 260px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius:3px; }

/* ---- LAYOUT ---- */
.app-layout { display:flex; min-height:100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top:0; left:0; bottom:0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
}

.logo-text { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; }
.logo-sub { font-size: 10px; color: var(--text3); letter-spacing: 0.5px; }

.sidebar-nav { padding: 16px 12px; flex:1; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 8px;
  margin: 16px 0 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
  cursor: pointer;
}

.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(0,212,170,0.12); color: var(--accent); }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge { margin-left:auto; background: var(--danger); color:#fff; font-size:10px; font-weight:600; padding:2px 6px; border-radius:10px; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.admin-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg3);
}

.admin-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent3), var(--accent2));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.admin-name { font-size: 13px; font-weight: 500; color: var(--text); }
.admin-role { font-size: 10px; color: var(--text3); text-transform: capitalize; }

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 16px; font-weight: 600; color: var(--text); }
.topbar-sub { font-size: 12px; color: var(--text3); margin-top: 1px; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-content { padding: 28px; flex: 1; }

/* ---- STATS CARDS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s;
}

.stat-card:hover { border-color: var(--border2); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.stat-card.teal::before { background: linear-gradient(90deg, var(--accent), transparent); }
.stat-card.blue::before { background: linear-gradient(90deg, var(--accent2), transparent); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--accent3), transparent); }
.stat-card.orange::before { background: linear-gradient(90deg, var(--warning), transparent); }
.stat-card.red::before { background: linear-gradient(90deg, var(--danger), transparent); }

.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 14px;
}

.stat-card.teal .stat-icon { background: rgba(0,212,170,0.12); }
.stat-card.blue .stat-icon { background: rgba(0,153,255,0.12); }
.stat-card.purple .stat-icon { background: rgba(124,92,252,0.12); }
.stat-card.orange .stat-icon { background: rgba(255,179,71,0.12); }
.stat-card.red .stat-icon { background: rgba(255,77,109,0.12); }

.stat-value { font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -1px; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text3); font-weight: 500; }
.stat-change { font-size: 11px; margin-top: 8px; }
.stat-change.up { color: var(--accent); }
.stat-change.down { color: var(--danger); }

/* ---- CARDS ---- */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.card-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
.card-body { padding: 22px; }

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

table { width: 100%; border-collapse: collapse; }

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
  white-space: nowrap;
}

tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text2);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg3); }
tbody tr:hover td:first-child { color: var(--text); }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-active   { background: rgba(0,212,170,0.12); color: var(--accent); }
.badge-inactive { background: rgba(139,151,176,0.12); color: var(--text3); }
.badge-expired  { background: rgba(255,77,109,0.12); color: var(--danger); }
.badge-suspended{ background: rgba(255,179,71,0.12); color: var(--warning); }
.badge-paid     { background: rgba(0,212,170,0.12); color: var(--accent); }
.badge-unpaid   { background: rgba(255,77,109,0.12); color: var(--danger); }
.badge-overdue  { background: rgba(255,77,109,0.15); color: var(--danger); }
.badge-pppoe    { background: rgba(0,153,255,0.12); color: var(--accent2); }
.badge-hotspot  { background: rgba(124,92,252,0.12); color: var(--accent3); }
.badge-online   { background: rgba(0,212,170,0.12); color: var(--accent); }
.badge-offline  { background: rgba(255,77,109,0.12); color: var(--danger); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: #00bfa0; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg4); }
.btn-danger { background: rgba(255,77,109,0.15); color: var(--danger); border: 1px solid rgba(255,77,109,0.2); }
.btn-danger:hover { background: rgba(255,77,109,0.25); }
.btn-warning { background: rgba(255,179,71,0.15); color: var(--warning); border: 1px solid rgba(255,179,71,0.2); }
.btn-info { background: rgba(0,153,255,0.15); color: var(--accent2); border: 1px solid rgba(0,153,255,0.2); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; border-radius: 6px; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; letter-spacing: 0.3px; }
.form-label span { color: var(--danger); }

.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.15s;
  outline: none;
}

.form-control:focus { border-color: var(--accent); background: var(--bg4); }
.form-control::placeholder { color: var(--text3); }

select.form-control option { background: var(--bg3); }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-hint { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* ---- ALERTS ---- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; border-left: 3px solid; }
.alert-success { background: rgba(0,212,170,0.08); border-color: var(--accent); color: var(--accent); }
.alert-danger  { background: rgba(255,77,109,0.08); border-color: var(--danger); color: var(--danger); }
.alert-warning { background: rgba(255,179,71,0.08); border-color: var(--warning); color: var(--warning); }
.alert-info    { background: rgba(0,153,255,0.08); border-color: var(--accent2); color: var(--accent2); }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 20px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---- SEARCH & FILTER ---- */
.table-toolbar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  flex: 1;
  min-width: 200px;
}

.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  width: 100%;
}

.search-box input::placeholder { color: var(--text3); }

/* ---- PAGINATION ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
}

.page-btn {
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  text-decoration: none;
  transition: all 0.15s;
}

.page-btn:hover { background: var(--bg4); color: var(--text); }
.page-btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

/* ---- MISC ---- */
.text-muted { color: var(--text3); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--accent2); }
.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.ml-auto { margin-left: auto; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.w-100 { width: 100%; }

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.login-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-icon { margin: 0 auto 12px; width: 56px; height: 56px; font-size: 22px; border-radius: 16px; }
.login-logo h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.login-logo p { font-size: 13px; color: var(--text3); margin-top: 4px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.empty-desc { font-size: 13px; color: var(--text3); }

/* ---- ROUTER STATUS DOT ---- */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.status-dot.online { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.status-dot.offline { background: var(--danger); }
.status-dot.unknown { background: var(--text3); }
