/* ============================================================
   BulkPing — WhatsApp BSP Dashboard
   Theme: Dark (WhatsApp-inspired)
   Config: config/theme.json  ← change colors there
   ============================================================ */

/* --- CSS Custom Properties (loaded from config/theme.json via JS) --- */
:root {
  --brand-primary: #075E54;
  --brand-primary-hover: #0B7E6D;
  --brand-accent: #00A884;
  --brand-accent-hover: #06CF9E;

  --sidebar-bg: #111B21;
  --sidebar-bg-hover: #1F2C33;
  --sidebar-bg-active: #2A3942;
  --sidebar-text: #E9EDEF;
  --sidebar-text-secondary: #8696A0;
  --sidebar-icon: #8696A0;
  --sidebar-border: #313D45;
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 72px;

  --header-bg: #1F2C33;
  --header-text: #E9EDEF;
  --header-border: #313D45;
  --header-height: 60px;

  --main-bg: #0B141A;
  --card-bg: #1F2C33;
  --card-border: #313D45;
  --text-primary: #E9EDEF;
  --text-secondary: #8696A0;
  --text-muted: #667781;

  --color-connected: #25D366;
  --color-disconnected: #EF5350;
  --color-pending: #FFA726;
  --color-qr-pending: #42A5F5;

  --msg-sent: #42A5F5;
  --msg-delivered: #66BB6A;
  --msg-read: #25D366;
  --msg-failed: #EF5350;
  --msg-pending: #FFA726;

  --input-bg: #2A3942;
  --input-border: #313D45;
  --input-text: #E9EDEF;
  --input-placeholder: #8696A0;
  --input-focus-border: #00A884;

  --btn-primary: #00A884;
  --btn-primary-hover: #06CF9E;
  --btn-primary-text: #FFFFFF;
  --btn-secondary: #2A3942;
  --btn-secondary-hover: #374A57;
  --btn-secondary-text: #E9EDEF;
  --btn-danger: #EF5350;
  --btn-danger-hover: #E53935;
  --btn-danger-text: #FFFFFF;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-xs: 11px;
  --font-sm: 13px;
  --font-base: 15px;
  --font-lg: 17px;
  --font-xl: 20px;
  --font-2xl: 24px;
  --font-3xl: 30px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 50%;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;

  --footer-bg: #111B21;
  --footer-text: #8696A0;
  --footer-border: #1F2C33;
  --footer-height: 56px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-family);
  background: var(--main-bg);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

a { color: var(--brand-accent); text-decoration: none; }
a:hover { color: var(--brand-accent-hover); text-decoration: underline; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- App Layout --- */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-normal), min-width var(--transition-normal);
  z-index: 100;
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-md);
  gap: var(--space-sm);
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-header .logo {
  width: 36px;
  height: 36px;
  background: var(--brand-accent);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 14px;
  color: #000;
}

.sidebar-header .brand-name {
  font-size: var(--font-lg);
  font-weight: 600;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-header { justify-content: center; }
.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .nav-arrow,
.sidebar.collapsed .sidebar-footer-text { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-icon { margin: 0; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm) 0;
}

.nav-section-label {
  padding: var(--space-md) var(--space-md) var(--space-xs);
  font-size: var(--font-xs);
  color: var(--sidebar-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px var(--space-md);
  cursor: pointer;
  color: var(--sidebar-text);
  border-radius: 0;
  transition: background var(--transition-fast);
  position: relative;
  white-space: nowrap;
  user-select: none;
}

.nav-item:hover { background: var(--sidebar-bg-hover); }
.nav-item.active {
  background: var(--sidebar-bg-active);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--brand-accent);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-icon);
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.nav-label {
  flex: 1;
  font-size: var(--font-base);
}

.nav-badge {
  background: var(--brand-accent);
  color: #000;
  font-size: var(--font-xs);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.nav-arrow {
  color: var(--sidebar-text-secondary);
  font-size: 10px;
}

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

.sidebar-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text-secondary);
  transition: background var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-text);
}

.sidebar-footer-text {
  font-size: var(--font-sm);
  color: var(--sidebar-text-secondary);
}

/* --- Main Content --- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* --- Header --- */
.header {
  height: var(--header-height);
  min-height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  gap: var(--space-md);
}

.header-title {
  font-size: var(--font-lg);
  font-weight: 600;
  flex: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* --- Page Content --- */
.content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
}

.page {
  display: none;
}
.page.active {
  display: block;
}

/* --- Footer --- */
.footer {
  height: var(--footer-height);
  min-height: var(--footer-height);
  background: var(--footer-bg);
  border-top: 1px solid var(--footer-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  font-size: var(--font-sm);
  color: var(--footer-text);
}

.footer a {
  color: var(--brand-accent);
}

/* --- Cards --- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: box-shadow var(--transition-fast);
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

/* --- Metrics Grid --- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.metric-label {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.metric-value {
  font-size: var(--font-3xl);
  font-weight: 700;
  color: var(--text-primary);
}

.metric-change {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.metric-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

/* --- Forms --- */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--input-text);
  font-size: var(--font-base);
  font-family: var(--font-family);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--input-placeholder);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.15);
}

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

.form-select {
  cursor: pointer;
  appearance: none;
  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='%238696A0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.form-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-accent);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-base);
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

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

.btn-secondary {
  background: var(--btn-secondary);
  color: var(--btn-secondary-text);
}
.btn-secondary:hover:not(:disabled) { background: var(--btn-secondary-hover); }

.btn-danger {
  background: var(--btn-danger);
  color: var(--btn-danger-text);
}
.btn-danger:hover:not(:disabled) { background: var(--btn-danger-hover); }

.btn-sm {
  padding: 6px 12px;
  font-size: var(--font-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: var(--font-lg);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* --- Tables --- */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-sm);
}

thead {
  background: var(--sidebar-bg);
}

th {
  text-align: left;
  padding: 12px var(--space-md);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: var(--font-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--card-border);
}

td {
  padding: 12px var(--space-md);
  border-bottom: 1px solid var(--card-border);
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255,255,255,0.02);
}

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: var(--font-xs);
  font-weight: 600;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
}

.badge-connected { background: rgba(37, 211, 102, 0.15); color: var(--color-connected); }
.badge-disconnected { background: rgba(239, 83, 80, 0.15); color: var(--color-disconnected); }
.badge-pending { background: rgba(255, 167, 38, 0.15); color: var(--color-pending); }
.badge-qr { background: rgba(66, 165, 245, 0.15); color: var(--color-qr-pending); }
.badge-sent { background: rgba(66, 165, 245, 0.15); color: var(--msg-sent); }
.badge-delivered { background: rgba(102, 187, 106, 0.15); color: var(--msg-delivered); }
.badge-read { background: rgba(37, 211, 102, 0.15); color: var(--msg-read); }
.badge-failed { background: rgba(239, 83, 80, 0.15); color: var(--msg-failed); }
.badge-queued { background: rgba(255, 167, 38, 0.15); color: var(--color-pending); }
.badge-sending { background: rgba(66, 165, 245, 0.15); color: var(--msg-sent); }
.badge-completed { background: rgba(37, 211, 102, 0.15); color: var(--msg-read); }
.badge-stopped { background: rgba(102, 102, 102, 0.15); color: var(--text-muted); }
.badge-warning { background: rgba(255, 167, 38, 0.15); color: var(--color-pending); }

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: var(--space-sm);
  border-bottom: 1px solid var(--card-border);
  margin-bottom: var(--space-lg);
}

.tab {
  padding: 10px var(--space-md);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  user-select: none;
}

.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--brand-accent);
  border-bottom-color: var(--brand-accent);
}

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

/* --- Diagram / Chart --- */
.chart-container {
  width: 100%;
  height: 300px;
  position: relative;
}

.chart-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
  height: 100%;
  padding: var(--space-md) 0;
}

.chart-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  height: 100%;
  justify-content: flex-end;
}

.chart-bar-fill {
  width: 100%;
  max-width: 60px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height var(--transition-slow);
  min-height: 4px;
}

.chart-bar-label {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  text-align: center;
}

.chart-bar-value {
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-primary);
}

/* --- Funnel Chart --- */
.funnel {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.funnel-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
}

.funnel-label {
  width: 100px;
  font-size: var(--font-sm);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.funnel-bar-wrapper {
  flex: 1;
  height: 32px;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.funnel-bar {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width var(--transition-slow);
  display: flex;
  align-items: center;
  padding-left: var(--space-sm);
}

.funnel-count {
  font-size: var(--font-sm);
  font-weight: 600;
  color: #000;
  white-space: nowrap;
}

.funnel-pct {
  width: 50px;
  text-align: right;
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* --- QR Code --- */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-xl);
}

.qr-image {
  width: 280px;
  height: 280px;
  border-radius: var(--radius-lg);
  background: white;
  padding: 12px;
  box-shadow: var(--shadow-lg);
}

.qr-hint {
  text-align: center;
  max-width: 400px;
  color: var(--text-secondary);
  font-size: var(--font-sm);
  line-height: 1.6;
}

/* --- Alerts --- */
.alert {
  padding: 12px var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.alert-success { background: rgba(37, 211, 102, 0.1); color: var(--color-connected); border: 1px solid rgba(37, 211, 102, 0.2); }
.alert-error { background: rgba(239, 83, 80, 0.1); color: var(--color-disconnected); border: 1px solid rgba(239, 83, 80, 0.2); }
.alert-warning { background: rgba(255, 167, 38, 0.1); color: var(--color-pending); border: 1px solid rgba(255, 167, 38, 0.2); }
.alert-info { background: rgba(66, 165, 245, 0.1); color: var(--color-qr-pending); border: 1px solid rgba(66, 165, 245, 0.2); }

/* --- Loading --- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
  gap: var(--space-sm);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--card-border);
  border-top-color: var(--brand-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--font-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state-text {
  font-size: var(--font-sm);
  max-width: 400px;
  margin: 0 auto var(--space-lg);
}

/* --- Modal --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-title {
  font-size: var(--font-lg);
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-full);
  font-size: 18px;
}

.modal-close:hover { background: var(--sidebar-bg-hover); color: var(--text-primary); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--card-border);
}

/* --- Login Page --- */
.login-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: var(--main-bg);
  padding: var(--space-md);
}

/* --- Utility --- */
.hidden { display: none !important; }

  .login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-lg);
}

.login-logo {
  width: 64px;
  height: 64px;
  background: var(--brand-accent);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  font-size: 24px;
  font-weight: 700;
  color: #000;
}

.login-title {
  text-align: center;
  font-size: var(--font-2xl);
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-sm);
  margin-bottom: var(--space-xl);
}

.google-btn-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-md);
}

.google-btn-wrapper > div > div {
  width: 100% !important;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: var(--font-base);
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.btn-google:hover { background: var(--sidebar-bg); border-color: var(--text-muted); }
.btn-google svg { flex-shrink: 0; }

.login-divider {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  color: var(--text-muted);
  font-size: var(--font-sm);
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--card-border);
}

/* --- Expandable / Accordion --- */
.expander {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  overflow: hidden;
}

.expander-header {
  padding: 10px var(--space-md);
  background: var(--sidebar-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-sm);
  font-weight: 500;
  user-select: none;
  transition: background var(--transition-fast);
}

.expander-header:hover { background: var(--sidebar-bg-hover); }

.expander-arrow {
  transition: transform var(--transition-fast);
  font-size: 10px;
}

.expander.open .expander-arrow { transform: rotate(90deg); }

.expander-body {
  display: none;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-sm);
  max-height: 200px;
  overflow-y: auto;
}

.expander.open .expander-body { display: block; }

.expander-item {
  padding: 6px 0;
  display: flex;
  justify-content: space-between;
  color: var(--text-primary);
  border-bottom: 1px solid var(--card-border);
}

.expander-item:last-child { border-bottom: none; }

/* --- Utility --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mt-md { margin-top: var(--space-md); }
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: var(--font-sm); }
.w-full { width: 100%; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-md); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar { width: var(--sidebar-collapsed-width); min-width: var(--sidebar-collapsed-width); }
  .sidebar .brand-name,
  .sidebar .nav-label,
  .sidebar .nav-badge,
  .sidebar .nav-arrow,
  .sidebar .sidebar-footer-text { display: none; }
  .sidebar .nav-item { justify-content: center; padding: 12px; }
  .sidebar .nav-icon { margin: 0; }
  .sidebar-header { justify-content: center; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .content { padding: var(--space-md); }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
