/* =====================================================
   ANALYTIX — Gen-Z Design System 2026
   Dark-first · Space Grotesk + Inter · Vivid gradients
   ===================================================== */

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

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
  /* Brand — purple → pink gradient */
  --primary:        #0984e3;
  --primary-end:    #0652DD;
  --primary-hover:  #0773c5;
  --primary-light:  rgba(9, 132, 227, 0.12);
  --primary-glow:   rgba(9, 132, 227, 0.35);
  --primary-grad:   linear-gradient(135deg, #0984e3 0%, #0652DD 100%);

  /* Accent palette */
  --accent-cyan:   #06b6d4;
  --accent-green:  #10b981;
  --accent-amber:  #f59e0b;
  --accent-rose:   #f43f5e;
  --accent-violet: #8b5cf6;
  --accent-sky:    #38bdf8;

  /* Dark surfaces */
  --bg:            #070a12;
  --bg-2:          #0b0f1a;
  --surface:       #0f1421;
  --surface-2:     #141b26;
  --border:        rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);

  /* Text */
  --text-primary:   #eef0f6;
  --text-secondary: #7c8494;
  --text-muted:     #434c5e;

  /* Sidebar */
  --sidebar-bg:            #050710;
  --sidebar-border:        rgba(255, 255, 255, 0.05);
  --sidebar-text:          rgba(255, 255, 255, 0.4);
  --sidebar-text-hover:    #ffffff;
  --sidebar-hover-bg:      rgba(255, 255, 255, 0.05);
  --sidebar-active-bg:     rgba(9, 132, 227, 0.14);
  --sidebar-active-text:   #60b4ff;
  --sidebar-active-border: #0984e3;

  /* Status */
  --success:        #10b981;
  --success-bg:     rgba(16, 185, 129, 0.1);
  --success-border: rgba(16, 185, 129, 0.25);
  --warning:        #f59e0b;
  --warning-bg:     rgba(245, 158, 11, 0.1);
  --warning-border: rgba(245, 158, 11, 0.25);
  --danger:         #f43f5e;
  --danger-bg:      rgba(244, 63, 94, 0.1);
  --danger-border:  rgba(244, 63, 94, 0.25);
  --info:           #38bdf8;
  --info-bg:        rgba(56, 189, 248, 0.1);
  --info-border:    rgba(56, 189, 248, 0.25);

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow:     0 2px 12px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md:  0 4px 24px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg:  0 10px 48px rgba(0, 0, 0, 0.7), 0 4px 16px rgba(0, 0, 0, 0.5);

  /* Radii — rounder for Gen-Z */
  --r-sm:  8px;
  --r:     12px;
  --r-md:  14px;
  --r-lg:  18px;
  --r-xl:  22px;
  --r-2xl: 28px;
  --r-full: 9999px;

  /* Layout */
  --sidebar-w: 240px;
  --transition: 0.18s ease;
}

/* ===== LIGHT THEME ===== */
html[data-theme="light"] {
  /* Surfaces */
  --bg:            #f2f4fb;
  --bg-2:          #e8ecf5;
  --surface:       #ffffff;
  --surface-2:     #f7f9fd;
  --border:        rgba(0, 0, 0, 0.07);
  --border-strong: rgba(0, 0, 0, 0.14);

  /* Text */
  --text-primary:   #0d1117;
  --text-secondary: #44546a;
  --text-muted:     #8a97aa;

  /* Sidebar stays dark — intentional (Vercel/Linear pattern) */
  --sidebar-bg:            #1a2340;
  --sidebar-border:        rgba(255, 255, 255, 0.07);
  --sidebar-text:          rgba(255, 255, 255, 0.45);
  --sidebar-text-hover:    #ffffff;
  --sidebar-hover-bg:      rgba(255, 255, 255, 0.07);
  --sidebar-active-bg:     rgba(9, 132, 227, 0.18);
  --sidebar-active-text:   #60b4ff;
  --sidebar-active-border: #0984e3;

  /* Shadows — softer for light */
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.07);
  --shadow:     0 2px 12px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md:  0 4px 24px rgba(0, 0, 0, 0.09), 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-lg:  0 10px 48px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.07);
}

/* Payment cards stay dark in light mode (credit-card aesthetic) */
html[data-theme="light"] .payment-card {
  background: linear-gradient(135deg, #1e2a48 0%, #111827 100%);
  border-color: rgba(9, 132, 227, 0.3);
  color: white;
}
html[data-theme="light"] .payment-card .card-meta {
  color: rgba(255, 255, 255, 0.6);
}

/* Aurora — lighter pastel wash in light mode */
html[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(139, 92, 246, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 100%, rgba(6, 182, 212, 0.03) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 100% 0%,  rgba(236, 72, 153, 0.03) 0%, transparent 50%);
}

/* Scrollbar — light-mode tint */
html[data-theme="light"] ::-webkit-scrollbar-track { background: #e8ecf5; }
html[data-theme="light"] ::-webkit-scrollbar-thumb  { background: #bcc5d6; }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #9aaab8; }

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Subtle aurora background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(139, 92, 246, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 100%, rgba(6, 182, 212, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 100% 0%,  rgba(236, 72, 153, 0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

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

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-body {
  flex: 1;
}

.page-content {
  padding: 2rem 2.5rem;
  max-width: 1440px;
}

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

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1.4rem 1.25rem 1.2rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.04em;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  font-family: 'Space Grotesk', sans-serif;
}

.logo-icon {
  width: 30px;
  height: 30px;
  background: var(--primary-grad);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.8rem;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(9, 132, 227, 0.55);
}

.nav-section {
  padding: 0.75rem 0.75rem 0;
  flex: 1;
}

.nav-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.2);
  padding: 1rem 0.5rem 0.3rem;
  margin-top: 0.25rem;
  user-select: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  margin: 1px 0;
  border-radius: var(--r-sm);
  color: var(--sidebar-text);
  font-size: 0.845rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}

.nav-item i {
  width: 1rem;
  font-size: 0.875rem;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-badge {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-hover);
}
.nav-item:hover i { opacity: 1; }

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}
.nav-item.active i { opacity: 1; color: var(--sidebar-active-text); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 2.5px;
  background: var(--primary-grad);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px rgba(9, 132, 227, 0.7);
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.65rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user:hover { background: var(--sidebar-hover-bg); }

.sidebar-avatar {
  width: 30px;
  height: 30px;
  background: var(--primary-grad);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.7rem;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(9, 132, 227, 0.4);
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
  font-size: 0.775rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 0.69rem;
  color: rgba(255, 255, 255, 0.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-more {
  color: rgba(255, 255, 255, 0.25);
  font-size: 0.78rem;
  flex-shrink: 0;
  transition: color var(--transition);
}
.sidebar-user:hover .sidebar-user-more { color: rgba(255, 255, 255, 0.5); }

.sidebar-footer { position: relative; }
.sidebar-user-menu {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0.35rem;
  margin-bottom: 0.35rem;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
  z-index: 10;
}
.sidebar-user-menu.open { display: block; }

.sidebar-user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.65rem;
  border-radius: 7px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  color: var(--text-secondary);
}
.sidebar-user-menu-item:hover { background: var(--surface); color: var(--text-primary); }
.sidebar-user-menu-item.danger { color: var(--danger); }
.sidebar-user-menu-item.danger:hover { background: rgba(244, 63, 94, 0.08); }

/* ===================================
   PAGE HEADER
   =================================== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
}

.page-header h1,
.page-header-left h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.2;
  background: var(--primary-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: 'Space Grotesk', sans-serif;
}

.page-header > div > p,
.page-header-left p {
  font-size: 0.855rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
  font-weight: 400;
}

.page-header-right {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}

/* ===================================
   CARDS
   =================================== */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  margin-bottom: 1.5rem;
}

.card:last-child { margin-bottom: 0; }

.card-body { padding: 1.5rem; }

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

.card-header h2 {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* ===================================
   STAT CARDS (Bento grid)
   =================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: default;
}

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

.stat-card.accent-blue   { border-top: 2px solid #818cf8; }
.stat-card.accent-green  { border-top: 2px solid #34d399; }
.stat-card.accent-amber  { border-top: 2px solid #fbbf24; }
.stat-card.accent-rose   { border-top: 2px solid #fb7185; }
.stat-card.accent-sky    { border-top: 2px solid #38bdf8; }
.stat-card.accent-violet { border-top: 2px solid #a78bfa; }

.stat-card.accent-blue:hover   { box-shadow: var(--shadow-md), 0 0 24px rgba(129, 140, 248, 0.1); }
.stat-card.accent-green:hover  { box-shadow: var(--shadow-md), 0 0 24px rgba(52, 211, 153, 0.1); }
.stat-card.accent-amber:hover  { box-shadow: var(--shadow-md), 0 0 24px rgba(251, 191, 36, 0.1); }
.stat-card.accent-rose:hover   { box-shadow: var(--shadow-md), 0 0 24px rgba(251, 113, 133, 0.1); }
.stat-card.accent-sky:hover    { box-shadow: var(--shadow-md), 0 0 24px rgba(56, 189, 248, 0.1); }
.stat-card.accent-violet:hover { box-shadow: var(--shadow-md), 0 0 24px rgba(167, 139, 250, 0.1); }

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  margin-bottom: 0.875rem;
}

.stat-icon.blue   { background: rgba(129, 140, 248, 0.15); color: #818cf8; }
.stat-icon.green  { background: rgba(52, 211, 153, 0.15);  color: #34d399; }
.stat-icon.amber  { background: rgba(251, 191, 36, 0.15);  color: #fbbf24; }
.stat-icon.rose   { background: rgba(251, 113, 133, 0.15); color: #fb7185; }
.stat-icon.sky    { background: rgba(56, 189, 248, 0.15);  color: #38bdf8; }
.stat-icon.violet { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.25rem;
  font-family: 'Space Grotesk', sans-serif;
}

.stat-label {
  font-size: 0.775rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.45rem;
  border-radius: var(--r-full);
  margin-top: 0.5rem;
  border: 1px solid transparent;
}
.stat-change.up      { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.stat-change.down    { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-border); }
.stat-change.neutral { background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* ===================================
   BUTTONS
   =================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--r-full);
  font-size: 0.845rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
  line-height: 1;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-grad);
  color: white;
  box-shadow: 0 2px 12px rgba(9, 132, 227, 0.4);
}
.btn-primary:hover {
  box-shadow: 0 4px 22px rgba(9, 132, 227, 0.6);
  transform: translateY(-1px);
  filter: brightness(1.07);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover {
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.45);
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { filter: brightness(1.1); }

.btn-sm  { padding: 0.375rem 0.875rem; font-size: 0.8rem; }
.btn-lg  { padding: 0.7rem 1.5rem; font-size: 0.95rem; }
.btn-icon {
  padding: 0.55rem;
  aspect-ratio: 1;
  justify-content: center;
  border-radius: var(--r-sm);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  filter: none !important;
}

/* ===================================
   BADGES
   =================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.6rem;
  border-radius: var(--r-full);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.badge-primary { background: rgba(9, 132, 227, 0.15); color: #60b4ff; border-color: rgba(9, 132, 227, 0.25); }
.badge-success { background: var(--success-bg);  color: var(--success); border-color: var(--success-border); }
.badge-warning { background: var(--warning-bg);  color: var(--warning); border-color: var(--warning-border); }
.badge-danger  { background: var(--danger-bg);   color: var(--danger);  border-color: var(--danger-border); }
.badge-neutral { background: rgba(255,255,255,0.06); color: var(--text-secondary); border-color: var(--border); }
.badge-info    { background: var(--info-bg);     color: var(--info);    border-color: var(--info-border); }

/* ── Agent health badge (#218) ──────────────────────────────────────────────
   Rendered next to the agent name in installed-agents lists and on the
   agent detail header. Healthy agents render no badge — only abnormal
   states get a visible label so the page stays clean. */
.health-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .02em;
  padding: .2rem .55rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  margin-left: .55rem;
  vertical-align: middle;
  white-space: nowrap;
  cursor: help;
}
.health-badge i { font-size: .65rem; }
.health-badge--warned {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}
.health-badge--disabled {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

/* Full-width banner shown on the agent detail page when the platform has
   delisted the agent. Renders only when JS sets display:flex. */
.agent-disabled-banner {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  padding: 1rem 1.25rem;
  margin: 1rem 0 1.25rem;
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  font-size: .9rem;
  line-height: 1.5;
}
.agent-disabled-banner i { font-size: 1.4rem; flex-shrink: 0; margin-top: .15rem; }
.agent-disabled-banner code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .85em;
  padding: .1rem .35rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
}

/* ===================================
   FORMS
   =================================== */
.form-group { margin-bottom: 1.25rem; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-2);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
  outline: none;
  appearance: none;
  line-height: 1.5;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(9, 132, 227, 0.15);
}

.form-control::placeholder { color: var(--text-muted); }
.form-control:read-only { background: rgba(255,255,255,0.02); color: var(--text-muted); cursor: default; }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23434c5e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-color: var(--bg-2);
  padding-right: 2rem;
  cursor: pointer;
}

textarea.form-control { resize: vertical; min-height: 100px; }

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0;
}
.checkbox-group input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.checkbox-group label { font-size: 0.875rem; color: var(--text-secondary); cursor: pointer; }

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(9, 132, 227, 0.12);
}
.search-bar i {
  padding-left: 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}
.search-bar input {
  flex: 1;
  padding: 0.575rem 1rem;
  border: none;
  outline: none;
  font-size: 0.855rem;
  color: var(--text-primary);
  background: transparent;
  font-family: inherit;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar button {
  padding: 0.575rem 1.1rem;
  background: var(--primary-grad);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 0.845rem;
  font-weight: 600;
  transition: filter var(--transition);
  font-family: inherit;
}
.search-bar button:hover { filter: brightness(1.1); }

/* Filter row */
.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.filter-select {
  padding: 0.525rem 2rem 0.525rem 0.875rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  background: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23434c5e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  font-size: 0.845rem;
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  appearance: none;
  outline: none;
  transition: border-color var(--transition);
}
.filter-select:focus { border-color: var(--primary); }

/* ===================================
   TABLE
   =================================== */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.845rem;
}

thead th {
  text-align: left;
  padding: 0.7rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

.td-primary { color: var(--text-primary) !important; font-weight: 500; }
.td-mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.8rem; }

/* ===================================
   PAGINATION
   =================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
}
.pagination-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0 0.375rem;
}

/* ===================================
   SKELETON LOADER
   =================================== */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite ease-in-out;
  border-radius: var(--r-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text   { height: 0.875rem; }
.skeleton-title  { height: 1.5rem; width: 40%; }
.skeleton-row    { height: 2.75rem; margin: 0.375rem 0; }
.skeleton-card   { height: 140px; border-radius: var(--r-lg); }
.skeleton-chart  { height: 200px; border-radius: var(--r); }
.skeleton-avatar { width: 36px; height: 36px; border-radius: var(--r-sm); flex-shrink: 0; }

/* ===================================
   STATE BOXES (empty / error)
   =================================== */
.state-box {
  padding: 3.5rem 2rem;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.state-box .state-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

.state-box.error .state-icon { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.state-box.empty .state-icon { background: rgba(255,255,255,0.04); color: var(--text-muted); }
.state-box p { font-size: 0.875rem; max-width: 280px; line-height: 1.5; }

/* ===================================
   MODAL
   =================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 16, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 0;
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
  animation: modalIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(-12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.modal-close {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.07);
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  font-size: 0.8rem;
}
.modal-close:hover { background: rgba(255,255,255,0.13); color: var(--text-primary); }

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.625rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ===================================
   TABS
   =================================== */
.tabs {
  display: flex;
  gap: 0.15rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.25rem;
  border-radius: var(--r-full);
  width: fit-content;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.tab-btn {
  padding: 0.42rem 1rem;
  background: transparent;
  border: none;
  border-radius: var(--r-full);
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}
.tab-btn.active {
  background: var(--primary-grad);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(9, 132, 227, 0.45);
}
.tab-btn:hover:not(.active) { color: var(--text-secondary); background: rgba(255,255,255,0.06); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Sub-tabs */
.sub-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.sub-tab-btn {
  padding: 0.6rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 0.845rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.sub-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.sub-tab-btn:hover:not(.active) { color: var(--text-secondary); }
.sub-tab-pane { display: none; }
.sub-tab-pane.active { display: block; }

/* ===================================
   AGENT CARDS (market grid)
   =================================== */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.agent-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 1.25rem;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
.agent-card:hover {
  border-color: rgba(9, 132, 227, 0.4);
  box-shadow: 0 4px 24px rgba(9, 132, 227, 0.15), var(--shadow-sm);
  transform: translateY(-2px);
}

.agent-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 0.875rem;
  background: rgba(9, 132, 227, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(9, 132, 227, 0.2);
}
.agent-icon-wrap img { width: 100%; height: 100%; object-fit: cover; }
.agent-icon-wrap i { font-size: 1.25rem; color: var(--primary); }

.agent-name {
  font-weight: 700;
  font-size: 0.925rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
  line-height: 1.3;
}
.agent-developer { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.agent-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.agent-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.agent-rating {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.stars { color: #fbbf24; font-size: 0.7rem; display: inline-flex; gap: 1px; }

/* Platform pills */
.platform-pills { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.18rem 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ===================================
   MEMBER TILES (team)
   =================================== */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.member-tile {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.member-tile:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.member-tile-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
}

.member-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--primary-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.member-name { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); }
.member-email { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; word-break: break-all; }

.member-tile-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border);
}

/* ===================================
   ACTION BAR (search + button)
   =================================== */
.action-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.action-bar .search-bar { flex: 1; min-width: 200px; max-width: 400px; }

/* ===================================
   DANGER ZONE
   =================================== */
.danger-zone {
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  border-radius: var(--r-md);
  padding: 1.4rem 1.5rem;
}
.danger-zone h3 {
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.danger-zone p { font-size: 0.855rem; color: var(--text-secondary); margin-bottom: 1rem; line-height: 1.6; }

/* ===================================
   STATUS MESSAGES
   =================================== */
.status-msg {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-radius: var(--r-sm);
  font-size: 0.845rem;
  font-weight: 500;
  margin-top: 1rem;
  animation: fadeIn 0.2s ease;
  border: 1px solid transparent;
}
.status-msg.show { display: flex; }
.status-msg.success {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}
.status-msg.error {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===================================
   CHARTS
   =================================== */
.chart-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.1rem 1.25rem;
}
.chart-box h3 {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.875rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Toggle buttons */
.chart-toggle { display: flex; gap: 0.375rem; margin-bottom: 1rem; }
.toggle-btn {
  padding: 0.35rem 0.875rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.toggle-btn.active {
  background: var(--primary-grad);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(9, 132, 227, 0.45);
}

/* Date range */
.date-range {
  display: flex;
  gap: 0.625rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.date-range input[type="date"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 0.845rem;
  color: var(--text-primary);
  font-family: inherit;
  background: var(--bg-2);
  outline: none;
  color-scheme: dark;
  transition: border-color var(--transition);
}
.date-range input[type="date"]:focus { border-color: var(--primary); }

/* ===================================
   API KEY DISPLAY
   =================================== */
.api-key-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.api-key-display .key-value {
  font-family: 'SF Mono', 'Fira Code', monospace;
  background: rgba(255,255,255,0.05);
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.eye-icon { cursor: pointer; color: var(--text-muted); transition: color var(--transition); font-size: 0.875rem; }
.eye-icon:hover { color: var(--primary); }

/* ===================================
   PAYMENT CARDS
   =================================== */
.payment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }

.payment-card {
  background: linear-gradient(135deg, #1a1030 0%, #0d0f1e 100%);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  color: white;
  position: relative;
  overflow: hidden;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(9, 132, 227, 0.2);
}
.payment-card::before {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 100px;
  height: 100px;
  background: rgba(9, 132, 227, 0.2);
  border-radius: 50%;
}
.payment-card.is-default {
  border-color: rgba(9, 132, 227, 0.5);
  box-shadow: 0 0 24px rgba(9, 132, 227, 0.15);
}

.card-chip { font-size: 1rem; margin-bottom: 0.5rem; }
.card-number { font-family: 'SF Mono', monospace; font-size: 1.05rem; letter-spacing: 0.2em; font-weight: 600; }
.card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 0.5rem; font-size: 0.75rem; opacity: 0.7; }

/* ===================================
   AGENT USAGE — Agent header
   =================================== */
.agent-header-block {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding: 1.5rem;
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.agent-icon-large {
  width: 72px;
  height: 72px;
  border-radius: var(--r-md);
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid var(--border);
}

.agent-header-info { flex: 1; }
.agent-header-info h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 0.3rem;
}
.agent-meta {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.agent-meta span { display: flex; align-items: center; gap: 0.35rem; }

.pricing-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pricing-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.65rem;
  background: rgba(9, 132, 227, 0.12);
  color: #60b4ff;
  border: 1px solid rgba(9, 132, 227, 0.25);
  border-radius: var(--r-full);
  font-size: 0.78rem;
  font-weight: 600;
}

/* ===================================
   MARKET AGENT DETAIL
   =================================== */
.agent-detail-hero {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.agent-detail-icon {
  width: 88px;
  height: 88px;
  border-radius: var(--r-lg);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.agent-detail-icon img { width: 100%; height: 100%; object-fit: cover; }

.agent-detail-body { flex: 1; min-width: 240px; }
.agent-detail-body h1 {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  margin-bottom: 0.5rem;
}
.agent-detail-meta {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
}

.agent-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
  min-width: 140px;
}

/* Function detail cards */
.function-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.25rem;
  margin-bottom: 0.875rem;
}
.function-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.625rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.function-url {
  background: rgba(9, 132, 227, 0.08);
  border: 1px solid rgba(9, 132, 227, 0.2);
  border-radius: var(--r-sm);
  padding: 0.5rem 0.75rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--primary);
  word-break: break-all;
  margin-bottom: 0.625rem;
}

.code-block {
  background: #080b14;
  color: #c4ccde;
  padding: 0.875rem 1rem;
  border-radius: var(--r-sm);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
  overflow-x: auto;
  margin-top: 0.5rem;
  line-height: 1.6;
  border: 1px solid var(--border);
}

/* ===================================
   ACTIVITY LOG
   =================================== */
.activity-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--r-full);
  font-size: 0.7rem;
  font-weight: 700;
}

/* ===================================
   DIVIDER
   =================================== */
.divider { height: 1px; background: var(--border); margin: 1.25rem 0; }

/* ===================================
   UTILITIES
   =================================== */
.text-muted     { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-primary   { color: var(--text-primary) !important; }
.text-success   { color: var(--success) !important; }
.text-danger    { color: var(--danger) !important; }
.text-sm        { font-size: 0.84rem !important; }
.text-xs        { font-size: 0.75rem !important; }
.font-mono      { font-family: 'SF Mono', 'Fira Code', monospace !important; }
.font-bold      { font-weight: 700 !important; }
.font-medium    { font-weight: 500 !important; }
.flex           { display: flex !important; }
.flex-col       { flex-direction: column !important; }
.items-center   { align-items: center !important; }
.items-start    { align-items: flex-start !important; }
.justify-between{ justify-content: space-between !important; }
.justify-end    { justify-content: flex-end !important; }
.gap-1  { gap: 0.25rem !important; }
.gap-2  { gap: 0.5rem !important; }
.gap-3  { gap: 0.75rem !important; }
.gap-4  { gap: 1rem !important; }
.w-full { width: 100% !important; }
.mt-1   { margin-top: 0.25rem !important; }
.mt-2   { margin-top: 0.5rem !important; }
.mt-3   { margin-top: 0.75rem !important; }
.mt-4   { margin-top: 1rem !important; }
.mt-6   { margin-top: 1.5rem !important; }
.mb-2   { margin-bottom: 0.5rem !important; }
.mb-3   { margin-bottom: 0.75rem !important; }
.mb-4   { margin-bottom: 1rem !important; }
.mb-6   { margin-bottom: 1.5rem !important; }
.p-4    { padding: 1rem !important; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .page-content { padding: 1.5rem 1.75rem; }
}

/* ===== TOP HEADER (mobile only) ===== */
.topbar {
  display: none;
  align-items: center;
  gap: 0.75rem;
  height: 56px;
  padding: 0 1.25rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.topbar-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  text-decoration: none;
}

/* Hamburger button — hidden on desktop, shown on mobile */
.mobile-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: var(--text-primary);
  flex-direction: column;
  gap: 5px;
  border-radius: 6px;
  transition: background 0.15s;
}
.mobile-hamburger:hover { background: var(--sidebar-hover-bg); }
.mobile-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.mobile-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-hamburger.open span:nth-child(2) { opacity: 0; }
.mobile-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }


@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .page-content { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filters-row { flex-direction: column; align-items: stretch; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .agents-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .topbar { display: flex; }
  .mobile-hamburger { display: flex; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .modal { max-width: 100%; margin: 0.5rem; border-radius: var(--r-lg); }
}
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  text-decoration: none;
}
.topbar-logo-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--primary-grad);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.72rem;
}
.topbar-right { display: flex; align-items: center; gap: 0.75rem; position: relative; }
.topbar-avatar {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--primary-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: #fff;
  cursor: pointer; user-select: none;
  transition: opacity 0.15s;
}
.topbar-avatar:hover { opacity: 0.85; }
.topbar-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 12px; min-width: 200px; padding: 0.5rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4); z-index: 200;
}
.topbar-dropdown.open { display: block; }
.topbar-dropdown-user {
  padding: 0.6rem 0.75rem 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.4rem;
}
.topbar-dropdown-name  { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.topbar-dropdown-email { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }
.topbar-dropdown-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.75rem; border-radius: 8px; cursor: pointer;
  font-size: 0.875rem; color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}
.topbar-dropdown-item:hover { background: var(--surface); color: var(--text-primary); }
.topbar-dropdown-item.danger { color: var(--danger); }
.topbar-dropdown-item.danger:hover { background: rgba(244,63,94,0.08); }

/* ===== TOAST ===== */
.toast-container {
  position: fixed; top: 1rem; right: 1rem; z-index: 9999;
  display: flex; flex-direction: column; gap: 0.5rem;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem; border-radius: 12px; min-width: 260px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  font-size: 0.875rem; color: var(--text-primary);
  pointer-events: all;
  animation: toastIn 0.25s ease;
}
.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error   { border-left: 3px solid var(--danger); }
.toast.toast-info    { border-left: 3px solid var(--primary); }
@keyframes toastIn {
  from { opacity:0; transform:translateX(20px); }
  to   { opacity:1; transform:translateX(0); }
}

/* ===== SKELETON SHIMMER ===== */
@keyframes shimmer {
  0%   { background-position: -800px 0; }
  100% { background-position: 800px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, rgba(255,255,255,0.04) 50%, var(--surface) 75%) !important;
  background-size: 800px 100% !important;
  animation: shimmer 1.5s infinite linear !important;
  border-radius: 8px;
}

/* ===== LAYOUT: page-content centering ===== */
.page-content {
  margin: 0 auto;
}

/* ===== CARD POLISH ===== */
.card { transition: box-shadow 0.2s; }
.card:hover { box-shadow: 0 0 0 1px rgba(9,132,227,0.12), 0 4px 24px rgba(0,0,0,0.18); }

/* ===== BUTTON POLISH ===== */
.btn { transition: all 0.15s; }
.btn:active { transform: scale(0.97); }
.btn-primary:hover { opacity: 0.9; box-shadow: 0 4px 12px rgba(9,132,227,0.3); }

/* ===== PROGRESS BAR ===== */
.progress-bar-wrap { background: #bcbcbc; border-radius: 8px; height: 10px; margin-top: 0.5rem; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 8px; background: var(--primary-grad); transition: width 0.6s ease; }
.budget-meta { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.35rem; }

/* ===== STATUS DOT ===== */
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.on  { background: var(--success); box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.status-dot.off { background: var(--text-muted); }
.recharge-status { display: flex; align-items: center; gap: 0.75rem; }

/* ===== PAYMENT CARD TILES ===== */
.payment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 1rem; }
.payment-card {
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-strong); border-radius: 16px;
  padding: 1.25rem; position: relative; overflow: hidden;
}
.payment-card::before {
  content: ''; position: absolute; top: -20px; right: -20px;
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--primary-light); pointer-events: none;
}
.card-number { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; font-size: 0.9rem; }
.card-number .fa-cc-visa, .card-number .fa-cc-mastercard, .card-number .fa-cc-amex { font-size: 1.6rem; }
.card-meta { font-size: 0.8rem; color: var(--text-muted); display: flex; gap: 1rem; }

/* ===== FILTERS ROW ===== */
.filters-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; align-items: center; }
.search-bar { display: flex; gap: 0.5rem; flex: 1; min-width: 200px; }
.search-bar input { flex: 1; }
