/* ============================================================================
   CRM AgentiSys — Feuille de style principale
   Thème dark "Hercules-like" adapté AgentiSys CRM
   ============================================================================ */

/* ---------------------------------------------------------------------------
   1. Variables CSS (avec support future light mode)
   --------------------------------------------------------------------------- */
:root {
  /* Couleurs fond */
  --bg-landing: #0a0e17;
  --bg-app: #121212;
  --bg-sidebar: #1E1E1E;
  --bg-card: #1F2937;
  --bg-card-hover: #374151;
  --bg-input: #1F2937;

  /* Couleurs bordures */
  --border: #374151;
  --border-light: #2D3748;
  --border-hover: #3B82F6;

  /* Couleurs accent */
  --primary: #3e79ff;
  --primary-hover: #2b6bed;
  --primary-dark: #1E3A8A;
  --primary-light: #7ba6ff;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --purple: #8B5CF6;

  /* Texte */
  --text-primary: #FFFFFF;
  --text-secondary: #9CA3AF;
  --text-tertiary: #718096;
  --text-muted: #4B5563;

  /* Layout */
  --sidebar-width: 240px;
  --detail-width: 480px;
  --content-padding: 24px;

  /* Rayons */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Ombres */
  --shadow-modal: 0 20px 60px rgba(0,0,0,0.5);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.3);

  /* Transitions */
  --transition: all 0.2s ease;
}

/* Light mode — prêt pour plus tard (inactif pour l'instant) */
:root.light {
  --bg-landing: #f8fafc;
  --bg-app: #ffffff;
  --bg-sidebar: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  --border: #e2e8f0;
  --border-light: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

img { max-width: 100%; height: auto; }

/* Scrollbar dark */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-app); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ---------------------------------------------------------------------------
   3. Boutons
   --------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: transparent;
  border-color: var(--primary);
  color: var(--primary);
}
.btn-secondary:hover { background: rgba(59,130,246,0.1); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--border);
}
.btn-danger:hover { background: rgba(239,68,68,0.1); border-color: var(--danger); }

.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-sm { padding: 4px 8px; font-size: 12px; }
.btn-block { width: 100%; }

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

/* ---------------------------------------------------------------------------
   4. Formulaires
   --------------------------------------------------------------------------- */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

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

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

.form-select {
  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='%239CA3AF' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border);
  border-radius: 20px;
  transition: var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px; width: 14px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ---------------------------------------------------------------------------
   5. Cartes
   --------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: var(--transition);
}
.card:hover { border-color: var(--primary); }
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}
.card-body { color: var(--text-secondary); font-size: 13px; }

/* ---------------------------------------------------------------------------
   6. Badges
   --------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary { background: var(--primary); color: #fff; }
.badge-success { background: var(--success); color: #fff; }
.badge-warning { background: var(--warning); color: #fff; }
.badge-danger  { background: var(--danger);  color: #fff; }
.badge-purple  { background: var(--purple);  color: #fff; }

.badge-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.badge-outline-success { color: var(--success); border-color: var(--success); }
.badge-outline-warning { color: var(--warning); border-color: var(--warning); }
.badge-outline-danger  { color: var(--danger);  border-color: var(--danger);  }

.badge-pays-TN { background: rgba(239,68,68,0.15); color: #FCA5A5; border: 1px solid rgba(239,68,68,0.3); }
.badge-pays-FR { background: rgba(59,130,246,0.15); color: var(--primary-light); border: 1px solid rgba(59,130,246,0.3); }
.badge-pays-CA { background: rgba(139,92,246,0.15); color: #C4B5FD; border: 1px solid rgba(139,92,246,0.3); }

/* ---------------------------------------------------------------------------
   7. Layout principal (3 colonnes)
   --------------------------------------------------------------------------- */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 16px 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}
.sidebar-logo img { height: 36px; }

/* Bouton "+ Nouvelle fiche" — bleu proéminent */
.sidebar-new-btn {
  margin-bottom: 16px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
}
.sidebar-new-btn svg { flex-shrink: 0; }

.sidebar-section { margin-bottom: 20px; }
.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  padding-left: 8px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  margin-bottom: 2px;
}
.sidebar-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
}
.sidebar-item.active {
  background: var(--bg-card);
  color: var(--text-primary);
}
.sidebar-item .icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-item .icon svg {
  width: 18px;
  height: 18px;
}
.sidebar-item .count {
  margin-left: auto;
  background: var(--border);
  color: var(--text-primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.sidebar-item.emploi    .icon { color: var(--primary); }
.sidebar-item.freelance .icon { color: var(--success); }
.sidebar-item.b2b       .icon { color: var(--warning); }
.sidebar-item.individu  .icon { color: var(--purple); }

/* Bouton icône (logout, etc.) */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  padding: 0;
}
.btn-icon:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-icon svg { width: 16px; height: 16px; }
.logout-btn:hover { color: var(--danger); }

/* Cartes modale "nouvelle fiche" */
.new-fiche-card {
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.new-fiche-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.new-fiche-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
}
.new-fiche-icon.emploi    { background: rgba(59,130,246,0.15); color: var(--primary); }
.new-fiche-icon.freelance { background: rgba(16,185,129,0.15); color: var(--success); }
.new-fiche-icon.b2b       { background: rgba(245,158,11,0.15); color: var(--warning); }
.new-fiche-icon.individu  { background: rgba(139,92,246,0.15); color: var(--purple); }
.new-fiche-icon svg { width: 28px; height: 28px; }

/* Icône dans état vide */
.empty-state .icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  opacity: 0.5;
  color: var(--text-secondary);
}
.empty-state .icon-wrap svg { width: 48px; height: 48px; }

/* User card en bas de sidebar */
.sidebar-user {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role { font-size: 11px; color: var(--text-tertiary); }

/* Contenu principal */
.main-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-header {
  padding: 20px var(--content-padding);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.page-title { font-size: 22px; font-weight: 700; }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.page-body {
  padding: var(--content-padding);
  flex: 1;
  display: grid;
  grid-template-columns: 1fr var(--detail-width);
  gap: var(--content-padding);
  min-height: 0;
}

.page-body.no-detail {
  grid-template-columns: 1fr;
}

/* Liste (colonne centrale) */
.list-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.list-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.list-filters .filter-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
}
.list-filters .filter-btn:hover { color: var(--text-primary); border-color: var(--text-tertiary); }
.list-filters .filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.list-counter { font-size: 13px; color: var(--text-secondary); }

/* Élément de liste */
.list-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  cursor: pointer;
  transition: var(--transition);
}
.list-item:hover { border-color: var(--primary); }
.list-item.active { border-color: var(--primary); background: rgba(59,130,246,0.05); }

.list-item-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.list-item-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 12px; flex-wrap: wrap; }
.list-item-meta .meta-item { display: flex; align-items: center; gap: 4px; }

/* État vide */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state .title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state .desc { font-size: 13px; }

/* Détail (colonne droite) */
.detail-column {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  overflow-y: auto;
  max-height: calc(100vh - 140px);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.detail-title { font-size: 18px; font-weight: 700; }
.detail-close { color: var(--text-tertiary); font-size: 20px; line-height: 1; cursor: pointer; }
.detail-close:hover { color: var(--text-primary); }

.detail-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}
.detail-label { width: 140px; color: var(--text-secondary); font-size: 13px; flex-shrink: 0; }
.detail-value { color: var(--text-primary); font-size: 13px; flex: 1; word-break: break-word; }
.detail-value.muted { color: var(--text-tertiary); }

.detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------------
   8. Modales
   --------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
}
.modal.lg { max-width: 720px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { color: var(--text-tertiary); font-size: 24px; line-height: 1; cursor: pointer; }
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 20px; }
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------------------------------------------------------------------------
   9. Onglets (Paramètres)
   --------------------------------------------------------------------------- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 20px;
  gap: 4px;
}
.tab {
  padding: 10px 16px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--primary);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------------------------------------------------------------------------
   10. Landing page
   --------------------------------------------------------------------------- */
.landing {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-landing) 0%, #1e293b 100%);
  display: flex;
  flex-direction: column;
}

.landing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
}
.landing-header .logo { height: 40px; }

.landing-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  max-width: 800px;
  margin: 0 auto;
}
.landing-hero h1 {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
}
.landing-hero h1 .highlight { color: var(--primary); }
.landing-hero p {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  max-width: 600px;
}
.landing-hero .geo-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-dark);
  color: var(--primary-light);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 24px;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 0 40px 60px 40px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.feature-card {
  background: rgba(17, 24, 39, 0.6);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: var(--transition);
}
.feature-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 24px;
}
.feature-icon.emploi    { background: rgba(59,130,246,0.15); color: var(--primary); }
.feature-icon.freelance { background: rgba(16,185,129,0.15); color: var(--success); }
.feature-icon.b2b       { background: rgba(245,158,11,0.15); color: var(--warning); }
.feature-icon.individu  { background: rgba(139,92,246,0.15); color: var(--purple); }
.feature-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.feature-card p { font-size: 13px; color: var(--text-secondary); }

.landing-footer {
  text-align: right;
  padding: 12px 24px;
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.landing-footer .bolt { color: var(--primary); }

/* ---------------------------------------------------------------------------
   11. Login page
   --------------------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-landing) 0%, #1e293b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-modal);
}
.login-logo {
  display: block;
  margin: 0 auto 24px;
  height: 48px;
}
.login-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}
.login-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid var(--danger);
  color: #FCA5A5;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.login-error.show { display: block; }

/* ---------------------------------------------------------------------------
   12. Dashboard
   --------------------------------------------------------------------------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}
.stat-card .stat-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}
.stat-card.primary .stat-value { color: var(--primary); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.purple .stat-value { color: var(--purple); }

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}
.chart-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.chart-wrapper { position: relative; height: 240px; }

/* ---------------------------------------------------------------------------
   13. Utilitaires
   --------------------------------------------------------------------------- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-sm { font-size: 12px; }
.text-md { font-size: 14px; }
.text-lg { font-size: 16px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-center { text-align: center; }
.hidden { display: none !important; }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------------
   14. Responsive (mobile via Tailscale)
   --------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  :root { --detail-width: 0px; }
  .page-body { grid-template-columns: 1fr; }
  .detail-column { display: none; }
  .landing-features { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 60px; --content-padding: 16px; }
  .sidebar { padding: 8px; }
  .sidebar-section-title,
  .sidebar-item span:not(.icon):not(.count),
  .user-info,
  .sidebar-logo img + span { display: none; }
  .sidebar-item { justify-content: center; padding: 10px; }
  .landing-hero h1 { font-size: 32px; }
  .landing-features { grid-template-columns: 1fr; }
  .page-title { font-size: 18px; }
  .modal { max-width: 100%; }
  .form-row { grid-template-columns: 1fr; }
}
