/* =============================================================================
   Vocal Admin - Desktop panel (EasyTrack-inspired sidebar layout)
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. Variables & Theme
   ----------------------------------------------------------------------------- */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  --bg-page: #f4f5fb;
  --bg-white: #ffffff;
  --text-main: #1e1b4b;
  --text-muted: #64748b;
  --border: #e2e8f0;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
  --shadow-hover: 0 10px 30px -8px rgba(99, 102, 241, 0.25);
  --shadow-primary-glow: 0 4px 14px rgba(99, 102, 241, 0.45);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 1.5rem;

  --sidebar-width: 280px;
  --header-height: 68px;
}

/* -----------------------------------------------------------------------------
   2. Base Styles
   ----------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-main);
  background: var(--bg-page);
  line-height: 1.5;
  letter-spacing: -0.01em;
}

/* Force la typo Plus Jakarta Sans partout (cohérence Taxibook style) */
button,
input,
select,
textarea {
  font-family: inherit;
}

.app-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-page);
}

.app-loading .loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

/* -----------------------------------------------------------------------------
   3. Layout
   ----------------------------------------------------------------------------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

/* -----------------------------------------------------------------------------
   4. Sidebar
   ----------------------------------------------------------------------------- */
.sidebar-header {
  flex-shrink: 0;
  height: var(--header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header .logo {
  height: 28px;
  width: auto;
  display: block;
  object-fit: contain;
}

.sidebar-header .sidebar-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.025em;
}

.sidebar-header .studio-pill {
  margin-left: auto;
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #1e40af;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
}

.nav-section {
  margin-bottom: 1.25rem;
}

.nav-section:last-child {
  margin-bottom: 0;
}

.nav-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 0.75rem 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-dark);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  box-shadow: var(--shadow-primary-glow);
}

.nav-item .nav-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

/* -----------------------------------------------------------------------------
   5. Sidebar Footer
   ----------------------------------------------------------------------------- */
.sidebar-footer {
  flex-shrink: 0;
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

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

.user-details .user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-details .user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* -----------------------------------------------------------------------------
   6. Page Header
   ----------------------------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  min-height: var(--header-height);
  padding: 1rem 2rem;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
}

.page-title {
  margin: 0;
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1.15;
}

.page-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
  font-weight: 500;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* -----------------------------------------------------------------------------
   7. Page Content
   ----------------------------------------------------------------------------- */
.page-content,
.page-container {
  flex: 1;
  padding: 1.5rem 2rem;
}

/* -----------------------------------------------------------------------------
   8. Buttons
   ----------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.25;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.005em;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: var(--shadow-primary-glow);
}

.btn-secondary {
  background: var(--bg-white);
  color: var(--text-main);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--primary-light);
  color: var(--primary-dark);
}

.btn-danger {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.btn-danger:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #f87171;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-icon {
  padding: 0.5rem;
  min-width: 2.25rem;
  min-height: 2.25rem;
  border-radius: 50%;
}

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

/* -----------------------------------------------------------------------------
   9. Cards
   ----------------------------------------------------------------------------- */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.card-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.card-body {
  padding: 1.5rem;
}

/* -----------------------------------------------------------------------------
   10. Stats Grid
   ----------------------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Stat card layout type Taxibook : icône en haut, valeur grosse, label en bas */
.stat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1.5rem;
  background: var(--bg-white);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(99, 102, 241, 0.25);
}

/* Bouton stat-card (utilisé en <button>) → reset look natif */
button.stat-card {
  font: inherit;
  color: inherit;
  appearance: none;
}

/* Le wrapper interne (label + value) → on inverse pour avoir
   la grosse valeur AU-DESSUS du label (style Taxibook) */
.stat-card > div:not(.stat-icon) {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 0.125rem;
  width: 100%;
}

/* "Les ronds" : grosses pastilles colorées arrondies au max */
.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.375rem;
  position: relative;
}

.stat-card:hover .stat-icon {
  transform: scale(1.05);
  transition: transform 0.25s ease;
}

.stat-icon.blue {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.08));
  color: #2563eb;
}

.stat-icon.green {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.08));
  color: #16a34a;
}

.stat-icon.orange {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(249, 115, 22, 0.08));
  color: #ea580c;
}

.stat-icon.red {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.08));
  color: #dc2626;
}

.stat-icon.purple {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(118, 75, 162, 0.1));
  color: var(--primary-dark);
}

.stat-card .stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.stat-card .stat-value {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 0.125rem;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

/* -----------------------------------------------------------------------------
   11. Data Table
   ----------------------------------------------------------------------------- */
.table-container {
  /* overflow-x: auto; */
  /* border-radius: var(--radius-xl); */
  /* border: 1px solid var(--border); */
  /* background: var(--bg-white); */
  /* box-shadow: var(--shadow-sm); */
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 0.875rem 1.125rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

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

.data-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.04);
}

.data-table tr.clickable {
  cursor: pointer;
}

.data-table tr.clickable:hover {
  background: rgba(99, 102, 241, 0.08);
}

/* -----------------------------------------------------------------------------
   12. Status Badges
   ----------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 9999px;
  line-height: 1.25;
  letter-spacing: -0.005em;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-warning {
  background: #fef3c7;
  color: #b45309;
}

.badge-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-purple {
  background: #ede9fe;
  color: #6d28d9;
}
.badge-orange {
  background: #fff7ed;
  color: #c2410c;
}
.badge-dark {
  background: #1e293b;
  color: #e2e8f0;
}

.badge-info {
  background: #e0e7ff;
  color: var(--primary-dark);
}

.badge-gray {
  background: #f1f5f9;
  color: #475569;
}

.badge-primary {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-dark);
}

/* alias couleurs simples */
.badge-green { background: #dcfce7; color: #166534; }
.badge-red   { background: #fee2e2; color: #b91c1c; }
.badge-blue  { background: #dbeafe; color: #1e40af; }

/* -----------------------------------------------------------------------------
   13. Forms
   ----------------------------------------------------------------------------- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-input,
.form-select,
.input,
textarea.input,
select.input {
  width: 100%;
  padding: 0.7rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
  color: var(--text-main);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

textarea.input { line-height: 1.5; resize: vertical; min-height: 80px; }

.form-input:focus,
.form-select:focus,
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-input:disabled,
.input:disabled { background: var(--bg-page); color: var(--text-muted); cursor: not-allowed; }

.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' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

/* -----------------------------------------------------------------------------
   14. Modals
   ----------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease;
}

.modal-content {
  width: 100%;
  max-width: 32rem;
  max-height: min(90vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-white);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.modal-content form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

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

.modal-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

.modal-close:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

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

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: #fafafa;
  flex-shrink: 0;
}

/* -----------------------------------------------------------------------------
   15. Tabs
   ----------------------------------------------------------------------------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.3rem;
  background: #e8eaf3;
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
}

.tab {
  padding: 0.5rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  letter-spacing: -0.005em;
}

.tab:hover:not(.active) {
  color: var(--text-main);
}

.tab.active {
  background: var(--bg-white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* -----------------------------------------------------------------------------
   16. Empty State
   ----------------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 1.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(118, 75, 162, 0.08));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.empty-state h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.empty-state p {
  margin: 0;
  font-size: 0.875rem;
  max-width: 24rem;
}

/* -----------------------------------------------------------------------------
   17. Login Split Screen
   ----------------------------------------------------------------------------- */
.login-split {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1fr 1fr;
}

.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg-white);
}

.login-form-side .login-form-inner {
  width: 100%;
  max-width: 400px;
}

.login-form-side .login-brand {
  margin-bottom: 2rem;
  text-align: center;
}

.login-form-side .login-brand img {
  height: 40px;
  margin-bottom: 0.5rem;
}

.login-form-side .login-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.login-form-side .login-form .form-input {
  margin-top: 0.25rem;
}

.login-visual-side {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  overflow: hidden;
  background: var(--gradient);
}

.login-visual-side::before,
.login-visual-side::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

/* Radial overlays - purple/violet (Vocal), not blue */
.login-visual-side::before {
  width: 120%;
  height: 120%;
  top: -30%;
  right: -20%;
  background: radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.18) 0%, transparent 45%);
}

.login-visual-side::after {
  width: 80%;
  height: 80%;
  bottom: -25%;
  left: -15%;
  background: radial-gradient(circle at 30% 70%, rgba(118, 75, 162, 0.5) 0%, transparent 50%);
}

.login-visual-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #fff;
  max-width: 28rem;
}

.login-visual-content h2 {
  margin: 0 0 0.75rem;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
}

.login-visual-content p {
  margin: 0;
  font-size: 1rem;
  opacity: 0.92;
  line-height: 1.6;
}

.login-form-side .form-code-input,
.form-code-input {
  display: block;
  width: 100%;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
  padding: 1rem 1.25rem;
  font-size: 1.75rem;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.35em;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-code-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* -----------------------------------------------------------------------------
   18. Animations
   ----------------------------------------------------------------------------- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

.loading-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* -----------------------------------------------------------------------------
   19. Responsive
   ----------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-header {
    display: flex !important;
  }

  .page-header {
    padding: 0.75rem 1rem;
  }

  .page-content,
  .page-container {
    padding: 1rem;
  }

  .login-split {
    grid-template-columns: 1fr;
  }

  .login-visual-side {
    min-height: 200px;
    order: -1;
  }
}

/* -----------------------------------------------------------------------------
   20. Scrollbar
   ----------------------------------------------------------------------------- */
.sidebar-nav::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.table-container::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.sidebar-nav::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.table-container::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.table-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* -----------------------------------------------------------------------------
   21. Utilities
   ----------------------------------------------------------------------------- */
.text-primary {
  color: var(--primary);
}

.text-success {
  color: #16a34a;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.gap-1 {
  gap: 0.25rem;
}
.gap-2 {
  gap: 0.5rem;
}
.gap-3 {
  gap: 0.75rem;
}
.gap-4 {
  gap: 1rem;
}
.gap-6 {
  gap: 1.5rem;
}

.hidden {
  display: none !important;
}

/* -----------------------------------------------------------------------------
   22. Skeleton Loaders
   ----------------------------------------------------------------------------- */
@keyframes skeleton-shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  display: inline-block;
  background: linear-gradient(90deg, #eef2f7 0%, #f7fafc 50%, #eef2f7 100%);
  background-size: 800px 100%;
  border-radius: 6px;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}

.skeleton-text {
  display: block;
  height: 0.85rem;
  width: 100%;
  border-radius: 4px;
}

.skeleton-block {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

.skeleton-circle {
  border-radius: 50%;
  display: inline-block;
}

.skeleton-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.skeleton-stat-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

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

.skeleton-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
}

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

.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

/* Card "flat" variant pour panels secondaires */
.card-flat {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  overflow: hidden;
}
.card-flat-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: #fafbff;
}
.card-flat-header h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}
.card-flat-content {
  padding: 1.25rem 1.5rem;
}

/* Form row compact (label + input vertical) */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.form-row > label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
}
.form-row > input,
.form-row > select,
.form-row > textarea {
  width: 100%;
  padding: 0.65rem 0.95rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
  color: var(--text-main);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-row > input:focus,
.form-row > select:focus,
.form-row > textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.form-row > input:disabled,
.form-row > select:disabled,
.form-row > textarea:disabled {
  background: #f8fafc;
  color: var(--text-muted);
}

/* Toggle row (checkbox + label inline) */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* -----------------------------------------------------------------------------
   23. Icon pills (inspiration Taxibook : "ronds" colorés)
   ----------------------------------------------------------------------------- */

/* Cercle parfait (ex: avatars, dots) */
.icon-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Carré arrondi (ex: containers d'icônes) */
.icon-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}

.icon-pill-sm,
.icon-circle-sm { width: 32px; height: 32px; font-size: 0.875rem; }
.icon-pill-md,
.icon-circle-md { width: 44px; height: 44px; font-size: 1rem; }
.icon-pill-lg,
.icon-circle-lg { width: 56px; height: 56px; font-size: 1.25rem; }

/* Variantes de couleurs (réutilisables) */
.tone-blue   { background: linear-gradient(135deg, rgba(59,130,246,0.18), rgba(59,130,246,0.06)); color: #2563eb; }
.tone-green  { background: linear-gradient(135deg, rgba(34,197,94,0.2),  rgba(34,197,94,0.06));  color: #16a34a; }
.tone-orange { background: linear-gradient(135deg, rgba(249,115,22,0.2), rgba(249,115,22,0.06)); color: #ea580c; }
.tone-red    { background: linear-gradient(135deg, rgba(239,68,68,0.2),  rgba(239,68,68,0.06));  color: #dc2626; }
.tone-purple { background: linear-gradient(135deg, rgba(99,102,241,0.22), rgba(118,75,162,0.08)); color: var(--primary-dark); }
.tone-amber  { background: linear-gradient(135deg, rgba(245,158,11,0.2), rgba(245,158,11,0.06)); color: #d97706; }
.tone-teal   { background: linear-gradient(135deg, rgba(20,184,166,0.2), rgba(20,184,166,0.06)); color: #0d9488; }
.tone-rose   { background: linear-gradient(135deg, rgba(244,63,94,0.2),  rgba(244,63,94,0.06));  color: #e11d48; }
.tone-slate  { background: linear-gradient(135deg, rgba(100,116,139,0.18), rgba(100,116,139,0.06)); color: #475569; }

/* Card hoverable (lift au survol) */
.card-hoverable {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  cursor: pointer;
}
.card-hoverable:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(99, 102, 241, 0.25);
}

/* Pill de statut "actif" avec dot (style Taxibook) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 9999px;
  line-height: 1.2;
}
.status-pill .status-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  display: inline-block;
}
.status-pill.is-on  { background: #dcfce7; color: #166534; }
.status-pill.is-on  .status-dot { background: #16a34a; }
.status-pill.is-off { background: #f1f5f9; color: #475569; }
.status-pill.is-off .status-dot { background: #94a3b8; }

/* Animations Taxibook-like */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-slide-up { animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.animate-fade-in  { animation: fadeIn 0.3s ease-out; }

/* ==================== WHATSAPP SENDER TABS (segmented) ==================== */
.sender-tabs {
    display: inline-flex;
    gap: 0;
    background: var(--bg-secondary, #f1f5f9);
    border-radius: 10px;
    padding: 4px;
    border: 1px solid var(--border);
}
.sender-tab {
    border: none;
    background: transparent;
    padding: 0.5rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}
.sender-tab:hover:not(.active) { color: var(--text); background: rgba(255,255,255,0.5); }
.sender-tab.active {
    background: white;
    color: var(--primary, #6366f1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}
@media (max-width: 640px) {
    .sender-tabs { width: 100%; overflow-x: auto; }
    .sender-tab { font-size: 0.8rem; padding: 0.45rem 0.85rem; }
}

/* ==================== AGENTS IA ==================== */
.ai-shell {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    height: calc(100vh - var(--header-height) - 2rem);
    min-height: 600px;
}
.ai-sidebar {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.ai-sidebar-header {
    padding: 1.1rem 1.2rem 0.9rem;
    background: var(--gradient);
    color: white;
}
.ai-sidebar-header h2 {
    margin: 0 0 0.2rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: white;
    display: flex; align-items: center; gap: 0.5rem;
}
.ai-sidebar-header .ai-count {
    font-size: 0.78rem;
    opacity: 0.85;
}
.ai-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}
.ai-agent-item {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 0.7rem 0.75rem;
    border: 1px solid transparent;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: 0.25rem;
    transition: all 0.15s ease;
}
.ai-agent-item:hover { background: var(--bg-page); }
.ai-agent-item.is-active {
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(118,75,162,0.08));
    border-color: rgba(99,102,241,0.25);
}
.ai-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--gradient);
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(99,102,241,0.3);
}
.ai-agent-meta { min-width: 0; flex: 1; }
.ai-agent-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-main);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ai-agent-phone {
    font-size: 0.74rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.ai-agent-badges {
    display: flex; gap: 0.3rem; margin-top: 0.3rem; flex-wrap: wrap;
}
.ai-chip {
    display: inline-flex; align-items: center; gap: 0.25rem;
    font-size: 0.68rem; font-weight: 600;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    line-height: 1.3;
}
.ai-chip.voice    { background: #e0f2fe; color: #075985; }
.ai-chip.wa       { background: #dcfce7; color: #166534; }
.ai-chip.wa-off   { background: #fef3c7; color: #92400e; }

.ai-detail {
    overflow-y: auto;
    padding-right: 0.25rem;
}
.ai-hero {
    background: var(--gradient);
    color: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.25rem;
    display: flex; align-items: center; gap: 1.25rem;
    box-shadow: var(--shadow-md);
}
.ai-hero-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(8px);
    display: grid; place-items: center;
    font-size: 1.6rem; font-weight: 700;
    flex-shrink: 0;
}
.ai-hero-body { flex: 1; min-width: 0; }
.ai-hero-name { font-size: 1.5rem; font-weight: 700; margin: 0 0 0.15rem; }
.ai-hero-sub  { font-size: 0.88rem; opacity: 0.9; font-variant-numeric: tabular-nums; }
.ai-hero-badges { display: flex; gap: 0.4rem; margin-top: 0.6rem; flex-wrap: wrap; }
.ai-hero-badges .ai-chip {
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 0.72rem;
    padding: 0.2rem 0.6rem;
}

.ai-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}
.ai-stat {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    box-shadow: var(--shadow-sm);
}
.ai-stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.ai-stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-main); margin-top: 0.2rem; font-variant-numeric: tabular-nums; }

.ai-tabs {
    display: inline-flex;
    background: var(--bg-page);
    border-radius: 10px;
    padding: 4px;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.ai-tab {
    border: none; background: transparent;
    padding: 0.5rem 1rem;
    font-size: 0.85rem; font-weight: 600;
    color: var(--text-muted);
    border-radius: 7px; cursor: pointer;
    transition: all 0.18s ease;
    display: inline-flex; align-items: center; gap: 0.4rem;
}
.ai-tab:hover:not(.is-active) { color: var(--text-main); }
.ai-tab.is-active {
    background: var(--bg-white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.ai-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.4rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}
.ai-card h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    color: var(--text-main);
    display: flex; align-items: center; gap: 0.5rem;
}
.ai-card .ai-card-hint {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 0 0 0.85rem;
}
.ai-field { display: block; margin-bottom: 0.9rem; }
.ai-field:last-child { margin-bottom: 0; }
.ai-field-label { font-weight: 600; font-size: 0.85rem; margin-bottom: 0.3rem; color: var(--text-main); }
.ai-field .input, .ai-field textarea, .ai-field select {
    width: 100%;
    font-family: inherit;
}

.ai-save-bar {
    position: sticky; bottom: 0;
    background: linear-gradient(180deg, rgba(244,245,251,0) 0%, var(--bg-page) 25%);
    padding: 1rem 0 0.5rem;
    display: flex; gap: 0.6rem; align-items: center;
    margin-top: 0.5rem;
}
.ai-save-bar .ai-dirty-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #f59e0b;
}

.ai-learn-result {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fbbf24;
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
    margin-top: 1rem;
}
.ai-learn-pre {
    white-space: pre-wrap; font-family: inherit; font-size: 0.85rem;
    background: white; padding: 0.85rem; border-radius: 6px;
    border: 1px solid var(--border); max-height: 320px; overflow: auto;
    margin: 0.6rem 0 0.8rem;
}

@media (max-width: 900px) {
    .ai-shell { grid-template-columns: 1fr; height: auto; }
    .ai-sidebar { max-height: 360px; }
    .ai-hero { flex-direction: column; text-align: center; }
}
