/* ==========================================================
   TimeClock — Thème Temple of Juice
   Palette : vert forêt · crème chaud · or ambre
   Fonts   : Playfair Display (titres) + DM Sans (UI)
   ========================================================== */

/* ── Variables ── */
:root {
  --sidebar-w: 265px;
  --topbar-h: 64px;

  /* Couleurs principales */
  --green-900: #1a2c10;
  --green-800: #1e3512;
  --green-700: #2a4a1a;
  --green-600: #3a6424;
  --green-500: #4a7830;
  --green-400: #6a9a50;
  --green-100: #e8f2df;
  --green-50:  #f2f8ec;

  --gold-600: #a8800a;
  --gold-500: #c49a2a;
  --gold-400: #d4aa40;
  --gold-200: #f0dfa0;
  --gold-100: #faf3d8;
  --gold-50:  #fffdf0;

  --cream-50:  #fdfaf4;
  --cream-100: #f8f3e8;
  --cream-200: #f0e8d4;
  --cream-300: #e4d5b8;

  --brown-800: #1a1008;
  --brown-700: #2e1e0e;
  --brown-500: #6a5030;
  --brown-400: #8a7050;
  --brown-300: #b09070;

  --red-700: #9e2a2a;
  --red-600: #c03232;
  --red-400: #d96060;
  --red-100: #fce8e8;
  --red-50:  #fdf4f4;

  /* Sémantique UI */
  --bg:           var(--cream-100);
  --bg-card:      #ffffff;
  --bg-muted:     var(--cream-200);
  --bg-subtle:    var(--cream-50);

  --sidebar-bg:   var(--green-900);
  --sidebar-text: #a8c498;
  --sidebar-active-bg: rgba(196,154,42,.15);
  --sidebar-active-text: #d4c060;
  --sidebar-hover-bg: rgba(255,255,255,.06);

  --primary:      var(--green-600);
  --primary-dark: var(--green-700);
  --primary-light: var(--green-500);
  --accent:       var(--gold-500);

  --text-base:    var(--brown-800);
  --text-muted:   var(--brown-500);
  --text-light:   var(--brown-400);

  --border:       var(--cream-300);
  --border-focus: var(--green-500);

  --shadow-xs: 0 1px 3px rgba(26,16,8,.06), 0 1px 2px rgba(26,16,8,.04);
  --shadow-sm: 0 2px 8px rgba(26,16,8,.08), 0 1px 3px rgba(26,16,8,.05);
  --shadow-md: 0 6px 20px rgba(26,16,8,.10), 0 2px 6px rgba(26,16,8,.06);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text-base);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--text-base);
  line-height: 1.25;
}

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

/* ── Layout ── */
#app-wrapper { display: flex; min-height: 100vh; }

/* ─────────────────────────────────────────────
   SIDEBAR
───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1040;
  overflow-y: auto;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}

.sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sidebar-brand i { color: var(--gold-400); font-size: 1rem; }

.sidebar-user {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: .75rem;
}

.avatar-circle {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-500), var(--green-700));
  border: 2px solid rgba(196,154,42,.3);
  color: #fff;
  font-weight: 700;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
  font-family: 'DM Sans', sans-serif;
}

.avatar-sm {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--cream-200);
  color: var(--brown-500);
  font-weight: 700;
  font-size: .72rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.sidebar-user-info .fw-semibold { color: #f0f0ec; font-size: .875rem; }

.sidebar-nav { flex: 1; padding: .5rem 0 1rem; }

.nav-section {
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(196,154,42,.45);
  padding: 1.1rem 1.25rem .3rem;
  font-family: 'DM Sans', sans-serif;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .5rem 1.25rem;
  color: var(--sidebar-text);
  font-family: 'DM Sans', sans-serif;
  font-size: .86rem;
  font-weight: 400;
  text-decoration: none;
  transition: background .12s, color .12s;
  border-radius: 0;
}
.sidebar-nav .nav-link i {
  width: 17px;
  text-align: center;
  font-size: .9rem;
  opacity: .6;
  flex-shrink: 0;
}
.sidebar-nav .nav-link:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}
.sidebar-nav .nav-link:hover i { opacity: .9; }
.sidebar-nav .nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 500;
}
.sidebar-nav .nav-link.active i { opacity: 1; }

.sidebar-footer {
  padding: .5rem 0;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-footer .nav-link { color: #7a9470; }
.sidebar-footer .nav-link:hover { color: #e07060; background: rgba(255,100,80,.08); }

/* Mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,44,16,.55);
  z-index: 1039;
  backdrop-filter: blur(2px);
}
.btn-icon {
  background: none;
  border: none;
  color: var(--sidebar-text);
  padding: .3rem .45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  line-height: 1;
  transition: background .12s;
}
.btn-icon:hover { background: var(--sidebar-hover-bg); }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
}

/* ─────────────────────────────────────────────
   MAIN WRAPPER & TOPBAR
───────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
@media (max-width: 991.98px) { .main-wrapper { margin-left: 0; } }

.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: var(--shadow-xs);
  gap: .75rem;
}

.topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-base);
  letter-spacing: .01em;
}

.topbar-clock {
  font-family: 'DM Sans', sans-serif;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .05em;
  font-variant-numeric: tabular-nums;
  background: var(--cream-100);
  border: 1px solid var(--border);
  padding: .25rem .65rem;
  border-radius: 999px;
}

.flash-area { flex-shrink: 0; }
.page-content { flex: 1; }

/* ─────────────────────────────────────────────
   BOOTSTRAP COMPONENT OVERRIDES
───────────────────────────────────────────── */

/* ── Buttons ── */
.btn {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: .855rem;
  letter-spacing: .01em;
  border-radius: var(--radius-sm);
  transition: all .15s;
}
.btn-sm  { border-radius: 5px; font-size: .8rem; }
.btn-lg  { border-radius: var(--radius); font-size: .95rem; font-weight: 600; }

.btn-primary {
  --bs-btn-bg:            var(--green-600);
  --bs-btn-border-color:  var(--green-600);
  --bs-btn-color:         #fff;
  --bs-btn-hover-bg:      var(--green-700);
  --bs-btn-hover-border-color: var(--green-700);
  --bs-btn-hover-color:   #fff;
  --bs-btn-active-bg:     var(--green-700);
  --bs-btn-active-border-color: var(--green-800);
  --bs-btn-focus-shadow-rgb: 74,120,48;
}
.btn-outline-primary {
  --bs-btn-color:          var(--green-600);
  --bs-btn-border-color:   var(--green-600);
  --bs-btn-hover-bg:       var(--green-600);
  --bs-btn-hover-color:    #fff;
  --bs-btn-hover-border-color: var(--green-600);
  --bs-btn-active-bg:      var(--green-700);
  --bs-btn-active-border-color: var(--green-700);
  --bs-btn-active-color:   #fff;
}
.btn-success {
  --bs-btn-bg:            var(--green-600);
  --bs-btn-border-color:  var(--green-600);
  --bs-btn-color:         #fff;
  --bs-btn-hover-bg:      var(--green-700);
  --bs-btn-hover-border-color: var(--green-700);
  --bs-btn-hover-color:   #fff;
}
.btn-danger {
  --bs-btn-bg:            #c03828;
  --bs-btn-border-color:  #c03828;
  --bs-btn-color:         #fff;
  --bs-btn-hover-bg:      #a02818;
  --bs-btn-hover-border-color: #a02818;
  --bs-btn-hover-color:   #fff;
}
.btn-secondary {
  --bs-btn-bg:            var(--cream-200);
  --bs-btn-border-color:  var(--border);
  --bs-btn-color:         var(--text-base);
  --bs-btn-hover-bg:      var(--cream-300);
  --bs-btn-hover-border-color: var(--cream-300);
  --bs-btn-hover-color:   var(--text-base);
}
.btn-outline-secondary {
  --bs-btn-color:          var(--text-muted);
  --bs-btn-border-color:   var(--border);
  --bs-btn-hover-bg:       var(--cream-200);
  --bs-btn-hover-color:    var(--text-base);
  --bs-btn-hover-border-color: var(--cream-300);
}
.btn-warning {
  --bs-btn-bg:            var(--gold-500);
  --bs-btn-border-color:  var(--gold-500);
  --bs-btn-color:         #fff;
  --bs-btn-hover-bg:      var(--gold-600);
  --bs-btn-hover-border-color: var(--gold-600);
  --bs-btn-hover-color:   #fff;
}

/* ── Forms ── */
.form-control, .form-select {
  background-color: var(--bg-card);
  border-color: var(--border);
  color: var(--text-base);
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  background-color: #fff;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(74,120,48,.14);
  color: var(--text-base);
}
.form-control::placeholder { color: var(--text-light); }
.form-label {
  font-family: 'DM Sans', sans-serif;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .35rem;
}
.input-group-text {
  background: var(--cream-200);
  border-color: var(--border);
  color: var(--text-muted);
  font-size: .875rem;
}

.form-check-input:checked {
  background-color: var(--green-600) !important;
  border-color: var(--green-600) !important;
}
.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(74,120,48,.14) !important;
  border-color: var(--green-500) !important;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.card-header {
  background: var(--cream-50);
  border-bottom: 1px solid var(--border);
  padding: .9rem 1.25rem;
  font-family: 'DM Sans', sans-serif;
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.card-body { padding: 1.25rem; }
.card-link { transition: box-shadow .15s, transform .15s; }
.card-link:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-link-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Alerts ── */
.alert {
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  font-weight: 500;
  border-width: 1px;
}
.alert-success { background: #eaf6e2; border-color: #b4d9a0; color: #1e4a14; }
.alert-danger  { background: #fce8e4; border-color: #d4a098; color: #5a1c14; }
.alert-warning { background: #fdf6e0; border-color: #d8c070; color: #5a3a10; }
.alert-info    { background: #e4eff8; border-color: #98c0dc; color: #1a3858; }

/* ── Badges ── */
.badge {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: .68rem;
  letter-spacing: .04em;
  border-radius: 5px;
  padding: .3em .6em;
}
.bg-success        { background-color: var(--green-600) !important; }
.bg-success-subtle { background-color: var(--green-50) !important; }
.text-success      { color: var(--green-700) !important; }

.bg-danger         { background-color: #c03828 !important; }
.bg-danger-subtle  { background-color: #fce8e4 !important; }
.text-danger       { color: #9a2818 !important; }

.bg-warning        { background-color: var(--gold-500) !important; }
.bg-warning-subtle { background-color: var(--gold-100) !important; }
.text-warning      { color: var(--gold-600) !important; }

.bg-primary        { background-color: var(--green-600) !important; }
.bg-primary-subtle { background-color: var(--green-50) !important; }
.text-primary      { color: var(--green-600) !important; }

.bg-secondary        { background-color: var(--cream-200) !important; color: var(--text-muted) !important; }
.bg-secondary-subtle { background-color: var(--cream-200) !important; }
.text-secondary      { color: var(--text-muted) !important; }
.text-muted          { color: var(--text-muted) !important; }

/* ── Tables ── */
.table {
  font-family: 'DM Sans', sans-serif;
  --bs-table-bg: var(--bg-card);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: var(--cream-50);
  --bs-table-hover-bg: var(--cream-100);
  color: var(--text-base);
}
.table th {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  background: var(--cream-100) !important;
  border-color: var(--border) !important;
  padding: .75rem 1rem;
}
.table td {
  font-size: .875rem;
  border-color: var(--border) !important;
  padding: .75rem 1rem;
  vertical-align: middle;
}
.table-light th, .table-light td { background: var(--cream-100) !important; }

/* ── Modals ── */
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  background: var(--cream-50);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-title {
  font-family: 'DM Sans', sans-serif;
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-base);
}
.modal-footer {
  border-top: 1px solid var(--border);
  background: var(--cream-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.btn-close { filter: sepia(.5) brightness(.6); }

/* ── Pagination ── */
.page-link {
  color: var(--text-muted);
  border-color: var(--border);
  background: var(--bg-card);
  font-family: 'DM Sans', sans-serif;
  font-size: .855rem;
  transition: all .12s;
}
.page-link:hover { background: var(--cream-200); border-color: var(--border); color: var(--text-base); }
.page-item.active .page-link { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.page-item.disabled .page-link { background: var(--cream-50); }

/* ── Dropdowns ── */
.dropdown-menu {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  padding: .4rem;
}
.dropdown-item {
  color: var(--text-base);
  border-radius: var(--radius-sm);
  padding: .45rem .75rem;
}
.dropdown-item:hover { background: var(--cream-100); color: var(--text-base); }
.dropdown-divider { border-color: var(--border); }

/* ── Nav pills (period filter) ── */
.nav-pills .nav-link {
  font-family: 'DM Sans', sans-serif;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .35rem .85rem;
  background: var(--bg-card);
  transition: all .12s;
}
.nav-pills .nav-link:hover { background: var(--cream-200); color: var(--text-base); }
.nav-pills .nav-link.active {
  background: var(--green-600);
  border-color: var(--green-600);
  color: #fff;
}

/* ── Progress ── */
.progress { background: var(--cream-200); border-radius: 999px; }
.progress-bar { background: var(--green-600); }

/* ── hr ── */
hr { border-color: var(--border); opacity: 1; }

/* ─────────────────────────────────────────────
   KPI CARDS
───────────────────────────────────────────── */
.kpi-label {
  font-family: 'DM Sans', sans-serif;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: .3rem;
}
.kpi-value {
  font-family: 'Playfair Display', serif;
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-base);
  line-height: 1.1;
}
.kpi-card { position: relative; overflow: hidden; }
.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--green-600);
  border-radius: 3px 0 0 3px;
}

/* ─────────────────────────────────────────────
   CLOCK CARD
───────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: 'DM Sans', sans-serif;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .3rem .85rem;
  border-radius: 999px;
}
.status-in  { background: var(--green-100); color: var(--green-700); }
.status-out { background: var(--cream-200); color: var(--text-muted); }
.status-in .bi-circle-fill { animation: pulse 1.8s infinite; font-size: .55rem; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

.clock-elapsed {
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--green-700);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.clock-display {
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-base);
  letter-spacing: -.02em;
}

/* ─────────────────────────────────────────────
   LOGIN PAGE
───────────────────────────────────────────── */
.login-bg {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: linear-gradient(150deg, var(--green-900) 0%, var(--green-800) 55%, #3a3010 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(.25rem, 1.5vh, 1rem);
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: clamp(.6rem, 3vh, 2.75rem) clamp(1rem, 5vw, 2.5rem);
  width: 100%;
  max-width: 400px;
  max-height: 100%;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.2);
  border: 1px solid rgba(255,255,255,.08);
}

.login-header { margin-bottom: clamp(.3rem, 2vh, 1.5rem); }

.login-icon {
  width: clamp(26px, 6.5vh, 64px); height: clamp(26px, 6.5vh, 64px);
  background: linear-gradient(135deg, var(--green-500), var(--green-800));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  font-size: clamp(.8rem, 3vh, 1.75rem);
  color: #fff;
  box-shadow: 0 6px 20px rgba(42,74,26,.4);
}

.login-card h2 {
  font-size: clamp(.8rem, 3vh, 1.6rem);
  color: var(--text-base);
  margin-top: clamp(.15rem, 1vh, .75rem);
}
.login-subtitle {
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(.62rem, 1.8vh, .78rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-muted);
}

.divider-line {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.5rem 0 1.25rem;
  color: var(--text-light);
  font-family: 'DM Sans', sans-serif;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.divider-line::before, .divider-line::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─────────────────────────────────────────────
   SCHEDULE GRIDS (preferences & admin)
───────────────────────────────────────────── */
.pref-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .75rem;
}
@media (max-width: 1300px) { .pref-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 768px)  { .pref-grid { grid-template-columns: repeat(2, 1fr); } }

/* ─────────────────────────────────────────────
   WEEK NAVIGATION
───────────────────────────────────────────── */
.week-nav {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.week-nav-label {
  flex: 1;
  text-align: center;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-base);
  min-width: 200px;
}
.week-nav-btn { width: 34px; height: 34px; padding: 0; display: flex; align-items: center; justify-content: center; }

/* ─────────────────────────────────────────────
   CALENDAR WEEK VIEW
───────────────────────────────────────────── */
.cal-week-view {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

/* Header */
.cal-header {
  display: flex;
  flex-shrink: 0;
  background: var(--cream-50);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.cal-gutter {
  width: 52px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}
.cal-day-head {
  flex: 1;
  text-align: center;
  padding: .55rem .25rem .45rem;
  border-right: 1px solid var(--border);
  font-family: 'DM Sans', sans-serif;
  transition: background .15s;
}
.cal-day-head.today { background: var(--green-50); }
.cal-day-head:last-child { border-right: 0; }
.cal-day-name {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}
.cal-day-num {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}
.cal-day-num.today-circle {
  background: var(--green-600);
  color: #fff;
  border-radius: 50%;
  font-size: 1.1rem;
}
.cal-today-tag {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--green-600);
  margin-top: .1rem;
}

/* Scrollable body */
.cal-body {
  display: flex;
  overflow-y: auto;
  max-height: 68vh;
}

/* Time labels */
.cal-time-col {
  width: 52px;
  flex-shrink: 0;
  position: relative;
  border-right: 1px solid var(--border);
  height: 1088px; /* 17h × 64px */
}
.cal-hour-label {
  position: absolute;
  right: 6px;
  font-size: .65rem;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-light);
  line-height: 1;
  transform: translateY(-50%);
  white-space: nowrap;
}

/* Day columns grid */
.cal-days-body {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-day-col {
  position: relative;
  height: 1088px; /* 17h × 64px */
  border-right: 1px solid var(--border);
  transition: background .15s;
}
.cal-day-col:last-child { border-right: 0; }
.cal-day-col.today { background: rgba(74, 120, 48, .035); }

/* Hour lines */
.cal-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
  opacity: .55;
}

/* Now indicator */
.cal-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold-500);
  z-index: 8;
  pointer-events: none;
}
.cal-now-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  background: var(--gold-500);
  border-radius: 50%;
}

/* "Repos" day-off overlay */
.cal-event-off {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 6px,
    var(--cream-200) 6px,
    var(--cream-200) 7px
  );
  color: var(--text-light);
  font-family: 'DM Sans', sans-serif;
  font-size: .78rem;
  font-weight: 600;
}

/* Work block */
.cal-event {
  position: absolute;
  left: 4px;
  right: 4px;
  border-radius: 6px;
  background: linear-gradient(160deg, var(--green-600), var(--green-800));
  color: #fff;
  padding: 6px 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(26, 44, 16, .25);
  font-family: 'DM Sans', sans-serif;
  z-index: 3;
  cursor: default;
  transition: box-shadow .15s;
}
.cal-event:hover {
  box-shadow: 0 4px 16px rgba(26, 44, 16, .35);
}
.cal-event-times {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.cal-event-time {
  font-weight: 700;
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.cal-event-arrow {
  font-size: .75rem;
  opacity: .7;
}
.cal-event-dur {
  font-size: .7rem;
  opacity: .75;
  margin-top: 3px;
  font-weight: 500;
}
.cal-event-note {
  font-size: .68rem;
  opacity: .7;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Preferences: vertical list ── */
.pref-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.pref-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green-400);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s, background .2s, box-shadow .15s;
}
.pref-row:hover { box-shadow: var(--shadow-sm); }
.pref-row.pref-unavailable {
  border-left-color: var(--red-400);
  background: var(--red-50);
}

.pref-row-controls {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .75rem 1rem;
  flex-wrap: wrap;
}
.pref-day-label {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: .9rem;
  color: var(--text-base);
  width: 88px;
  flex-shrink: 0;
}

/* ── Disponible / Indisponible button ── */
.pref-avail-btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .38rem .85rem;
  border-radius: 99px;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, color .2s, box-shadow .15s;
  flex-shrink: 0;
  white-space: nowrap;
}
.pref-avail-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.pref-avail-btn.is-avail {
  background: var(--green-600);
  color: #fff;
  box-shadow: 0 2px 6px rgba(58,100,36,.25);
}
.pref-avail-btn.is-avail:hover { background: var(--green-700); }
.pref-avail-btn.is-off {
  background: var(--red-600);
  color: #fff;
  box-shadow: 0 2px 6px rgba(192,50,50,.3);
}
.pref-avail-btn.is-off:hover { background: var(--red-700); }
.pref-avail-btn i { font-size: .95rem; }

/* ── Shift buttons ── */
.pref-shifts {
  display: flex;
  gap: .4rem;
  margin-left: auto;
  flex-wrap: wrap;
  align-items: center;
  transition: opacity .2s;
}
.pref-shift-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .4rem .9rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
  transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.pref-shift-btn small {
  font-size: .67rem;
  font-weight: 400;
  opacity: .75;
}
.pref-shift-btn:hover:not(.active) {
  border-color: var(--green-400);
  color: var(--green-600);
  background: var(--green-50);
}
.pref-shift-btn.active {
  border-color: var(--green-600);
  background: var(--green-600);
  color: #fff;
  box-shadow: 0 2px 6px rgba(58,100,36,.2);
}
.pref-shift-btn.active small { opacity: .85; }

.pref-bar-wrap {
  padding: 0 1rem .7rem;
  transition: opacity .2s;
}
.pref-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: .65rem;
  color: var(--text-light);
  font-family: 'DM Sans', sans-serif;
  margin-top: .25rem;
  padding: 0 1px;
}


/* ── Admin schedule: vertical list ── */
.sadmin-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.sadmin-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem 1rem;
  transition: border-color .15s, background .15s;
}
.sadmin-row.today {
  border-color: var(--green-400);
  background: var(--green-50);
}
.sadmin-day-info {
  display: flex;
  align-items: center;
  gap: .45rem;
  width: 130px;
  flex-shrink: 0;
}
.sadmin-day-name {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: .9rem;
  color: var(--text-base);
}
.sadmin-day-date {
  font-family: 'DM Sans', sans-serif;
  font-size: .75rem;
  color: var(--text-muted);
}
.sadmin-today-badge {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--green-600);
  background: rgba(74,120,48,.1);
  border: 1px solid rgba(74,120,48,.2);
  border-radius: 99px;
  padding: 1px 6px;
  white-space: nowrap;
}
.sadmin-pref-hint {
  font-family: 'DM Sans', sans-serif;
  font-size: .78rem;
  color: var(--text-muted);
  min-width: 160px;
  flex-shrink: 0;
  white-space: nowrap;
}
.sadmin-inputs {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  flex-wrap: wrap;
  margin-left: auto;
}
.sadmin-time-pair {
  display: flex;
  align-items: flex-end;
  gap: .4rem;
}
.sadmin-time-pair input[type="time"] { width: 110px; }
.sadmin-note { min-width: 160px; }
.sadmin-off-label {
  font-family: 'DM Sans', sans-serif;
  font-size: .82rem;
  color: var(--text-muted);
  font-style: italic;
  margin-left: auto;
}

/* Time bar */
.time-bar-track {
  height: 5px;
  background: var(--cream-200);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  margin-top: .5rem;
}
.time-bar-fill {
  position: absolute;
  height: 100%;
  background: linear-gradient(90deg, var(--green-600), var(--green-400));
  border-radius: 999px;
  transition: left .2s, width .2s;
}

/* ─────────────────────────────────────────────
   TEAM SCHEDULE
───────────────────────────────────────────── */

/* ── Toolbar ── */
.team-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}
.team-toolbar-center {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.team-toolbar-right { margin-left: auto; }

/* Score strip drag hint */
.score-strip-hint {
  font-family: 'DM Sans', sans-serif;
  font-size: .72rem;
  color: var(--text-light);
  white-space: nowrap;
}
.user-score-chip[draggable] { cursor: grab; }
.user-score-chip[draggable]:active,
.user-score-chip.chip-dragging { opacity: .5; cursor: grabbing; }

/* Shift block "+" add button */
.shift-add-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0 2px;
  line-height: 1;
  font-size: .85rem;
  margin-left: auto;
  opacity: .5;
  transition: opacity .15s, color .15s;
}
.shift-add-btn:hover { opacity: 1; color: var(--green-600); }

/* ── User picker panel ── */
.user-pick-panel {
  position: fixed;
  z-index: 300;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem .8rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.16);
  min-width: 200px;
  max-width: 260px;
  display: none;
}
.upick-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 260px;
  overflow-y: auto;
  margin-top: .4rem;
}
.upick-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .4rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  transition: background .1s;
}
.upick-item:hover:not(.upick-disabled) { background: var(--cream-100); border-color: var(--border); }
.upick-disabled { opacity: .45; cursor: default; }
.upick-av {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--green-700);
  font-weight: 700;
  font-size: .62rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'DM Sans', sans-serif;
}
.upick-name {
  flex: 1;
  font-size: .78rem;
  color: var(--text-base);
}
.upick-badge {
  font-size: .62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 99px;
  background: var(--cream-200);
  color: var(--text-muted);
  flex-shrink: 0;
}
.upick-badge.upick-move { background: var(--gold-100); color: var(--gold-600); }

/* ── Score strip ── */
.score-strip {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .55rem 1rem;
  flex-wrap: wrap;
}
.score-strip-label {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: .82rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.score-bar-track {
  width: 140px;
  height: 7px;
  background: var(--cream-200);
  border-radius: 99px;
  overflow: hidden;
  flex-shrink: 0;
}
.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green-500), var(--green-400));
  border-radius: 99px;
  transition: width .4s;
}
.score-banner-pct { font-weight: 800; font-size: .95rem; }
.score-green { color: var(--green-600); }
.score-gold  { color: var(--gold-600); }
.score-red   { color: var(--red-600); }

.score-badge {
  display: inline-block;
  font-weight: 800;
  font-size: .75rem;
  font-family: 'DM Sans', sans-serif;
  padding: .15rem .45rem;
  border-radius: 99px;
  line-height: 1;
}
.score-badge.score-green { background: var(--green-50);  color: var(--green-700); }
.score-badge.score-gold  { background: var(--gold-100);  color: var(--gold-600); }
.score-badge.score-red   { background: var(--red-100);   color: var(--red-700); }

/* User score chips in strip */
.user-score-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--cream-100);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: .2rem .5rem .2rem .25rem;
}
.usc-av {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--green-700);
  font-size: .62rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
  flex-shrink: 0;
}
.usc-name {
  font-family: 'DM Sans', sans-serif;
  font-size: .72rem;
  color: var(--text-muted);
}

/* ── Team calendar view ── */
.tcal-view {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

/* Header */
.tcal-header {
  display: flex;
  flex-shrink: 0;
  background: var(--cream-50);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.tcal-gutter {
  width: 52px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}
.tcal-day-head {
  flex: 1;
  text-align: center;
  padding: .5rem .25rem .4rem;
  border-right: 1px solid var(--border);
  font-family: 'DM Sans', sans-serif;
}
.tcal-day-head:last-child { border-right: 0; }
.tcal-day-head.today { background: var(--green-50); }

/* Scrollable body */
.tcal-body {
  display: flex;
  overflow-y: auto;
  max-height: 68vh;
}

/* Time labels */
.tcal-time-col {
  width: 52px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  position: relative;
  height: 896px; /* 14h × 64px */
}

/* Day columns container */
.tcal-days {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  min-width: 600px;
}

/* Individual day column */
.tcal-day-col {
  position: relative;
  height: 896px;
  border-right: 1px solid var(--border);
}
.tcal-day-col:last-child { border-right: 0; }
.tcal-day-col.today { background: rgba(74,120,48,.03); }

/* Drop zones — hidden by default, revealed on drag */
.drop-zone {
  position: absolute;
  left: 0; right: 0;
  border: 2px dashed transparent;
  border-radius: 6px;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .1s, background .1s;
}
.drop-zone .dz-label {
  font-family: 'DM Sans', sans-serif;
  font-size: .72rem;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transition: opacity .15s;
  line-height: 1.3;
}
.dz-matin   .dz-label { color: #2e7d32; }
.dz-ap      .dz-label { color: #f57f17; }
.dz-ap2     .dz-label { color: #e65100; }
.dz-soir    .dz-label { color: #1a4a7a; }
.dz-soirwe  .dz-label { color: #6a1b9a; }
.dz-cloture .dz-label { color: #1a237e; }

body.drag-mode .drop-zone {
  pointer-events: all;
  border-color: rgba(74,120,48,.2);
  background: rgba(74,120,48,.04);
}
body.drag-mode .drop-zone .dz-label { opacity: 1; }
body.drag-mode .dz-matin   { border-color: rgba(46,125,50,.25);  background: rgba(46,125,50,.06); }
body.drag-mode .dz-ap      { border-color: rgba(245,175,23,.3);  background: rgba(249,168,37,.06); }
body.drag-mode .dz-ap2     { border-color: rgba(230,81,0,.25);   background: rgba(230,81,0,.06); }
body.drag-mode .dz-soir    { border-color: rgba(26,74,122,.25);  background: rgba(26,74,122,.05); }
body.drag-mode .dz-soirwe  { border-color: rgba(106,27,154,.25); background: rgba(106,27,154,.05); }
body.drag-mode .dz-cloture { border-color: rgba(26,35,126,.25);  background: rgba(26,35,126,.05); }
.drop-zone.drag-over {
  border-color: var(--green-500) !important;
  background: rgba(74,120,48,.12) !important;
}

/* Shift blocks */
.tcal-shift-block {
  position: absolute;
  left: 4px;
  right: 4px;
  border-radius: 6px;
  overflow: hidden;
  z-index: 8;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
  display: flex;
  flex-direction: column;
}
.cell-matin.tcal-shift-block   { background: #e8f5e9; border-left: 3px solid #2e7d32; }
.cell-ap.tcal-shift-block      { background: #fff8e1; border-left: 3px solid #f9a825; }
.cell-soir.tcal-shift-block    { background: #e8eef5; border-left: 3px solid #1a4a7a; }
.cell-soirwe.tcal-shift-block  { background: #ede7f6; border-left: 3px solid #6a1b9a; }
.cell-custom.tcal-shift-block  { background: var(--cream-100); border-left: 3px solid var(--brown-400); }

.shift-block-head {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .5rem .25rem;
  border-bottom: 1px solid rgba(0,0,0,.08);
  flex-shrink: 0;
}
.shift-block-label {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: .72rem;
  line-height: 1;
}
.cell-matin   .shift-block-label { color: #2e7d32; }
.cell-ap      .shift-block-label { color: #f57f17; }
.cell-soir    .shift-block-label { color: #1a4a7a; }
.cell-soirwe  .shift-block-label { color: #6a1b9a; }
.cell-custom  .shift-block-label { color: var(--brown-500); }

.shift-block-time {
  font-family: 'DM Sans', sans-serif;
  font-size: .65rem;
  color: var(--text-light);
  flex: 1;
}
.shift-block-count {
  font-family: 'DM Sans', sans-serif;
  font-size: .65rem;
  font-weight: 700;
  background: rgba(0,0,0,.08);
  border-radius: 99px;
  padding: 1px 5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* User chips inside blocks — vertical list */
.shift-block-users {
  padding: .3rem .4rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  flex: 1;
}
.shift-block-users:empty::after {
  content: 'Aucun employé';
  font-family: 'DM Sans', sans-serif;
  font-size: .65rem;
  color: var(--text-light);
  padding: .35rem .2rem;
  opacity: .55;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,.75);
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 6px;
  padding: 3px 7px 3px 4px;
  cursor: pointer;
  user-select: none;
  font-family: 'DM Sans', sans-serif;
  font-size: .72rem;
  transition: box-shadow .1s, background .1s, opacity .15s;
  white-space: nowrap;
  width: 100%;
  box-sizing: border-box;
}
.user-chip:hover { box-shadow: 0 2px 6px rgba(0,0,0,.12); background: rgba(255,255,255,.95); }
.user-chip.chip-dragging { opacity: .35; cursor: grabbing; }
.user-chip.selected { box-shadow: 0 0 0 2px var(--green-500); background: rgba(255,255,255,.98); }
.user-chip.match-ok  { border-color: rgba(46,125,50,.35); }
.user-chip.match-bad { border-color: rgba(192,50,50,.35); }
.chip-av {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--green-700);
  font-weight: 700;
  font-size: .6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-chip.match-bad .chip-av { background: var(--red-100); color: var(--red-700); }
.chip-name { line-height: 1; color: var(--text-base); flex: 1; }

/* ── Chip action panel ── */
.chip-action-panel {
  position: fixed;
  z-index: 300;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem .8rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.16);
  min-width: 210px;
  display: none;
}
.cpanel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .45rem;
}
.cpanel-name {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: .85rem;
  color: var(--text-base);
}
.cpanel-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0 2px;
  line-height: 1;
  font-size: 1rem;
}
.cpanel-close:hover { color: var(--text-base); }
.cpanel-label {
  font-family: 'DM Sans', sans-serif;
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .3rem;
}
.cpanel-shifts {
  display: flex;
  gap: .3rem;
  margin-bottom: .5rem;
}
.cpanel-shift-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .3rem .4rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.3;
  background: var(--bg-card);
  transition: filter .1s, outline .1s;
  flex: 1;
  text-align: center;
}
.cpanel-shift-btn small { font-size: .58rem; font-weight: 400; display: block; }
.cpanel-shift-btn.cell-matin   { background: #e8f5e9; border-color: #a5d6a7; color: #2e7d32; }
.cpanel-shift-btn.cell-ap      { background: #fff8e1; border-color: #ffe082; color: #f57f17; }
.cpanel-shift-btn.cell-soir    { background: #e8eef5; border-color: #b0c4de; color: #1a4a7a; }
.cpanel-shift-btn.cell-soirwe  { background: #ede7f6; border-color: #ce93d8; color: #6a1b9a; }
.cpanel-shift-btn.active     { outline: 2px solid var(--green-500); outline-offset: 1px; }
.cpanel-shift-btn:hover:not(.active) { filter: brightness(.9); }
.cpanel-remove {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  background: var(--red-50);
  border: 1px solid var(--red-100);
  color: var(--red-700);
  border-radius: var(--radius-sm);
  padding: .3rem;
  font-family: 'DM Sans', sans-serif;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .1s;
}
.cpanel-remove:hover { background: var(--red-100); }

/* Off ribbon at bottom of day column */
.off-ribbon {
  position: absolute;
  bottom: 2px;
  left: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: 'DM Sans', sans-serif;
  font-size: .65rem;
  color: var(--text-light);
  background: var(--cream-200);
  border-radius: 4px;
  padding: 2px 5px;
  z-index: 6;
}
.off-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--cream-300);
  color: var(--text-muted);
  font-size: .6rem;
  font-weight: 700;
}

/* Legend */
.roster-legend {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  font-family: 'DM Sans', sans-serif;
  font-size: .72rem;
}
.legend-item {
  padding: .18rem .5rem;
  border-radius: 4px;
  font-weight: 600;
}
.legend-item.cell-matin   { color: #2e7d32; background: #e8f5e9; }
.legend-item.cell-ap      { color: #f57f17; background: #fff8e1; }
.legend-item.cell-soir    { color: #1a4a7a; background: #e8eef5; }
.legend-item.cell-soirwe  { color: #6a1b9a; background: #ede7f6; }
.legend-item.cell-off     { color: var(--text-light); background: var(--cream-200); }
.legend-sep { color: var(--text-light); font-size: .8rem; }
.legend-dot-item {
  display: flex;
  align-items: center;
  gap: .35rem;
  color: var(--text-muted);
}
.legend-dot-item::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-dot-item.match-ok::before  { background: var(--green-500); }
.legend-dot-item.match-bad::before { background: var(--red-400); }

/* ─────────────────────────────────────────────
   UTILITIES
───────────────────────────────────────────── */
.text-xs  { font-size: .72rem; }
.x-small  { font-size: .75rem; }

.text-success-emphasis { color: var(--green-700) !important; }
.text-danger-emphasis  { color: #902010 !important; }

/* Subtle backgrounds */
.bg-light { background-color: var(--cream-100) !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--cream-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--brown-300); }

/* ─────────────────────────────────────────────
   SCHEDULE TABLE (shifts × days)
───────────────────────────────────────────── */
.sched-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'DM Sans', sans-serif;
  font-size: .82rem;
  table-layout: fixed;
}

/* Header */
.sched-th-shift {
  width: 110px;
  min-width: 90px;
}
.sched-th-day {
  text-align: center;
  padding: .4rem .3rem;
  border: 1px solid var(--border);
  background: var(--cream-100);
  min-width: 110px;
}
.sched-th-day.sched-today { background: #e8f5e9; }
.sth-name { font-weight: 700; font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.sth-date { font-size: 1.1rem; font-weight: 600; color: var(--text-dark); line-height: 1.2; }
.sth-today-num {
  display: inline-block;
  background: var(--green-500);
  color: #fff;
  border-radius: 50%;
  width: 28px; height: 28px;
  line-height: 28px;
  font-size: .95rem;
}
.sth-tag { font-size: .6rem; color: var(--green-700); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; margin-top: 1px; }

/* Shift label column */
.sched-shift-label {
  padding: .55rem .6rem;
  border: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
.ssl-name { display: block; font-weight: 700; font-size: .78rem; }
.ssl-time { display: block; font-size: .68rem; opacity: .8; }
.ssl-badge {
  display: inline-block;
  margin-top: 2px;
  font-size: .58rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(0,0,0,.12);
  letter-spacing: .04em;
}

/* Shift label colors */
.sched-shift-label.cell-matin   { background: #e8f5e9; border-left: 3px solid #81c784; color: #2e7d32; }
.sched-shift-label.cell-ap      { background: #fff8e1; border-left: 3px solid #ffe082; color: #f57f17; }
.sched-shift-label.cell-soir    { background: #e8eef5; border-left: 3px solid #90b4d4; color: #1a4a7a; }
.sched-shift-label.cell-soirwe  { background: #ede7f6; border-left: 3px solid #ce93d8; color: #6a1b9a; }

/* Data cells */
.sched-cell {
  border: 1px solid var(--border);
  vertical-align: top;
  padding: .3rem .3rem .25rem;
  min-width: 110px;
  position: relative;
}
.sched-cell.sched-today { border-top: 2px solid #66bb6a; }
.sched-cell-na {
  background: repeating-linear-gradient(
    135deg,
    transparent,
    transparent 4px,
    rgba(0,0,0,.03) 4px,
    rgba(0,0,0,.03) 8px
  );
}

/* Cell backgrounds — very light */
.cell-matin-bg   { background: #f7fdf7; }
.cell-ap-bg      { background: #fffef5; }
.cell-soir-bg    { background: #f5f8fc; }
.cell-soirwe-bg  { background: #faf7fe; }

/* Drag highlight */
.sched-cell.drag-over {
  outline: 2px dashed var(--green-500);
  outline-offset: -2px;
  background: rgba(76, 175, 80, .07) !important;
}

/* Chip list inside cell */
.cell-users {
  display: flex;
  flex-direction: column;
  gap: .18rem;
  min-height: 32px;
  margin-bottom: .2rem;
}

/* "+" button in cell */
.sched-cell .shift-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 4px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-light);
  font-size: .75rem;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  padding: 0;
}
.sched-cell .shift-add-btn:hover {
  background: var(--green-500);
  color: #fff;
  border-color: var(--green-500);
}

/* ─────────────────────────────────────────────
   CAMERA CAPTURE WIDGET
───────────────────────────────────────────── */
.camera-wrap {
  position: relative;
  background: #111;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  max-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.camera-error {
  color: #888;
  text-align: center;
  font-size: .82rem;
  padding: 1rem;
}

/* ─────────────────────────────────────────────
   PHOTO VIEWER (history)
───────────────────────────────────────────── */
.photo-thumb {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity .15s;
  border: 1px solid var(--border);
}
.photo-thumb:hover { opacity: .75; }

/* ─────────────────────────────────────────────
   LOGIN — onglets Email / Code PIN
───────────────────────────────────────────── */
.login-tabs {
  display: flex;
  gap: .4rem;
  background: var(--bg-subtle);
  border-radius: var(--radius);
  padding: .25rem;
  margin-bottom: clamp(.3rem, 2vh, 1.5rem);
}
.login-tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: clamp(.2rem, 1vh, .55rem) .5rem;
  border-radius: var(--radius-sm);
  font-size: clamp(.72rem, 2vh, .85rem);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.login-tab-btn.active {
  background: var(--bg-card);
  color: var(--primary-dark);
  box-shadow: var(--shadow-xs);
}

.login-tab-pane { display: none; }

.login-pin-hint {
  font-size: clamp(.62rem, 1.7vh, .8rem);
  line-height: 1.3;
  margin-bottom: clamp(.2rem, 1.2vh, .5rem) !important;
}

.pin-login-dots {
  display: flex;
  justify-content: center;
  gap: clamp(.4rem, 1.5vh, .85rem);
  margin: clamp(.1rem, 1vh, .5rem) 0 clamp(.25rem, 1.5vh, 1.25rem);
}
.pin-dot {
  width: clamp(8px, 1.8vh, 16px); height: clamp(8px, 1.8vh, 16px);
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: background .1s, border-color .1s;
}
.pin-dot.filled { background: var(--primary); border-color: var(--primary); }

.pin-login-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(.2rem, 1vh, .6rem);
  max-width: 280px;
  margin: 0 auto;
}
.pin-login-key {
  aspect-ratio: 1;
  max-height: clamp(24px, 6.5vh, 64px);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: clamp(.7rem, 2.2vh, 1.25rem);
  font-weight: 600;
  color: var(--text-base);
  cursor: pointer;
  transition: background .1s;
}
.pin-login-key:hover { background: var(--cream-200); }
.pin-login-key:active { background: var(--green-100); }

/* ─────────────────────────────────────────────
   TASKS (checklists ouverture / fermeture)
───────────────────────────────────────────── */
.task-list { list-style: none; margin: 0; padding: 0; }
.task-item {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  transition: opacity .15s, background .15s;
  cursor: pointer;
}
.task-item:hover { background: var(--bg-subtle); }
.task-item:last-child { border-bottom: none; }
.task-item.task-done { opacity: .55; }
.task-item.task-done .task-title { text-decoration: line-through; }

.task-check {
  background: none;
  border: none;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--text-light);
  cursor: pointer;
  flex-shrink: 0;
}
.task-item.task-done .task-check { color: var(--primary); }

.task-check-static {
  font-size: 1.4rem;
  line-height: 1;
  color: var(--text-light);
  flex-shrink: 0;
}
.task-item.task-done .task-check-static { color: var(--primary); }

.task-thumb {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.task-thumb-sm {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.task-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  color: var(--text-light);
  font-size: 1.1rem;
}

.task-text { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: .95rem; }
.task-desc { color: var(--text-muted); font-size: .82rem; margin-top: .1rem; }

.task-detail-image {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: var(--radius);
  background: var(--bg-subtle);
}
.task-detail-image.task-thumb-placeholder {
  height: 220px;
  font-size: 2.5rem;
}
#taskDetailDescription {
  color: var(--text-muted);
  font-size: .92rem;
  white-space: pre-line;
}
.pin-login-key-action { color: var(--text-muted); font-size: 1.05rem; }

/* ─────────────────────────────────────────────
   INVENTORY FORM
───────────────────────────────────────────── */
.inventory-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .5rem 1.5rem;
}
.inventory-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .4rem 0;
  border-bottom: 1px dotted var(--border);
}
.inventory-label { font-size: .9rem; flex: 1; }
.inventory-input { width: 100px; flex-shrink: 0; text-align: right; }
