/* ===========================
   MSS PLANNING — Styles
   =========================== */

:root {
  --primary:       #1a73e8;
  --primary-light: #e8f0fe;
  --primary-dark:  #1557b0;
  --danger:        #db4437;
  --surface:       #ffffff;
  --surface-2:     #f8f9fa;
  --border:        #e0e0e0;
  --text-1:        #202124;
  --text-2:        #5f6368;
  --text-3:        #9aa0a6;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md:     0 4px 8px rgba(0,0,0,.12);
  --shadow-lg:     0 10px 30px rgba(0,0,0,.18);
  --radius:        8px;
  --radius-sm:     4px;
  --sidebar-w:     260px;
  --header-h:      60px;
  --emp-bar-h:     58px;
  --mobile-nav-h:  56px;
  --hour-h:        64px;
  --hour-start:    7;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text-1);
  background: var(--surface-2);
  height: 100vh;
  overflow: hidden;
}

/* ═══ THÈME SOMBRE ═══ */
[data-theme="dark"] {
  --surface:   #1e1e2e;
  --surface-2: #181825;
  --border:    #313244;
  --text-1:    #cdd6f4;
  --text-2:    #a6adc8;
  --text-3:    #6c7086;
  --primary-light: #1e1e3e;
}
[data-theme="dark"] body { background: var(--surface-2); }
[data-theme="dark"] .app-header,
[data-theme="dark"] .flyout-panel,
[data-theme="dark"] .modal,
[data-theme="dark"] .prefs-panel { background: var(--surface); }

/* ═══ PANNEAU PRÉFÉRENCES ═══ */
.prefs-panel {
  position: fixed; top: var(--header-h); left: 0;
  width: 320px; background: var(--surface);
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 12px 0;
  box-shadow: var(--shadow-lg);
  z-index: 200; padding: 16px;
  display: flex; flex-direction: column; gap: 16px;
}
.prefs-panel.hidden { display: none; }
.prefs-section { display: flex; flex-direction: column; gap: 8px; }
.prefs-label {
  font-size: 11px; font-weight: 700; color: #1a237e;
  text-transform: uppercase; letter-spacing: .5px;
}
/* ─── Toggle mode consultation ─── */
.readonly-toggle { display:flex; align-items:center; gap:10px; cursor:pointer; user-select:none; }
.readonly-toggle input { display:none; }
.readonly-toggle-track {
  width:44px; height:24px; border-radius:12px; background:#1a237e;
  position:relative; transition:background .2s; flex-shrink:0;
}
.readonly-toggle input:checked + .readonly-toggle-track { background:#bbb; }
.readonly-toggle-thumb {
  position:absolute; top:3px; left:23px;
  width:18px; height:18px; border-radius:50%; background:#fff;
  box-shadow:0 1px 3px rgba(0,0,0,.3); transition:left .2s;
}
.readonly-toggle input:checked + .readonly-toggle-track .readonly-toggle-thumb { left:3px; }
.readonly-toggle-text { font-size:13px; font-weight:600; color:var(--text-1); }

/* Bandeau consultation */
:root { --banner-h: 28px; }
.readonly-banner {
  display:none; position:fixed; top:var(--header-h); left:0; right:0;
  height:var(--banner-h);
  background:#e8eaf6; border-bottom:2px solid #1a237e;
  color:#1a237e; font-size:12px; font-weight:700; text-align:center;
  line-height:var(--banner-h); z-index:101; letter-spacing:.5px; text-transform:uppercase;
}
body.readonly-mode .readonly-banner { display:block; }
body.readonly-mode .emp-bar { top: calc(var(--header-h) + var(--banner-h)); }
body.readonly-mode .prefs-panel { top: calc(var(--header-h) + var(--banner-h)); }
body.readonly-mode .app-body {
  margin-top: calc(var(--header-h) + var(--emp-bar-h) + var(--banner-h));
  height: calc(100vh - var(--header-h) - var(--emp-bar-h) - var(--banner-h));
}
body.readonly-mode #cal-wrap { cursor:default !important; }
body.readonly-mode a[data-blocked-readonly] {
  opacity: .35; cursor: default; color: var(--text-3);
}

.prefs-overlay {
  display: none; position: fixed; inset: 0; z-index: 199;
}
.prefs-overlay.active { display: block; }

/* ═══ HEADER ═══ */
.app-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-left  { display: flex; align-items: center; gap: 8px; min-width: 180px; }
.header-center { display: flex; align-items: center; gap: 4px; flex: 1; }
.header-right  { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.logo { display: flex; align-items: center; gap: 8px; }
.logo-img { width: 28px; height: 28px; object-fit: contain; }
.logo-icon { font-size: 22px; }
.logo-text { font-size: 19px; font-weight: 400; color: var(--text-2); white-space: nowrap; }

.period-label {
  font-size: 17px;
  font-weight: 400;
  color: var(--text-1);
  white-space: nowrap;
  margin-left: 6px;
}

/* Boutons */
.icon-btn {
  background: none; border: none; cursor: pointer;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--text-2);
  transition: background .15s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.small { width: 28px; height: 28px; font-size: 17px; }

.header-action-btn {
  background: #1a237e !important;
  color: #fff !important;
  border-radius: 8px !important;
  width: 36px; height: 36px;
  box-shadow: 0 2px 6px rgba(26,35,126,.35);
  transition: background .15s, transform .1s;
}
.header-action-btn:hover { background: #283593 !important; transform: scale(1.07); }
.header-action-btn.btn-add-round { width: 36px; height: 36px; font-size: 22px; line-height: 34px; border-radius: 8px !important; }

.nav-btn { font-size: 30px; font-weight: 300; line-height: 1; }

.btn-today {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  cursor: pointer; font-size: 13px;
  color: var(--text-1);
  transition: background .15s;
  white-space: nowrap;
}
.btn-today:hover { background: var(--surface-2); }

.btn-goto {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  cursor: pointer; font-size: 13px;
  color: var(--primary); font-weight: 600;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-goto:hover { background: var(--primary-light); border-color: var(--primary); }

.goto-input {
  opacity: 0; position: absolute;
  pointer-events: none; width: 0; height: 0;
}

.btn-primary {
  padding: 7px 18px;
  background: var(--primary); color: white;
  border: none; border-radius: 20px;
  cursor: pointer; font-size: 13px; font-weight: 500;
  display: flex; align-items: center;
  transition: background .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-md); }
.btn-add-round {
  width: 34px; height: 34px; padding: 0;
  border-radius: 50%; font-size: 22px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  background: #1a237e;
}

.zoom-ctrl {
  display: flex; align-items: center;
  border: 1px solid var(--border); border-radius: 20px; overflow: hidden;
}
.zoom-btn {
  padding: 5px 11px; border: none; background: var(--surface);
  cursor: pointer; font-size: 15px; font-weight: 600;
  color: #1a237e; transition: background .15s;
  line-height: 1;
}
.zoom-btn:hover { background: var(--primary-light); }
.zoom-fit { font-size: 13px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.zoom-sep-btn { border-left: 1px solid var(--border); }
.service-filter-select {
  border: 2px solid #1a237e; border-radius: 20px;
  padding: 6px 14px; font-size: 15px; font-weight: 700;
  color: #1a237e; background: var(--surface); cursor: pointer;
  outline: none; transition: border-color .15s, box-shadow .15s;
  max-width: 200px;
}
.service-filter-select:focus { border-color: #0d1557; box-shadow: 0 0 0 3px rgba(26,35,126,.18); }
.zoom-select {
  border: none; background: var(--surface); font-size: 12px;
  color: #1a237e; font-weight: 600; cursor: pointer;
  padding: 0 4px; height: 100%; outline: none;
}
.zoom-sep { font-size: 12px; color: var(--text-3); padding: 0 1px; }

.view-switcher {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
}
.view-btn {
  padding: 6px 13px; border: none;
  background: var(--surface); cursor: pointer;
  font-size: 13px; color: var(--text-2);
  transition: background .15s, color .15s;
}
.view-btn:hover { background: var(--surface-2); color: var(--text-1); }
.view-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--primary);
}


/* ═══ BARRE EMPLOYÉS ═══ */
.emp-bar {
  height: var(--emp-bar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  z-index: 99;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.emp-bar-scroll {
  flex: 1; min-width: 0;
  display: flex; align-items: center;
  gap: 10px; padding: 0 4px;
  overflow-x: auto;
  scroll-behavior: smooth;
  height: 100%;
}
.emp-bar-scroll::-webkit-scrollbar { display: none; }
.emp-bar-nav {
  flex-shrink: 0; background: none; border: none; cursor: pointer;
  width: 32px; height: 100%; display: flex; align-items: center; justify-content: center;
  color: #1a237e; font-size: 24px; font-weight: 700;
  transition: background .15s;
}
.emp-bar-nav:hover { background: var(--primary-light); }
.emp-bar-nav:disabled { opacity: 0.15; cursor: default; }
.emp-bar-actions {
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px 0 6px; flex-shrink: 0;
  border-left: 1px solid var(--border);
  height: 100%;
}

.emp-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 24px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background .15s, opacity .15s, border-color .15s;
  flex-shrink: 0;
  user-select: none;
  background: var(--surface-2);
}
.emp-card:hover { background: #f1f3f4; }
.emp-card.active { border-color: currentColor; background: var(--surface); }
.emp-card.dimmed { opacity: .38; }
.emp-card.emp-selected { background: #1a237e; color: #fff !important; border-color: #3949ab; }
.emp-card.emp-selected .emp-card-name,
.emp-card.emp-selected .emp-card-hours { color: #e8eaf6 !important; }
.emp-card { cursor: pointer; }

/* ─── Tooltip compteur employé ─── */
.emp-tooltip {
  position: fixed; z-index: 9999;
  background: #1a237e; color: #fff;
  border-radius: 8px; padding: 8px 12px;
  font-size: 12px; line-height: 1.7;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  pointer-events: none; white-space: pre;
  opacity: 0; transition: opacity .15s;
  max-width: 260px;
}
.emp-tooltip.visible { opacity: 1; }

.emp-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.emp-card-info { line-height: 1.2; }
.emp-card-name  { font-size: 13px; font-weight: 500; white-space: nowrap; }
.emp-card-hours { font-size: 11px; color: var(--text-2); white-space: nowrap; }
.emp-card-hours.hours-over { color: #e53935; font-weight: 600; }

.emp-bar-add {
  background: none; border: 2px dashed var(--border);
  border-radius: 24px; padding: 6px 14px;
  cursor: pointer; font-size: 12px; color: var(--text-2);
  flex-shrink: 0; transition: border-color .15s, color .15s;
  white-space: nowrap;
}
.emp-bar-add:hover { border-color: var(--primary); color: var(--primary); }
.emp-bar-filter {
  background: #fff; border: 2px solid var(--border);
  border-radius: 24px; padding: 6px 14px;
  cursor: pointer; font-size: 14px; color: var(--text-2);
  flex-shrink: 0; transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.emp-bar-filter:hover { border-color: #1a237e; color: #1a237e; }
.emp-bar-filter.filter-on { background: #1a237e; border-color: #1a237e; color: #fff; }

/* ═══ BODY ═══ */
.app-body {
  display: flex; position: relative;
  height: calc(100vh - var(--header-h) - var(--emp-bar-h));
  margin-top: calc(var(--header-h) + var(--emp-bar-h));
  overflow: hidden;
}

/* ═══ SIDEBAR ═══ */
/* ─── Barre d'icônes verticale ─── */
.icon-rail {
  width: 52px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  padding: 10px 0;
  position: relative; z-index: 52;
}
.rail-btn {
  background: none; border: none; cursor: pointer;
  padding: 4px; border-radius: 10px;
  transition: transform .15s;
}
.rail-btn:hover { transform: scale(1.1); }
.rail-btn.active .rail-badge { background: #e65100 !important; box-shadow: none; }
.rail-badge {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
}

/* ─── Panneau flyout ─── */
.flyout-panel {
  width: 240px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex; flex-direction: column;
  margin-left: -241px;
  transition: margin-left .25s ease;
}
.flyout-panel.open { margin-left: 0; }

.flyout-overlay { display: none; }
.flyout-overlay.active { display: none; }
.flyout-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 12px 10px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 700; color: #1a237e;
  text-transform: uppercase; letter-spacing: .5px;
}
.flyout-body { flex: 1; overflow-y: auto; padding: 10px 12px; }
.flyout-content { display: none; }
.flyout-content.active { display: block; }
.flyout-group-btn {
  width: 100%; background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 6px; color: #1a237e;
  font-size: 13px; font-weight: 700;
  border-bottom: 2px solid #1a237e;
  margin-bottom: 2px;
}
.flyout-group-arrow {
  font-size: 16px; font-weight: 700; transition: transform .2s;
}
.flyout-group-btn.open .flyout-group-arrow { transform: rotate(90deg); }
.flyout-group-body {
  overflow: hidden; max-height: 600px;
  transition: max-height .25s ease;
}
.flyout-group-body.collapsed { max-height: 0; }
.flyout-menu { list-style: none; display: flex; flex-direction: column; gap: 0; }
.flyout-item {
  display: block; width: 100%; background: none; border: none; text-align: left;
  padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: 13px; color: #1a237e; cursor: pointer;
  text-decoration: none; transition: background .15s;
}
.flyout-item:hover { background: var(--primary-light); }

/* ─── Sous-menu flyout ─── */
.flyout-item-has-sub { position: relative; }
.flyout-item-sub-trigger { display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.flyout-sub-arrow { font-size: 14px; transition: transform .2s; }
.flyout-submenu {
  list-style: none;
  display: none;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 2px 4px 10px rgba(0,0,0,.12);
  padding: 4px;
  margin-top: 2px;
  margin-left: 8px;
}
.flyout-item-has-sub.sub-open .flyout-submenu { display: flex; }
.flyout-item-has-sub.sub-open .flyout-sub-arrow { transform: rotate(90deg); }

/* ─── Page Employés dans le flyout ─── */
.emp-page-search { margin-bottom: 8px; }
.emp-page-list { display: flex; flex-direction: column; gap: 4px; }
.emp-page-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
}
.emp-page-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.emp-page-info { flex: 1; min-width: 0; }
.emp-page-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emp-page-role { font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emp-page-edit {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 14px; padding: 2px 4px;
  border-radius: 4px; transition: color .15s;
}
.emp-page-edit:hover { color: var(--primary); }
.flyout-back {
  background: none; border: none; cursor: pointer; color: #1a237e;
  font-size: 13px; font-weight: 700; padding: 2px 0 8px;
  display: flex; align-items: center; gap: 4px;
}
.flyout-back:hover { color: #3949ab; }
.page-top-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.search-wrap { position: relative; }
.search-wrap .form-control,
.search-wrap .search-input { padding-right: 28px; width: 100%; }
.search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font-size: 11px; color: var(--text-3); padding: 2px 4px;
  border-radius: 50%; line-height: 1; display: none;
  transition: color .15s;
}
.search-clear:hover { color: var(--danger); }
.search-wrap:has(input:not(:placeholder-shown)) .search-clear { display: block; }

.page-add-btn {
  background: none; border: none; cursor: pointer;
  font-size: 22px; font-weight: 700; color: #1a237e;
  line-height: 1; padding: 2px 6px; border-radius: 4px;
  transition: color .15s;
}
.page-add-btn:hover { color: #3949ab; }

.sidebar-overlay { display: none; }

.sidebar-section {
  padding: 12px 12px 8px;
  border-bottom: 1px solid var(--border);
}
.sidebar-section:last-child { border-bottom: none; }

.section-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.section-title {
  font-size: 11px; font-weight: 700;
  color: var(--text-2); text-transform: uppercase; letter-spacing: .6px;
}

/* ─── Mini calendrier ─── */
.mini-cal { padding: 2px 0; }

.mini-cal-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 6px; padding: 0 2px;
}
.mini-cal-title { font-size: 13px; font-weight: 500; }
.mini-cal-nav {
  background: none; border: none; cursor: pointer;
  color: var(--text-2); font-size: 18px;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.mini-cal-nav:hover { background: var(--surface-2); }

.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.mini-day-name {
  text-align: center; font-size: 10px;
  color: var(--text-3); font-weight: 600;
  padding: 2px 0;
}
.mini-day {
  text-align: center; font-size: 11px;
  padding: 3px; border-radius: 50%;
  cursor: pointer; transition: background .12s;
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
}
.mini-day:hover { background: var(--surface-2); }
.mini-day.other-month { color: var(--text-3); }
.mini-day.today { background: var(--primary); color: white; font-weight: 700; }
.mini-day.selected:not(.today) { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.mini-day.has-events { font-weight: 700; }

/* ─── Employés ─── */
.employee-list { display: flex; flex-direction: column; gap: 2px; }

.employee-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .12s;
  user-select: none;
}
.employee-item:hover { background: var(--surface-2); }

.emp-check {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid; flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: white; font-weight: 700;
  transition: all .15s;
}

.emp-info { flex: 1; min-width: 0; }
.emp-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emp-role { font-size: 10px; color: var(--text-2); }

.emp-actions { display: none; gap: 2px; }
.employee-item:hover .emp-actions { display: flex; }

.act-btn {
  background: none; border: none; cursor: pointer;
  font-size: 12px; color: var(--text-2);
  padding: 2px 4px; border-radius: 3px;
}
.act-btn:hover { background: var(--border); color: var(--text-1); }

/* ─── Bibliothèque de tâches ─── */
.task-search { margin-bottom: 6px; }
.search-input {
  width: 100%; padding: 5px 10px;
  border: 1px solid var(--border); border-radius: 20px;
  font-size: 12px; outline: none;
  background: var(--surface-2); font-family: inherit;
}
.search-input:focus { border-color: var(--primary); background: var(--surface); }

.task-library { display: flex; flex-direction: column; }

.task-cat {
  font-size: 10px; font-weight: 700;
  color: var(--text-3); text-transform: uppercase;
  padding: 8px 6px 2px; letter-spacing: .5px;
}

.task-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: var(--radius-sm);
  cursor: grab; transition: background .12s;
  user-select: none;
}
.task-item:hover { background: var(--surface-2); }
.task-item:active { cursor: grabbing; opacity: .7; }

.task-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.task-info { flex: 1; min-width: 0; }
.task-name { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-dur  { font-size: 10px; color: var(--text-2); }

.task-actions { display: none; gap: 2px; }
.task-item:hover .task-actions { display: flex; }

/* ═══ CALENDAR MAIN ═══ */
.calendar-main { flex: 1; overflow: auto; position: relative; }
.calendar-view  { height: 100%; }

/* ─── VUE MOIS ─── */
.month-view { display: flex; flex-direction: column; height: 100%; }

.month-names-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}
.month-day-name {
  text-align: center; padding: 8px 4px;
  font-size: 11px; font-weight: 700;
  color: var(--text-2); text-transform: uppercase; letter-spacing: .5px;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  flex: 1;
  border-left: 1px solid var(--border);
}

.month-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px; min-height: 90px;
  cursor: pointer; transition: background .1s;
  overflow: hidden; position: relative;
}
.month-cell:hover { background: #f1f3f4; }
.month-cell.today-col { background: #f5f5f5; border: 1.5px solid #e53935; }
.wcol.today-col { background: #f5f5f5; border-left: 2px solid #e53935; border-right: 2px solid #e53935; }
.month-cell.other-month { background: var(--surface-2); }
/* Jour férié — bleu ciel pâle */
.month-cell.day-ferie { background: #e3f2fd; }
.month-cell.day-ferie .day-num { color: #1565c0; }
.wcol.day-ferie { background: #e3f2fd; }
.wdh.day-ferie .wdh-name, .wdh.day-ferie .wdh-num { color: #1565c0; }

/* Dimanche — rose très pâle */
.month-cell.day-sunday { background: #fce4ec; }
.month-cell.day-sunday .day-num { color: #ad1457; }
.wcol.day-sunday { background: #fce4ec; }
.wdh.day-sunday .wdh-name, .wdh.day-sunday .wdh-num { color: #ad1457; }

/* Jour actuel — gris très pâle (déjà géré par today-col) */
.today-col { background: #f5f5f5 !important; }
.month-cell.drop-active { background: var(--primary-light) !important; outline: 2px dashed var(--primary); }

/* ─── Label férié ─── */
.wdh-ferie {
  display: block; font-size: 10px; font-weight: 600;
  color: #b71c1c; opacity: .7;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; margin-top: 1px;
}
.month-ferie-label {
  font-size: 10px; font-weight: 600; color: #b71c1c; opacity: .65;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 2px; margin-top: 1px;
}
.col-ferie-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  font-size: 48px; font-weight: 800; letter-spacing: 6px;
  color: #b71c1c; opacity: .18;
  white-space: nowrap; pointer-events: none;
  text-transform: uppercase; z-index: 0;
  user-select: none;
}

.day-num {
  font-size: 13px; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; margin-bottom: 2px; font-weight: 400;
}
.day-num.today { background: var(--primary); color: white; font-weight: 700; }
.month-cell.other-month .day-num { color: var(--text-3); }

.event-chip {
  display: flex; align-items: center; gap: 3px;
  padding: 1px 5px; border-radius: 10px;
  font-size: 11px; margin-bottom: 2px;
  cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  color: white; font-weight: 500;
  transition: filter .12s;
}
.event-chip:hover { filter: brightness(.88); }
.event-chip-dot { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.8); flex-shrink: 0; }

.more-chips {
  font-size: 11px; color: var(--text-2);
  padding: 1px 5px; cursor: pointer; border-radius: 10px;
}
.more-chips:hover { background: var(--border); }

/* ─── VUE SEMAINE & JOUR ─── */
.week-view, .day-view { display: flex; flex-direction: column; height: 100%; background: var(--surface); }

.week-header, .day-view-header {
  display: flex; border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}

.time-gutter { width: 52px; flex-shrink: 0; border-right: 1px solid var(--border); }
.week-gutter-info {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
}
.gutter-week  { font-size: 11px; font-weight: 800; color: #1a237e; line-height: 1; }
.gutter-month { font-size: 10px; font-weight: 500; color: var(--text-3); line-height: 1; }

.week-day-headers { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); }
.day-col-header   { flex: 1; }

.wdh {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 4px 4px;
  border-right: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
}
.wdh:hover { background: var(--surface-2); }
.wdh:last-child { border-right: none; }

.wdh-name { display: inline; font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; }
.wdh-num  {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 13px; font-weight: 400;
}
.wdh-num.today { background: var(--primary); color: white; font-weight: 600; }

.day-view-hdr { flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.day-pill {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px 14px; border-radius: 20px;
  font-size: 15px; font-weight: 600; color: var(--text-1);
  background: var(--surface-2); border: 1px solid var(--border);
  white-space: nowrap; margin-top: 2px;
}
.day-pill.today { background: var(--primary); color: #fff; border-color: var(--primary); }

.week-body, .day-body { display: flex; flex: 1; overflow-y: auto; }

/* ─── Bandeau repos ─── */
.repos-band { display: flex; border-bottom: 2px solid var(--border); background: var(--surface-2); flex-shrink: 0; }
.repos-band-gutter { background: transparent; border-right: 1px solid var(--border); }
.repos-band-cols { display: flex; flex: 1; }
.repos-band-cell {
  flex: 1; min-height: 28px; max-height: 64px; padding: 3px 2px;
  border-right: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 2px; align-content: flex-start;
  overflow-y: auto;
}
.repos-band-cell:last-child { border-right: none; }
.repos-chip {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 4px;
  border-radius: 4px; cursor: pointer;
  font-size: 10px; font-weight: 700; color: #fff;
  user-select: none;
}
.repos-chip-code { pointer-events: none; }
#repos-band-tip {
  display: none;
  position: fixed; z-index: 700;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px;
  font-size: 12px; color: var(--text-1); line-height: 1.6;
  white-space: nowrap; box-shadow: var(--shadow-md);
  pointer-events: none;
}

.time-col {
  width: 52px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding-top: 0;
}
.time-lbl {
  height: calc(var(--hour-h) / 4);
  display: flex; align-items: flex-start;
  justify-content: flex-end;
  padding: 0 6px 0 0;
  font-size: 10px; color: var(--text-3);
  transform: translateY(-6px);
}
.time-lbl-quarter { color: transparent; }

.week-cols { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); position: relative; }
.day-col-wrap { flex: 1; position: relative; }

.wcol {
  border-right: 1px solid var(--border);
  position: relative; cursor: pointer;
}
.wcol:last-child { border-right: none; }

/* ─── Ligne heure courante ─── */
.now-line {
  position: absolute; left: 0; right: 0;
  height: 2px; background: #e53935;
  z-index: 10; pointer-events: none;
}
.now-dot {
  position: absolute; left: -5px; top: -4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #e53935;
}

.hour-row {
  height: calc(var(--hour-h) / 4);
  border-bottom: 1px dashed #ebebeb;
}
.hour-row:not(.quarter) { border-top: 1px solid var(--border); }
.hour-row:hover { background: var(--primary-light); }

.cal-event {
  position: absolute; left: 2px; right: 2px;
  border-radius: var(--radius-sm);
  padding: 2px 4px 8px;
  font-size: 11px; color: white;
  cursor: grab; overflow: hidden; z-index: 5;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: box-shadow .12s, opacity .12s;
  user-select: none;
}
.cal-event:hover  { box-shadow: var(--shadow-md); z-index: 6; }
.cal-event.dragging { opacity: .75; z-index: 20; box-shadow: var(--shadow-lg); cursor: grabbing; }
/* ─── Sélection & copier-coller ─── */
.cal-event.evt-selected { outline: 3px solid #fff; outline-offset: -2px; filter: brightness(1.15); }
.paste-mode .hour-row   { cursor: crosshair; }
.paste-banner {
  position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%);
  background: #1a237e; color: #fff;
  padding: 10px 18px; border-radius: 24px;
  font-size: 13px; z-index: 2100;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  display: flex; align-items: center; gap: 14px;
  animation: slideUp .2s ease;
}
.paste-banner button {
  background: rgba(255,255,255,.2); border: none; color: #fff;
  border-radius: 12px; padding: 3px 10px; cursor: pointer; font-size: 12px;
}
.paste-banner button:hover { background: rgba(255,255,255,.35); }

.cal-event-title   { font-size: 11px; font-weight: 700; line-height: 1.3; padding-right: 16px; }
.cal-event-code    { font-size: 13px; font-weight: 900; letter-spacing: 1px; line-height: 1.2; }
.cal-event-repos   { box-shadow: inset 0 0 0 1px #e0e0e0; }
.cal-event-repos .cal-event-del { color: #9e9e9e; }
.cal-event-repos .cal-event-title,
.cal-event-repos .cal-event-service,
.cal-event-repos .cal-event-code,
.cal-event-repos .cal-event-task,
.cal-event-repos .cal-event-time { color: #333; }
.cal-event-night-badge { font-size: 9px; font-weight: 700; background: rgba(0,0,0,.25);
  border-radius: 4px; padding: 1px 4px; display: inline-block; margin-bottom: 2px; }
.cal-event-comp-badge {
  position: absolute; bottom: 18px; left: 3px;
  width: 13px; height: 13px; border-radius: 3px;
  background: rgba(0,0,0,.25); color: #fff;
  font-size: 8px; font-weight: 900; line-height: 13px; text-align: center;
}

/* ─── Menu contextuel ─── */
.ctx-menu {
  display: none; position: fixed; z-index: 800;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 0;
  box-shadow: var(--shadow-md); min-width: 200px;
}
.ctx-item {
  padding: 8px 16px; font-size: 13px; cursor: pointer;
  color: var(--text-1); white-space: nowrap;
}
.ctx-item:hover { background: var(--primary-light); }
.ctx-item.ctx-danger { color: var(--danger); }
.ctx-item.ctx-danger:hover { background: #fce4ec; }

/* ─── Section compensation (modal) ─── */
.compens-section { margin-bottom: 12px; }
.compens-summary {
  font-size: 11px; color: var(--text-3); cursor: pointer;
  list-style: none; padding: 4px 0; user-select: none;
  display: flex; align-items: center; gap: 6px;
}
.compens-summary::-webkit-details-marker { display: none; }
.compens-summary::before { content: '▸'; font-size: 10px; }
details[open] .compens-summary::before { content: '▾'; }
.compens-badge {
  background: #fff3e0; color: #e65100;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px;
}
.compens-body { padding: 8px 0 4px; display: flex; flex-direction: column; gap: 6px; }
.cal-event-service { font-size: 10px; font-weight: 600; opacity: .85; line-height: 1.2;
                     font-style: italic; }
.cal-event-task    { font-size: 10px; font-weight: 400; opacity: .9; line-height: 1.2; }
.cal-event-time    { font-size: 10px; opacity: .9; }
.cal-event-notes   { font-size: 10px; opacity: .75; line-height: 1.2;
                     white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event-emp     { font-size: 10px; opacity: .8; }

/* Bouton supprimer */
.cal-event-del {
  position: absolute; top: 2px; right: 2px;
  width: 14px; height: 14px;
  background: rgba(0,0,0,.25); border: none;
  border-radius: 50%; color: white;
  font-size: 10px; line-height: 1;
  cursor: pointer; display: none;
  align-items: center; justify-content: center;
  padding: 0;
}
.cal-event:hover .cal-event-del { display: flex; }
.cal-event-del:hover { background: rgba(0,0,0,.5); }

/* Poignée de redimensionnement */
.cal-event-resize {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 7px; cursor: s-resize;
  display: flex; align-items: center; justify-content: center;
}
.cal-event-resize::after {
  content: '';
  display: block; width: 20px; height: 2px;
  background: rgba(255,255,255,.5);
  border-radius: 2px;
}

/* Ligne heure courante */
.now-line {
  position: absolute; left: 0; right: 0; height: 2px;
  background: var(--danger); z-index: 8; pointer-events: none;
}
.now-dot {
  position: absolute; left: -4px; top: -4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--danger);
}

/* ─── VUE AGENDA ─── */
.agenda-view { padding: 16px 20px; max-width: 820px; margin: 0 auto; }

.agenda-month-sep {
  font-size: 18px; font-weight: 400;
  color: var(--text-2); margin: 24px 0 12px;
  padding-bottom: 6px; border-bottom: 2px solid var(--border);
}

.agenda-day  { display: flex; gap: 16px; margin-bottom: 6px; }

.agenda-date {
  width: 72px; flex-shrink: 0;
  text-align: right; padding-top: 10px;
}
.agenda-dnum { font-size: 22px; font-weight: 300; line-height: 1; }
.agenda-dname { font-size: 11px; color: var(--text-2); text-transform: uppercase; }
.agenda-date.today .agenda-dnum { color: var(--primary); font-weight: 600; }

.agenda-evts { flex: 1; padding-top: 10px; }

.agenda-evt {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius);
  margin-bottom: 5px; cursor: pointer;
  border-left: 4px solid; background: var(--surface);
  box-shadow: var(--shadow-sm); transition: box-shadow .15s;
}
.agenda-evt:hover { box-shadow: var(--shadow-md); }

.agenda-evt-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; }
.agenda-evt-body { flex: 1; }
.agenda-evt-title { font-size: 14px; font-weight: 500; }
.agenda-evt-meta  { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.status-badge {
  padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.s-pending    { background: #fff3e0; color: #e65100; }
.s-inprogress { background: #e3f2fd; color: #1565c0; }
.s-done       { background: #e8f5e9; color: #2e7d32; }

.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-2);
}
.empty-icon { font-size: 52px; margin-bottom: 12px; }

/* ═══ MODAL ═══ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface); border-radius: var(--radius);
  width: 100%; max-width: 480px;
  max-height: 92vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in .18s ease;
}

@keyframes modal-in {
  from { transform: scale(.95); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.modal-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 17px; font-weight: 500; }

.modal-body { padding: 18px; }

.form-group { margin-bottom: 14px; }

.form-label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--text-2); margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: .5px;
}

.form-control {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; outline: none;
  transition: border-color .15s;
  font-family: inherit; color: var(--text-1);
  background: var(--surface);
}
.form-control:focus { border-color: var(--primary); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ─── Onglets fiche employé ─── */
.emp-tabs {
  display: flex; gap: 2px; margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}
.emp-tab {
  background: none; border: none; cursor: pointer;
  padding: 7px 10px; font-size: 12px; font-weight: 600;
  color: var(--text-2); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.emp-tab:hover { color: #1a237e; }
.emp-tab.active { color: #1a237e; border-bottom-color: #1a237e; }
.emp-tab-panel { display: none; }
.emp-tab-panel.active { display: block; }
.tab-empty { font-size: 13px; color: var(--text-3); padding: 20px 0; text-align: center; }

/* ─── Page Contrôle et assistance ─── */
.ctrl-summary {
  padding: 14px 20px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600;
}
.ctrl-ok   { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.ctrl-warn { background: #fff8e1; color: #e65100; border: 1px solid #ffcc80; }
.ctrl-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
}
.ctrl-section-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}
.ctrl-icon { font-size: 18px; }
.ctrl-section-titre { font-size: 14px; font-weight: 700; color: var(--text-1); flex: 1; }
.ctrl-badge {
  font-size: 11px; font-weight: 700; padding: 2px 10px;
  border-radius: 20px;
}
.ctrl-badge-ok  { background: #e8f5e9; color: #0b8043; }
.ctrl-badge-err { background: #fce4ec; color: #c62828; }
.ctrl-section-desc { font-size: 12px; color: var(--text-2); margin: 0 0 10px; }
.ctrl-skipped { font-size: 12px; color: var(--text-3); font-style: italic; margin: 0; }
.ctrl-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ctrl-table th {
  text-align: left; padding: 5px 10px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-2); border-bottom: 2px solid var(--border);
}
.ctrl-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ctrl-table tr:last-child td { border-bottom: none; }
.ctrl-table tr:hover td { background: var(--surface-2); }
.ctrl-emp-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.ctrl-emp-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.ctrl-emp-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.ctrl-emp-name  { font-size: 14px; font-weight: 700; color: var(--text-1); flex: 1; }
.ctrl-emp-icons { font-size: 16px; letter-spacing: 2px; }

.ctrl-emp-dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:5px; vertical-align:middle; }

@media print {
  /* ─── Pages internes (contrôle, etc.) ─── */
  .page-header, #btn-print, #ctrl-view-toggle { display: none !important; }
  .page-body { margin:0; padding:6px; overflow:visible !important; }
  .ctrl-summary { font-size:10px; padding:6px 10px; margin-bottom:6px; }
  .ctrl-emp-card { break-inside:avoid; margin-bottom:6px; }
  .ctrl-emp-header { padding:5px 8px; }
  .ctrl-emp-name  { font-size:11px; }
  .ctrl-emp-icons { font-size:11px; }
  .ctrl-badge     { font-size:9px; padding:1px 6px; }
  .ctrl-table     { font-size:9px; }
  .ctrl-table th,
  .ctrl-table td  { padding:3px 6px; }
  .ctrl-emp-avatar { width:20px; height:20px; font-size:8px; }

  /* ─── Agenda principal (index.html) ─── */
  .app-header, #prefs-panel, #prefs-overlay, .readonly-banner,
  .icon-rail, .flyout-panel, #flyout-overlay, #sidebar-overlay,
  .mobile-nav, #float-tasks, #modal-overlay,
  #toast, #toast-readonly, .ctx-menu, .present-popup,
  #btn-presents-popup, #emp-bar { display: none !important; }

  body, #app { background: #fff !important; }

  .app-body {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
  }

  .calendar-main {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .calendar-view {
    overflow: visible !important;
    height: auto !important;
  }

  /* Empêcher la coupure au milieu des événements */
  .cal-event { break-inside: avoid; }
}

/* ─── Page Congés annuels ─── */
.ca-page-body { flex-direction:column; overflow-y:auto; padding:16px 20px; gap:20px; }
.ca-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; }
.ca-section-title { font-size: 14px; font-weight: 700; color: var(--text-1); margin: 0 0 14px; text-transform: uppercase; letter-spacing: .5px; }
.ca-section-title-inline { margin: 0; }
.ca-section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.ca-soldes-grid { display: grid; grid-template-columns: repeat(auto-fill, 180px); gap: 12px; }
.ca-card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; width: 180px;
  display: flex; flex-direction: column; gap: 4px;
}
.ca-card-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color:#fff; font-size:12px; font-weight:700; margin-bottom:4px; }
.ca-card-name { font-size: 13px; font-weight: 600; color: var(--text-1); margin-bottom: 6px; }
.ca-card-row { display: flex; justify-content: space-between; font-size: 12px; }
.ca-card-solde { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; font-weight: 700; }
.ca-card-accrual { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.ca-label { color: var(--text-2); }
.ca-pos { color: #0b8043; font-weight: 600; }
.ca-neg { color: var(--danger); font-weight: 600; }
.ca-solde-pos  { color: #0b8043; }
.ca-solde-neg  { color: var(--danger); }
.ca-solde-zero { color: var(--text-3); }
.ca-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ca-table th { text-align: left; padding: 6px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-2); border-bottom: 2px solid var(--border); }
.ca-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ca-table tr:last-child td { border-bottom: none; }
.ca-table tr:hover td { background: var(--surface-2); }
.ca-emp-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.ca-type-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.ca-type-credit_mensuel { background: #e8f5e9; color: #0b8043; }
.ca-type-debit_agenda   { background: #fce4ec; color: #c62828; }
.ca-type-reintegration  { background: #e3f2fd; color: #1565c0; }
.ca-type-ajustement     { background: #fff8e1; color: #f57f17; }

/* Toggle switch (fiche employé — onglet Autre) */
.toggle-inline { display:flex; align-items:center; gap:10px; padding:14px 0; }
.toggle-label { font-size:14px; font-weight:500; color:var(--text-1); cursor:pointer; line-height:1.4; }
.toggle-hint { font-size:12px; color:var(--text-3); font-weight:400; }
.toggle-switch { position:relative; display:inline-block; width:44px; height:24px; flex-shrink:0; cursor:pointer; }
.toggle-switch input { opacity:0; width:0; height:0; }
.toggle-thumb {
  position:absolute; inset:0; background:#ccc; border-radius:24px;
  transition:background .2s;
}
.toggle-thumb::before {
  content:''; position:absolute; width:18px; height:18px; left:3px; top:3px;
  background:#fff; border-radius:50%; transition:transform .2s;
  box-shadow:0 1px 3px rgba(0,0,0,.3);
}
.toggle-switch input:checked + .toggle-thumb { background:var(--primary); }
.toggle-switch input:checked + .toggle-thumb::before { transform:translateX(20px); }
/* Badge masqué compteurs dans la liste */
.emp-hidden-badge { font-size:15px; color:#1a237e; vertical-align:middle; }

.form-actions {
  display: flex; gap: 8px;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  margin-top: 14px;
}

.btn-secondary {
  padding: 7px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface);
  cursor: pointer; font-size: 13px; font-family: inherit;
  transition: background .15s; color: var(--text-1);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-danger {
  padding: 7px 14px; border: none;
  border-radius: var(--radius-sm); background: var(--danger);
  color: white; cursor: pointer; font-size: 13px;
  margin-right: auto; font-family: inherit;
}
.btn-danger:hover { filter: brightness(.9); }

/* Couleurs */
.color-options { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.color-opt {
  width: 22px; height: 22px; border-radius: 50%;
  cursor: pointer; border: 3px solid transparent;
  transition: border-color .12s, transform .12s;
}
.color-opt:hover { transform: scale(1.18); }
.color-opt.sel   { border-color: var(--text-1); }
.color-custom-row {
  display: flex; align-items: center; gap: 10px; margin-top: 4px;
}
.color-custom-label { font-size: 12px; color: var(--text-2); }
.color-custom-input {
  width: 36px; height: 28px; padding: 2px; border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer; background: none;
}

/* Statuts */
.status-opts { display: flex; gap: 6px; }
.status-opt {
  flex: 1; padding: 6px 4px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  text-align: center; cursor: pointer;
  font-size: 11px; font-weight: 500;
  transition: all .15s;
}
.status-opt.sel { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

/* ═══ TOAST ═══ */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: #323232; color: white;
  padding: 9px 20px; border-radius: 20px;
  font-size: 13px; z-index: 2000;
  box-shadow: var(--shadow-md);
  border: 3px solid #1a237e;
  pointer-events: none;
}
.toast.hidden { display: none; }

#toast-readonly {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.8);
  background: rgba(30,30,30,.92); color: #fff;
  padding: 14px 28px; border-radius: 12px;
  font-size: 15px; font-weight: 600; letter-spacing: .3px;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
  pointer-events: none; z-index: 9999;
  opacity: 0; transition: opacity .18s, transform .18s;
}
#toast-readonly.toast-center-show {
  opacity: 1; transform: translate(-50%, -50%) scale(1);
}

/* ─── Fenêtre flottante ─── */
.float-win {
  position: fixed; z-index: 500;
  top: 120px; left: 80px;
  width: 240px; min-width: 180px; min-height: 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  max-height: 90vh;
  user-select: none;
}
.float-win-resize {
  position: absolute; bottom: 0; right: 0;
  width: 18px; height: 18px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 40%, var(--border) 40%, var(--border) 60%, transparent 60%),
              linear-gradient(135deg, transparent 55%, var(--border) 55%, var(--border) 75%, transparent 75%);
  border-radius: 0 0 12px 0;
  opacity: .6;
}
.float-win-resize:hover { opacity: 1; }
.float-win.hidden { display: none; }
.float-win.minimized .float-win-body,
.float-win.minimized .float-drawer,
.float-win.minimized .float-win-resize { display: none; }
.float-win.minimized { height: auto !important; }
.float-win-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 8px;
  background: #1a237e; color: #fff;
  border-radius: 12px 12px 0 0;
  cursor: grab; font-size: 13px; font-weight: 600;
}
.float-win-header:active { cursor: grabbing; }
.float-win-header .icon-btn { color: #fff; opacity: .8; }
.float-win-header .icon-btn:hover { opacity: 1; background: rgba(255,255,255,.15); }
.float-win-search { padding: 8px 10px 4px; }

.float-win-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* ─── Tiroirs fenêtre flottante ─── */
.float-drawer { display: flex; flex-direction: column; min-height: 0; }
.float-drawer:has(.float-drawer-body:not(.collapsed)) { flex: 1; }

.float-drawer-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 5px 10px;
  background: #e8eaf6; border: none;
  border-top: 2px solid #1a237e;
  color: #1a237e; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  cursor: pointer; flex-shrink: 0;
  transition: background .15s;
}
.float-drawer-btn:hover { background: #c5cae9; }
.float-drawer-btn .flyout-group-arrow { transition: transform .2s; font-size: 13px; color: #1a237e; }
.float-drawer-btn.open .flyout-group-arrow { transform: rotate(90deg); }

.float-drawer-btn-right { display: flex; align-items: center; gap: 6px; }
.float-drawer-add {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: #1a237e; color: #fff;
  font-size: 13px; font-weight: 700; line-height: 1;
  text-decoration: none;
  transition: background .15s, transform .15s;
}
.float-drawer-add:hover { background: #283593; transform: scale(1.15); }

.float-drawer-body {
  flex: 1; overflow-y: auto;
  padding: 0 6px 4px;
}
.float-drawer-body.collapsed { display: none; }

.float-drawer-search { padding: 4px 0 2px; }
.float-task-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px; border-radius: 5px;
  border: 1px solid var(--border); margin-bottom: 3px;
  background: var(--surface-2); cursor: grab;
  font-size: 11px; transition: background .15s, border-color .15s;
}
.float-task-item:hover { background: var(--primary-light); border-color: var(--primary); }
.float-task-item:active { cursor: grabbing; opacity: .7; }
.float-task-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.float-task-info { flex: 1; min-width: 0; }
.float-task-title { font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.float-task-time  { font-size: 10px; color: var(--text-3); }

/* ─── Bouton présents ─── */
.present-btn { position:relative; }
.present-badge {
  position:absolute; top:-4px; right:-4px;
  min-width:16px; height:16px; border-radius:8px;
  background:var(--primary); color:#fff;
  font-size:9px; font-weight:700; line-height:16px;
  text-align:center; padding:0 3px;
  pointer-events:none;
}
/* 5 états selon le nb de présents : 0/1-2/3-4/5-6/7+ */
.present-btn[data-state="0"]  { color:var(--text-3); }
.present-btn[data-state="1"]  { color:#90caf9; }
.present-btn[data-state="2"]  { color:#42a5f5; }
.present-btn[data-state="3"]  { color:#1e88e5; }
.present-btn[data-state="4"]  { color:#1565c0; }
/* Intensité p1/p2 selon état */
.present-btn[data-state="0"] .p1,
.present-btn[data-state="0"] .p2 { opacity:.2; }
.present-btn[data-state="1"] .p1  { opacity:1; }
.present-btn[data-state="1"] .p2  { opacity:.25; }
.present-btn[data-state="2"] .p1,
.present-btn[data-state="2"] .p2  { opacity:.7; }
.present-btn[data-state="3"] .p1,
.present-btn[data-state="3"] .p2  { opacity:.9; }
.present-btn[data-state="4"] .p1,
.present-btn[data-state="4"] .p2  { opacity:1; }

/* ─── Popup présents ─── */
.presents-popup {
  position:fixed; top:calc(var(--header-h) + 8px); right:120px; z-index:600;
  width:320px; max-height:70vh;
  background:var(--surface); border:1px solid var(--border);
  border-radius:12px; box-shadow:var(--shadow-lg);
  display:flex; flex-direction:column; overflow:hidden;
}
.presents-popup.hidden { display:none; }
.presents-popup-header {
  display:flex; align-items:center; gap:8px; padding:10px 14px;
  background:#1a237e; color:#fff; border-radius:12px 12px 0 0;
  flex-shrink:0;
}
.presents-popup-title { font-size:13px; font-weight:700; flex:1; }
.presents-popup-time  { font-size:11px; opacity:.75; }
.presents-popup-body  { overflow-y:auto; padding:8px 0; }
.presents-group + .presents-group { border-top:1px solid var(--border); }
.presents-service-label {
  font-size:12px; font-weight:700; text-transform:uppercase;
  letter-spacing:.5px; color:#5c6bc0;
  padding:8px 14px 4px;
}
.presents-row {
  display:flex; align-items:center; gap:8px;
  padding:5px 14px; font-size:12px;
}
.presents-row:hover { background:var(--surface-2); }
.presents-avatar {
  width:24px; height:24px; border-radius:50%; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-size:9px; font-weight:700;
}
.presents-name       { font-weight:600; color:var(--text-1); flex:1; min-width:0; }
.presents-task-info  { display:flex; flex-direction:column; align-items:flex-end; gap:1px; min-width:0; }
.presents-task-title { font-size:11px; color:var(--text-2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:120px; }
.presents-task-times { font-size:10px; color:var(--primary); font-weight:600; white-space:nowrap; }
.presents-empty      { padding:20px; text-align:center; color:var(--text-3); font-size:13px; }
.presents-toggle     { cursor:pointer; user-select:none; display:flex; align-items:center; gap:6px; }
.presents-toggle:hover { background:rgba(0,0,0,.04); }
.presents-arrow      { font-size:10px; color:var(--text-3); }
.presents-count      { background:var(--primary-light); color:var(--primary); border-radius:10px; font-size:10px; font-weight:700; padding:0 6px; margin-left:auto; }

.float-tasks-btn {
  position: fixed; bottom: 24px; right: 24px; z-index: 499;
  width: 44px; height: 44px; border-radius: 50%;
  background: #1a237e; color: #fff; border: none;
  font-size: 20px; cursor: pointer; box-shadow: var(--shadow-md);
  transition: background .15s, transform .15s;
}
.float-tasks-btn:hover { background: #283593; transform: scale(1.08); }

/* ─── Confirm dialog ─── */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .15s ease;
}
.confirm-overlay.hidden { display: none; }
.confirm-box {
  background: var(--surface); border-radius: 16px;
  padding: 28px 28px 20px;
  width: auto; min-width: 320px; max-width: 90vw; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: slideUp .18s ease;
}
.confirm-msg div { white-space: nowrap; }
.confirm-icon { font-size: 36px; margin-bottom: 12px; }
.confirm-title {
  font-size: 16px; font-weight: 700; color: #1a237e;
  margin-bottom: 8px;
}
.confirm-msg {
  font-size: 13px; color: var(--text-2);
  margin-bottom: 22px; line-height: 1.8;
  text-align: left;
}
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* Dialog équivalent travail repos */
.equiv-radio-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--border); cursor: pointer;
  transition: background .15s;
}
.equiv-radio-row:has(input:checked) { background: var(--primary-light); border-color: var(--primary); }
.equiv-radio-label { flex: 1; font-size: 13px; font-weight: 500; color: var(--text-1); }
.equiv-val-input { text-align: right; }
.equiv-val-input:disabled { background: var(--surface-2); color: var(--text-3); }
.equiv-unit { font-size: 12px; color: var(--text-2); }
.confirm-actions .btn-secondary { flex: 1; }
.confirm-actions .btn-danger {
  flex: 1; background: #e53935; color: #fff;
  border: none; border-radius: var(--radius-sm);
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.confirm-actions .btn-danger:hover { background: #c62828; }
@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ═══ MOBILE NAV ═══ */
.mobile-nav { display: none; }

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 800px) {
  :root { --sidebar-w: 280px; }

  .sidebar {
    position: fixed;
    left: 0; top: var(--header-h); bottom: 0;
    z-index: 90;
    transform: translateX(calc(-1 * var(--sidebar-w)));
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.3);
    z-index: 80;
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
  }
  .sidebar-overlay.active { opacity: 1; pointer-events: all; }

  .logo-text { display: none; }
  .btn-label { display: none; }
  .view-switcher { display: none; }
  .period-label { font-size: 14px; }

  .emp-bar { top: var(--header-h); }
  .app-body { margin-bottom: var(--mobile-nav-h); }
  .emp-card-name { max-width: 80px; overflow: hidden; text-overflow: ellipsis; }

  .mobile-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--mobile-nav-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 100; box-shadow: 0 -2px 8px rgba(0,0,0,.08);
  }
  .mobile-nav-btn {
    flex: 1; border: none; background: none;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px; cursor: pointer;
    font-size: 10px; color: var(--text-2);
    transition: color .15s;
  }
  .mobile-nav-btn.active { color: var(--primary); }
  .mobile-nav-icon { font-size: 18px; }

  .month-cell { min-height: 60px; }
  .event-chip span:not(.event-chip-dot) { display: none; }
  .event-chip { min-width: 8px; padding: 3px; justify-content: center; }
}

@media (max-width: 480px) {
  .btn-today { padding: 5px 10px; font-size: 12px; }
  .period-label { display: none; }
  .form-row { grid-template-columns: 1fr; }
}
