:root {
  --bg-primary: #030508;
  --bg-secondary: #080c18;
  --bg-card: rgba(8, 14, 30, 0.65);
  --bg-card-hover: rgba(0, 212, 255, 0.04);
  --border: rgba(0, 212, 255, 0.07);
  --border-hover: rgba(0, 212, 255, 0.22);
  --text-primary: #eef2ff;
  --text-secondary: rgba(255, 255, 255, 0.42);
  --text-muted: rgba(255, 255, 255, 0.22);
  --accent: #00d4ff;
  --accent-2: #a855f7;
  --accent-glow: rgba(0, 212, 255, 0.15);
  --neon-blue: #00d4ff;
  --neon-purple: #a855f7;
  --neon-pink: #ec4899;
  --neon-green: #00ff88;
  --success: #00ff88;
  --warning: #fbbf24;
  --danger: #ff4d6a;
  --info: #00d4ff;
  --sidebar-width: 248px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --shadow: 0 4px 32px rgba(0, 0, 0, 0.6);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 10% 10%, rgba(0, 212, 255, 0.03), transparent),
    radial-gradient(ellipse 500px 500px at 80% 20%, rgba(168, 85, 247, 0.025), transparent),
    radial-gradient(ellipse 400px 300px at 50% 80%, rgba(236, 72, 153, 0.02), transparent);
  pointer-events: none;
  z-index: 0;
}

/* GLASS */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--border);
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 212, 255, 0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 212, 255, 0.3); }

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 600px at 20% 30%, rgba(0, 212, 255, 0.06), transparent),
    radial-gradient(ellipse 600px 600px at 80% 70%, rgba(168, 85, 247, 0.05), transparent),
    radial-gradient(ellipse 500px 400px at 50% 10%, rgba(236, 72, 153, 0.04), transparent);
  pointer-events: none;
  z-index: 0;
}

.login-bg { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  animation: float 10s ease-in-out infinite;
  will-change: transform;
}
.orb-1 { width: 450px; height: 450px; background: radial-gradient(circle, #00d4ff, transparent 70%); top: -120px; left: -120px; }
.orb-2 { width: 350px; height: 350px; background: radial-gradient(circle, #a855f7, transparent 70%); bottom: -120px; right: -60px; animation-delay: -4s; }
.orb-3 { width: 280px; height: 280px; background: radial-gradient(circle, #ec4899, transparent 70%); top: 35%; left: 55%; animation-delay: -6s; }

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-35px) scale(1.06); }
}

.login-card {
  width: 100%;
  max-width: 420px;
  margin: 20px;
  padding: 44px;
  border-radius: var(--radius-lg);
  position: relative;
  z-index: 1;
  background: rgba(8, 14, 30, 0.8);
  backdrop-filter: blur(32px) saturate(1.3);
  -webkit-backdrop-filter: blur(32px) saturate(1.3);
  border: 1px solid rgba(0, 212, 255, 0.1);
  box-shadow:
    0 0 0 1px rgba(0, 212, 255, 0.05),
    0 0 60px rgba(0, 212, 255, 0.04),
    0 30px 60px -20px rgba(0, 0, 0, 0.8);
  animation: cardReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), transparent 40%, transparent 60%, rgba(168, 85, 247, 0.15));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.login-card:hover::before { opacity: 1; }

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.3px; }
.login-logo p { font-size: 12px; color: var(--text-muted); }
.logo-icon { display: flex; align-items: center; justify-content: center; }
.login-card h2 { font-size: 26px; font-weight: 800; margin-bottom: 6px; background: linear-gradient(135deg, #fff 0%, #00d4ff 45%, #a855f7 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; letter-spacing: -0.5px; }
.login-subtitle { color: var(--text-secondary); margin-bottom: 32px; font-size: 14px; }
.login-footer { margin-top: 28px; text-align: center; color: var(--text-muted); font-size: 11px; letter-spacing: 0.3px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 7px; letter-spacing: 0.3px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  background: rgba(8, 14, 30, 0.6);
  border: 1.5px solid rgba(0, 212, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
  outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: rgba(0, 212, 255, 0.45);
  background: rgba(0, 212, 255, 0.04);
  box-shadow:
    0 0 0 3px rgba(0, 212, 255, 0.08),
    0 0 20px rgba(0, 212, 255, 0.06),
    inset 0 0 20px rgba(0, 212, 255, 0.02);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-muted); }
.form-group select option { background: #080c18; color: var(--text-primary); }
.form-group textarea { resize: vertical; min-height: 80px; }

.input-password { position: relative; }
.input-password input { padding-right: 44px; }
.btn-eye { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 16px; opacity: 0.4; transition: all 0.2s; }
.btn-eye:hover { opacity: 1; transform: translateY(-50%) scale(1.1); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
  position: relative;
  overflow: hidden;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #0055cc, #00a8e8, #00d4ff);
  color: white;
  box-shadow: 0 2px 12px rgba(0, 212, 255, 0.2);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 6px 24px rgba(0, 212, 255, 0.35),
    0 0 60px rgba(0, 212, 255, 0.1);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-secondary { background: rgba(0, 212, 255, 0.06); color: var(--text-primary); border: 1px solid rgba(0, 212, 255, 0.12); }
.btn-secondary:hover:not(:disabled) { border-color: rgba(0, 212, 255, 0.3); color: var(--accent); background: rgba(0, 212, 255, 0.1); box-shadow: 0 0 20px rgba(0, 212, 255, 0.06); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: rgba(0, 212, 255, 0.06); }
.btn-success { background: linear-gradient(135deg, #00cc6a, #00ff88); color: #000; box-shadow: 0 2px 12px rgba(0, 255, 136, 0.15); }
.btn-success:hover:not(:disabled) { box-shadow: 0 4px 24px rgba(0, 255, 136, 0.3); transform: translateY(-1px); }
.btn-danger { background: linear-gradient(135deg, #cc3355, #ff4d6a); color: white; box-shadow: 0 2px 12px rgba(255, 77, 106, 0.15); }
.btn-danger:hover:not(:disabled) { box-shadow: 0 4px 24px rgba(255, 77, 106, 0.3); transform: translateY(-1px); }
.btn-warning { background: linear-gradient(135deg, #e6a800, #fbbf24); color: #1a1a1a; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 7px; width: 34px; height: 34px; justify-content: center; border-radius: 8px; }

/* ===== ALERTS ===== */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.alert-error { background: rgba(255, 77, 106, 0.06); border: 1px solid rgba(255, 77, 106, 0.2); color: #ff8a9a; }
.alert-success { background: rgba(0, 255, 136, 0.06); border: 1px solid rgba(0, 255, 136, 0.2); color: #6ee7b7; }
.alert-info { background: rgba(0, 212, 255, 0.06); border: 1px solid rgba(0, 212, 255, 0.2); color: #67e8f9; }

/* ===== LAYOUT ===== */
#app { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  border-right: 1px solid rgba(0, 212, 255, 0.04);
  border-radius: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(3, 5, 10, 0.97);
  backdrop-filter: blur(32px) saturate(1.2);
  -webkit-backdrop-filter: blur(32px) saturate(1.2);
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.12), rgba(168, 85, 247, 0.08), transparent);
  pointer-events: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 18px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.04);
  flex-shrink: 0;
}

.sidebar-logo { display: flex; align-items: center; gap: 11px; }
.sidebar-name { font-size: 17px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.3px; }

.sidebar-toggle {
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; font-size: 18px; padding: 5px;
  border-radius: 8px; transition: var(--transition);
}
.sidebar-toggle:hover { color: var(--text-primary); background: rgba(0, 212, 255, 0.08); }

.sidebar-user {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px; border-bottom: 1px solid rgba(0, 212, 255, 0.04);
  flex-shrink: 0;
}
.user-avatar {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, #0055cc, #00d4ff);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.25), inset 0 1px 0 rgba(255,255,255,0.1);
}
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role {
  font-size: 10px; color: var(--text-muted);
  background: rgba(0, 212, 255, 0.06); padding: 2px 8px; border-radius: 6px;
  display: inline-block; margin-top: 3px; letter-spacing: 0.3px; font-weight: 500;
}

.sidebar-nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-section-label {
  font-size: 9px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1.2px;
  padding: 14px 10px 7px; margin-top: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); font-size: 13px; font-weight: 500;
  position: relative; text-decoration: none; margin-bottom: 2px;
  border: 1px solid transparent;
}
.nav-item:hover {
  background: rgba(0, 212, 255, 0.05);
  color: var(--text-primary);
  border-color: rgba(0, 212, 255, 0.06);
}
.nav-item.active {
  background: rgba(0, 212, 255, 0.08);
  color: var(--accent);
  border: 1px solid rgba(0, 212, 255, 0.18);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.04), inset 0 0 20px rgba(0, 212, 255, 0.02);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -11px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}
.nav-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.nav-label { white-space: nowrap; }
.nav-badge {
  margin-left: auto; background: linear-gradient(135deg, #ff3366, #ff4d6a);
  color: white; font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px; min-width: 18px; text-align: center;
  box-shadow: 0 0 12px rgba(255, 77, 106, 0.35);
  letter-spacing: 0.3px;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
  position: relative;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; height: 62px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.04);
  background: rgba(3, 5, 10, 0.85);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
}
.topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.1), transparent);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-toggle { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 18px; display: none; padding: 7px; border-radius: 8px; }
.page-title { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.topbar-status { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.5), 0 0 20px rgba(0, 255, 136, 0.15);
  animation: pulseNeon 2s ease-in-out infinite;
}
.status-dot.offline { background: var(--danger); box-shadow: 0 0 8px rgba(255, 77, 106, 0.4); }

@keyframes pulseNeon {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(0, 255, 136, 0.5), 0 0 20px rgba(0, 255, 136, 0.15); }
  50% { opacity: 0.6; box-shadow: 0 0 4px rgba(0, 255, 136, 0.3), 0 0 10px rgba(0, 255, 136, 0.08); }
}

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

/* ===== CARDS ===== */
.card {
  background: rgba(8, 14, 30, 0.6);
  border: 1px solid rgba(0, 212, 255, 0.06);
  border-radius: var(--radius);
  padding: 22px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  position: relative;
}
.card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), transparent 50%, transparent 50%, rgba(168, 85, 247, 0.1));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.card:hover::before { opacity: 1; }
.card:hover { border-color: rgba(0, 212, 255, 0.12); box-shadow: 0 0 30px rgba(0, 212, 255, 0.03); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.2px; }
.card-actions { display: flex; gap: 8px; }

/* ===== STAT CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat-card {
  background: rgba(8, 14, 30, 0.55);
  border: 1px solid rgba(0, 212, 255, 0.06);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, #00d4ff, #a855f7, #ec4899);
  background-size: 200% 100%;
  animation: shimmerGradient 4s linear infinite;
}
@keyframes shimmerGradient {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.stat-card::after {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at center, rgba(0, 212, 255, 0.04), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.stat-card:hover::after { opacity: 1; }
.stat-card:hover {
  border-color: rgba(0, 212, 255, 0.2);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 212, 255, 0.1), 0 0 0 1px rgba(0, 212, 255, 0.08);
}
.stat-icon { font-size: 30px; margin-bottom: 14px; filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.2)); }
.stat-value { font-size: 30px; font-weight: 800; background: linear-gradient(135deg, #fff 20%, #00d4ff 80%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; letter-spacing: -0.5px; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 5px; text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; }
.stat-change { font-size: 11px; margin-top: 10px; display: flex; align-items: center; gap: 4px; font-weight: 600; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ===== TABLES ===== */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 11px 16px; text-align: left; font-size: 10px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.05); background: rgba(0, 212, 255, 0.02);
  white-space: nowrap;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid rgba(0, 212, 255, 0.03); font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: all 0.2s ease; }
tbody tr:hover { background: rgba(0, 212, 255, 0.03); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 100px;
  font-size: 10px; font-weight: 700; white-space: nowrap;
  letter-spacing: 0.3px;
}
.badge-green { background: rgba(0, 255, 136, 0.08); color: #00ff88; border: 1px solid rgba(0, 255, 136, 0.18); box-shadow: 0 0 8px rgba(0, 255, 136, 0.06); }
.badge-red { background: rgba(255, 77, 106, 0.08); color: #ff8a9a; border: 1px solid rgba(255, 77, 106, 0.18); box-shadow: 0 0 8px rgba(255, 77, 106, 0.06); }
.badge-yellow { background: rgba(251, 191, 36, 0.08); color: #fcd34d; border: 1px solid rgba(251, 191, 36, 0.18); box-shadow: 0 0 8px rgba(251, 191, 36, 0.06); }
.badge-blue { background: rgba(0, 212, 255, 0.08); color: #67e8f9; border: 1px solid rgba(0, 212, 255, 0.18); box-shadow: 0 0 8px rgba(0, 212, 255, 0.06); }
.badge-purple { background: rgba(168, 85, 247, 0.08); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.18); box-shadow: 0 0 8px rgba(168, 85, 247, 0.06); }
.badge-gray { background: rgba(148,163,184,0.05); color: var(--text-secondary); border: 1px solid rgba(0, 212, 255, 0.04); }

/* ===== GRID LAYOUTS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; margin-top: 28px; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(3, 5, 10, 0.85);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  animation: fadeIn 0.2s ease;
}
.modal {
  width: 90%; max-width: 580px; max-height: 85vh;
  border-radius: var(--radius-lg);
  overflow: hidden; display: flex; flex-direction: column;
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  background: rgba(8, 14, 30, 0.92);
  border: 1px solid rgba(0, 212, 255, 0.1);
  box-shadow:
    0 0 0 1px rgba(0, 212, 255, 0.05),
    0 0 60px rgba(0, 212, 255, 0.04),
    0 30px 80px -20px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(32px) saturate(1.3);
  -webkit-backdrop-filter: blur(32px) saturate(1.3);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px; border-bottom: 1px solid rgba(0, 212, 255, 0.06); flex-shrink: 0;
}
.modal-header h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; }
.modal-close {
  background: rgba(0, 212, 255, 0.06); border: 1px solid rgba(0, 212, 255, 0.08);
  color: var(--text-secondary); cursor: pointer; font-size: 18px;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; transition: var(--transition);
}
.modal-close:hover { color: var(--accent); background: rgba(0, 212, 255, 0.12); border-color: rgba(0, 212, 255, 0.2); }
.modal-body { padding: 26px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 18px 26px; border-top: 1px solid rgba(0, 212, 255, 0.06); display: flex; gap: 10px; justify-content: flex-end; flex-shrink: 0; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ===== TOAST ===== */
#toast-container { position: fixed; bottom: 28px; right: 28px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: rgba(8, 14, 30, 0.92);
  border: 1px solid rgba(0, 212, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 13px;
  min-width: 300px;
  display: flex; align-items: center; gap: 11px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 212, 255, 0.04);
  animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

/* ===== CONVERSATIONS ===== */
.chat-layout { display: grid; grid-template-columns: 320px 1fr; gap: 0; height: calc(100vh - 114px); border: 1px solid rgba(0, 212, 255, 0.06); border-radius: var(--radius); overflow: hidden; }
.chat-sidebar { border-right: 1px solid rgba(0, 212, 255, 0.04); overflow-y: auto; background: rgba(3, 5, 10, 0.6); }
.chat-search { padding: 14px; border-bottom: 1px solid rgba(0, 212, 255, 0.04); }
.chat-search input {
  width: 100%; background: rgba(8, 14, 30, 0.6); border: 1.5px solid rgba(0, 212, 255, 0.07);
  border-radius: var(--radius-sm); padding: 9px 14px; color: var(--text-primary);
  font-size: 13px; outline: none; transition: var(--transition);
}
.chat-search input:focus { border-color: rgba(0, 212, 255, 0.4); box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.08); }
.conv-item {
  padding: 15px 18px; cursor: pointer; transition: all 0.2s ease;
  border-bottom: 1px solid rgba(0, 212, 255, 0.03); display: flex; gap: 12px; align-items: flex-start;
  border-left: 2px solid transparent;
}
.conv-item:hover { background: rgba(0, 212, 255, 0.03); }
.conv-item.active { background: rgba(0, 212, 255, 0.06); border-left-color: var(--accent); }
.conv-avatar {
  width: 42px; height: 42px; border-radius: 14px;
  background: linear-gradient(135deg, #0055cc, #00d4ff);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.15);
}
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-last-msg { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.conv-time { font-size: 10px; color: var(--text-muted); white-space: nowrap; font-weight: 500; }
.conv-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }

.chat-main { display: flex; flex-direction: column; background: rgba(3, 5, 10, 0.8); }
.chat-header {
  padding: 15px 22px; border-bottom: 1px solid rgba(0, 212, 255, 0.04);
  display: flex; align-items: center; gap: 14px;
  background: rgba(8, 14, 30, 0.5); flex-shrink: 0;
}
.chat-contact-info { flex: 1; }
.chat-contact-name { font-weight: 700; font-size: 14px; }
.chat-contact-phone { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.chat-empty { display: flex; align-items: center; justify-content: center; flex: 1; color: var(--text-muted); flex-direction: column; gap: 14px; font-size: 14px; }

.msg { max-width: 72%; padding: 11px 16px; border-radius: 18px; font-size: 13px; line-height: 1.55; word-wrap: break-word; }
.msg-inbound {
  background: rgba(8, 14, 30, 0.75);
  border: 1px solid rgba(0, 212, 255, 0.06);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.msg-outbound {
  background: linear-gradient(135deg, #0055cc, #00d4ff);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 212, 255, 0.2), inset 0 1px 0 rgba(255,255,255,0.1);
}
.msg-time { font-size: 10px; color: var(--text-muted); margin-top: 5px; display: flex; align-items: center; gap: 5px; }
.msg-outbound .msg-time { color: rgba(255,255,255,0.55); justify-content: flex-end; }
.msg-ai-badge {
  font-size: 9px; background: rgba(0, 212, 255, 0.15); padding: 2px 6px;
  border-radius: 6px; color: var(--accent); font-weight: 600;
  border: 1px solid rgba(0, 212, 255, 0.15);
}

.chat-input {
  padding: 18px 22px; border-top: 1px solid rgba(0, 212, 255, 0.04);
  display: flex; gap: 12px; background: rgba(8, 14, 30, 0.5); flex-shrink: 0;
}
.chat-input textarea {
  flex: 1; background: rgba(8, 14, 30, 0.6); border: 1.5px solid rgba(0, 212, 255, 0.07);
  border-radius: var(--radius-sm); padding: 11px 16px; color: var(--text-primary);
  font-family: 'Inter', sans-serif; font-size: 13px; resize: none; max-height: 100px;
  outline: none; transition: var(--transition);
}
.chat-input textarea:focus {
  border-color: rgba(0, 212, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.08), 0 0 20px rgba(0, 212, 255, 0.04);
}

/* ===== INSTANCES ===== */
.instance-card {
  background: rgba(8, 14, 30, 0.55); border: 1px solid rgba(0, 212, 255, 0.06);
  border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.instance-card:hover {
  border-color: rgba(0, 212, 255, 0.2);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 212, 255, 0.06);
}
.instance-header { display: flex; align-items: center; gap: 14px; }
.instance-icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, #1fa855, #25d366);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  box-shadow: 0 0 20px rgba(37, 211, 102, 0.2), inset 0 1px 0 rgba(255,255,255,0.1);
}
.instance-name { font-weight: 700; font-size: 14px; }
.instance-phone { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.instance-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* QR Code */
.qr-container { text-align: center; padding: 24px; }
.qr-container img { width: 210px; height: 210px; border-radius: 12px; border: 3px solid var(--accent); box-shadow: 0 0 30px rgba(0, 212, 255, 0.15), 0 0 60px rgba(0, 212, 255, 0.05); }
.qr-instructions { color: var(--text-secondary); font-size: 13px; margin-top: 14px; line-height: 1.7; }

/* ===== PIX ===== */
.pix-card { text-align: center; padding: 24px; }
.pix-qr img { width: 210px; height: 210px; border: 3px solid var(--success); border-radius: 14px; box-shadow: 0 0 30px rgba(0, 255, 136, 0.15), 0 0 60px rgba(0, 255, 136, 0.05); }
.pix-code {
  background: rgba(8, 14, 30, 0.6); border: 1px solid rgba(0, 212, 255, 0.06);
  border-radius: var(--radius-sm); padding: 14px;
  word-break: break-all; font-size: 11px; color: var(--text-muted); margin-top: 14px;
}

/* ===== LOADING ===== */
.loading { display: flex; align-items: center; justify-content: center; padding: 56px; color: var(--text-muted); flex-direction: column; gap: 14px; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(0, 212, 255, 0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.1);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== SEARCH ===== */
.search-bar { display: flex; gap: 12px; margin-bottom: 18px; }
.search-bar input {
  flex: 1; background: rgba(8, 14, 30, 0.6);
  border: 1.5px solid rgba(0, 212, 255, 0.07); border-radius: var(--radius-sm);
  padding: 10px 16px; color: var(--text-primary); font-size: 13px; outline: none;
  transition: var(--transition);
}
.search-bar input:focus { border-color: rgba(0, 212, 255, 0.4); box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.08); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar-toggle { display: block; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
  .chat-sidebar.active { display: block; }
}

/* ===== MISC ===== */
.divider {
  height: 1px; margin: 18px 0;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.1), transparent);
}
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent); }
.mt-4 { margin-top: 18px; }
.mb-4 { margin-bottom: 18px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.font-mono { font-family: 'SF Mono', 'Fira Code', monospace; }
.text-sm { font-size: 12px; }
.bold { font-weight: 700; }

.empty-state { text-align: center; padding: 56px 28px; color: var(--text-muted); }
.empty-state-icon { font-size: 52px; margin-bottom: 18px; filter: grayscale(0.3); }
.empty-state h3 { font-size: 17px; color: var(--text-secondary); margin-bottom: 8px; font-weight: 700; }
.empty-state p { font-size: 13px; }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.section-title { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid rgba(0, 212, 255, 0.05); margin-bottom: 22px; }
.tab { padding: 11px 18px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; transition: var(--transition); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text-primary); }

.chart-placeholder {
  background: rgba(8, 14, 30, 0.4); border-radius: var(--radius-sm);
  height: 200px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 13px; flex-direction: column; gap: 10px;
  border: 1px dashed rgba(0, 212, 255, 0.1);
}

.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.1);
  border-radius: 24px; transition: all 0.3s ease;
}
.toggle-slider:before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; bottom: 2px;
  background: var(--text-muted); border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle input:checked + .toggle-slider {
  background: rgba(0, 212, 255, 0.25);
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.2);
}
.toggle input:checked + .toggle-slider:before {
  transform: translateX(20px);
  background: var(--accent);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* ===== SUPORTE INTERNO ===== */
.support-layout {
  display: flex;
  height: calc(100vh - 72px);
  gap: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(0, 212, 255, 0.06);
  background: rgba(8, 14, 30, 0.5);
}
.support-layout-single { border-radius: var(--radius); }

.support-companies-panel {
  width: 300px;
  min-width: 260px;
  border-right: 1px solid rgba(0, 212, 255, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.support-companies-header {
  padding: 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(0, 212, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(8, 14, 30, 0.5);
}
.support-total-badge {
  background: linear-gradient(135deg, #0055cc, #00d4ff);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 8px;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.25);
}
#support-companies-list { overflow-y: auto; flex: 1; }
.support-company-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 212, 255, 0.03);
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
}
.support-company-item:hover { background: rgba(0, 212, 255, 0.03); }
.support-company-item.active { background: rgba(0, 212, 255, 0.06); border-left-color: var(--accent); }
.sci-avatar {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, #0055cc, #00d4ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
}
.sci-info { flex: 1; min-width: 0; }
.sci-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sci-last { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.sci-badge {
  background: linear-gradient(135deg, #ff3366, #ff4d6a); color: white;
  font-size: 9px; font-weight: 700;
  border-radius: 10px; padding: 2px 7px; min-width: 18px; text-align: center; flex-shrink: 0;
  box-shadow: 0 0 8px rgba(255, 77, 106, 0.3);
}
.support-no-chats { padding: 28px; text-align: center; color: var(--text-muted); font-size: 13px; }

.support-chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.support-chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.04);
  background: rgba(8, 14, 30, 0.4);
}
.support-avatar {
  width: 42px; height: 42px; border-radius: 14px;
  background: linear-gradient(135deg, #0055cc, #00d4ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  box-shadow: 0 0 14px rgba(0, 212, 255, 0.2);
}
.support-header-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.support-header-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.support-messages-list {
  flex: 1;
  overflow-y: auto;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}
.support-msgs-empty {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 36px;
  white-space: pre-line;
  line-height: 1.7;
}
.support-msgs-empty div { margin-bottom: 8px; }

.support-message { display: flex; flex-direction: column; max-width: 70%; }
.support-message.from-me { align-self: flex-end; align-items: flex-end; }
.support-message.from-them { align-self: flex-start; align-items: flex-start; }
.support-msg-sender { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; padding-left: 4px; }
.support-msg-bubble {
  padding: 10px 15px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
  max-width: 100%;
  position: relative;
}
.from-me .support-msg-bubble {
  background: linear-gradient(135deg, rgba(0,85,204,0.35), rgba(0,212,255,0.25));
  border: 1px solid rgba(0,212,255,0.18);
  border-bottom-right-radius: 4px;
  color: var(--text-primary);
}
.from-them .support-msg-bubble {
  background: rgba(8, 14, 30, 0.7);
  border: 1px solid rgba(0, 212, 255, 0.06);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}
.support-msg-text { display: block; }
.support-msg-time {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 5px;
  text-align: right;
}

.support-input-area {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid rgba(0, 212, 255, 0.04);
  background: rgba(8, 14, 30, 0.4);
}
.support-input-area textarea {
  flex: 1;
  background: rgba(8, 14, 30, 0.6);
  border: 1.5px solid rgba(0, 212, 255, 0.07);
  border-radius: 22px;
  padding: 11px 18px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  overflow-y: auto;
  outline: none;
  transition: var(--transition);
  line-height: 1.45;
}
.support-input-area textarea:focus {
  border-color: rgba(0, 212, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.08);
}
.support-send-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  padding: 0; flex-shrink: 0;
}

.support-empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-muted); text-align: center; gap: 10px;
}
.support-empty-state h3 { color: var(--text-secondary); margin: 0; font-weight: 700; }
.support-empty-state p { font-size: 13px; margin: 0; }

@media (max-width: 768px) {
  .support-companies-panel { width: 100%; border-right: none; }
  .support-layout { flex-direction: column; height: auto; }
}

.inline-flex { display: inline-flex; align-items: center; gap: 7px; }

/* ── COBRANÇAS SGP ─────────────────────────────────────────────────────────── */
.stat-mini { display:flex; flex-direction:column; gap:3px; }
.stat-mini span { font-size:11px; color:var(--text-muted); }
.stat-mini strong { font-size:14px; font-weight:700; color:var(--text-primary); }
.trigger-row { border-bottom:1px solid rgba(255,255,255,0.04); padding-bottom:10px; }
.trigger-row:last-child { border-bottom:none; padding-bottom:0; }
.badge-muted { background:rgba(255,255,255,0.08); color:var(--text-muted); }
