/* ===== PANEL NODE - Premium Design v2 ===== */
:root {
  --sidebar-bg: #0d1117;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-active-bg: rgba(99,102,241,.18);
  --sidebar-active-text: #a5b4fc;
  --sidebar-text: #8892a4;
  --sidebar-width: 248px;
  --topbar-height: 60px;
  --accent: #4f6ef7;
  --accent2: #7c5cfc;
  --accent-hover: #3d5ce6;
  --accent-gradient: linear-gradient(135deg, #4f6ef7 0%, #7c5cfc 100%);
  --success: #10b981;
  --success-bg: rgba(16,185,129,.1);
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,.1);
  --info: #3b82f6;
  --info-bg: rgba(59,130,246,.1);
  --body-bg: #f4f5f9;
  --card-bg: #ffffff;
  --card-radius: 14px;
  --text-primary: #0f172a;
  --text-muted: #64748b;
  --border: #e4e8f0;
  --border-light: #f1f4fb;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.05), 0 1px 8px rgba(0,0,0,.04);
  --shadow: 0 2px 8px rgba(0,0,0,.06), 0 6px 24px rgba(0,0,0,.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,.1), 0 12px 40px rgba(0,0,0,.07);
  --shadow-hover: 0 8px 30px rgba(79,110,247,.22), 0 4px 12px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }

body {
  font-family: 'Outfit', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--body-bg);
  color: var(--text-primary);
  margin: 0;
  overflow-x: hidden;
  font-size: 14px;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  background-image: radial-gradient(ellipse at top left, rgba(99,102,241,.12) 0%, transparent 60%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
  border-right: 1px solid rgba(255,255,255,.04);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  height: var(--topbar-height);
  border-bottom: 1px solid rgba(255,255,255,.05);
  text-decoration: none;
}

.sidebar-brand-icon {
  width: 34px; height: 34px;
  background: var(--accent-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,.4);
}

.sidebar-brand-text {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.2px;
}

.sidebar-brand-text span {
  color: #a5b4fc;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #3a4255;
  padding: 18px 10px 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all .15s ease;
  position: relative;
}

.sidebar-item:hover {
  background: var(--sidebar-hover);
  color: #c4cad6;
}

.sidebar-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--accent-gradient);
  border-radius: 0 3px 3px 0;
}

.sidebar-item.active .sidebar-icon { color: #818cf8; }

.sidebar-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  transition: color .15s;
}

.sidebar-footer {
  padding: 10px 10px 14px;
  border-top: 1px solid rgba(255,255,255,.05);
}

.sidebar-footer .sidebar-item { color: #4a5268; }
.sidebar-footer .sidebar-item:hover { color: #6b7280; }

/* Sidebar scrollbar */
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 3px; }

/* ===== TOPBAR ===== */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  gap: 16px;
}

.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.user-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 10px 5px 5px;
  background: var(--border-light);
  border-radius: 100px;
  cursor: default;
}

.user-avatar {
  width: 30px; height: 30px;
  background: var(--accent-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}

.user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: 28px 28px;
  min-height: calc(100vh - var(--topbar-height));
}

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -.3px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 3px 0 0;
}

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--card-radius) !important;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease;
}

.card:hover { box-shadow: var(--shadow); }

.card-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--card-radius) !important;
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: transparent !important;
  border-bottom: 1px solid var(--border-light) !important;
  padding: 16px 20px !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.card-title {
  font-size: 14px !important;
  font-weight: 700 !important;
  color: var(--text-primary) !important;
  margin: 0 !important;
}

.card-body { padding: 20px !important; }

/* Stat Cards */
.stat-card {
  border-radius: var(--card-radius);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  border: none;
  transition: transform .2s ease, box-shadow .2s ease;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md) !important; }

.stat-card::after {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
}

.stat-card-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  margin-bottom: 14px;
  background: rgba(255,255,255,.2);
  color: #fff;
}

.stat-card-value {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: 12px;
  color: rgba(255,255,255,.75);
  font-weight: 500;
}

.stat-card-purple { background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); box-shadow: 0 8px 24px rgba(99,102,241,.35); }
.stat-card-green  { background: linear-gradient(135deg, #10b981 0%, #059669 100%); box-shadow: 0 8px 24px rgba(16,185,129,.35); }
.stat-card-blue   { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); box-shadow: 0 8px 24px rgba(59,130,246,.35); }
.stat-card-orange { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); box-shadow: 0 8px 24px rgba(245,158,11,.35); }
.stat-card-red    { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); box-shadow: 0 8px 24px rgba(239,68,68,.35); }
.stat-card-teal   { background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%); box-shadow: 0 8px 24px rgba(20,184,166,.35); }

/* ===== TABLES ===== */
.table {
  font-size: 13px !important;
  color: var(--text-primary) !important;
}

.table thead th {
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted) !important;
  background: var(--border-light) !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 10px 14px !important;
  white-space: nowrap;
}

.table td {
  padding: 11px 14px !important;
  vertical-align: middle !important;
  border-color: var(--border-light) !important;
}

.table tbody tr:hover td { background: #f8faff !important; }
.table-sm td { padding: 8px 12px !important; }

/* ===== NAVIGATION TABS ===== */
.nav-tabs { border-bottom: 2px solid var(--border) !important; gap: 2px; }

.nav-tabs .nav-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  border: none !important;
  border-bottom: 2px solid transparent !important;
  padding: 10px 16px;
  border-radius: 0 !important;
  margin-bottom: -2px;
  transition: color .15s;
}

.nav-tabs .nav-link:hover { color: var(--accent); }

.nav-tabs .nav-link.active {
  color: var(--accent) !important;
  border-bottom-color: var(--accent) !important;
  background: transparent !important;
}

.nav-tabs .nav-link .tab-icon { margin-right: 6px; }

/* ===== BUTTONS ===== */
.btn {
  font-size: 13px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  transition: all .15s ease !important;
}

.btn-primary {
  background: var(--accent-gradient) !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(99,102,241,.3) !important;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,.4) !important;
}

.btn-primary:active { transform: translateY(0); }

.btn-success { border-radius: 8px !important; }
.btn-danger  { border-radius: 8px !important; }
.btn-warning { border-radius: 8px !important; }
.btn-info    { border-radius: 8px !important; }

.btn-outline-primary { border-color: #c7d2fe !important; color: var(--accent) !important; }
.btn-outline-primary:hover { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }

.btn-outline-secondary { border-color: var(--border) !important; color: var(--text-muted) !important; }
.btn-outline-secondary:hover { background: var(--border-light) !important; color: var(--text-primary) !important; border-color: var(--border) !important; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border: none;
  border-radius: 8px !important;
  cursor: pointer;
  transition: all .15s;
  padding: 0;
  font-size: 13px;
}

.btn-icon:hover { transform: scale(1.1); }
.btn-icon.edit    { background: rgba(99,102,241,.1);  color: var(--accent); }
.btn-icon.delete  { background: rgba(239,68,68,.1);   color: var(--danger); }
.btn-icon.view    { background: rgba(16,185,129,.1);  color: var(--success); }
.btn-icon.sync    { background: rgba(59,130,246,.1);  color: var(--info); }
.btn-icon.lock    { background: rgba(245,158,11,.1);  color: var(--warning); }
.btn-icon.copy    { background: rgba(99,102,241,.1);  color: var(--accent); }
.btn-icon.open    { background: rgba(16,185,129,.1);  color: var(--success); }

/* Action group */
.action-group { display: flex; gap: 4px; align-items: center; }

/* ===== FORM CONTROLS ===== */
.form-control, .form-select {
  border-radius: 9px !important;
  border: 1.5px solid var(--border) !important;
  font-size: 13px !important;
  padding: 9px 13px !important;
  transition: all .15s !important;
  color: var(--text-primary) !important;
  background: #fafbfe !important;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12) !important;
  background: #fff !important;
}

.form-control::placeholder { color: #b0bac8 !important; }

.form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.form-check-label { font-size: 13px; font-weight: 500; }

.input-group .form-control { border-right: none !important; }
.input-group .btn { border-radius: 0 9px 9px 0 !important; }

/* ===== BADGES ===== */
.badge {
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: .3px !important;
  padding: 4px 10px !important;
  border-radius: 100px !important;
}

.badge.bg-success { background: var(--success-bg) !important; color: #059669 !important; }
.badge.bg-danger  { background: var(--danger-bg)  !important; color: #dc2626 !important; }
.badge.bg-warning { background: var(--warning-bg) !important; color: #d97706 !important; }
.badge.bg-info    { background: var(--info-bg)    !important; color: #2563eb !important; }
.badge.bg-secondary { background: rgba(100,116,139,.1) !important; color: #64748b !important; }
.badge.bg-primary { background: rgba(99,102,241,.12) !important; color: var(--accent) !important; }

/* Force-color variants (progress bars etc) */
.badge.badge-solid-success { background: var(--success) !important; color: #fff !important; }
.badge.badge-solid-danger  { background: var(--danger)  !important; color: #fff !important; }
.badge.badge-solid-warning { background: var(--warning) !important; color: #fff !important; }

/* ===== MODALS ===== */
.modal-content {
  border: none !important;
  border-radius: 16px !important;
  box-shadow: 0 24px 80px rgba(0,0,0,.2) !important;
  overflow: hidden;
}

.modal-header {
  background: var(--border-light);
  border-bottom: 1px solid var(--border) !important;
  padding: 18px 22px !important;
}

.modal-title { font-size: 15px !important; font-weight: 800 !important; }
.modal-body  { padding: 22px !important; }
.modal-footer { padding: 14px 22px !important; border-top: 1px solid var(--border) !important; background: var(--border-light); }

/* ===== ALERTS ===== */
.alert {
  border: none !important;
  border-radius: 10px !important;
  font-size: 13.5px !important;
  padding: 14px 18px !important;
}

.alert-success { background: rgba(16,185,129,.1)  !important; color: #065f46 !important; }
.alert-danger  { background: rgba(239,68,68,.1)   !important; color: #991b1b !important; }
.alert-warning { background: rgba(245,158,11,.1)  !important; color: #92400e !important; }
.alert-info    { background: rgba(59,130,246,.1)  !important; color: #1e40af !important; }

/* ===== STATUS INDICATORS ===== */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.up      { background: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,.2); animation: pulse-green 2s infinite; }
.status-dot.down    { background: var(--danger);  box-shadow: 0 0 0 3px rgba(239,68,68,.2); }
.status-dot.unknown { background: #94a3b8; }

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 2px rgba(16,185,129,.2); }
  50%       { box-shadow: 0 0 0 5px rgba(16,185,129,.12); }
}

/* ===== PROGRESS ===== */
.progress {
  border-radius: 100px !important;
  background: var(--border) !important;
}

.progress-bar { border-radius: 100px !important; }

/* ===== CODE / MONOSPACE ===== */
.font-monospace, code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace !important;
  font-size: 12px !important;
}

.code-tag {
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 11.5px;
  background: rgba(99,102,241,.08);
  padding: 2px 7px;
  border-radius: 5px;
  color: #5b21b6;
  border: 1px solid rgba(99,102,241,.15);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 52px 24px;
  color: var(--text-muted);
}

.empty-state i { font-size: 44px; margin-bottom: 14px; display: block; opacity: .3; }
.empty-state h6 { font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; max-width: 280px; margin: 0 auto; }

/* ===== HEALTH STATUS ICONS ===== */
.health-icon-ok      { color: var(--success); }
.health-icon-warn    { color: var(--warning); }
.health-icon-bad     { color: var(--danger); }
.health-icon-unknown { color: #94a3b8; }

/* ===== SHORTLINK CARD ===== */
.sl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background .12s;
}

.sl-row:last-child { border-bottom: none; }
.sl-row:hover { background: #f8faff; }

.sl-code {
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(99,102,241,.08);
  padding: 3px 9px;
  border-radius: 6px;
  white-space: nowrap;
}

.sl-url {
  flex: 1;
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sl-clicks {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--border-light);
  padding: 2px 8px;
  border-radius: 100px;
  white-space: nowrap;
}

/* ===== SPINNER ===== */
.spinner-sm {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  min-width: 300px;
  border-radius: 12px !important;
  font-size: 13.5px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2) !important;
  border: none !important;
}

/* ===== AUTH PAGE ===== */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0a0f1e 0%, #1a1040 50%, #0a0f1e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(24px);
  border-radius: 20px;
  padding: 42px 38px;
}

.auth-logo { text-align: center; margin-bottom: 34px; }

.auth-logo-icon {
  width: 60px; height: 60px;
  background: var(--accent-gradient);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 26px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(99,102,241,.5);
}

.auth-logo h4 { color: #fff; font-weight: 800; margin: 0; font-size: 22px; }
.auth-logo p  { color: #8892a4; font-size: 13px; margin: 6px 0 0; }

.auth-form .form-label { color: #8892a4; font-size: 11.5px; }

.auth-form .form-control {
  background: rgba(255,255,255,.06) !important;
  border: 1.5px solid rgba(255,255,255,.1) !important;
  color: #fff !important;
}

.auth-form .form-control:focus {
  background: rgba(255,255,255,.09) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}

.auth-form .form-control::placeholder { color: #3d4559 !important; }

/* ===== IFRAME ===== */
.spin-iframe { width:100%; height:82vh; border:none; display:block; }

/* ===== CLOUDFLARE NS STATUS ===== */
.ns-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}

.ns-status-badge.checking { background: var(--info-bg); color: var(--info); }
.ns-status-badge.active   { background: var(--success-bg); color: #059669; }
.ns-status-badge.pending  { background: var(--warning-bg); color: #d97706; }
.ns-status-badge.unknown  { background: rgba(100,116,139,.1); color: #64748b; }

/* ===== ADMIN GRANULAR PERMISSIONS — nested tri-state tree ===== */
.perm-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.perm-item {
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all .15s;
  font-size: 12.5px;
  font-weight: 600;
}

.perm-item:hover { border-color: var(--accent); background: rgba(99,102,241,.04); }
.perm-item input:checked ~ .perm-label { color: var(--accent); }
.perm-item.checked { border-color: var(--accent); background: rgba(99,102,241,.06); }
.perm-item-sm { padding: 5px 12px; font-size: 11.5px; font-weight: 500; opacity: .92; }

.perm-node { margin-bottom: 2px; }
.perm-toggle {
  font-size: 11px; width: 16px; flex-shrink: 0; text-align: center;
  color: var(--text-muted); cursor: pointer; transition: transform .15s;
}
.perm-toggle-spacer { width: 16px; flex-shrink: 0; }
.perm-children {
  border-left: 2px dashed var(--border);
  padding-left: 4px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
/* Native tri-state visual for the parent checkbox while some-but-not-all
   children are checked — browsers render :indeterminate with a dash. */
.perm-item input:indeterminate { accent-color: var(--accent); opacity: .85; }

/* ===== MENU GROUP ===== */
.menu-group-header {
  user-select: none;
  border: 1px solid var(--border);
  transition: background .15s;
}
.menu-group-header:hover { background: var(--bg-tertiary) !important; }
.menu-group .perm-grid { border-left: 2px solid var(--border); padding-left: 8px; }

/* ===== NAWALA CHECK RESULT ===== */
.nawala-result-card {
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid var(--border);
}

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

.nawala-result-body { padding: 14px 18px; }

.nawala-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.nawala-result-row:last-child { border-bottom: none; }

/* ===== KOMDIGI BADGE ===== */
.komdigi-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
}

.komdigi-badge.blocked { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.komdigi-badge.clean   { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.komdigi-badge.unknown { background: #f8fafc; color: #64748b; border: 1px solid var(--border); }

/* ===== DOMAIN MONITOR TABS ===== */
.domain-health-row { cursor: pointer; }
.domain-health-row:hover td { background: #f5f7ff !important; }

/* ===== SHORTLINK TABLE ===== */
#sl-link-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== BREADCRUMB ===== */
.breadcrumb-bar {
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}

/* ===== FILE MANAGER ===== */
.fm-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background .1s;
}

.fm-item:hover { background: #f8fafc; }
.fm-item:last-child { border-bottom: none; }
.fm-icon { font-size: 20px; width: 28px; text-align: center; }
.fm-icon.folder { color: #f59e0b; }
.fm-icon.file   { color: #94a3b8; }
.fm-name { flex: 1; font-size: 13.5px; font-weight: 500; }
.fm-size { font-size: 12px; color: var(--text-muted); width: 80px; text-align: right; }
.fm-date { font-size: 12px; color: var(--text-muted); width: 140px; text-align: right; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .topbar, .main-content { left: 0; margin-left: 0; }
  .topbar { left: 0; }
  .main-content { padding: 18px 14px; }
}

/* ===== MISC UTILS ===== */
.text-accent { color: var(--accent) !important; }
.bg-accent { background: var(--accent-gradient) !important; color: #fff !important; }
.cursor-pointer { cursor: pointer; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.border-accent { border-color: var(--accent) !important; }
.gap-xs { gap: 4px !important; }

/* Separator line */
.sep { height: 1px; background: var(--border); margin: 16px 0; }

/* Inline IP monospace */
.ip-mono {
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
  color: #334155;
}

/* ===== V4 ADDITIONS ===== */

/* Admin tabs scrollable on mobile */
.admin-tabs { -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs .nav-link { white-space: nowrap; }

/* Tab label hide on xs */
@media (max-width: 576px) {
  .tab-label { display: none; }
  .tab-icon { margin: 0 !important; }
  .admin-tabs .nav-link { padding: 8px 10px; }
}

/* Spin cards */
.spin-card .card-body { min-height: 220px; }

/* Notification items */
.notif-unread { background: rgba(99,102,241,.04); }
.notif-item { transition: background .15s; }
.notif-item:hover { background: #f8fafc; }
.notif-item:last-child { border-bottom: none !important; }

/* Action group extra buttons */
.action-group .btn-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
}
.action-group .btn-icon:hover { filter: brightness(.9); transform: translateY(-1px); }

/* ===== MOBILE RESPONSIVE REDESIGN ===== */
@media (max-width: 992px) {
  :root { --sidebar-width: 240px; }

  .sidebar {
    transform: translateX(-100%);
    z-index: 1050;
    transition: transform .25s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.25); }

  /* Overlay when sidebar open */
  .sidebar.open::after {
    content: '';
    position: fixed;
    inset: 0;
    left: var(--sidebar-width);
    background: rgba(0,0,0,.4);
    z-index: -1;
  }

  .topbar { left: 0 !important; padding: 0 12px; }
  .main-content { margin-left: 0 !important; padding: 16px 12px; }
}

@media (max-width: 768px) {
  .page-header { flex-direction: column; align-items: flex-start !important; gap: 12px; }
  .page-header > div:last-child { width: 100%; }
  .card-header { flex-wrap: wrap; gap: 8px; }
  .card-header .d-flex { flex-wrap: wrap; }

  /* Tables: make scrollable */
  .table-responsive { -webkit-overflow-scrolling: touch; }

  /* Stat badges wrap nicely */
  #adminStats { flex-wrap: wrap !important; gap: 6px !important; }
  #adminStats .badge { font-size: 11px; }

  /* Nav tabs compact */
  .nav-tabs .nav-link { padding: 7px 10px; font-size: 13px; }

  /* Action buttons stack on mobile */
  .action-group { gap: 3px !important; flex-wrap: wrap; }
  .action-group .btn-icon { width: 28px; height: 28px; font-size: 12px; }

  /* Modals full-width on mobile */
  .modal-dialog { margin: 0.5rem; }
  .modal-dialog.modal-lg, .modal-dialog.modal-xl { max-width: 100%; }

  /* Form layout */
  .row.g-4 > .col-md-5, .row.g-4 > .col-md-4, .row.g-4 > .col-md-7 { width: 100%; }
}

@media (max-width: 480px) {
  .topbar-title { font-size: 14px; }
  .user-name { display: none; }
  .main-content { padding: 12px 10px; }
  .page-title { font-size: 18px; }
  h6.card-title { font-size: 13px; }

  /* Input groups stack */
  .input-group .form-control { font-size: 13px; }
  .btn { font-size: 13px; }

  /* Wide tables become card-style on tiny screens */
  .table-xs-stack thead { display: none; }
  .table-xs-stack tr { display: block; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
  .table-xs-stack td { display: flex; justify-content: space-between; border: none; padding: 4px 0; font-size: 12px; }
  .table-xs-stack td::before { content: attr(data-label); font-weight: 600; color: var(--text-muted); }
}

/* Sidebar toggle button */
.sidebar-toggle { background: none; border: none; line-height: 1; }

/* Spin status improvements */
.spin-card { position: relative; overflow: hidden; }
.spin-card::before { content: ''; position: absolute; top: 0; right: 0; width: 120px; height: 120px; background: var(--accent-gradient); opacity: .04; border-radius: 50%; transform: translate(30px,-30px); }

/* Security pill nav */
#securityPills .nav-link { border-radius: 100px; font-size: 13px; padding: 6px 14px; }
#securityPills .nav-link.active { background: var(--accent-gradient); color: #fff; }

/* API key table */
#apiKeysTable .font-monospace { font-size: 12px; }

/* Approval badges */
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-approved { background: var(--success-bg); color: var(--success); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); }

/* ===== V8 — REDESIGN ADDITIONS ===== */

/* ─── Typography upgrades ───────────────────────────────────────────────────── */
.page-title { letter-spacing: -.4px; font-size: 23px; }
h1,h2,h3,h4,h5,h6 { letter-spacing: -.2px; }
.font-monospace, code { font-family: 'JetBrains Mono', 'Fira Code', monospace !important; }

/* ─── Dashboard hero welcome ────────────────────────────────────────────────── */
.dash-hero {
  background: var(--accent-gradient);
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  color: #fff;
}
.dash-hero::before {
  content: '';
  position: absolute;
  right: -60px; top: -60px;
  width: 220px; height: 220px;
  background: rgba(255,255,255,.07);
  border-radius: 50%;
}
.dash-hero::after {
  content: '';
  position: absolute;
  right: 40px; bottom: -80px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
}
.dash-hero h2 { font-size: 24px; font-weight: 800; margin: 0 0 6px; }
.dash-hero p { font-size: 13.5px; margin: 0; opacity: .8; }
.dash-role-chip {
  display: inline-block;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  letter-spacing: .4px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* ─── Stat cards v2 ─────────────────────────────────────────────────────────── */
.stat-v2 {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.stat-v2:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-v2-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}
.stat-v2-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.stat-v2-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.stat-v2-delta {
  position: absolute;
  top: 18px; right: 18px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
}
.stat-v2-delta.up   { background: var(--success-bg); color: #059669; }
.stat-v2-delta.down { background: var(--danger-bg);  color: #dc2626; }
.stat-v2-bar {
  height: 3px;
  border-radius: 100px;
  background: var(--border);
  margin-top: 14px;
  overflow: hidden;
}
.stat-v2-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width .8s ease;
}

/* ─── Quick access grid v2 ──────────────────────────────────────────────────── */
.qa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
.qa-item {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 10px; padding: 16px;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  text-decoration: none;
  transition: all .18s ease;
  cursor: pointer;
}
.qa-item:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.qa-item:active { transform: translateY(0) scale(.98); }
.qa-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.qa-label { font-size: 13px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.qa-desc  { font-size: 11.5px; color: var(--text-muted); font-weight: 400; }

/* ─── Announcements banner ──────────────────────────────────────────────────── */
.announce-banner {
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 14px;
  display: flex; align-items: flex-start; gap: 12px;
  border-left: 4px solid transparent;
  position: relative;
}
.announce-banner.info    { background: rgba(59,130,246,.07);  border-left-color: #3b82f6; }
.announce-banner.warning { background: rgba(245,158,11,.07);  border-left-color: #f59e0b; }
.announce-banner.success { background: rgba(16,185,129,.07);  border-left-color: #10b981; }
.announce-banner.danger  { background: rgba(239,68,68,.07);   border-left-color: #ef4444; }
.announce-banner .ann-title { font-weight: 700; font-size: 13.5px; }
.announce-banner .ann-body  { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.announce-banner .ann-close { position: absolute; top: 10px; right: 12px; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 4px; }
.announce-banner .ann-close:hover { background: rgba(0,0,0,.06); }

/* ─── Jabatan badge ─────────────────────────────────────────────────────────── */
.jabatan-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 6px;
  background: rgba(100,116,139,.1);
  color: #475569;
  border: 1px solid rgba(100,116,139,.15);
  letter-spacing: .2px;
}

/* ─── LiveChat — WhatsApp-style bubble layout ───────────────────────────────── */
.chat-wrap {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0;
  height: calc(100vh - 140px);
  min-height: 420px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.chat-sidebar {
  background: var(--body-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.chat-sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center;
}
.chat-user-list { flex: 1; overflow-y: auto; padding: 8px; }
.chat-user-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  cursor: pointer; transition: background .12s; position: relative;
}
.chat-user-item:hover { background: var(--card-bg); }
.chat-user-item.active { background: rgba(79,110,247,.08); }
.chat-user-item .chat-avatar {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; flex-shrink: 0; color: #fff;
}
.chat-user-item .chat-uname { font-size: 12.5px; font-weight: 600; }
.chat-user-item .chat-preview { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100px; }
.chat-unread-dot {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; background: var(--accent); border-radius: 50%;
  font-size: 10px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.chat-group-btn {
  margin: 8px; padding: 10px 12px; border-radius: 10px; cursor: pointer;
  font-size: 12.5px; font-weight: 700;
  border: 1.5px solid var(--border); background: transparent; text-align: left;
  display: flex; align-items: center; gap: 8px; transition: all .12s;
}
.chat-group-btn:hover { background: var(--card-bg); }
.chat-group-btn.active { background: rgba(79,110,247,.08); border-color: var(--accent); color: var(--accent); }

.chat-main { display: flex; flex-direction: column; background: var(--card-bg); overflow: hidden; }
.chat-header {
  padding: 12px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}

/* Message area — key fix: justify-content:flex-end means the first messages
   appear at the BOTTOM of the container (like every real chat app), and grow
   upward as more messages are added. Previously it was flex-start, which
   caused messages to render from the top down, leaving a gap at the bottom. */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  display: flex; flex-direction: column;
  /* justify-content:flex-end on a scroll container CUTS OFF the top of
     overflowing content and makes it impossible to scroll up to the first
     message. Use flex-start + margin-top:auto on the first child instead:
     short conversations still sit at the bottom, but long ones scroll all
     the way to the beginning. */
  justify-content: flex-start;
  gap: 2px;
  background: var(--body-bg);
  scroll-behavior: smooth;
}
.chat-messages > :first-child { margin-top: auto; }
.chat-empty-state {
  text-align: center; color: var(--text-muted); font-size: 13px;
  padding: 40px 20px; flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}

/* ── Message rows ── */
.chat-msg-row {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 2px 0; max-width: 100%;
}
.chat-msg-mine {
  flex-direction: row-reverse; /* own messages on the right */
}

/* Avatar circle (only for others) */
.chat-bubble-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #fff; flex-shrink: 0;
  margin-bottom: 18px; /* offset to align with bubble bottom, not name */
}

/* Bubble wrapper */
.chat-bubble-wrap {
  display: flex; flex-direction: column; max-width: 68%;
  min-width: 60px;
}
.chat-msg-mine .chat-bubble-wrap { align-items: flex-end; }

.chat-bubble-name {
  font-size: 10.5px; font-weight: 700; padding: 0 4px; margin-bottom: 2px;
}
.chat-bubble {
  border-radius: 14px; overflow: hidden; word-break: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.chat-bubble-them {
  background: var(--card-bg); border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-bubble-me {
  background: var(--accent-gradient); color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble-text {
  padding: 8px 13px; font-size: 13.5px; line-height: 1.45;
}
.chat-bubble-me .chat-bubble-text { color: #fff; }
.chat-bubble-them .chat-bubble-text { color: var(--text-primary); }

/* Image inside bubble */
.chat-bubble-img {
  display: block; max-width: 100%; max-height: 260px; width: auto;
  object-fit: cover; cursor: zoom-in; border-radius: 0;
  transition: opacity .15s;
}
.chat-bubble-img:hover { opacity: .9; }
/* when image + text, give text its padding inside same bubble */
.chat-bubble-img + .chat-bubble-text { padding-top: 6px; }

/* Timestamp + delete row */
.chat-bubble-meta {
  display: flex; align-items: center; gap: 4px;
  font-size: 10px; color: var(--text-muted); padding: 1px 4px;
  margin-top: 1px; opacity: .8;
}
.chat-msg-mine .chat-bubble-meta { flex-direction: row-reverse; }

.chat-msg-delete {
  opacity: 0; transition: opacity .12s;
  border: none; background: transparent; color: var(--text-muted);
  width: 18px; height: 18px; border-radius: 4px; font-size: 11px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  cursor: pointer; padding: 0;
}
.chat-msg-row:hover .chat-msg-delete { opacity: 1; }
.chat-msg-delete:hover { background: rgba(239,68,68,.12); color: #ef4444; }

/* Input row */
.chat-input-row {
  padding: 10px 14px; border-top: 1px solid var(--border);
  background: var(--card-bg); display: flex; gap: 8px; flex-shrink: 0;
  align-items: center;
}

/* Responsive */
@media (max-width: 700px) {
  .chat-wrap { grid-template-columns: 1fr; height: auto; min-height: auto; }
  .chat-sidebar { height: 180px; border-right: none; border-bottom: 1px solid var(--border); }
  .chat-user-list { flex-direction: row; display: flex; overflow-x: auto; overflow-y: hidden; gap: 4px; padding: 6px; }
  .chat-user-item { flex-direction: column; min-width: 70px; text-align: center; padding: 8px; gap: 4px; }
  .chat-user-item .chat-preview { display: none; }
  .chat-messages { height: 300px; justify-content: flex-start; }
  .chat-bubble-wrap { max-width: 82%; }
}

/* ─── Announcement admin table ──────────────────────────────────────────────── */
.ann-type-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 6px;
}
.ann-type-dot.info    { background: #3b82f6; }
.ann-type-dot.warning { background: #f59e0b; }
.ann-type-dot.success { background: #10b981; }
.ann-type-dot.danger  { background: #ef4444; }

/* ─── Role-label colors ─────────────────────────────────────────────────────── */
.role-superadmin { background: rgba(239,68,68,.1);  color: #dc2626; border: 1px solid rgba(239,68,68,.2); }
.role-admin      { background: rgba(245,158,11,.1); color: #d97706; border: 1px solid rgba(245,158,11,.2); }
.role-operator   { background: rgba(100,116,139,.1);color: #475569; border: 1px solid rgba(100,116,139,.2); }

/* ─── Smooth scroll ─────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

/* ─── Sidebar section title improved ───────────────────────────────────────── */
.sidebar-section-title { font-size: 9.5px; letter-spacing: 1.2px; color: #2e3a4e; }



/* ===== V10 — STICKY TABS + SCROLL FIX ===== */

/* Sticky tab nav — safe version without negative margins */
.sticky-tabs {
  background: var(--body-bg);
  padding-bottom: 0;
  margin-bottom: 20px;
}
.sticky-tabs .nav-tabs {
  border-bottom: 2px solid var(--border) !important;
  margin-bottom: 0 !important;
}

/* Compact page-header so tabs appear higher */
.page-header-compact {
  padding: 16px 0 12px;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.page-header-compact .page-title { font-size: 20px; margin-bottom: 2px; }
.page-header-compact .page-subtitle { display: none; }

/* Admin stats inline in header */
#adminStats { display: flex; gap: 6px; flex-wrap: wrap; }
#adminStats .stat-chip {
  display: flex; align-items: center; gap: 5px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Lucky Spin native embed ─────────────────────────────────────────────── */
.spin-card {
  background: var(--card-bg);
  transition: border-color .2s;
}
.spin-card:hover {
  border-color: var(--accent) !important;
}
.nav-pill-btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  padding: 6px 14px;
  color: var(--text);
  background: var(--card-bg);
  cursor: pointer;
  text-decoration: none;
}
.nav-pill-btn.active,
.nav-pill-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
#spinCanvas {
  touch-action: none;
}
#spinArrow {
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.5));
}
.min-height-24 { min-height: 24px; }

/* ── Tab content visibility fix ─────────────────────────────────────────── */
/* Ensure tab-pane children don't overflow sticky nav */
.tab-content {
  position: relative;
  z-index: 1;
}
/* Shift badge */
#shiftBadge .badge {
  font-size: 11px;
  font-weight: 600;
}

/* ── Login day toggle buttons (Jam Login restriction, Edit User modal) ──── */
.login-day-btn.active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}
