/* =============================================
   CRM Always Improving — Main CSS
   Stack : Flask + Jinja2 + HTMX + Alpine.js
   ============================================= */

/* ---- Variables ---- */
:root {
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 60px;
  --topbar-height: 56px;

  --color-bg:          #F8FAFC;
  --color-card:        #FFFFFF;
  --color-border:      #E2E8F0;
  --color-text:        #1E293B;
  --color-text-muted:  #64748B;
  --color-text-light:  #94A3B8;

  --color-accent:      #3B82F6;
  --color-accent-pale: #EFF6FF;
  --color-emerald:     #10B981;
  --color-emerald-pale:#ECFDF5;
  --color-amber:       #F59E0B;
  --color-amber-pale:  #FFFBEB;
  --color-rose:        #F43F5E;
  --color-rose-pale:   #FFF1F2;
  --color-purple:      #8B5CF6;
  --color-purple-pale: #F5F3FF;

  --color-sidebar-bg:  #1E293B;
  --color-sidebar-text:#CBD5E1;
  --color-sidebar-hover:#334155;
  --color-sidebar-active:#3B82F6;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);

  --transition: .18s ease;
}

/* Dark mode */
.dark {
  --color-bg:         #0F172A;
  --color-card:       #1E293B;
  --color-border:     #334155;
  --color-text:       #F1F5F9;
  --color-text-muted: #94A3B8;
  --color-sidebar-bg: #0F172A;
}

/* ---- Reset léger ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Inter', 'Segoe UI', system-ui, sans-serif; font-size: 14px; }
body { background: var(--color-bg); color: var(--color-text); }
a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
[x-cloak] { display: none !important; }

/* ---- Filter pill buttons (Todos, etc.) ---- */
.todo-filter-active {
  background: var(--color-card);
  color: var(--color-accent);
  border-color: var(--color-accent) !important;
  box-shadow: 0 1px 6px rgba(0,0,0,0.10);
  font-weight: 600;
}
.todo-filter-inactive {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border) !important;
  box-shadow: none;
  font-weight: 400;
}
.todo-filter-inactive:hover {
  background: var(--color-accent-pale);
  color: var(--color-accent);
  border-color: var(--color-accent) !important;
}

/* ---- Layout ---- */
body { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  display: flex;
  flex-direction: column;
  transition: width var(--transition), min-width var(--transition);
  overflow: hidden;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
}
.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
}

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

/* ---- Sidebar ---- */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  white-space: nowrap;
}
.logo-icon { font-size: 1.4rem; }
.logo-text  { font-size: .95rem; font-weight: 700; color: #F1F5F9; }

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

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1rem;
  color: var(--color-sidebar-text);
  border-radius: var(--radius-sm);
  margin: 2px .5rem;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.nav-item:hover { background: var(--color-sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--color-sidebar-active); color: #fff; }
.nav-item-danger:hover { background: rgba(244,63,94,.2); color: var(--color-rose); }
.nav-icon  { font-size: 1rem; min-width: 20px; text-align: center; }
.nav-label { font-size: .85rem; font-weight: 500; }
.sidebar-divider { height: 1px; background: rgba(255,255,255,.08); margin: .4rem .75rem; }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: .75rem .5rem;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .5rem .75rem;
  overflow: hidden;
}
.user-avatar {
  min-width: 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
}
.user-name  { font-size: .8rem; font-weight: 600; color: #F1F5F9; }
.user-role  { font-size: .7rem; color: var(--color-sidebar-text); }

/* ---- Topbar ---- */
.topbar {
  height: var(--topbar-height);
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { flex: 1; font-weight: 600; font-size: 1rem; }
.topbar-right { display: flex; align-items: center; gap: .5rem; }
.topbar-btn {
  background: none;
  border: none;
  padding: .4rem .5rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--color-text-muted);
  transition: background var(--transition);
}
.topbar-btn:hover { background: var(--color-accent-pale); color: var(--color-accent); }

/* ---- Lang switch ---- */
.lang-switch { display: flex; gap: 2px; }
.lang-btn {
  padding: .25rem .5rem;
  border-radius: var(--radius-sm);
  font-size: .75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  transition: background var(--transition);
}
.lang-btn:hover  { background: var(--color-accent-pale); text-decoration: none; }
.lang-btn.active { background: var(--color-accent); color: #fff; }

/* ---- Notifications ---- */
.notif-wrapper { position: relative; }
.notif-btn     { position: relative; }
.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--color-rose);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  border-radius: 99px;
  padding: 0 4px;
  min-width: 16px;
  text-align: center;
}
.notif-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 320px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-height: 400px;
  overflow-y: auto;
}

/* ---- Page content ---- */
.page-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

/* ---- Cards ---- */
.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}
.card-title {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--color-text);
}

/* ---- KPI Cards ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-label { font-size: .75rem; color: var(--color-text-muted); font-weight: 500; margin-bottom: .25rem; }
.kpi-value { font-size: 1.6rem; font-weight: 800; }
.kpi-sub   { font-size: .7rem; color: var(--color-text-light); margin-top: .25rem; }

/* ---- Tables ---- */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: .6rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}
tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  font-size: .85rem;
}
tbody tr:hover { background: var(--color-accent-pale); }
tbody tr:last-child td { border-bottom: none; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 600;
}
.badge-active   { color: var(--color-emerald); background: var(--color-emerald-pale); }
.badge-success  { color: var(--color-emerald); background: var(--color-emerald-pale); }
.badge-warning  { color: var(--color-amber);   background: var(--color-amber-pale); }
.badge-danger   { color: var(--color-rose);    background: var(--color-rose-pale); }
.badge-info     { color: var(--color-accent);  background: var(--color-accent-pale); }
.badge-purple   { color: var(--color-purple);  background: var(--color-purple-pale); }
.badge-muted    { color: var(--color-text-muted); background: var(--color-bg); }
.badge-green  { color: var(--color-emerald);      background: var(--color-emerald-pale); }
.badge-yellow { color: var(--color-amber);        background: var(--color-amber-pale); }
.badge-red    { color: var(--color-rose);         background: var(--color-rose-pale); }
.badge-blue   { color: var(--color-accent);       background: var(--color-accent-pale); }
.badge-gray   { color: var(--color-text-muted);   background: var(--color-bg); }
.badge-count  { display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:9px;font-size:10px;font-weight:700;background:var(--color-accent-pale);color:var(--color-accent);margin-left:4px; }
.badge-count--red    { background: var(--color-rose-pale);  color: var(--color-rose); }
.badge-count--yellow { background: var(--color-amber-pale); color: var(--color-amber); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  border: none;
  transition: background var(--transition), opacity var(--transition);
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn-primary   { background: var(--color-accent); color: #fff; }
.btn-secondary { background: var(--color-bg); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-danger    { background: var(--color-rose); color: #fff; }
.btn-success   { background: var(--color-emerald); color: #fff; }
.btn-sm        { padding: .3rem .7rem; font-size: .78rem; }
.btn-xs        { padding: .15rem .5rem !important; font-size: .72rem !important; height: auto !important; }
.btn-full      { width: 100%; justify-content: center; }
.btn-green     { background: var(--color-emerald); color: #fff; border: none; }
.btn-green:hover { background: #059669; }
.btn-red       { background: var(--color-rose); color: #fff; border: none; }
.btn-red:hover { background: #DC2626; }
.btn-yellow    { background: var(--color-amber); color: #fff; border: none; }
.btn-yellow:hover { background: #D97706; }

/* ---- Empty state ---- */
.empty-icon  { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-title { font-weight: 600; color: var(--color-text); margin-bottom: .35rem; }
.empty-sub   { font-size: 13px; color: #94A3B8; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: .35rem;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-card);
  color: var(--color-text);
  font-size: .85rem;
  transition: border-color var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-textarea { resize: vertical; min-height: 80px; }
.pw-toggle {
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: .95rem;
  color: var(--color-text-muted);
  padding: .25rem;
}

/* ---- Search ---- */
.search-bar {
  position: relative;
  max-width: 280px;
}
.search-bar input {
  padding-left: 2.2rem;
}
.search-icon {
  position: absolute;
  left: .6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: .9rem;
  pointer-events: none;
}

/* ---- Tabs ---- */
.tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.tab-btn {
  padding: .5rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color var(--transition), border-color var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.tab-btn:hover  { color: var(--color-accent); }
.tab-btn.active { color: var(--color-accent); border-bottom-color: var(--color-accent); font-weight: 700; }

/* Settings / KB sidebar nav */
.settings-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: .55rem 1rem;
  font-size: .85rem;
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
}
.settings-nav-item:hover  { background: var(--color-accent-pale); color: var(--color-accent); }
.settings-nav-item.active { background: var(--color-accent-pale); color: var(--color-accent); font-weight: 600; }

/* ---- Alerts / Flash ---- */
.flash-container { padding: 0 1.5rem; margin-top: .75rem; }
.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  margin-bottom: .5rem;
  animation: fadeIn .2s ease;
}
.flash-success { background: var(--color-emerald-pale); color: var(--color-emerald); border: 1px solid var(--color-emerald); }
.flash-danger  { background: var(--color-rose-pale);    color: var(--color-rose);    border: 1px solid var(--color-rose); }
.flash-warning { background: var(--color-amber-pale);   color: var(--color-amber);   border: 1px solid var(--color-amber); }
.flash-info    { background: var(--color-accent-pale);  color: var(--color-accent);  border: 1px solid var(--color-accent); }
.flash-close   { background: none; border: none; font-size: 1.1rem; cursor: pointer; }

.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .85rem; margin-bottom: 1rem; }
.alert-danger { background: var(--color-rose-pale); color: var(--color-rose); border: 1px solid var(--color-rose); }

/* ---- Login page ---- */
.login-page {
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo  { text-align: center; margin-bottom: 2rem; }
.login-title { font-size: 1.3rem; font-weight: 800; margin-top: .5rem; }
.login-sub   { color: var(--color-text-muted); font-size: .85rem; margin-top: .25rem; }
.link-muted  { color: var(--color-text-muted); font-size: .82rem; }
.link-muted:hover { color: var(--color-accent); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.modal-box {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}
.modal-title  { font-weight: 700; font-size: .95rem; }
.modal-close  { background: none; border: none; font-size: 1.2rem; color: var(--color-text-muted); }
.modal-body   { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--color-border); display: flex; gap: .75rem; justify-content: flex-end; }

/* ---- Progress bar ---- */
.progress { background: var(--color-border); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; transition: width .3s ease; background: var(--color-accent); }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--color-text-muted);
}
.empty-state-icon  { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state-title { font-weight: 600; color: var(--color-text); margin-bottom: .35rem; }

/* ---- HTMX loading indicator ---- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator  { display: inline-block; }

/* ---- Animations ---- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* =============================================
   DASHBOARD — Composants spécifiques
   ============================================= */

/* ---- Utilitaires Flexbox ---- */
.d-flex           { display: flex; }
.align-items-center { align-items: center; }
.justify-between  { justify-content: space-between; }
.justify-end      { justify-content: flex-end; }
.flex-wrap        { flex-wrap: wrap; }
.flex-col         { flex-direction: column; }
.gap-1            { gap: .25rem; }
.gap-2            { gap: .5rem; }
.gap-3            { gap: .75rem; }
.gap-4            { gap: 1rem; }
.flex-1           { flex: 1; }

/* ---- Utilitaires Spacing ---- */
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.ml-auto { margin-left: auto; }

/* ---- Utilitaires Texte ---- */
.text-muted       { color: var(--color-text-muted); }
.text-light       { color: var(--color-text-light); }
.text-sm          { font-size: .8rem; }
.font-bold        { font-weight: 700; }
.text-center      { text-align: center; }

/* ---- Page title ---- */
.page-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-text);
}

/* ---- Card header / body ---- */
.card {
  /* override pour permettre padding interne custom */
  padding: 0;
}
.card-header {
  padding: .75rem 1.1rem;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-card);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.card-body {
  padding: 1rem 1.1rem;
}

/* ---- KPI card — amélioré ---- */
.kpi-card {
  position: relative;
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--kpi-color, var(--color-accent));
}
.kpi-icon {
  font-size: 1.4rem;
  margin-bottom: .35rem;
  display: block;
}
.kpi-trend {
  display: inline-flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 700;
  margin-top: .35rem;
}
.kpi-trend.positive { color: var(--color-emerald); }
.kpi-trend.negative { color: var(--color-rose); }

/* ---- Today widget ---- */
.today-widget-item {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--color-card);
  border-left: 3px solid var(--tw-color, var(--color-accent));
}
.tw-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--tw-color, var(--color-accent));
}
.tw-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 3px;
}

/* ---- Badge process statuses ---- */
.badge-on_track   { color: var(--color-emerald); background: var(--color-emerald-pale); }
.badge-delayed    { color: var(--color-rose);    background: var(--color-rose-pale); }
.badge-completed  { color: #6366F1;              background: #EEF2FF; }
.badge-cancelled  { color: var(--color-text-muted); background: var(--color-bg); }

/* ---- Table variants ---- */
.table     { width: 100%; border-collapse: collapse; }
.table-sm thead th { padding: .5rem .75rem; font-size: .72rem; }
.table-sm tbody td { padding: .55rem .75rem; font-size: .82rem; }

/* ---- Button close ---- */
.btn-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: .1rem .35rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.btn-close:hover { background: var(--color-bg); }

/* =============================================
   PHASE 3 — Composants modules
   ============================================= */

/* ---- Page header ---- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.page-subtitle { font-size: .85rem; color: var(--color-text-muted); margin-top: .2rem; }
.back-link { font-size: .85rem; color: var(--color-accent); text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; }
.back-link:hover { text-decoration: underline; }

/* ---- Link helpers ---- */
.company-link { font-weight: 600; color: var(--color-accent); text-decoration: none; }
.company-link:hover { text-decoration: underline; }
.hover-underline:hover { text-decoration: underline; }

/* ---- Filter bar ---- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-bottom: 1rem;
}
.input-search {
  padding: .45rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  min-width: 200px;
  background: var(--color-card);
  color: var(--color-text);
  transition: border-color var(--transition);
}
.input-search:focus { outline: none; border-color: var(--color-accent); }
.input-select {
  padding: .45rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  background: var(--color-card);
  color: var(--color-text);
  transition: border-color var(--transition);
}
.input-select:focus { outline: none; border-color: var(--color-accent); }

/* ---- Data table (composant card) ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table th {
  text-align: left;
  padding: .6rem .75rem;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-border);
}
.data-table td {
  padding: .65rem .75rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--color-accent-pale); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ---- Info grid / block ---- */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.info-block {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.info-block-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--color-text-muted);
  margin-bottom: .75rem;
}
.info-dl { display: grid; grid-template-columns: 1fr 1.6fr; gap: .4rem .75rem; font-size: .85rem; }
.info-dl dt { color: var(--color-text-muted); align-self: start; padding-top: .1rem; }
.info-dl dd { color: var(--color-text); font-weight: 500; margin: 0; word-break: break-word; }

/* ---- Tabs Alpine.js ---- */
.tabs-nav { margin-top: 1.5rem; }
.tabs-list {
  display: flex;
  gap: .25rem;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.tab-active { color: var(--color-accent) !important; border-bottom-color: var(--color-accent) !important; font-weight: 700 !important; }
.tab-panel { padding: .5rem 0; }

/* ---- Progress bar (wrap variant) ---- */
.progress-bar-wrap {
  background: var(--color-border);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}
.progress-bar-success { background: var(--color-emerald); }
.progress-bar-danger  { background: var(--color-rose); }
.progress-bar-info    { background: var(--color-accent); }
.progress-bar-muted   { background: var(--color-text-light); }

/* ---- KPI row ---- */
.kpi-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.kpi-row .kpi-card { flex: 1; min-width: 150px; }

/* ---- Kanban ---- */
.kanban-board { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: 1rem; }
.kanban-col {
  min-width: 210px;
  background: var(--color-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}
.kanban-col-header {
  padding: .55rem .85rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kanban-count {
  background: var(--color-border);
  border-radius: 99px;
  min-width: 1.4rem;
  height: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  color: var(--color-text-muted);
  padding: 0 .3rem;
}
.kanban-card {
  margin: .4rem .5rem;
  padding: .7rem .85rem;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: .82rem;
}
.kanban-card-title { font-weight: 600; font-size: .85rem; margin-bottom: .2rem; }
.kanban-empty { padding: 1rem; text-align: center; color: var(--color-text-muted); font-size: .78rem; }

/* ---- Form extras ---- */
.form-control {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  background: var(--color-card);
  color: var(--color-text);
  transition: border-color var(--transition);
}
.form-control:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-check { display: flex; align-items: center; gap: .5rem; font-size: .875rem; }

/* ---- Badge extras ---- */
.badge-outline { border: 1px solid var(--color-border); color: var(--color-text-muted); background: transparent; font-size: .7rem; padding: .15rem .5rem; border-radius: 99px; }

/* ---- Alert extras ---- */
.alert-warning { background: var(--color-amber-pale); color: #92400E; border: 1px solid var(--color-amber); }
.alert-info    { background: var(--color-accent-pale); color: var(--color-accent); border: 1px solid var(--color-accent); }
.alert-success { background: var(--color-emerald-pale); color: var(--color-emerald); border: 1px solid var(--color-emerald); }

/* ---- Utility aliases ---- */
.flex         { display: flex; }
.items-center { align-items: center; }
.mt-6         { margin-top: 1.5rem; }
.text-xs      { font-size: .72rem; }
.text-danger  { color: var(--color-rose); }
.text-warning { color: var(--color-amber); }
.text-success { color: var(--color-emerald); }

/* ---- Surface alt (ex: row hover) ---- */
.bg-surface-alt { background: var(--color-bg); }


