/* Design system premium — pilotage multi-franchises */
:root {
  --sidebar-w: 264px;
}
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }

body { -webkit-font-smoothing: antialiased; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg,#0a0e17 0%,#0f172a 100%);
  color: #e2e8f0;
  position: fixed; top: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column;
  z-index: 40;
  transition: transform .2s ease;
}
.sidebar-brand { padding: 22px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-brand .logo-mark { width:34px;height:34px;border-radius:10px;background:linear-gradient(135deg,#4f46e5,#818cf8); display:flex;align-items:center;justify-content:center;font-weight:800;color:#fff; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.sidebar-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 14px 10px 6px; font-weight: 600; }
.sidebar-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px; color: #cbd5e1; font-size: 14px; font-weight: 500;
  text-decoration: none; margin-bottom: 2px; transition: all .15s;
}
.sidebar-link i { width: 18px; text-align: center; font-size: 14px; color: #64748b; }
.sidebar-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-link.active { background: rgba(79,70,229,.18); color: #fff; }
.sidebar-link.active i { color: #818cf8; }
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.06); }

.main-area { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display:flex; flex-direction:column; }
.topbar {
  height: 64px; background: #fff; border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
  position: sticky; top: 0; z-index: 30;
}
.page-content { padding: 28px; flex: 1; }

.card {
  background: #fff; border: 1px solid #eef1f6; border-radius: 16px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.kpi-card { padding: 18px 20px; border-radius: 16px; background:#fff; border:1px solid #eef1f6; position: relative; overflow: hidden; }
.kpi-card .kpi-bar { position:absolute; left:0; top:0; bottom:0; width:4px; }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.kpi-label { font-size: 12.5px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }

.badge { display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:999px; font-size:12px; font-weight:600; }
.badge-green { background:#dcfce7; color:#15803d; }
.badge-orange { background:#fef3c7; color:#b45309; }
.badge-red { background:#fee2e2; color:#b91c1c; }
.badge-neutral { background:#f1f5f9; color:#64748b; }
.dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
.dot-green{background:#16a34a;} .dot-orange{background:#f59e0b;} .dot-red{background:#dc2626;} .dot-neutral{background:#94a3b8;}

table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table thead th {
  text-align: left; padding: 10px 14px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: #64748b; font-weight: 700; border-bottom: 1px solid #e2e8f0; background: #f8fafc; white-space:nowrap;
}
table.data-table tbody td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; white-space:nowrap; }
/* Couleur de texte par défaut des cellules, avec une spécificité nulle (:where) pour ne jamais
   passer devant les classes de coloration Tailwind (text-emerald-600 / text-red-600) posées sur
   les colonnes d'écart (vs Objectif, vs N-1) — sinon cette règle plus spécifique les écrasait
   systématiquement en gris/noir, quel que soit le sens de l'écart. */
:where(table.data-table tbody td) { color: #1e293b; }
table.data-table tbody tr:hover { background: #f8fafc; }
table.data-table tbody tr:last-child td { border-bottom: none; }

.btn { display:inline-flex; align-items:center; gap:8px; padding: 9px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 600; cursor:pointer; transition:.15s; border: 1px solid transparent; }
.btn-primary { background: #4338ca; color: #fff; }
.btn-primary:hover { background: #3730a3; }
.btn-secondary { background: #fff; color: #1e293b; border-color: #e2e8f0; }
.btn-secondary:hover { background: #f8fafc; }
.btn-danger { background:#fee2e2; color:#b91c1c; }
.btn-danger:hover { background:#fecaca; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn:disabled, .btn[disabled] { opacity:.6; cursor:not-allowed; }
/* Empêche tout double-clic pendant qu'une action (upload, envoi d'email, import, sauvegarde...)
   est en cours : voir withLoading() dans common.js. */
.btn-loading { cursor:wait !important; }

.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border-radius: 9px; border: 1px solid #e2e8f0; font-size: 13.5px; background:#fff; color:#0f172a;
}
.input:focus, select.input:focus, textarea.input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.label { font-size: 12.5px; font-weight: 600; color: #334155; margin-bottom: 5px; display:block; }

.tab-btn { padding: 8px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color:#64748b; cursor:pointer; }
.tab-btn.active { background:#eef2ff; color:#4338ca; }

.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display:flex; align-items:center; justify-content:center; z-index: 100; backdrop-filter: blur(2px); }
.modal-box { background:#fff; border-radius: 18px; max-width: 560px; width: 92%; max-height: 88vh; overflow-y:auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }

.skeleton { background: linear-gradient(90deg,#f1f5f9 25%,#e2e8f0 37%,#f1f5f9 63%); background-size: 400% 100%; animation: skeleton-loading 1.4s ease infinite; border-radius: 8px; }
@keyframes skeleton-loading { 0%{background-position:100% 50%} 100%{background-position:0 50%} }

.mobile-menu-btn { display: none; }
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .mobile-menu-btn { display: inline-flex; }
}

.scrollbar-x { overflow-x: auto; }
.fade-in { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity:0; transform: translateY(4px);} to { opacity:1; transform:none; } }

.prose-ai p, .prose-ai li { line-height: 1.6; }
