/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #232637;
  --border: #2e3145;
  --accent: #5b8dee;
  --accent-hover: #7aa3f5;
  --text: #e0e3f0;
  --text-muted: #7a7f9a;
  --col-normal: #c8843c;       /* brun-orangé Excel */
  --col-holiday: #5b9bd5;      /* bleu clair Excel */
  --col-weekend-bg: #111216;
  --col-weekend-hdr: #222;
  --success: #4caf50;
  --danger: #e53935;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body { height: 100%; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0d0f1a 0%, #141726 100%);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo svg { width: 56px; height: 56px; margin-bottom: 12px; }
.login-logo h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 7px; }
.form-group input {
  width: 100%; padding: 11px 14px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px;
  transition: border-color .2s;
  outline: none;
}
.form-group input:focus { border-color: var(--accent); }

.btn-login {
  width: 100%; padding: 12px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .2s;
  margin-top: 6px;
}
.btn-login:hover { background: var(--accent-hover); }

.login-error {
  display: none;
  background: rgba(229,57,53,0.15);
  border: 1px solid rgba(229,57,53,0.4);
  color: #ef9a9a;
  border-radius: 7px; padding: 10px 14px;
  font-size: 13px; margin-top: 14px; text-align: center;
}

/* ============================================================
   APP SCREEN
   ============================================================ */
#app-screen { display: none; min-height: 100vh; flex-direction: column; }

/* TOP BAR */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 20px; height: 56px; position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-logo { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; }
.topbar-logo span { color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-badge {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 14px;
  font-size: 13px; font-weight: 600;
}
.btn-logout {
  padding: 6px 14px; background: transparent;
  border: 1px solid var(--border); border-radius: 7px;
  color: var(--text-muted); font-size: 13px; cursor: pointer;
  transition: all .2s;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

/* TABS */
.tabs {
  display: flex; gap: 4px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 20px;
}
.tab-btn {
  padding: 12px 20px; background: transparent;
  border: none; border-bottom: 3px solid transparent;
  color: var(--text-muted); font-size: 14px; font-weight: 500;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  transition: all .2s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* MAIN CONTENT */
.main-content { flex: 1; padding: 24px 20px; overflow-x: auto; }

/* ============================================================
   SCHEDULE TAB
   ============================================================ */
.schedule-header {
  display: flex; flex-direction: column;
  margin-bottom: 20px; gap: 10px;
}
.period-nav { display: flex; align-items: center; gap: 14px; }
.period-nav h2 { font-size: 20px; font-weight: 700; min-width: 200px; text-align: center; }
.schedule-header-controls {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
}
.period-toggle { display: none; } /* caché sur PC, affiché sur mobile via media query */
.month-nav { display: flex; align-items: center; gap: 14px; }
.btn-nav {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.btn-nav:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.btn-nav:disabled { opacity: 0.3; cursor: default; }

/* SCHEDULE GRID */
.schedule-grid-wrap { overflow-x: auto; width: 100%; }
#schedule-grid { width: 100%; }

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

/* All cells (th and td) share base style */
.schedule-table th,
.schedule-table td {
  height: 40px;
  text-align: center;
  vertical-align: middle;
  font-size: 11px; font-weight: 600;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  padding: 0 1px;
}

/* Name column */
.name-cell {
  width: 110px;
  min-width: 90px;
  text-align: left;
  padding: 0 10px;
  background: var(--surface);
  border-right: 2px solid var(--border);
  position: sticky; left: 0; z-index: 10;
  white-space: nowrap;
}
.person-code { font-weight: 700; font-size: 13px; color: var(--accent); display: block; }
.person-fullname { font-size: 10px; color: var(--text-muted); display: block; }

/* Header row */
.header-row th { background: var(--surface2); height: 50px; }
.day-header { }
.day-header-inner { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.day-num { font-size: 12px; font-weight: 700; display: block; }
.day-name { font-size: 9px; color: var(--text-muted); font-weight: 400; display: block; }

/* Day type colors in header */
.header-row .normal-col { color: var(--col-normal); }
.header-row .holiday-col { color: var(--col-holiday); }
.header-row .weekend-col { background: var(--col-weekend-hdr) !important; color: #444; }

/* Data cells */
.schedule-cell { cursor: default; }
.schedule-cell.weekend-col { background: #111216 !important; color: #222 !important; }
.schedule-cell.holiday-col { background: var(--surface2); }
.schedule-cell.editable { cursor: pointer; }
.schedule-cell.editable:hover { filter: brightness(1.3); outline: 2px solid rgba(255,255,255,0.3); }

/* My row highlight */
.my-row .name-cell { background: rgba(91,141,238,0.1) !important; border-left: 3px solid var(--accent); }
.my-row .schedule-cell { box-shadow: inset 0 0 0 1px rgba(91,141,238,0.15); }

/* Jours prestés */
.jp-header, .jp-cell {
  width: 50px; min-width: 48px;
  background: var(--surface2) !important; font-weight: 700;
  border-left: 2px solid var(--border);
  color: var(--accent);
}

/* Schedule header centered */
.schedule-header {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 16px; gap: 12px;
}
.month-nav {
  display: flex; align-items: center; gap: 14px;
  justify-content: center;
}
.month-nav h2 { font-size: 20px; font-weight: 700; min-width: 200px; text-align: center; }

/* Toggle view button */
.view-toggle { display: flex; gap: 6px; }
.btn-toggle {
  padding: 7px 18px; border-radius: 20px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface2); color: var(--text-muted);
  transition: all .2s;
}
.btn-toggle.is-active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn-toggle:hover:not(.is-active) { border-color: var(--text-muted); color: var(--text); }

/* Separator row */
.separator-row td {
  background: var(--border) !important;
  height: 26px;
}
.sep-label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  text-align: left; padding-left: 10px;
}

/* ============================================================
   LÉGENDE
   ============================================================ */
.legend-section {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
}
.legend-section h4 { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; }
#legend-content {
  display: flex; flex-direction: column; gap: 8px;
}
.legend-item { display: flex; align-items: center; gap: 10px; }
.legend-color {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 24px; border-radius: 4px; font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.legend-text { font-size: 12px; color: var(--text-muted); }
.legend-text strong { color: var(--text); }

/* Day type dots */
.legend-day-dot {
  width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; display: inline-block;
}
.normal-col-leg { background: var(--col-normal); }
.holiday-col-leg { background: var(--col-holiday); }
.weekend-col-leg { background: #444; }

/* ============================================================
   RÉCAPITULATIF
   ============================================================ */
#tab-recap { padding: 0; }

.recap-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 20px;
  overflow: hidden;
}
.recap-card-header {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  background: var(--surface2); border-bottom: 1px solid var(--border);
}
.recap-code { font-size: 18px; font-weight: 800; color: var(--accent); }
.recap-name { font-size: 16px; font-weight: 600; flex: 1; }
.recap-total { font-size: 13px; color: var(--text-muted); background: var(--bg); border-radius: 20px; padding: 4px 12px; }

.recap-summary {
  display: flex; flex-wrap: wrap; gap: 0;
  border-bottom: 1px solid var(--border);
}
.recap-sum-item {
  flex: 1; min-width: 80px; padding: 12px 16px;
  border-right: 1px solid var(--border); text-align: center;
}
.recap-sum-item:last-child { border-right: none; }
.rs-num { font-size: 22px; font-weight: 800; color: var(--text); }
.rs-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.recap-table-wrap { overflow-x: auto; padding: 16px 20px; }
.recap-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.recap-table th, .recap-table td {
  padding: 7px 10px; text-align: center;
  border: 1px solid var(--border);
}
.recap-table th { background: var(--surface2); font-weight: 700; color: var(--text-muted); font-size: 11px; }
.recap-table td:first-child { text-align: left; }
.recap-table .val-pos { color: var(--text); font-weight: 600; }
.recap-table .total-cell { font-weight: 800; color: var(--accent); background: var(--surface2); }
.slot-badge {
  display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 700;
}

/* ============================================================
   ADMIN
   ============================================================ */
.admin-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; margin-bottom: 20px;
}
.admin-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 14px; }
.admin-table th, .admin-table td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; }
.admin-table th { background: var(--surface2); font-weight: 700; color: var(--text-muted); font-size: 12px; }
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.role-admin { background: rgba(91,141,238,0.2); color: #7aa3f5; }
.role-user { background: rgba(76,175,80,0.2); color: #81c784; }
.role-backup { background: rgba(255,152,0,0.2); color: #ffb74d; }
.role-viewer { background: rgba(158,158,158,0.2); color: #bdbdbd; }

/* ============================================================
   MODALES
   ============================================================ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); z-index: 1000;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px 32px;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-box h3 { font-size: 17px; font-weight: 700; margin-bottom: 20px; }
.modal-box .form-group select, .modal-box .form-group input {
  width: 100%; padding: 10px 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); font-size: 14px; outline: none;
}
.modal-box .form-group select:focus, .modal-box .form-group input:focus { border-color: var(--accent); }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.btn-primary {
  padding: 10px 20px; background: var(--accent); color: #fff;
  border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .2s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  padding: 10px 20px; background: transparent;
  border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 8px; font-size: 14px; cursor: pointer;
  transition: all .2s;
}
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text); }
.btn-sm {
  padding: 5px 10px; font-size: 12px; border-radius: 5px;
  cursor: pointer; border: none;
}
.btn-edit { background: rgba(91,141,238,0.2); color: #7aa3f5; }
.btn-edit:hover { background: rgba(91,141,238,0.4); }
.checkbox-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.checkbox-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  /* Afficher le bouton Semaine/Mois sur tablette et mobile */
  .period-toggle { display: flex; }
}

@media (max-width: 768px) {
  .topbar { padding: 0 12px; }
  .main-content { padding: 16px 8px; }
  .tabs { padding: 0 8px; overflow-x: auto; }
  .tab-btn { padding: 10px 12px; font-size: 13px; white-space: nowrap; }
  .period-nav h2 { font-size: 16px; min-width: 160px; }
  .month-nav h2 { font-size: 16px; min-width: 150px; }
  .login-card { padding: 32px 24px; }
  .recap-summary { flex-direction: row; }
  .recap-sum-item { min-width: 60px; padding: 10px 8px; }
  .rs-num { font-size: 18px; }
  .recap-table { font-size: 11px; }
  .recap-table th, .recap-table td { padding: 5px 6px; }
  .name-cell { width: 80px; min-width: 70px; padding: 0 6px; }
  .schedule-table th, .schedule-table td { min-width: 26px; font-size: 10px; }
  .btn-toggle { padding: 6px 12px; font-size: 12px; }
  .schedule-header-controls { gap: 8px; }
  .export-btns { gap: 4px; }
  .btn-export { padding: 6px 10px; font-size: 11px; }
}

@media (max-width: 480px) {
  .topbar-logo { font-size: 14px; }
  .user-badge { font-size: 12px; padding: 4px 10px; }
  .period-nav h2 { font-size: 14px; min-width: 140px; }
  .month-nav h2 { font-size: 14px; min-width: 130px; }
  .name-cell { width: 60px; min-width: 52px; padding: 0 4px; }
  .person-fullname { display: none; }
  /* Vue mois sur petit écran */
  .schedule-table th, .schedule-table td { min-width: 20px; height: 34px; font-size: 9px; }
  .day-num { font-size: 9px !important; }
  .day-name { display: none; }
  .btn-toggle { padding: 5px 10px; font-size: 11px; }
  .export-btns { display: none; } /* cacher PDF sur très petit écran */
}

/* ============================================================
   VUE SEMAINE — cellules élargies et lisibles
   ============================================================ */
.week-view .schedule-table {
  table-layout: auto;
}
.week-view .schedule-table th,
.week-view .schedule-table td {
  height: 52px;
  font-size: 13px;
  padding: 4px 2px;
}
.week-view .name-cell {
  width: 90px; min-width: 80px;
}
.week-view .day-header-inner {
  gap: 3px;
}
.week-view .day-num {
  font-size: 15px !important;
}
.week-view .day-name {
  display: block !important;
  font-size: 11px !important;
}
.week-view .day-header {
  min-width: 52px;
}
/* Jour actuel mis en valeur */
.today-col .day-header-inner .day-num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
}
.today-col.schedule-cell {
  box-shadow: inset 0 0 0 2px rgba(91,141,238,0.4);
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   COMMENTAIRES SUR CELLULE
   ============================================================ */
.schedule-cell { position: relative; }

.comment-dot {
  position: absolute;
  top: 2px; right: 2px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.9;
  pointer-events: none;
  flex-shrink: 0;
}

/* Tooltip commentaire */
.comment-tooltip {
  position: fixed;
  z-index: 500;
  background: #1a1d27;
  border: 1px solid #5b8dee;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #e0e3f0;
  max-width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  pointer-events: none;
  white-space: pre-wrap;
  line-height: 1.5;
}
.comment-tooltip strong {
  display: block;
  color: #5b8dee;
  margin-bottom: 4px;
  font-size: 11px;
}

/* Bouton commentaire dans modal d'édition */
.btn-comment {
  padding: 10px 16px; background: rgba(91,141,238,0.15);
  border: 1px solid rgba(91,141,238,0.4); border-radius: 8px;
  color: #7aa3f5; font-size: 14px; cursor: pointer;
  transition: all .2s;
}
.btn-comment:hover { background: rgba(91,141,238,0.3); }

/* Bouton supprimer commentaire */
.btn-danger {
  padding: 10px 16px; background: rgba(229,57,53,0.15);
  border: 1px solid rgba(229,57,53,0.4); border-radius: 8px;
  color: #ef9a9a; font-size: 14px; cursor: pointer;
  transition: all .2s; margin-right: auto;
}
.btn-danger:hover { background: rgba(229,57,53,0.3); }

/* ============================================================
   EXPORT PDF
   ============================================================ */
.export-btns { display: flex; gap: 8px; }

.btn-export {
  padding: 7px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2); color: var(--text-muted);
  transition: all .2s; white-space: nowrap;
}
.btn-export:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   IMPRESSION PDF
   ============================================================ */
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area {
    display: block !important;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 9px;
    color: #000;
    background: #fff;
  }
  .print-page {
    page-break-after: always;
    padding: 10mm;
  }
  .print-page:last-child { page-break-after: avoid; }
  .print-title {
    font-size: 14px; font-weight: 700;
    text-align: center; margin-bottom: 8px;
    color: #1a1d27;
  }
  .print-table {
    width: 100%; border-collapse: collapse;
    table-layout: fixed;
  }
  .print-table th, .print-table td {
    border: 1px solid #ccc;
    text-align: center; vertical-align: middle;
    height: 18px; font-size: 8px; padding: 1px;
    overflow: hidden;
  }
  .print-table .print-name {
    text-align: left; padding-left: 4px;
    font-weight: 700; width: 60px;
    background: #f5f5f5;
  }
  .print-weekend { background: #e0e0e0 !important; color: #999; }
  .print-holiday { background: #dbeeff !important; color: #1565c0; font-weight: 600; }
  .print-sep { background: #e8e8e8; font-size: 7px; font-weight: 700; color: #666; text-transform: uppercase; letter-spacing: 1px; }
  .print-comment-icon { font-size: 7px; }
  .print-legend {
    margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px;
  }
  .print-legend-item {
    display: flex; align-items: center; gap: 4px; font-size: 8px;
  }
  .print-legend-color {
    width: 20px; height: 10px; border-radius: 2px; flex-shrink: 0;
    display: inline-block;
  }
  .print-comments-section {
    margin-top: 8px; font-size: 8px;
  }
  .print-comments-section h4 {
    font-size: 9px; margin-bottom: 4px; color: #333;
  }
  .print-comment-row {
    padding: 2px 0; border-bottom: 1px solid #eee;
  }
}

@media (max-width: 768px) {
  .export-btns { gap: 4px; }
  .btn-export { padding: 6px 10px; font-size: 11px; }
}
@media (max-width: 480px) {
  .btn-export { padding: 5px 8px; font-size: 10px; }
  .export-btns { flex-wrap: wrap; justify-content: center; }
}

/* ============================================================
   MODULE ALERTES
   ============================================================ */
.alert-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff;
  border-radius: 10px; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px;
  margin-left: 4px; vertical-align: middle;
}

/* Sections alertes */
.alertes-section {
  margin-bottom: 24px;
}
.alertes-section-title {
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.alertes-new-btns { display: flex; gap: 8px; }
.btn-new-request {
  padding: 6px 14px; border-radius: 7px; font-size: 12px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text-muted);
  transition: all .2s;
}
.btn-new-request:hover { border-color: var(--accent); color: var(--accent); }

/* Carte de demande */
.alert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 16px;
  margin-bottom: 12px;
  transition: border-color .2s;
}
.alert-card.pending   { border-left: 4px solid #f59e0b; }
.alert-card.approved  { border-left: 4px solid #4caf50; }
.alert-card.refused   { border-left: 4px solid #e53935; }
.alert-card.expired   { border-left: 4px solid #555; opacity: .7; }
.alert-card.action-needed { border-color: var(--accent); }

.alert-card-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px; margin-bottom: 10px;
}
.alert-card-type {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
}
.alert-card-title { font-size: 14px; font-weight: 600; margin-top: 2px; }
.alert-card-meta  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.alert-status {
  font-size: 11px; font-weight: 700; padding: 3px 8px;
  border-radius: 10px; white-space: nowrap; flex-shrink: 0;
}
.status-pending  { background: rgba(245,158,11,0.2);  color: #f59e0b; }
.status-approved { background: rgba(76,175,80,0.2);   color: #4caf50; }
.status-refused  { background: rgba(229,57,53,0.2);   color: #e53935; }
.status-expired  { background: rgba(100,100,100,0.2); color: #888; }

.alert-card-body { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.alert-card-body strong { color: var(--text); }

.alert-approvals {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.approval-chip {
  font-size: 11px; padding: 3px 10px; border-radius: 10px;
  border: 1px solid var(--border);
}
.approval-chip.done    { background: rgba(76,175,80,0.15);  color: #4caf50; border-color: #4caf50; }
.approval-chip.refused { background: rgba(229,57,53,0.15);  color: #e53935; border-color: #e53935; }
.approval-chip.waiting { background: var(--surface2); color: var(--text-muted); }

.alert-comment-block {
  background: var(--surface2); border-radius: 6px;
  padding: 8px 12px; font-size: 12px; color: var(--text-muted);
  margin-bottom: 10px; border-left: 3px solid var(--border);
}
.alert-comment-block em { color: var(--text); font-style: normal; }

.alert-card-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Modal wide */
.modal-wide { max-width: 520px; }

/* Info box dans les modals */
.ex-info-box {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 16px;
  font-size: 13px; margin-bottom: 16px;
}
.ex-info-box .slot-badge { font-size: 12px; padding: 3px 8px; }
.ex-info-box.warning { border-color: #f59e0b; background: rgba(245,158,11,0.08); color: #f59e0b; }
.ex-info-box.error   { border-color: #e53935; background: rgba(229,57,53,0.08);  color: #ef9a9a; }

/* Cibles d'échange */
.ex-target-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 7px;
  background: var(--surface2); border: 1px solid var(--border);
  margin-bottom: 6px; cursor: pointer; transition: all .2s;
}
.ex-target-item:hover { border-color: var(--accent); }
.ex-target-item input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.ex-target-name { font-weight: 600; font-size: 13px; flex: 1; }
.ex-target-slot { }

/* Alertes vides */
.alertes-empty {
  text-align: center; padding: 40px 20px;
  color: var(--text-muted); font-size: 14px;
}
.alertes-empty .empty-icon { font-size: 40px; margin-bottom: 10px; }

/* ============================================================
   MENU UTILISATEUR (topbar dropdown)
   ============================================================ */
.user-menu-wrap {
  position: relative;
}

.user-badge {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 14px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 6px;
  transition: border-color .2s;
}
.user-badge:hover { border-color: var(--accent); }
.user-menu-chevron { font-size: 10px; color: var(--text-muted); }

.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; min-width: 220px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 200; overflow: hidden;
}

.user-dropdown-item {
  width: 100%; text-align: left;
  padding: 12px 16px; background: transparent;
  border: none; color: var(--text); font-size: 14px;
  cursor: pointer; display: flex; align-items: center; gap: 10px;
  transition: background .15s;
}
.user-dropdown-item:hover { background: var(--surface2); }
.user-dropdown-logout { color: var(--danger); }
.user-dropdown-logout:hover { background: rgba(229,57,53,0.1); }
.user-dropdown-sep { height: 1px; background: var(--border); margin: 2px 0; }

/* ============================================================
   MODAL CHANGEMENT DE MOT DE PASSE
   ============================================================ */
.pwd-input-wrap {
  position: relative; display: flex;
}
.pwd-input-wrap input {
  flex: 1; padding-right: 40px !important;
}
.pwd-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font-size: 16px; color: var(--text-muted); padding: 0;
  line-height: 1;
}
.pwd-toggle:hover { color: var(--text); }

.pwd-strength-bar {
  height: 5px; border-radius: 3px; background: var(--border);
  margin-top: 8px; overflow: hidden;
}
#pwd-strength-fill {
  height: 100%; border-radius: 3px;
  transition: width .3s, background .3s;
  width: 0%;
}

.pwd-rules {
  margin-top: 8px; display: flex; flex-direction: column; gap: 3px;
}
.pwd-rule {
  font-size: 11px; color: var(--text-muted); transition: color .2s;
}
.pwd-rule.ok { color: #4caf50; }
.pwd-rule.ok::first-letter { }

@media (max-width: 480px) {
  .user-badge { padding: 4px 10px; font-size: 12px; }
  .user-dropdown { min-width: 180px; }
}

/* Bouton reset mot de passe dans admin */
.btn-reset-pwd {
  background: rgba(245,158,11,0.2); color: #f59e0b;
  margin-left: 4px;
}
.btn-reset-pwd:hover { background: rgba(245,158,11,0.4); }

/* Bouton mot de passe oublié */
.btn-forgot-pwd {
  background: none; border: none;
  color: var(--text-muted); font-size: 13px;
  cursor: pointer; text-decoration: underline;
  padding: 0; transition: color .2s;
}
.btn-forgot-pwd:hover { color: var(--accent); }

/* Feedback modal mot de passe oublié */
.forgot-success {
  background: rgba(76,175,80,0.1); border: 1px solid #4caf50;
  color: #81c784; border-radius: 8px; padding: 12px 16px;
  font-size: 13px; margin-bottom: 8px;
}
.forgot-error {
  background: rgba(229,57,53,0.1); border: 1px solid #e53935;
  color: #ef9a9a; border-radius: 8px; padding: 12px 16px;
  font-size: 13px; margin-bottom: 8px;
}

/* Bouton supprimer utilisateur */
.btn-delete {
  background: rgba(229,57,53,0.15); color: #ef9a9a;
  margin-left: 4px;
}
.btn-delete:hover { background: rgba(229,57,53,0.35); }

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px;
  padding: 12px 24px; font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 2000; opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s;
  white-space: nowrap;
}
.toast-show {
  opacity: 1; pointer-events: auto;
  display: block !important;
}
.toast-success { border-color: #4caf50; color: #81c784; }
.toast-error   { border-color: #e53935; color: #ef9a9a; }

/* ============================================================
   GESTION ANNÉE 2027
   ============================================================ */
.year-toggle { display: flex; }

.year-visibility-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px;
}
.year-visibility-info {
  display: flex; align-items: center; gap: 14px;
}
.year-badge {
  font-size: 18px; font-weight: 800; color: var(--accent);
  background: rgba(91,141,238,0.12); border: 1px solid rgba(91,141,238,0.3);
  border-radius: 8px; padding: 6px 14px;
}

/* Statut "Traité" dans les alertes */
.alert-card.done { border-left-color: #555; opacity: .65; }
.status-done { background: rgba(100,100,100,0.2); color: #aaa; }

/* Bouton toggle année dans le header planning */
@media (max-width: 900px) {
  .year-toggle { display: flex; }
}

/* Bouton "Marquer traité" dans les alertes */
.btn-done {
  padding: 6px 12px; font-size: 12px; font-weight: 600;
  border-radius: 6px; cursor: pointer;
  background: rgba(76,175,80,0.15);
  border: 1px solid rgba(76,175,80,0.4);
  color: #81c784;
  transition: all .2s;
}
.btn-done:hover { background: rgba(76,175,80,0.3); }
