/* ═══════════════════════════════════════════════════════════
   CODEBEANS SUPER ADMIN — PREMIUM CSS DESIGN SYSTEM
   cb-admin.css
   Dark mode by default · Light mode via .cb-light
   ═══════════════════════════════════════════════════════════ */

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

/* ─── Dark Mode Variables (default) ─── */
:root {
  --cb-bg-primary: #0a0e1a;
  --cb-bg-secondary: #111827;
  --cb-bg-card: #1a2236;
  --cb-bg-card-hover: #1f2a42;
  --cb-bg-input: #0d1321;
  --cb-border: #1e293b;
  --cb-text-primary: #f1f5f9;
  --cb-text-secondary: #94a3b8;
  --cb-text-muted: #64748b;
  --cb-accent-blue: #3b82f6;
  --cb-accent-emerald: #10b981;
  --cb-accent-amber: #f59e0b;
  --cb-accent-red: #ef4444;
  --cb-accent-purple: #8b5cf6;
  --cb-sidebar-width: 260px;
  --cb-topbar-height: 64px;
  --cb-radius: 12px;
  --cb-radius-sm: 8px;
  --cb-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --cb-glow-blue: 0 0 20px rgba(59, 130, 246, 0.15);
  --cb-glow-emerald: 0 0 20px rgba(16, 185, 129, 0.15);
  --cb-shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --cb-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* ─── Light Mode Variables ─── */
.cb-light {
  --cb-bg-primary: #f8fafc;
  --cb-bg-secondary: #f1f5f9;
  --cb-bg-card: #ffffff;
  --cb-bg-card-hover: #f8fafc;
  --cb-bg-input: #f1f5f9;
  --cb-border: #e2e8f0;
  --cb-text-primary: #0f172a;
  --cb-text-secondary: #334155;
  --cb-text-muted: #64748b;
  --cb-shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --cb-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
  --cb-glow-blue: 0 0 20px rgba(59, 130, 246, 0.08);
  --cb-glow-emerald: 0 0 20px rgba(16, 185, 129, 0.08);
}

/* ═══════════════════════════════════════════════════════════
   RESETS & BASE
   ═══════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* ═══════════════════════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════════════════════ */
.cb-progress-bar-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9999;
  background: transparent;
}

.cb-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--cb-accent-blue), var(--cb-accent-purple), var(--cb-accent-blue));
  background-size: 200% 100%;
  animation: cb-progress-slide 1.5s ease-in-out infinite, cb-progress-grow 0.8s ease-out forwards;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 10px var(--cb-accent-blue), 0 0 5px var(--cb-accent-purple);
}

@keyframes cb-progress-slide {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes cb-progress-grow {
  0% { width: 0%; }
  50% { width: 60%; }
  100% { width: 85%; }
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT: SIDEBAR + MAIN
   ═══════════════════════════════════════════════════════════ */
.cb-admin-layout {
  display: flex;
  min-height: 100vh;
}

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

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

.cb-sidebar-brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
}

.cb-sidebar-brand-text h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--cb-text-primary);
  line-height: 1.2;
}

.cb-sidebar-brand-text span {
  font-size: 11px;
  font-weight: 500;
  color: var(--cb-accent-blue);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cb-sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  overflow-y: auto;
}

.cb-sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--cb-text-muted);
  padding: 16px 12px 6px;
}

.cb-sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--cb-radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--cb-text-secondary);
  text-decoration: none;
  transition: all var(--cb-transition);
  position: relative;
  margin-bottom: 2px;
}

.cb-sidebar-link:hover {
  background: var(--cb-bg-card);
  color: var(--cb-text-primary);
}

.cb-sidebar-link.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.1));
  color: var(--cb-accent-blue);
  font-weight: 600;
  box-shadow: var(--cb-glow-blue);
}

.cb-sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--cb-accent-blue);
}

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

.cb-sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.cb-sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--cb-accent-blue), var(--cb-accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.cb-sidebar-user-info p {
  font-size: 13px;
  font-weight: 600;
  color: var(--cb-text-primary);
  line-height: 1.2;
}

.cb-sidebar-user-info span {
  font-size: 11px;
  color: var(--cb-text-muted);
  text-transform: capitalize;
}

.cb-theme-toggle {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--cb-border);
  background: var(--cb-bg-card);
  color: var(--cb-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--cb-transition);
}

.cb-theme-toggle:hover {
  background: var(--cb-bg-card-hover);
  color: var(--cb-accent-amber);
  border-color: var(--cb-accent-amber);
}

.cb-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--cb-radius-sm);
  border: 1px solid var(--cb-border);
  background: transparent;
  color: var(--cb-text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--cb-transition);
}

.cb-logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--cb-accent-red);
  color: var(--cb-accent-red);
}

/* ─── Main Content ─── */
.cb-main {
  flex: 1;
  margin-left: var(--cb-sidebar-width);
  min-height: 100vh;
  transition: opacity var(--cb-transition);
}

.cb-main-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════════════ */
.cb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--cb-border);
  background: var(--cb-bg-secondary);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

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

.cb-topbar-subtitle {
  font-size: 13px;
  color: var(--cb-text-muted);
  font-weight: 400;
  margin-top: 2px;
}

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

/* ═══════════════════════════════════════════════════════════
   CONTENT WRAPPER
   ═══════════════════════════════════════════════════════════ */
.cb-content {
  padding: 24px 28px;
}

/* ═══════════════════════════════════════════════════════════
   KPI GRID & CARDS
   ═══════════════════════════════════════════════════════════ */
.cb-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.cb-kpi-card {
  background: var(--cb-bg-card);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--cb-transition);
  box-shadow: var(--cb-shadow-card);
}

.cb-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.cb-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--cb-shadow-lg);
}

.cb-kpi-card.blue::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.cb-kpi-card.emerald::before { background: linear-gradient(90deg, #10b981, #34d399); }
.cb-kpi-card.amber::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.cb-kpi-card.purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.cb-kpi-card.red::before { background: linear-gradient(90deg, #ef4444, #f87171); }

.cb-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cb-kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--cb-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cb-kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cb-kpi-icon.blue { background: rgba(59, 130, 246, 0.12); color: var(--cb-accent-blue); }
.cb-kpi-icon.emerald { background: rgba(16, 185, 129, 0.12); color: var(--cb-accent-emerald); }
.cb-kpi-icon.amber { background: rgba(245, 158, 11, 0.12); color: var(--cb-accent-amber); }
.cb-kpi-icon.purple { background: rgba(139, 92, 246, 0.12); color: var(--cb-accent-purple); }
.cb-kpi-icon.red { background: rgba(239, 68, 68, 0.12); color: var(--cb-accent-red); }

.cb-kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--cb-text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.cb-kpi-sub {
  font-size: 12px;
  color: var(--cb-text-muted);
}

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */
.cb-card {
  background: var(--cb-bg-card);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow-card);
  overflow: hidden;
  margin-bottom: 20px;
}

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

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

.cb-card-body {
  padding: 20px;
}

.cb-card-body.no-pad {
  padding: 0;
}

/* ═══════════════════════════════════════════════════════════
   SEARCH & FILTER BAR
   ═══════════════════════════════════════════════════════════ */
.cb-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.cb-search-input {
  flex: 1;
  min-width: 200px;
  padding: 9px 14px 9px 38px;
  border-radius: var(--cb-radius-sm);
  border: 1px solid var(--cb-border);
  background: var(--cb-bg-input);
  color: var(--cb-text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: all var(--cb-transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m13 13-3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

.cb-search-input::placeholder {
  color: var(--cb-text-muted);
}

.cb-search-input:focus {
  outline: none;
  border-color: var(--cb-accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.cb-filter-select {
  padding: 9px 32px 9px 14px;
  border-radius: var(--cb-radius-sm);
  border: 1px solid var(--cb-border);
  background: var(--cb-bg-input);
  color: var(--cb-text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--cb-transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m2 4 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.cb-filter-select:focus {
  outline: none;
  border-color: var(--cb-accent-blue);
}

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

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

.cb-table thead th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cb-text-muted);
  text-align: left;
  border-bottom: 1px solid var(--cb-border);
  background: var(--cb-bg-secondary);
  white-space: nowrap;
}

.cb-table tbody td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--cb-text-secondary);
  border-bottom: 1px solid var(--cb-border);
  vertical-align: middle;
}

.cb-table tbody tr {
  transition: background var(--cb-transition);
}

.cb-table tbody tr:hover {
  background: var(--cb-bg-card-hover);
}

.cb-table tbody tr:last-child td {
  border-bottom: none;
}

.cell-primary {
  color: var(--cb-text-primary) !important;
  font-weight: 500;
}

.cell-mono {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  color: var(--cb-text-muted) !important;
}

.cb-table-empty {
  text-align: center;
  padding: 40px 16px !important;
  color: var(--cb-text-muted);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════ */
.cb-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.cb-badge.blue {
  background: rgba(59, 130, 246, 0.12);
  color: var(--cb-accent-blue);
}

.cb-badge.emerald {
  background: rgba(16, 185, 129, 0.12);
  color: var(--cb-accent-emerald);
}

.cb-badge.amber {
  background: rgba(245, 158, 11, 0.12);
  color: var(--cb-accent-amber);
}

.cb-badge.red {
  background: rgba(239, 68, 68, 0.12);
  color: var(--cb-accent-red);
}

.cb-badge.purple {
  background: rgba(139, 92, 246, 0.12);
  color: var(--cb-accent-purple);
}

.cb-badge.gray {
  background: rgba(100, 116, 139, 0.12);
  color: var(--cb-text-muted);
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.cb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--cb-radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--cb-transition);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.cb-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cb-btn-primary {
  background: linear-gradient(135deg, var(--cb-accent-blue), #2563eb);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.cb-btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
  transform: translateY(-1px);
}

.cb-btn-secondary {
  background: var(--cb-bg-card);
  color: var(--cb-text-secondary);
  border-color: var(--cb-border);
}

.cb-btn-secondary:hover:not(:disabled) {
  background: var(--cb-bg-card-hover);
  color: var(--cb-text-primary);
  border-color: var(--cb-text-muted);
}

.cb-btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--cb-accent-red);
  border-color: rgba(239, 68, 68, 0.2);
}

.cb-btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--cb-accent-red);
}

.cb-btn-ghost {
  background: transparent;
  color: var(--cb-text-secondary);
  border-color: transparent;
  padding: 8px;
}

.cb-btn-ghost:hover:not(:disabled) {
  background: var(--cb-bg-card);
  color: var(--cb-text-primary);
}

.cb-btn-sm {
  padding: 7px 14px;
  font-size: 12px;
}

.cb-btn-icon {
  padding: 8px;
  border-radius: 10px;
}

/* ═══════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════ */
.cb-form-grid {
  display: grid;
  gap: 24px;
}

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

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

.cb-form-columns {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
}

.cb-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cb-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--cb-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cb-input {
  padding: 10px 14px;
  border-radius: var(--cb-radius-sm);
  border: 1px solid var(--cb-border);
  background: var(--cb-bg-input);
  color: var(--cb-text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: all var(--cb-transition);
  width: 100%;
}

.cb-input::placeholder {
  color: var(--cb-text-muted);
}

.cb-input:focus {
  outline: none;
  border-color: var(--cb-accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.cb-input.mono {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
}

.cb-input-prefix {
  position: relative;
}

.cb-input-prefix .cb-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cb-text-muted);
  font-size: 13px;
  pointer-events: none;
}

.cb-input-prefix .cb-input {
  padding-left: 28px;
}

.cb-input-suffix {
  position: relative;
}

.cb-input-suffix .cb-suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cb-text-muted);
  font-size: 11px;
  font-weight: 500;
  pointer-events: none;
}

.cb-input-suffix .cb-input {
  padding-right: 50px;
}

.cb-select {
  padding: 10px 36px 10px 14px;
  border-radius: var(--cb-radius-sm);
  border: 1px solid var(--cb-border);
  background: var(--cb-bg-input);
  color: var(--cb-text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--cb-transition);
  appearance: none;
  width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m2 4 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.cb-select:focus {
  outline: none;
  border-color: var(--cb-accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.cb-textarea {
  padding: 10px 14px;
  border-radius: var(--cb-radius-sm);
  border: 1px solid var(--cb-border);
  background: var(--cb-bg-input);
  color: var(--cb-text-primary);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  transition: all var(--cb-transition);
  width: 100%;
  min-height: 80px;
}

.cb-textarea:focus {
  outline: none;
  border-color: var(--cb-accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.cb-hint {
  font-size: 11px;
  color: var(--cb-text-muted);
  margin-top: 2px;
}

/* Checkbox */
.cb-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.cb-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--cb-border);
  background: var(--cb-bg-input);
  accent-color: var(--cb-accent-blue);
  cursor: pointer;
}

.cb-checkbox:checked {
  border-color: var(--cb-accent-blue);
}

.cb-checkbox-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--cb-text-primary);
}

/* Toggle Switch */
.cb-toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

.cb-toggle-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.cb-toggle-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cb-toggle-icon.blue { background: rgba(59, 130, 246, 0.12); color: var(--cb-accent-blue); }
.cb-toggle-icon.emerald { background: rgba(16, 185, 129, 0.12); color: var(--cb-accent-emerald); }
.cb-toggle-icon.amber { background: rgba(245, 158, 11, 0.12); color: var(--cb-accent-amber); }
.cb-toggle-icon.purple { background: rgba(139, 92, 246, 0.12); color: var(--cb-accent-purple); }
.cb-toggle-icon.red { background: rgba(239, 68, 68, 0.12); color: var(--cb-accent-red); }

.cb-toggle-text h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--cb-text-primary);
}

.cb-toggle-text p {
  font-size: 11px;
  color: var(--cb-text-muted);
  margin-top: 2px;
}

.cb-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.cb-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cb-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--cb-border);
  border-radius: 24px;
  transition: all var(--cb-transition);
}

.cb-toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: all var(--cb-transition);
}

.cb-toggle input:checked + .cb-toggle-slider {
  background: var(--cb-accent-blue);
}

.cb-toggle input:checked + .cb-toggle-slider::before {
  transform: translateX(20px);
}

/* ═══════════════════════════════════════════════════════════
   TABS (for sub-navigation like fraud protection)
   ═══════════════════════════════════════════════════════════ */
.cb-tabs {
  display: flex;
  gap: 4px;
  padding: 0 28px;
  border-bottom: 1px solid var(--cb-border);
  background: var(--cb-bg-secondary);
}

.cb-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--cb-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all var(--cb-transition);
  margin-bottom: -1px;
}

.cb-tab:hover {
  color: var(--cb-text-primary);
}

.cb-tab.active {
  color: var(--cb-accent-blue);
  border-bottom-color: var(--cb-accent-blue);
  font-weight: 600;
}

/* The tab styles above assume an <a>. A <button class="cb-tab"> otherwise keeps
   its user-agent chrome and renders as a grey box, so reset it here — this is
   the only difference between the two elements. `.cb-tab.active` still wins the
   border colour on specificity (0,2,0 beats 0,1,1). */
button.cb-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  cursor: pointer;
}

/* Tab strip used INSIDE .cb-content, sitting on the top edge of the card it
   switches — rather than as a full-width sub-nav directly under the topbar.
   Drops the bar background and gutter so it reads as part of the card. */
.cb-tabs.cb-tabs-inline {
  background: none;
  padding: 0;
  margin-bottom: -1px;
}

/* ═══════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */
.cb-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: cb-fade-in 0.2s ease;
}

.cb-modal {
  background: var(--cb-bg-card);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  margin: 16px;
  box-shadow: var(--cb-shadow-lg);
  animation: cb-scale-in 0.2s ease;
}

.cb-modal h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--cb-text-primary);
  margin-bottom: 8px;
}

.cb-modal p {
  font-size: 13px;
  color: var(--cb-text-secondary);
  margin-bottom: 16px;
}

.cb-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ── Large modal: pinned header + footer, scrolling body ──────────────────
   .cb-modal on its own is a single padded box, so a tall form scrolls its own
   title and buttons out of view. This variant moves the padding onto three
   slots instead, so only the body scrolls. */
.cb-modal.cb-modal-lg {
  max-width: 760px;
  max-height: 88vh;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.cb-modal-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--cb-border);
  flex-shrink: 0;
}

.cb-modal-head h3 { margin-bottom: 4px; }

.cb-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.cb-modal-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--cb-border);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* The modal body is a flex column with its own gap, so a .cb-form-group inside
   it must not also carry a margin — the gap is the only spacing authority. */
.cb-modal-body > .cb-form-group { gap: 8px; }

/* ── Checkbox row with a description underneath ───────────────────────────
   .cb-checkbox-row centres a single-line label. A two-line item (title +
   description) needs top alignment, breathing room, and a hover target,
   otherwise consecutive rows read as one wall of text. */
.cb-checkbox-row.stacked {
  align-items: flex-start;
  padding: 9px 10px;
  border-radius: 8px;
  transition: background var(--cb-transition);
}

.cb-checkbox-row.stacked:hover { background: var(--cb-bg-input); }

.cb-checkbox-row.stacked .cb-checkbox {
  margin-top: 2px;
  flex-shrink: 0;
}

.cb-checkbox-desc {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--cb-text-muted);
}

/* ── Grouped block of checkbox rows ───────────────────────────────────── */
.cb-optgroup {
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius);
  padding: 14px 14px 8px;
}

.cb-optgroup + .cb-optgroup { margin-top: 12px; }

.cb-optgroup.danger {
  border-color: var(--cb-accent-red);
  background: rgba(239, 68, 68, 0.04);
}

.cb-optgroup .cb-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Monospace block for copyable config snippets ─────────────────────── */
.cb-codeblock {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius);
  background: var(--cb-bg-input);
  color: var(--cb-text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
}

.cb-codeblock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

@keyframes cb-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cb-scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ═══════════════════════════════════════════════════════════
   ALERTS / INFO BOXES
   ═══════════════════════════════════════════════════════════ */
.cb-alert {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--cb-radius);
  border: 1px solid;
}

.cb-alert.blue {
  background: rgba(59, 130, 246, 0.06);
  border-color: rgba(59, 130, 246, 0.15);
}

.cb-alert.blue .cb-alert-icon { color: var(--cb-accent-blue); }

.cb-alert.emerald {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.15);
}

.cb-alert.red {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.15);
}

.cb-alert-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.cb-alert-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--cb-text-primary);
  margin-bottom: 6px;
}

.cb-alert-body {
  font-size: 12px;
  color: var(--cb-text-secondary);
  line-height: 1.6;
}

.cb-alert-body ul {
  list-style: none;
  padding: 0;
}

.cb-alert-body li {
  margin-bottom: 2px;
}

.cb-alert-body strong {
  color: var(--cb-text-primary);
}

/* ═══════════════════════════════════════════════════════════
   SUCCESS MESSAGE
   ═══════════════════════════════════════════════════════════ */
.cb-success-msg {
  font-size: 13px;
  font-weight: 600;
  color: var(--cb-accent-emerald);
}

/* ═══════════════════════════════════════════════════════════
   RADIO CARDS
   ═══════════════════════════════════════════════════════════ */
.cb-radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cb-radio-card {
  position: relative;
  padding: 16px;
  border-radius: var(--cb-radius);
  border: 1px solid var(--cb-border);
  background: var(--cb-bg-input);
  cursor: pointer;
  transition: all var(--cb-transition);
}

.cb-radio-card:hover {
  border-color: var(--cb-text-muted);
}

.cb-radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.cb-radio-card.selected,
.cb-radio-card:has(input:checked) {
  border-color: var(--cb-accent-blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  background: rgba(59, 130, 246, 0.04);
}

.cb-radio-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--cb-text-primary);
  margin-bottom: 4px;
}

.cb-radio-card-desc {
  font-size: 11px;
  color: var(--cb-text-muted);
}

/* ═══════════════════════════════════════════════════════════
   BACK LINK
   ═══════════════════════════════════════════════════════════ */
.cb-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--cb-text-muted);
  text-decoration: none;
  transition: color var(--cb-transition);
  margin-bottom: 20px;
}

.cb-back-link:hover {
  color: var(--cb-accent-blue);
}

/* ═══════════════════════════════════════════════════════════
   EMPTY STATES
   ═══════════════════════════════════════════════════════════ */
.cb-empty {
  text-align: center;
  padding: 60px 20px;
}

.cb-empty-icon {
  color: var(--cb-text-muted);
  opacity: 0.4;
  margin-bottom: 16px;
}

.cb-empty h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--cb-text-primary);
  margin-bottom: 6px;
}

.cb-empty p {
  font-size: 13px;
  color: var(--cb-text-muted);
}

/* ═══════════════════════════════════════════════════════════
   AUTH PAGES (login / signup)
   ═══════════════════════════════════════════════════════════ */
.cb-auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0e1a 0%, #111827 40%, #1a1040 100%);
  padding: 20px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.cb-auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--cb-bg-card);
  border: 1px solid var(--cb-border);
  border-radius: 16px;
  padding: 36px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.cb-auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.cb-auth-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: #f1f5f9;
  margin-bottom: 8px;
}

.cb-auth-header p {
  font-size: 13px;
  color: #94a3b8;
}

.cb-auth-header a {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 600;
}

.cb-auth-header a:hover {
  text-decoration: underline;
}

.cb-auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.cb-auth-label {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 6px;
  display: block;
}

.cb-auth-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid #1e293b;
  background: #0d1321;
  color: #f1f5f9;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.cb-auth-input::placeholder {
  color: #64748b;
}

.cb-auth-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.cb-auth-submit {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.cb-auth-submit:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.cb-auth-error {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════
   SECTION DIVIDERS
   ═══════════════════════════════════════════════════════════ */
.cb-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--cb-text-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--cb-border);
  margin-bottom: 16px;
}

/* ═══════════════════════════════════════════════════════════
   DRIP / NESTED CHECKBOXES
   ═══════════════════════════════════════════════════════════ */
.cb-drip-tree {
  margin-left: 28px;
  padding-left: 16px;
  border-left: 2px solid var(--cb-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .cb-sidebar {
    width: 220px;
  }
  .cb-main {
    margin-left: 220px;
  }
  .cb-form-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .cb-sidebar {
    display: none;
  }
  .cb-main {
    margin-left: 0;
  }
  .cb-kpi-grid {
    grid-template-columns: 1fr;
  }
  .cb-form-grid-2,
  .cb-form-grid-3,
  .cb-radio-group {
    grid-template-columns: 1fr;
  }
  .cb-topbar {
    padding: 16px 20px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .cb-content {
    padding: 20px;
  }
}