﻿/* ============================================================
   Mon magasin — design system (bleu profond + orange)
   ============================================================ */
:root {
  /* GroupeMarché Blue — couleur signature, ton officiel proche du PMS 286 */
  --primary:        #003D7A;
  --primary-hover:  #002A57;
  --primary-soft:   #e5edf5;
  --primary-text:   #002A57;

  /* GroupeMarché Orange — couleur d'accent (highlights, badges, actions critiques) */
  --accent:         #FF6E00;
  --accent-hover:   #d95c00;
  --accent-soft:    #fff0e0;
  --accent-text:    #b85200;

  --success:        #16a34a;
  --success-soft:   #dcfce7;
  --warning:        #f59e0b;
  --warning-soft:   #fef3c7;
  --danger:         #dc2626;
  --danger-soft:    #fee2e2;
  --info:           #0ea5e9;
  --info-soft:      #e0f2fe;

  --text:           #0f172a;
  --text-muted:     #64748b;
  --text-soft:      #94a3b8;

  --surface:        #ffffff;
  --surface-2:      #f8fafc;
  --surface-3:      #f1f5f9;
  --border:         #e2e8f0;
  --border-strong:  #cbd5e1;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow:    0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.05);

  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Échelle typographique (Sprint 2 — design system unifié)
   * Ratio modulaire 1.2, base 14px : 11 · 12 · 14 · 17 · 20 · 24 · 28 · 36 */
  --font-2xs: 11px;    /* metadata, labels secondaires */
  --font-xs:  12px;    /* small text, captions */
  --font-sm:  13px;    /* body small */
  --font-md:  14px;    /* body default */
  --font-lg:  16px;    /* body emphasized, inputs */
  --font-xl:  20px;    /* h3, titres section */
  --font-2xl: 24px;    /* h2, titres page */
  --font-3xl: 28px;    /* h1 */
  --font-4xl: 36px;    /* hero, kpi values */

  /* Échelle d'espacement (multiples de 4) */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Transitions standardisées (Sprint 3) */
  --transition-fast: 0.12s ease;
  --transition:      0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-w: 240px;
  --topbar-h:  56px;

  --leave-conges:     #6366f1;
  --leave-rtt:        #a855f7;
  --leave-maladie:    #f59e0b;
  --leave-formation:  #10b981;
  --leave-stage:      #8b5cf6;
  --leave-absence:    #ef4444;
  --leave-teletravail:#06b6d4;
}

[data-theme="dark"] {
  --text:           #f1f5f9;
  --text-muted:     #94a3b8;
  --text-soft:      #64748b;
  --surface:        #0f172a;
  --surface-2:      #1e293b;
  --surface-3:      #334155;
  --border:         #334155;
  --border-strong:  #475569;
  --primary-soft:   #002A57;
  --primary-text:   #b3c7e0;
  --accent-soft:    #4d2200;
  --accent-text:    #ffb380;
}

/* Badge "BETA" pour signaler la version pré-prod */
.beta-badge {
  display: inline-block;
  padding: 1px 6px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 6px;
  text-transform: uppercase;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--surface-2);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }

/* ============ SHELL ============ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  grid-row: 1 / 3;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 18px;
  letter-spacing: -0.02em;
}
.sidebar .brand .logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
}
.sidebar nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.sidebar .nav-group { margin-bottom: 14px; }
.sidebar .nav-group-label {
  font-size: 10.5px; font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 10px;
}
.sidebar a.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  margin-bottom: 1px;
  color: var(--text-muted);
  border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500;
  text-decoration: none;
}
.sidebar a.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar a.nav-item.active {
  background: var(--primary-soft); color: var(--primary-text);
  font-weight: 600;
}
.sidebar a.nav-item .ico {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.sidebar a.nav-item .badge {
  margin-left: auto;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px;
}
.sidebar .sb-foot {
  padding: 12px;
  border-top: 1px solid var(--border);
}

/* TOPBAR */
.topbar {
  grid-column: 2 / 3;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .search {
  flex: 1; max-width: 480px;
  position: relative;
}
.topbar .search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
}
.topbar .search input:focus {
  outline: none; border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.topbar .search::before {
  content: "🔍"; position: absolute;
  left: 11px; top: 50%; transform: translateY(-50%);
  font-size: 13px; opacity: 0.6;
}
.topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  color: var(--text-muted);
  font-size: 16px;
  font-family: inherit;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--danger); border-radius: 50%;
  border: 2px solid var(--surface);
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  cursor: pointer;
}
.user-block {
  display: flex; align-items: center; gap: 10px;
  padding-left: 8px; border-left: 1px solid var(--border);
}
.user-block .user-text {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 2px; line-height: 1;
}
.user-block .user-name { font-size: 13px; font-weight: 600; }
.role-chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  font-size: 10.5px; font-weight: 600;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
}
.role-chip.role-admin    { background: linear-gradient(135deg, #4f46e5, #8b5cf6); }
.role-chip.role-director { background: linear-gradient(135deg, #be185d, #ef4444); }
.role-chip.role-manager { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.role-chip.role-agent   { background: linear-gradient(135deg, #10b981, #059669); }

@media (max-width: 768px) {
  .user-block .user-text { display: none; }
}

/* MAIN */
.main {
  grid-column: 2 / 3;
  padding: 24px 28px 40px;
  overflow-x: hidden;
}

/* Page header */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head h1 {
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.01em;
}
.page-head .subtitle {
  color: var(--text-muted); font-size: 13px;
  margin-top: 4px;
}
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 14px; font-weight: 600; }
.card-head .more { color: var(--text-muted); font-size: 13px; }
.card-body { padding: 16px; }
.card-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 13px;
}
.card-empty .emoji { font-size: 32px; margin-bottom: 6px; opacity: 0.6; }

/* BOUTONS */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px; font-weight: 500;
  font-family: inherit;
  transition: all 0.12s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
}
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.success {
  background: var(--success); color: #fff; border-color: var(--success);
}
.btn.success:hover { background: #15803d; }
.btn.danger {
  background: var(--danger); color: #fff; border-color: var(--danger);
}
.btn.danger:hover { background: #b91c1c; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 12px; }

/* TAGS / BADGES */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text);
}
.tag.green { background: var(--success-soft); color: #166534; }
.tag.red { background: var(--danger-soft); color: #991b1b; }
.tag.amber { background: var(--warning-soft); color: #92400e; }
.tag.blue { background: var(--info-soft); color: #075985; }
.tag.indigo { background: var(--primary-soft); color: var(--primary-text); }
.tag.dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

/* TABLE */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table.data {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
table.data thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  text-align: left;
  padding: 10px 14px;
  font-weight: 600; font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
table.data tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ===== Loading states (audit Lentille 6) ===== */
.btn.is-loading,
button.is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.75;
  color: transparent !important;
}
.btn.is-loading::after,
button.is-loading::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 14px; height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid var(--text);
  border-top-color: transparent;
  border-radius: 50%;
  animation: yolo-spin 0.6s linear infinite;
}
@keyframes yolo-spin {
  to { transform: rotate(360deg); }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: yolo-skeleton 1.4s ease infinite;
  border-radius: 6px;
  color: transparent;
  min-height: 14px;
}
@keyframes yolo-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* FORMULAIRES */
/* Note : par défaut .form-row est un grid 2-cols (label à gauche).
 * Dans les modales, on force display:block car beaucoup de modales utilisent
 * 3+ enfants par form-row (label + filtres + liste) que le grid 2-cols casse. */
.modal-backdrop .form-row,
.modal .form-row {
  display: block !important;
  margin-bottom: 14px;
}
.modal-backdrop .form-row > label,
.modal .form-row > label {
  display: block;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.modal-backdrop .form-row > input:not([type="checkbox"]):not([type="radio"]),
.modal-backdrop .form-row > select,
.modal-backdrop .form-row > textarea,
.modal .form-row > input:not([type="checkbox"]):not([type="radio"]),
.modal .form-row > select,
.modal .form-row > textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

.form-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}
.form-row > label {
  font-weight: 500;
  font-size: 13px;
  padding-top: 8px;
  color: var(--text-muted);
}
.form-row input:not([type="checkbox"]):not([type="radio"]),
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.form-row input[type="checkbox"],
.form-row input[type="radio"] {
  /* Évite le width:100% qui transforme la checkbox en barre géante */
  width: auto;
  margin: 0;
  vertical-align: middle;
  cursor: pointer;
  flex-shrink: 0;
}
.form-row textarea { min-height: 80px; resize: vertical; }
.form-row input:not([type="checkbox"]):not([type="radio"]):focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* FILTRES (chips) */
.filters {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}
.chip:hover { background: var(--surface-2); }
.chip.active {
  background: var(--primary-soft); border-color: var(--primary-soft);
  color: var(--primary-text);
}
.filters select, .filters input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--text);
}

/* KPIs */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi .kpi-label {
  font-size: 12px; color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 6px;
}
.kpi .kpi-value {
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.kpi .kpi-sub {
  font-size: 12px; color: var(--text-muted);
  margin-top: 4px;
}
.kpi .kpi-icon {
  position: absolute; top: 14px; right: 14px;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.kpi.indigo .kpi-icon { background: var(--primary-soft); color: var(--primary); }
.kpi.green .kpi-icon { background: var(--success-soft); color: var(--success); }
.kpi.amber .kpi-icon { background: var(--warning-soft); color: var(--warning); }
.kpi.red .kpi-icon { background: var(--danger-soft); color: var(--danger); }

/* GRID */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* TUILES — version moderne */
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  display: flex; flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
  text-decoration: none;
}
.tile .tile-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: var(--primary-soft); color: var(--primary);
}
.tile .tile-name { font-weight: 600; font-size: 14.5px; }
.tile .tile-desc { color: var(--text-muted); font-size: 12.5px; line-height: 1.4; }

/* ===== Vue année compacte ===== */
.year-calendar {
  display: grid;
  grid-template-columns: 200px repeat(var(--days, 365), minmax(3px, 1fr));
  font-size: 11px;
  overflow-x: auto;
  background: var(--surface);
}
.year-calendar .cal-corner {
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 22px;
  grid-column: 1 / 2;
  grid-row: 1 / 2;
  position: sticky; left: 0; z-index: 3;
}
.year-calendar .year-month-head {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600; font-size: 10px;
  text-align: center; padding: 4px 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
.year-calendar .cal-row-head {
  background: var(--surface);
  font-weight: 600; font-size: 11.5px;
  display: flex; flex-direction: column;
  align-items: flex-start; gap: 1px;
  padding: 4px 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: sticky; left: 0; z-index: 1;
  min-height: 24px;
}
.year-calendar .year-cell {
  min-height: 24px;
  border-right: 1px solid #f1f5f9;
  border-bottom: 1px solid var(--border);
  position: relative;
  padding: 2px 0;
}
.year-calendar .year-cell.we { background: var(--surface-2); }
.year-calendar .year-cell.today { box-shadow: inset 0 0 0 2px var(--primary); }
.year-calendar .year-cell.holiday { background: #fef3c7; }
.year-calendar .year-cell .year-seg {
  width: 100%; height: 100%;
  border-radius: 1px;
}
.year-cell .year-seg.conges     { background: var(--leave-conges); }
.year-cell .year-seg.rtt        { background: var(--leave-rtt); }
.year-cell .year-seg.maladie    { background: var(--leave-maladie); }
.year-cell .year-seg.formation  { background: var(--leave-formation); }
.year-cell .year-seg.stage      { background: var(--leave-stage); }
.year-cell .year-seg.absence    { background: var(--leave-absence); }
.year-cell .year-seg.teletravail{ background: var(--leave-teletravail); }

/* ALERTES & FLASH */
.alert-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.alert-row:last-child { border-bottom: none; }
.alert-row .ico {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}
.alert-row.high .ico { background: var(--danger-soft); color: var(--danger); }
.alert-row.medium .ico { background: var(--warning-soft); color: var(--warning); }
.alert-row.low .ico { background: var(--info-soft); color: var(--info); }
.alert-row .body { flex: 1; font-size: 13px; }
.alert-row .body .date { font-size: 11.5px; color: var(--text-muted); }

/* CALENDAR */
.cal-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.cal-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.cal-toolbar .month {
  font-weight: 600; font-size: 15px;
  flex: 1; text-align: center;
}
.calendar {
  display: grid;
  grid-template-columns: 200px repeat(var(--days, 31), minmax(32px, 1fr)) 160px;
  font-size: 12px;
  overflow-x: auto;
}
/* Cellule "corner droite" (header stats) */
.calendar .cal-corner-right {
  background: var(--surface-2);
  font-weight: 700;
  color: var(--text-muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  position: sticky; top: 0; right: 0; z-index: 3;
}
/* Cellule stats par ligne */
.calendar .cal-row-stats {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-left: 2px solid var(--border);
  padding: 4px 8px;
  display: flex; flex-wrap: wrap; gap: 4px;
  align-items: center; justify-content: flex-start;
  position: sticky; right: 0; z-index: 1;
}
.calendar .cal-row-stats .row-stat {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
}
/* Header de groupe équipe (occupe toute la largeur) */
.calendar .pl-team-row {
  grid-column: 1 / -1;
  background: linear-gradient(90deg, var(--primary-soft), transparent);
  border-bottom: 1px solid var(--border);
}
.calendar .pl-team-row .pl-team-header {
  padding: 8px 14px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-text);
  display: flex; align-items: center; gap: 10px;
}
.calendar .pl-team-row .pl-team-header .count {
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-muted);
  font-size: 11.5px;
}
/* Badge "X absents" en haut de chaque colonne */
.calendar .cal-head-abs {
  position: absolute;
  bottom: 2px; right: 2px;
  background: var(--accent);
  color: #fff;
  font-size: 8.5px; font-weight: 800;
  min-width: 14px; height: 14px;
  border-radius: 7px;
  padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
/* Aujourd'hui : surlignage de la colonne entière (top + cells) */
.calendar .cal-head.today { background: var(--accent-soft); color: var(--accent-text); border-top: 2px solid var(--accent); }
.calendar .cal-cell.today { background: rgba(255,110,0,0.06); }
.calendar .cal-cell.today::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--accent); opacity: 0.5;
}
/* Hover ligne : highlight via attribute selector au runtime */
.calendar .cal-cell:hover, .calendar .cal-row-head:hover { background: var(--primary-soft); cursor: pointer; }
.calendar .cal-cell.today:hover { background: rgba(255,110,0,0.15); }

/* ============================================================
   VUE JOUR (renderDayView)
   ============================================================ */
.day-view-body { padding: 16px; display: flex; flex-direction: column; gap: 20px; }
.day-team-block { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.day-team-title { padding: 10px 14px; background: var(--primary-soft); color: var(--primary-text); font-size: 13px; margin: 0; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.day-team-title small { font-weight: 400; color: var(--text-muted); text-transform: none; letter-spacing: normal; }
.day-table { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
.day-table col.col-collab { width: 28%; }
.day-table col.col-status { width: 14%; }
.day-table col.col-missions { width: 32%; }
.day-table col.col-delegs  { width: 26%; }
.day-table th { background: var(--surface-2); padding: 8px 12px; text-align: left; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.day-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.day-table tr:last-child td { border-bottom: none; }
.day-emp b { font-weight: 700; }
.day-emp small { color: var(--text-muted); font-size: 11px; }
.day-status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 11.5px; }
.day-status.present { background: #dcfce7; color: #15803d; }
.day-status.absent { background: var(--surface-2); color: var(--danger); }
.day-status.off { background: var(--surface-2); color: var(--text-muted); }
.day-status.shift.shift-M { background: #fef3c7; color: #92400e; }
.day-status.shift.shift-A { background: #cffafe; color: #155e75; }
.day-status.shift.shift-N { background: #e0e7ff; color: #312e81; }
.day-task, .day-del { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; margin: 2px 4px 2px 0; background: var(--surface-2); border-radius: 6px; font-size: 11.5px; }
.day-del { background: #fff7ed; color: #9a3412; }
.day-empty { color: var(--text-soft); font-style: italic; }

/* ============================================================
   VUE SEMAINE (renderWeekView)
   ============================================================ */
.week-view-body { padding: 14px; display: flex; flex-direction: column; gap: 18px; }
.week-team-block { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.week-team-title { padding: 10px 14px; background: var(--primary-soft); color: var(--primary-text); font-size: 13px; margin: 0; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.week-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.week-table th, .week-table td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px 8px; text-align: center; }
.week-table th { background: var(--surface-2); font-weight: 700; font-size: 11px; }
.week-table th.we, .week-table td.we { background: var(--surface-3); }
.week-table th.today, .week-table td.today { background: var(--accent-soft); }
.week-table th.today { border-top: 2px solid var(--accent); }
.week-table th.week-head .dow { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }
.week-emp { background: var(--surface) !important; text-align: left !important; font-size: 12px; padding: 8px 12px !important; min-width: 160px; }
.week-emp b { font-weight: 700; }
.week-emp small { color: var(--text-muted); font-size: 11px; display: block; }
.week-cell { min-height: 48px; padding: 4px !important; }
.week-shift { display: inline-block; padding: 3px 8px; border-radius: 4px; font-weight: 800; font-size: 12px; }
.week-shift-M { background: #f59e0b; color: #fff; }
.week-shift-A { background: #06b6d4; color: #fff; }
.week-shift-N { background: #312e81; color: #fff; }
.week-shift-R { background: #94a3b8; color: #fff; }
.week-tasks { font-size: 10.5px; color: var(--primary-text); margin-top: 3px; font-weight: 600; }
.week-abs { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.week-abs-tag { font-size: 11px; padding: 0; line-height: 1; }
.week-abs-label { font-size: 10px; color: var(--text-muted); }
.week-empty { color: var(--text-soft); }

/* ============================================================
   VUE QUART (renderShiftView)
   ============================================================ */
.shift-view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px; padding: 16px;
}
.shift-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--sh-color, var(--primary));
  border-radius: 12px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.shift-card-head {
  padding: 14px 16px;
  background: var(--sh-soft, var(--primary-soft));
  border-bottom: 1px solid var(--border);
}
.shift-card-title { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.shift-card-icon { font-size: 24px; }
.shift-card-hours { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-bottom: 10px; }
.shift-card-stats { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; }
.shift-stat { color: var(--text-muted); }
.shift-stat b { color: var(--text); font-weight: 800; font-size: 14px; }
.shift-card-body { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.shift-section h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 0 0 8px; }
.shift-agent-list, .shift-task-list, .shift-del-list { display: flex; flex-direction: column; gap: 6px; }
.shift-agent {
  display: grid; grid-template-columns: 1fr auto;
  align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--surface-2); border-radius: 6px;
  font-size: 12px;
}
.shift-agent.absent { opacity: 0.6; }
.shift-agent-name { font-weight: 700; }
.shift-agent-role { font-size: 10.5px; color: var(--text-muted); display: block; }
.shift-agent-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.shift-agent-badge.absent { background: var(--danger-soft); color: var(--danger); }
.shift-agent-badge.tasks { background: var(--primary-soft); color: var(--primary-text); }
.shift-task {
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 6px;
  border-left: 3px solid var(--sh-color, var(--primary));
}
.shift-task-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; font-weight: 700; }
.shift-task-icon { font-size: 14px; }
.shift-task-label { flex: 1; min-width: 0; }
.shift-task-crit { background: var(--danger); color: #fff; font-size: 9px; padding: 1px 6px; border-radius: 3px; font-weight: 800; letter-spacing: 0.05em; }
.shift-task-status { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; margin-left: auto; }
.shift-task-status.ok { background: #dcfce7; color: #15803d; }
.shift-task-status.warn { background: #fef3c7; color: #92400e; }
.shift-task-status.ko { background: var(--danger-soft); color: var(--danger); }
.shift-task-status.pending { background: var(--surface-3); color: var(--text-muted); }
.shift-task-sub { margin-top: 4px; font-size: 11px; color: var(--text-muted); }
.shift-del {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: #fff7ed; border-left: 3px solid var(--accent); border-radius: 6px;
  font-size: 11.5px;
}
.shift-del small { color: var(--text-muted); margin-left: 4px; }
.shift-del-status { margin-left: auto; font-size: 10px; padding: 2px 7px; border-radius: 999px; font-weight: 700; }
.shift-del-status.pending { background: var(--warning-soft); color: var(--warning); }
.shift-del-status.ok { background: #dcfce7; color: #15803d; }
.shift-del-status.ko { background: var(--danger-soft); color: var(--danger); }
.shift-empty { color: var(--text-soft); font-style: italic; font-size: 11.5px; padding: 4px 0; }
.calendar .cal-corner,
.calendar .cal-head,
.calendar .cal-row-head,
.calendar .cal-cell {
  min-height: 36px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.calendar .cal-corner,
.calendar .cal-head {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  position: sticky; top: 0; z-index: 2;
}
.calendar .cal-head .dow { font-size: 10px; opacity: 0.7; }
.calendar .cal-head.we { background: var(--surface-3); }
.calendar .cal-head.today { background: var(--primary-soft); color: var(--primary-text); }
.calendar .cal-row-head {
  background: var(--surface);
  font-weight: 600;
  font-size: 12.5px;
  justify-content: flex-start;
  padding-left: 14px;
  position: sticky; left: 0; z-index: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.calendar .cal-row-head .role {
  font-size: 11px; font-weight: 400; color: var(--text-muted);
}
.calendar .cal-cell.we { background: var(--surface-2); }
.calendar .cal-cell.today { background: var(--primary-soft); }
.calendar .cal-cell { user-select: none; }
.calendar .cal-cell.cal-selecting {
  background: var(--primary-soft) !important;
  box-shadow: inset 0 0 0 2px var(--primary);
}
.calendar .cal-cell.cal-drop {
  background: var(--success-soft) !important;
  box-shadow: inset 0 0 0 2px var(--success);
}
.calendar .seg { user-select: none; }
.calendar .seg[draggable="true"] { cursor: grab; }
.calendar .seg[draggable="true"]:active { cursor: grabbing; }
.calendar .seg.seg-dragging { opacity: 0.4; }
.calendar .cal-cell.holiday { background: #fef3c7 !important; }
.calendar .cal-cell.holiday::after {
  content: "★"; position: absolute;
  top: 1px; right: 2px; font-size: 8px;
  color: #d97706; opacity: 0.7;
}
.calendar .seg.seg-conflict {
  box-shadow: inset 0 0 0 1.5px #fff, inset 0 0 0 3px var(--warning);
}
.calendar .seg .seg-badge {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--warning);
  color: #000;
  font-size: 8px; font-weight: 700;
  min-width: 12px; height: 12px;
  border-radius: 6px;
  padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid #fff;
}
.calendar .seg { position: absolute; }

/* ===== Quarts (amplitude retail) ===== */
.calendar .cal-cell { position: relative; }
.shift-tag {
  position: absolute;
  top: 1px; left: 1px;
  font-size: 8px; font-weight: 700;
  padding: 1px 3px;
  border-radius: 3px;
  color: #fff;
  line-height: 1;
  z-index: 2;
  pointer-events: none;
}
.shift-tag.shift-M { background: #f59e0b; }  /* matin = orange */
.shift-tag.shift-A { background: #06b6d4; }  /* après-midi = cyan */
.shift-tag.shift-N { background: #312e81; }  /* nuit = indigo profond */
.shift-tag.shift-R { background: #94a3b8; }  /* repos = gris */
.calendar .seg { /* on déplace le seg pour laisser voir le shift-tag dans le coin */
  inset: 4px 1px;
}
/* Indicateur de tâche(s) affectée(s) sur la cellule */
.task-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #8b5cf6);
  box-shadow: 0 0 0 1.5px var(--surface);
  z-index: 3;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 7px; font-weight: 700;
  cursor: help;
}
/* Variante : tâche issue d'une délégation directeur → manager → agent (en losange ambre) */
.task-dot.task-dot-delegated {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: 2px;
  transform: rotate(45deg);
}
.task-dot.task-dot-delegated > * { transform: rotate(-45deg); }
/* Variante mixte (délégation + auto/IA le même jour) : bord ambre */
.task-dot.task-dot-mixed {
  background: linear-gradient(135deg, #4f46e5, #8b5cf6);
  box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 2.5px #f59e0b;
}

/* ===== Mode plein écran (cache la sidebar) ===== */
body.yolo-fullscreen .sidebar { display: none; }
body.yolo-fullscreen .app { grid-template-columns: 1fr; }
body.yolo-fullscreen .topbar { grid-column: 1 / 2; }
body.yolo-fullscreen .main   { grid-column: 1 / 2; }

/* ===== Command palette ===== */
.cmdk-item.sel {
  background: var(--primary-soft);
  outline: 1px solid var(--primary);
}
kbd {
  font-family: inherit;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  background: var(--surface-2);
}

/* ===== Soldes de congés (widget compact) ===== */
.balances-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.balance-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 14px;
}
.balance-card .b-label {
  font-size: 12px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.balance-card .b-main {
  display: flex; align-items: baseline; gap: 4px;
}
.balance-card .b-remaining {
  font-size: 28px; font-weight: 700; color: var(--primary);
}
.balance-card .b-sep { color: var(--text-muted); }
.balance-card .b-acquired { color: var(--text-muted); font-size: 14px; }
.balance-card .b-detail {
  margin-top: 6px;
  font-size: 11.5px; color: var(--text-muted);
  display: flex; gap: 8px; flex-wrap: wrap;
}
.balance-card .b-bar {
  margin-top: 8px;
  background: var(--surface-3);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
}
.balance-card .b-bar i {
  display: block; height: 100%;
}
.balance-card .b-bar .b-taken    { background: var(--success); }
.balance-card .b-bar .b-planned  { background: var(--info); }
.balance-card .b-bar .b-pending  { background: var(--warning); }

/* ===== Headcount warning sur calendrier ===== */
.cal-cell.below-min {
  box-shadow: inset 0 -3px 0 var(--danger);
}

/* ===== Bulk select demandes ===== */
.bulk-bar {
  position: sticky; bottom: 12px;
  background: var(--text); color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 12px;
  margin-top: 16px;
}
.bulk-bar .count { font-weight: 600; }

/* ===== Commentaires demande ===== */
.request-comments {
  margin-top: 10px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: var(--radius);
}
.request-comments .c-item {
  padding: 6px 0;
  border-bottom: 1px dotted var(--border);
  font-size: 12.5px;
}
.request-comments .c-item:last-child { border-bottom: none; }
.request-comments .c-meta { color: var(--text-muted); font-size: 11px; margin-bottom: 2px; }
.calendar .cal-cell .seg {
  position: absolute; inset: 4px 1px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
}
.seg.conges     { background: var(--leave-conges); }
.seg.rtt        { background: var(--leave-rtt); }
.seg.maladie    { background: var(--leave-maladie); }
.seg.formation  { background: var(--leave-formation); }
.seg.stage      { background: var(--leave-stage); }
.seg.absence    { background: var(--leave-absence); }
.seg.teletravail{ background: var(--leave-teletravail); }

/* Légende */
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12px; }
.legend .sw { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw i {
  width: 14px; height: 14px; border-radius: 3px;
}

/* PROGRESS BARS */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bars .row { display: grid; grid-template-columns: 180px 1fr 60px; gap: 12px; align-items: center; }
.bars .label { font-weight: 600; font-size: 13px; }
.bars .label .sub { font-weight: 400; color: var(--text-muted); font-size: 11.5px; }
.bars .track {
  height: 22px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.bars .fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 8px;
  color: #fff; font-size: 11px; font-weight: 700;
  transition: width 0.3s;
}
.bars .fill.warn { background: var(--warning); }
.bars .fill.over { background: var(--danger); }
.bars .value { text-align: right; font-weight: 600; font-size: 13px; }

/* STATUS BOARD */
.status-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex; align-items: center; gap: 12px;
}
.status-card .avatar-sm {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.status-card .info { flex: 1; min-width: 0; }
.status-card .name { font-weight: 600; font-size: 13.5px; }
.status-card .team { font-size: 11.5px; color: var(--text-muted); }

/* MODAL */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  display: none;
  opacity: 0;
  transition: opacity var(--transition);
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop.open { display: flex; opacity: 1; }
.modal {
  background: var(--surface);
  width: 560px; max-width: 100%;
  max-height: 90vh;
  overflow: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateY(-12px) scale(0.97);
  opacity: 0;
  transition: transform var(--transition), opacity var(--transition);
}
.modal-backdrop.open .modal { transform: translateY(0) scale(1); opacity: 1; }

/* Hover transitions globales (Sprint 3) */
.btn, .icon-btn, .chip, .nav-item, .tab {
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
.btn:active:not(:disabled), .icon-btn:active { transform: translateY(1px); }

/* Toast slide + bounce (Sprint 3) */
.toast {
  transform: translateY(20px);
  opacity: 0;
  transition: transform var(--transition) cubic-bezier(0.34, 1.56, 0.64, 1), opacity var(--transition);
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Focus visible (Sprint 4 — accessibilité WCAG AA) */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.btn:focus-visible, .icon-btn:focus-visible {
  outline-offset: 3px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: var(--primary);
}
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-head .close {
  cursor: pointer;
  font-size: 18px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.modal-head .close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 20px; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* TOAST */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--text);
  color: var(--surface);
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0; pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }

/* HERO sur dashboard */
.hero {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: ""; position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.hero h1 {
  font-size: 24px; font-weight: 700;
  margin-bottom: 6px;
  position: relative;
}
.hero p {
  margin: 0;
  opacity: 0.92;
  font-size: 14px;
  position: relative;
}
.hero .quick {
  margin-top: 16px;
  display: flex; gap: 8px; flex-wrap: wrap;
  position: relative;
}
.hero .quick .btn {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
  backdrop-filter: blur(6px);
}
.hero .quick .btn:hover {
  background: rgba(255,255,255,0.28);
}
.hero .quick .btn.primary {
  background: #fff;
  color: var(--primary);
  border-color: #fff;
}

/* TABS */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tabs a {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  text-decoration: none;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* PROSE (Aide) */
.prose { max-width: 760px; font-size: 14px; line-height: 1.7; }
.prose h2 { margin: 24px 0 8px; font-size: 17px; }
.prose h3 { margin: 18px 0 6px; font-size: 14.5px; }
.prose p { margin: 0 0 10px; color: var(--text); }
.prose ul { margin: 6px 0 12px; padding-left: 22px; }
.prose code {
  background: var(--surface-3);
  padding: 1px 6px; border-radius: 4px;
  font-size: 0.92em;
}

/* TIMELINE / journal */
.timeline {
  position: relative;
  padding-left: 24px;
}
.timeline::before {
  content: ""; position: absolute;
  left: 6px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline .entry {
  position: relative;
  padding: 8px 0;
}
.timeline .entry::before {
  content: ""; position: absolute;
  left: -22px; top: 14px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
}
.timeline .when { font-size: 11.5px; color: var(--text-muted); }
.timeline .what { font-size: 13.5px; }
.timeline .what b { font-weight: 600; }

/* RESPONSIVE */
@media (max-width: 1024px) {
  :root { --sidebar-w: 64px; }
  .sidebar .brand span:not(.logo) { display: none; }
  .sidebar a.nav-item span:not(.ico):not(.badge) { display: none; }
  .sidebar a.nav-item { justify-content: center; }
  .sidebar .nav-group-label { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .form-row > label { padding-top: 0; }
}
@media (max-width: 720px) {
  .main { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero { padding: 18px; }
  .hero h1 { font-size: 19px; }
  .page-head { flex-direction: column; align-items: stretch; }
}

/* ============================================================
   Mobile complet (< 720px) — drawer sidebar + touch UX
   ============================================================ */
@media (max-width: 720px) {
  :root { --sidebar-w: 0px; }
  html, body { overflow-x: hidden; max-width: 100vw; }

  /* App grid : 1 colonne, contraint à 100vw (minmax(0,1fr) sinon les enfants larges étendent la colonne) */
  .app {
    grid-template-columns: minmax(0, 1fr) !important;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .main, .topbar { min-width: 0 !important; max-width: 100vw !important; box-sizing: border-box; }
  /* Tous les containers principaux : box-sizing + max-width pour absorber le padding */
  .hero, .card, .page-head, .kpis, .grid-2, .grid-3, .grid-4 {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  /* Mobile : badge magasin dans hero redondant avec topbar-magasin-mobile button */
  #magasin-badge { display: none !important; }

  /* Sidebar : drawer slide-in à gauche, cachée par défaut */
  .sidebar {
    position: fixed !important;
    top: 0; left: 0;
    width: 78vw !important; max-width: 320px;
    height: 100vh !important;
    background: var(--surface) !important;
    border-right: 1px solid var(--border);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    padding: 14px;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar .brand span:not(.logo) { display: inline !important; }
  .sidebar a.nav-item span:not(.ico):not(.badge) { display: inline !important; }
  .sidebar a.nav-item { justify-content: flex-start !important; }
  .sidebar .nav-group-label { display: block !important; }

  /* Overlay quand sidebar ouverte */
  body.sidebar-open::before {
    content: '';
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
  }

  /* Bouton hamburger dans topbar */
  .topbar-hamburger {
    display: inline-flex !important;
    align-items: center; justify-content: center;
    width: 40px; height: 40px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    margin-right: 8px;
  }

  /* Topbar : compact, icônes seulement */
  .topbar {
    grid-column: 1 / -1 !important;
    padding: 12px 14px !important;
    gap: 8px;
    flex-wrap: wrap;
  }
  .topbar .search { display: none; }
  .topbar .actions { gap: 6px; }
  .user-block .user-text { display: none !important; }
  .user-block .avatar { width: 38px; height: 38px; font-size: 13px; }
  #magasin-switcher { font-size: 10.5px !important; min-width: 0 !important; padding: 6px 8px !important; }

  /* Main : padding réduit */
  .main {
    grid-column: 1 / -1 !important;
    padding: 14px !important;
  }

  /* Cards & layouts : empilés */
  .grid-2, .grid-3, .grid-4, .hub-cards { grid-template-columns: 1fr !important; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 12px !important; }
  .kpi .kpi-value { font-size: 20px !important; }

  /* Hero */
  .hero { padding: 16px !important; border-radius: 10px; }
  .hero h1 { font-size: 18px !important; }
  .hero p { font-size: 13px !important; }
  .hero .quick { gap: 6px; flex-wrap: wrap; }
  .hero .quick .btn { padding: 8px 12px; font-size: 12px; }

  /* Tabs scroll horizontal */
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 4px;
  }
  .tabs a { white-space: nowrap; flex-shrink: 0; }

  /* Modales : 96vw mobile */
  .modal {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: 90vh;
    overflow-y: auto;
    margin: 5vh auto;
  }
  .modal-body { padding: 14px !important; }
  .modal-foot { flex-wrap: wrap; gap: 6px; }
  .modal-foot .btn { flex: 1; min-width: 100px; }

  /* Forms : touch targets 44px min */
  input[type="text"], input[type="password"], input[type="email"],
  input[type="date"], input[type="number"], select, textarea {
    min-height: 44px;
    font-size: 16px !important;  /* évite le zoom iOS sur focus */
  }
  .btn { min-height: 44px; padding: 10px 16px; }
  .btn.sm { min-height: 36px; padding: 6px 12px; font-size: 12px; }
  .icon-btn { min-width: 40px; min-height: 40px; }

  /* Tables : scroll horizontal + cellules compactes */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Tables non-wrappées : on les rend scrollables auto. display: block pour permettre overflow */
  .data {
    font-size: 12px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .data thead, .data tbody, .data tfoot { display: table; width: max-content; min-width: 100%; }
  .data tr { display: table-row; }
  .data th, .data td { display: table-cell; padding: 6px 8px !important; white-space: nowrap; }

  /* Calendrier planning équipe : scroll horizontal pour les semaines */
  .pl-team-row, .pl-team-header {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  /* Aide : TOC latérale inutile en mobile (le contenu suit la lecture linéaire) */
  .help-toc { display: none !important; }

  /* Calendar : scroll horizontal */
  .calendar { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cal-toolbar { flex-wrap: wrap; gap: 6px; }
  .cal-toolbar .btn { font-size: 11px; padding: 6px 10px; }

  /* Filters : wrap */
  .filters { flex-wrap: wrap; gap: 6px; }
  .chip { font-size: 11px; padding: 4px 8px; }

  /* Page-head : ne pas tronquer l'h1 */
  .page-head h1 { font-size: 18px; }
  .page-head .actions { width: 100%; justify-content: flex-end; }

  /* Toast positionné en bas, plus large */
  .toast { left: 8px !important; right: 8px !important; max-width: none !important; bottom: 12px !important; }
}

/* Bouton hamburger : invisible desktop, visible mobile via @media */
.topbar-hamburger { display: none; }

/* Tablet (720-1024) — légères adaptations */
@media (min-width: 720px) and (max-width: 1024px) {
  .main { padding: 18px; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

/* Sécurité contre les débordements horizontaux */
* { max-width: 100%; }
.cal-wrap, .calendar, .heatmap-cell { max-width: none; } /* exceptions : scroll horizontal voulu */

/* ============================================================
   ATELIER — panneau de magasin dans la sidebar
   Desktop : tuile riche avec hero image + boutton switcher
   Mobile  : drawer affiche le panneau complet + topbar compact
   ============================================================ */

/* Bouton "magasin active" dans la topbar — visible uniquement mobile */
.topbar-magasin-mobile {
  display: none;
  align-items: center; gap: 6px;
  padding: 8px 12px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff;
  border: none;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.2px;
  white-space: nowrap;
  max-width: 50vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-magasin-mobile span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Brand text (le "Mon magasin BETA") */
.sidebar .brand .brand-text {
  display: inline-flex; align-items: center; gap: 4px;
  flex-wrap: wrap;
}

/* Panneau magasin (tuile prominente) */
.magasin-panel {
  margin: 14px 12px 10px;
  border-radius: 14px;
  padding: 18px 16px 14px;
  color: #fff;
  background-color: var(--primary);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow:
    0 10px 28px -10px rgba(0,42,87,0.55),
    inset 0 0 0 1px rgba(255,255,255,0.1),
    inset 0 -3px 0 var(--accent);
  position: relative;
  overflow: hidden;
  min-height: 210px;
  display: flex; flex-direction: column;
  isolation: isolate;
}
/* Rivets décoratifs (style atelier) */
.magasin-panel::before,
.magasin-panel::after {
  content: '';
  position: absolute;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
  z-index: 2;
}
.magasin-panel::before { top: 9px; left: 9px; }
.magasin-panel::after  { top: 9px; right: 9px; }

.magasin-panel-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 10.5px; font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 12px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.55);
}
.magasin-status-dot {
  width: 9px; height: 9px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(74,222,128,0.25), 0 0 8px rgba(74,222,128,0.6);
  animation: centraleStatusPulse 2.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes centraleStatusPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(74,222,128,0.25), 0 0 8px rgba(74,222,128,0.6); }
  50%      { box-shadow: 0 0 0 6px rgba(74,222,128,0.0), 0 0 12px rgba(74,222,128,0.9); }
}
.magasin-status-label {
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}
.magasin-tag {
  margin-left: auto;
  padding: 3px 8px;
  background: var(--accent);
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.12em;
  box-shadow: 0 2px 6px -1px rgba(255,110,0,0.5);
}

.magasin-panel-body {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.magasin-panel-text {
  flex: 1; min-width: 0;
}
.magasin-name-big {
  font-size: 16px; font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
  margin-bottom: 3px;
  word-wrap: break-word;
}
.magasin-region-big {
  font-size: 11.5px; font-weight: 600;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 1px 6px rgba(0,0,0,0.55);
  letter-spacing: 0.02em;
}

/* Logo industriel d'une magasin */
.magasin-logo {
  position: relative;
  display: inline-flex;
  align-items: center; justify-content: center;
  border-radius: 9px;
  color: #fff;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow:
    0 5px 12px -3px rgba(0,0,0,0.3),
    inset 0 0 0 1px rgba(255,255,255,0.22),
    inset 0 -2px 0 rgba(0,0,0,0.18);
  overflow: hidden;
  letter-spacing: 0.5px;
}
.magasin-logo::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, transparent 0 5px, rgba(255,255,255,0.06) 5px 6px);
  pointer-events: none;
}
.magasin-logo .cl-initials {
  position: relative;
  text-shadow: 0 1px 3px rgba(0,0,0,0.55);
  z-index: 1;
}
.magasin-logo .cl-mark {
  position: absolute;
  bottom: 2px; right: 3px;
  font-size: 9px;
  opacity: 0.9;
  text-shadow: 0 0 4px rgba(0,0,0,0.6);
  z-index: 2;
}
.magasin-logo-all {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 60%, #6d28d9 100%);
}

.magasin-switch-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  margin-top: auto;
  padding: 11px 12px;
  min-height: 44px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 13px; font-weight: 800;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow:
    0 6px 14px -3px rgba(255,110,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 -2px 0 rgba(0,0,0,0.12);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.magasin-switch-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 8px 18px -3px rgba(255,110,0,0.75),
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -2px 0 rgba(0,0,0,0.12);
}
.magasin-switch-btn:active { transform: translateY(0); }
.magasin-switch-btn .csb-ico { font-size: 15px; }
.magasin-switch-btn .csb-label { flex: 1; text-align: left; }
.magasin-switch-btn .csb-arrow { opacity: 0.9; font-size: 11px; }

.magasin-locked-tile {
  display: flex; align-items: center; gap: 8px;
  margin-top: auto;
  padding: 9px 12px;
  background: rgba(255,255,255,0.14);
  border: 1px dashed rgba(255,255,255,0.4);
  border-radius: 8px;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Vue "toutes magasins" (admin sans cible) — pattern industriel */
.magasin-panel-all {
  background-image:
    linear-gradient(135deg, rgba(255,255,255,0.05) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.05) 50%, rgba(255,255,255,0.05) 75%, transparent 75%),
    linear-gradient(180deg, var(--primary) 0%, var(--primary-hover) 100%) !important;
  background-size: 18px 18px, 100% 100% !important;
}
.magasin-panel-all .magasin-name-big { font-size: 17px; }

/* Sidebar collapsed (tablette 720-1024) : panneau caché, logo seul */
@media (max-width: 1024px) {
  .magasin-panel { display: none; }
}

/* Mobile : drawer ouvre le panneau complet, topbar montre bouton compact */
@media (max-width: 720px) {
  .magasin-panel {
    display: flex !important;
    margin: 12px 8px 14px;
    min-height: 140px;
  }
  .topbar-magasin-mobile { display: inline-flex; }
}

/* ============================================================
   ATELIER — habillage industriel des groupes nav
   ============================================================ */
.sidebar .nav-group-label {
  border-left: 2px solid var(--accent);
  padding-left: 8px;
  margin: 4px 6px 4px 8px;
  color: var(--primary-text);
}
[data-theme="dark"] .sidebar .nav-group-label { color: var(--accent-text); }

.sidebar a.nav-item.active {
  position: relative;
  background: linear-gradient(90deg, var(--accent-soft) 0%, var(--primary-soft) 100%);
}
.sidebar a.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
