:root {
  --site-a-color: #0d6efd;
  --site-a-bg: #cfe2ff;
  --site-a-open-bg: #7bcb95;
  --site-a-open-color: #0a5c36;
  --site-a-mid-bg: #ffb877;
  --site-a-mid-color: #7c3700;
  --site-a-close-bg: #85b8f7;
  --site-a-close-color: #084298;
  --site-b-bg: #ffdd66;
  --site-b-color: #856404;
  --admin-bg: #c9a3f5;
  --admin-color: #5b21b6;
  --leave-color: #6c757d;
  --leave-bg: #c6c9cd;
  --recup-color: #fd7e14;
  --recup-bg: #ffe5d0;
  --repos-bg: #b9c1c9;
  --repos-color: #495057;
  --comp-bg: #6fc8d1;
  --comp-color: #0b5a63;
  --comp-border: #04282a;
  --absent-bg: #c9976a;
  --absent-color: #6b4322;
  --holiday-color: #dc3545;
  --holiday-bg: #f3a8b1;
  --conflict-color: #ffc107;
  --conflict-bg: #fff3cd;
  --empty-color: #adb5bd;
  --grid-empty-bg: #f1f3f5;
  --other-period-bg: #e2e3e5;
  --other-period-color: #41464b;
  --other-period-border: #6c757d;
  --sidebar-width: 240px;
}

body {
  font-size: 0.9rem;
  background-color: #f8f9fa;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background-color: #212529;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar .nav-link {
  color: rgba(255, 255, 255, 0.75);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  margin: 0.1rem 0.5rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link .bi {
  margin-right: 0.5rem;
  width: 1rem;
  text-align: center;
}

.sidebar-brand {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.main-content {
  margin-left: var(--sidebar-width);
  padding: 1.5rem;
  min-height: 100vh;
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    min-height: auto;
    position: relative;
  }
  .main-content {
    margin-left: 0;
  }
}

/* Planning — Vue semaine */
.planning-table {
  table-layout: fixed;
  width: 100%;
  font-size: 0.82rem;
}

.planning-table th,
.planning-table td {
  vertical-align: middle;
  padding: 0.4rem 0.5rem;
  border: 1px solid #dee2e6;
}

.planning-table .employee-col {
  width: 140px;
  font-weight: 600;
  background-color: #f8f9fa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shift-cell {
  cursor: pointer;
  transition: opacity 0.15s;
  border-radius: 0;
  padding: 0.35rem 0.25rem;
  text-align: center;
  font-size: 0.78rem;
  display: block;
  width: 100%;
}

.shift-cell:hover {
  opacity: 0.8;
}

.shift-site-a {
  background-color: var(--site-a-bg);
  color: var(--site-a-color);
}

.shift-site-a.shift-open  { background-color: var(--site-a-open-bg); color: var(--site-a-open-color); }
.shift-site-a.shift-mid   { background-color: var(--site-a-mid-bg); color: var(--site-a-mid-color); }
.shift-site-a.shift-close { background-color: var(--site-a-close-bg); color: var(--site-a-close-color); }

.shift-admin {
  background-color: var(--admin-bg);
  color: var(--admin-color);
}

.shift-site-b {
  background-color: var(--site-b-bg);
  color: var(--site-b-color);
}

.shift-leave {
  background-color: var(--leave-bg);
  color: var(--leave-color);
}

.shift-recup {
  background-color: var(--recup-bg);
  color: var(--recup-color);
}

.shift-holiday {
  background-color: var(--holiday-bg);
  color: var(--holiday-color);
}

.shift-empty {
  color: var(--empty-color);
  font-style: italic;
  display: block;
  width: 100%;
  padding: 0.35rem 0.25rem;
}

.shift-repos {
  background-color: var(--repos-bg);
  color: var(--repos-color);
  display: block;
  width: 100%;
  padding: 0.35rem 0.25rem;
}

.shift-comp {
  background-color: var(--comp-bg);
  color: var(--comp-color);
  border: 1px dashed var(--comp-border);
  display: block;
  width: 100%;
  padding: 0.35rem 0.25rem;
}

.shift-absent {
  background-color: var(--absent-bg);
  color: var(--absent-color);
  border: 1px dashed var(--absent-color);
  display: block;
  width: 100%;
  padding: 0.35rem 0.25rem;
}

/* Planning — Vue mois compacte (grille employés × jours, sans texte) */
.month-grid-table th,
.month-grid-table td {
  padding: 1px 2px;
}

.month-grid-table .employee-col {
  width: 110px;
  font-size: 0.72rem;
}

.grid-day-header {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 0 !important;
}

.grid-day-header.holiday {
  background-color: var(--holiday-bg);
  color: var(--holiday-color);
}

.grid-day-header.weekend {
  background-color: #343a40;
}

.grid-swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 20px;
  border-radius: 2px;
  outline: 1px solid rgba(0, 0, 0, 0.15);
  outline-offset: -1px;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1;
}

.grid-swatch.shift-empty {
  background-color: var(--grid-empty-bg);
}

.conflict-badge {
  background-color: var(--conflict-bg);
  color: #856404;
  border: 1px solid #ffecb5;
}

/* Planning — Vue mois */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.month-day {
  min-height: 90px;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  padding: 0.3rem;
  background: #fff;
  font-size: 0.78rem;
  overflow: hidden;
}

.month-day.other-month {
  background: #f8f9fa;
  color: #adb5bd;
}

.month-day.today {
  border-color: var(--site-a-color);
  border-width: 2px;
}

.month-day.holiday {
  background-color: var(--holiday-bg);
}

.month-day.other-period {
  border-left: 3px solid var(--other-period-border);
}

.shift-other-period {
  background: var(--other-period-bg);
  color: var(--other-period-color);
  font-weight: 600;
}

.month-day-number {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.month-day-header {
  font-weight: 600;
  text-align: center;
  padding: 0.25rem;
  background: #212529;
  color: #fff;
  font-size: 0.78rem;
  border-radius: 0.25rem;
}

.day-shift-pill {
  display: block;
  border-radius: 0.2rem;
  padding: 0.1rem 0.25rem;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.72rem;
}

/* Badges status */
.badge-draft { background-color: #6c757d; }
.badge-validated { background-color: #198754; }

/* Formulaires */
.form-card {
  max-width: 600px;
  margin: 0 auto;
}

/* Responsive table */
@media (max-width: 768px) {
  .planning-table {
    font-size: 0.72rem;
  }
  .planning-table .employee-col {
    width: 80px;
  }
}

/* ── Bouton mode jour/nuit ────────────────────────────────────────────────── */
.theme-toggle-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 1rem;
  border-radius: 0.375rem;
  transition: color 0.15s, background 0.15s;
}
.theme-toggle-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

/* ── MODE NUIT ────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --site-a-bg:    #1e3a5f;
  --site-a-color: #90b8e8;
  --site-a-open-bg:    #1f5c40;
  --site-a-open-color: #6dbf8e;
  --site-a-mid-bg:     #5c4400;
  --site-a-mid-color:  #f5c06b;
  --site-a-close-bg:   #2a4a80;
  --site-a-close-color:#90b0e8;
  --site-b-bg:    #5c4b00;
  --site-b-color: #e5c76b;
  --admin-bg:     #452a70;
  --admin-color:  #c4a3f5;
  --leave-bg:     #3d3d3d;
  --leave-color:  #9aa0a6;
  --repos-bg:     #2b3947;
  --repos-color:  #9ca3af;
  --comp-bg:      #164e52;
  --comp-color:   #5fd1d9;
  --comp-border:  #5fd1d9;
  --absent-bg:    #4a3220;
  --absent-color: #d9a875;
  --holiday-bg:   #5c2626;
  --holiday-color:#e07070;
  --conflict-bg:  #3d3200;
  --conflict-color:#ffc107;
  --empty-color:  #4b5563;
  --grid-empty-bg:#1f2937;
  --other-period-bg: #374151;
  --other-period-color: #d1d5db;
  --other-period-border: #9ca3af;
}

[data-theme="dark"] body {
  background-color: #111827;
  color: #e5e7eb;
}

[data-theme="dark"] .main-content {
  background-color: #111827;
}

[data-theme="dark"] .sidebar {
  background-color: #0d1117;
  border-right: 1px solid #1f2937;
}

[data-theme="dark"] .sidebar-brand {
  border-bottom-color: rgba(255,255,255,0.07);
}

[data-theme="dark"] .card {
  background-color: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}

[data-theme="dark"] .card-header {
  background-color: #263042;
  border-bottom-color: #374151;
}

[data-theme="dark"] .table {
  color: #e5e7eb;
  border-color: #374151;
}

[data-theme="dark"] .table-light thead {
  background-color: #263042 !important;
  color: #e5e7eb;
}

[data-theme="dark"] .table-hover > tbody > tr:hover > * {
  background-color: rgba(255,255,255,0.04);
}

[data-theme="dark"] .table-bordered > :not(caption) > * > * {
  border-color: #374151;
}

[data-theme="dark"] .planning-table td,
[data-theme="dark"] .planning-table th {
  background-color: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}

[data-theme="dark"] .planning-table .employee-col {
  background-color: #263042;
  color: #e5e7eb;
}

[data-theme="dark"] .planning-table thead.table-dark th {
  background-color: #0d1117;
  color: #e5e7eb;
}

[data-theme="dark"] .grid-day-header.weekend {
  background-color: #0d1117;
}

[data-theme="dark"] .grid-swatch {
  outline-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: #263042;
  border-color: #374151;
  color: #e5e7eb;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  background-color: #2d3a50;
  border-color: #4b84c4;
  color: #e5e7eb;
}

[data-theme="dark"] .form-control::placeholder {
  color: #6b7280;
}

[data-theme="dark"] .input-group-text {
  background-color: #263042;
  border-color: #374151;
  color: #9ca3af;
}

[data-theme="dark"] .modal-content {
  background-color: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}

[data-theme="dark"] .modal-header {
  border-bottom-color: #374151;
}

[data-theme="dark"] .modal-footer {
  border-top-color: #374151;
}

[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="dark"] .alert-warning {
  background-color: #3d3200;
  border-color: #7a6500;
  color: #fde68a;
}

[data-theme="dark"] .alert-info {
  background-color: #1a3a5c;
  border-color: #2563eb;
  color: #93c5fd;
}

[data-theme="dark"] .alert-danger {
  background-color: #3d1a1a;
  border-color: #7a2020;
  color: #fca5a5;
}

[data-theme="dark"] .text-muted {
  color: #9ca3af !important;
}

[data-theme="dark"] .border,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom {
  border-color: #374151 !important;
}

[data-theme="dark"] .month-day {
  background-color: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}

[data-theme="dark"] .month-day.other-month {
  background-color: #161f2c;
  color: #4b5563;
}

[data-theme="dark"] .month-day.today {
  border-color: #3b82f6;
}

[data-theme="dark"] .month-day-header {
  background-color: #0d1117;
}

[data-theme="dark"] .badge-draft {
  background-color: #374151;
}
