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

  /* EDF 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;

  --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; }

/* FORMULAIRES */
.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, .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 textarea { min-height: 80px; resize: vertical; }
.form-row input: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(28px, 1fr));
  font-size: 12px;
  overflow-x: auto;
}
.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 (3×8) ===== */
.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;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.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;
}
.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; }
  body { overflow-x: hidden; }

  /* App grid : full width main */
  .app { grid-template-columns: 1fr !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; }
  #centrale-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; }
  .data { font-size: 12px; }
  .data th, .data td { padding: 6px 8px !important; white-space: nowrap; }

  /* 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 */
