:root {
  --bg-deep:   #dbeafe;
  --bg-base:   #eff6ff;
  --surface:        rgba(255,255,255,.68);
  --surface2:       rgba(255,255,255,.90);
  --surface-soft:   rgba(255,255,255,.50);
  --stroke:         rgba(30,64,175,.09);
  --stroke-med:     rgba(30,64,175,.15);
  --stroke-strong:  rgba(30,64,175,.22);
  --text:    #1e3a5f;
  --muted:   #1d4ed8;
  --muted2:  rgba(29,78,216,.70);
  --muted3:  rgba(29,78,216,.50);
  --accent:    #f59e0b;
  --accentBg:  rgba(245,158,11,.10);
  --accentBdr: rgba(245,158,11,.30);
  --ok:      #059669;
  --amber:   #b45309;
  --crit:    #dc2626;
  --okBg:    rgba(5,150,105,.08);
  --amberBg: rgba(180,83,9,.10);
  --critBg:  rgba(220,38,38,.08);
  --chip-p-bg:  rgba(5,150,105,.12);
  --chip-p-fg:  #065f46;
  --chip-p-bdr: rgba(5,150,105,.28);
  --chip-r-bg:  rgba(99,102,241,.10);
  --chip-r-fg:  #3730a3;
  --chip-r-bdr: rgba(99,102,241,.25);
  --chip-c-bg:  rgba(245,158,11,.12);
  --chip-c-fg:  #92400e;
  --chip-c-bdr: rgba(245,158,11,.28);
  --shadow-card: 0 8px 28px rgba(30,64,175,.08), 0 2px 8px rgba(30,64,175,.04);
  --shadow-lg:   0 20px 60px rgba(30,64,175,.12), 0 4px 16px rgba(30,64,175,.06);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: #f5f9fe;
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

body::before, body::after { display: none; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(30,64,175,.18); border-radius: 999px; }

.glass-card {
  background: linear-gradient(160deg, var(--surface2) 0%, var(--surface) 100%);
  border: 1px solid var(--stroke-med);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.hTitle {
  font-family: "DM Serif Display", Georgia, serif;
  letter-spacing: -.02em;
  color: #0f2744;
  font-weight: 400;
}

.smallCaps {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .13em;
  font-size: 10px;
  color: var(--muted2);
}

.accent-bar {
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, rgba(245,158,11,0) 100%);
  border-radius: 999px;
  opacity: .80;
}

.accent-bar-blue {
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, rgba(29,78,216,.55) 0%, rgba(29,78,216,0) 100%);
  border-radius: 999px;
}

.view-btn {
  color: var(--muted3);
  border: 1px solid transparent;
  transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
  background: transparent;
}
.view-btn:hover:not(.active) {
  background: rgba(29,78,216,.06);
  color: var(--muted);
}
.view-btn.active {
  background: rgba(245,158,11,.14);
  color: #92400e;
  border-color: rgba(245,158,11,.38);
  box-shadow: inset 0 0 0 1px rgba(245,158,11,.12), 0 2px 8px rgba(245,158,11,.10);
}

.inpt {
  width: 100%;
  background: rgba(255,255,255,.88);
  border: 1px solid var(--stroke-med);
  border-radius: 14px;
  padding: 11px 14px;
  color: var(--text);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
  font-size: 12px;
  outline: none;
  color-scheme: light;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.inpt::placeholder { color: var(--muted3); font-weight: 600; }
.inpt:focus {
  border-color: rgba(245,158,11,.55);
  box-shadow: 0 0 0 3px rgba(245,158,11,.12);
}

.btn-login {
  width: 100%;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(245,158,11,.18), rgba(245,158,11,.10));
  color: #78350f;
  border: 1px solid rgba(245,158,11,.38);
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
  cursor: pointer;
}
.btn-login:hover {
  background: linear-gradient(135deg, rgba(245,158,11,.26), rgba(245,158,11,.16));
  box-shadow: 0 4px 14px rgba(245,158,11,.18);
  transform: translateY(-1px);
}
.btn-login:active { transform: translateY(0); }

.btn-action {
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  cursor: pointer;
}
.btn-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(14,165,233,.16);
}
.btn-action:active { transform: translateY(0); box-shadow: none; }

.btn-sheets:hover  { box-shadow: 0 4px 14px rgba(66,133,244,.18) !important; }
.btn-danger:hover  { box-shadow: 0 4px 14px rgba(220,38,38,.14)  !important; }
.btn-neutral:hover { box-shadow: 0 4px 12px rgba(30,64,175,.10)  !important; }
.btn-amber:hover   { box-shadow: 0 4px 14px rgba(245,158,11,.18) !important; }

.spin {
  width: 28px; height: 28px;
  border-radius: 999px;
  border: 3px solid rgba(30,64,175,.10);
  border-top-color: var(--accent);
  animation: sp .85s linear infinite;
  flex-shrink: 0;
}
@keyframes sp { to { transform: rotate(360deg); } }

.staff-card {
  border-left-width: 3px;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(255,255,255,.90), rgba(255,255,255,.72));
}
.staff-card:hover  { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(30,64,175,.12); }
.staff-card:active { transform: scale(.990); }

.staff-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.0) 0%, rgba(255,255,255,.18) 50%, rgba(255,255,255,.0) 100%);
  opacity: 0;
  transition: opacity .25s ease;
}
.staff-card:hover::after { opacity: 1; }

.status-dot {
  position: absolute; top: 10px; right: 10px;
  width: 7px; height: 7px; border-radius: 999px;
  box-shadow: 0 0 0 5px rgba(255,255,255,.35);
}

/* ─── Avatars Collaborateurs ─── */
.staff-avatar {
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(30,64,175,.12);
  border: 2px solid rgba(255,255,255,.92);
  background: rgba(245,158,11,.10);
  transition: transform .2s ease, box-shadow .2s ease;
}
.staff-card:hover .staff-avatar {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(30,64,175,.20);
}
.staff-avatar-fallback {
  border-radius: 999px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: .02em;
  background: linear-gradient(135deg, rgba(245,158,11,.22), rgba(29,78,216,.14));
  color: #1e3a5f;
  border: 2px solid rgba(255,255,255,.92);
  box-shadow: 0 2px 8px rgba(30,64,175,.08);
}


.arrive-time {
  position: absolute; bottom: 12px; right: 12px;
  font-family: "DM Serif Display", serif;
  font-size: 14px;
  color: rgba(15,39,68,.72);
  letter-spacing: .01em;
}

.status-green  { border-left-color: var(--ok)   !important; background: var(--okBg); }
.status-orange { border-left-color: var(--amber) !important; background: var(--amberBg); }
.status-red    { border-left-color: var(--crit)  !important; background: var(--critBg); }
.status-flash  {
  border-left-color: var(--crit) !important;
  background: var(--critBg);
  animation: flash-red 1s infinite;
}
@keyframes flash-red {
  0%   { box-shadow: inset 0 0 0px rgba(220,38,38,0); }
  50%  { box-shadow: inset 0 0 20px rgba(220,38,38,.10); border-left-width: 5px; }
  100% { box-shadow: inset 0 0 0px rgba(220,38,38,0); }
}
.status-off {
  border-left-color: rgba(148,163,184,.45) !important;
  background: rgba(255,255,255,.32);
  opacity: .62;
}
/* Absent non justifié : bordure + pulse orange */
.status-absent {
  border-left-color: rgba(234,88,12,.70) !important;
  background: rgba(234,88,12,.06);
  animation: pulse-absent 2s ease-in-out infinite;
}
@keyframes pulse-absent {
  0%,100% { box-shadow: inset 0 0 0px rgba(234,88,12,0); border-left-width: 3px; }
  50%      { box-shadow: inset 0 0 18px rgba(234,88,12,.10); border-left-width: 5px; }
}

/* Badge absent inline dans le modal historique */
.badge-absent {
  display:inline-flex; align-items:center; gap:4px;
  background:rgba(234,88,12,.10); border:1px solid rgba(234,88,12,.30);
  color:#9a3412; font-weight:900; font-size:10px;
  padding:3px 8px; border-radius:999px; letter-spacing:.04em;
}

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--stroke-med);
  font-weight: 900; font-size: 11px;
  background: rgba(255,255,255,.70);
  color: var(--text);
}
.chip-p  { background: var(--chip-p-bg);  border-color: var(--chip-p-bdr);  color: var(--chip-p-fg); }
.chip-r  { background: var(--chip-r-bg);  border-color: var(--chip-r-bdr);  color: var(--chip-r-fg); }
.chip-c  { background: var(--chip-c-bg);  border-color: var(--chip-c-bdr);  color: var(--chip-c-fg); }

/* ─── Table R/C ─── */
.rc-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.rc-table th, .rc-table td {
  border: 1px solid rgba(30,64,175,.07);
  padding: 8px 6px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.rc-table td.col-emp {
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
}
.rc-table th {
  background: rgba(255,255,255,.55);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 9px;
  color: var(--muted2);
  padding: 8px 6px;
}
.rc-table tbody tr:nth-child(odd)  { background: rgba(255,255,255,.22); }
.rc-table tbody tr[data-nom] {
  cursor: pointer;
  transition: background .18s ease, transform .12s ease;
}
.rc-table tbody tr[data-nom]:hover {
  background: rgba(245,158,11,.08);
}
.rc-table tbody tr[data-nom]:active { opacity: .80; }
.muted-dash { opacity: .38; }

/* Typographie spécifique employé dans le tableau */
.emp-name-main {
  font-weight: 900;
  font-size: 11px;
  color: #0f2744;
  letter-spacing: .01em;
}
.emp-prenom-sub {
  opacity: .65;
  font-weight: 700;
  font-size: 10.5px;
  color: #0f2744;
}
.rc-poste-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  color: var(--muted2);
  letter-spacing: .04em;
  margin-top: 1px;
}

/* ─── Agrandissement adaptatif pour PC & Tablette ─── */
@media (min-width: 640px) {
  .rc-table th, .rc-table td {
    padding: 11px 8px;
    font-size: 12.5px;
  }
  .rc-table th {
    font-size: 10.5px;
    padding: 10px 8px;
    letter-spacing: .10em;
  }
  .emp-name-main {
    font-size: 13.5px;
  }
  .emp-prenom-sub {
    font-size: 12.5px;
  }
  .rc-poste-badge {
    font-size: 10px;
    padding: 1px 6px;
    background: rgba(30,64,175,.06);
    border-radius: 6px;
  }
}

@media (min-width: 1024px) {
  .rc-table th, .rc-table td {
    padding: 14px 12px;
    font-size: 14px;
  }
  .rc-table th {
    font-size: 11.5px;
    padding: 12px 12px;
  }
  .emp-name-main {
    font-size: 16px;
    font-weight: 800;
  }
  .emp-prenom-sub {
    font-size: 14.5px;
    font-weight: 600;
  }
  .rc-poste-badge {
    font-size: 11px;
    padding: 2px 8px;
  }
  .solde-badge {
    padding: 3px 9px;
    font-size: 12px;
  }
}

.cal-cell {
  border-radius: 9px;
  padding: 5px 2px;
  min-height: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid rgba(148,163,184,.10);
}
.cal-cell.cal-today {
  border: 2px solid rgba(245,158,11,.65) !important;
  box-shadow: 0 0 0 3px rgba(245,158,11,.10);
}
.cal-cell.cal-out { background: rgba(148,163,184,.04); }

/* ─── Drawers ─── */
.drawer {
  border: 1px solid var(--stroke-med);
  border-radius: 22px;
  overflow: clip;
  background: linear-gradient(160deg, rgba(255,255,255,.86), rgba(255,255,255,.66));
}
.drawer summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background .2s ease;
}
.drawer summary:hover { background: rgba(245,158,11,.04); }
.drawer summary::-webkit-details-marker { display: none; }
.drawer .chev { transition: transform .22s ease; opacity: .65; color: var(--accent); font-size: 13px; }
.drawer[open] .chev { transform: rotate(180deg); }
.drawer .body { padding: 0 18px 18px 18px; }

/* ─── Modals ─── */
.modal-active { display: flex !important; animation: slideUp .32s cubic-bezier(0,.1,.2,1); }
.modal-closing { animation: slideDown .26s cubic-bezier(.4,0,1,1) forwards; }
@keyframes slideUp   { from { transform: translateY(100%); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideDown { from { transform: translateY(0);    opacity: 1; } to { transform: translateY(100%); opacity: 0; } }

.modal-overlay {
  background: rgba(10,30,65,.32);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.modal-sheet {
  background: linear-gradient(160deg, rgba(255,255,255,.97), rgba(239,246,255,.94));
  border: 1px solid var(--stroke-med);
  box-shadow: var(--shadow-lg);
}
.handle {
  width: 38px; height: 4px;
  background: rgba(30,64,175,.16);
  border-radius: 999px;
  margin: 0 auto 16px auto;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-in {
  animation: fadeSlideUp .45s cubic-bezier(0,.1,.2,1) both;
}
.anim-in-1 { animation-delay: .05s; }
.anim-in-2 { animation-delay: .12s; }
.anim-in-3 { animation-delay: .20s; }
.anim-in-4 { animation-delay: .28s; }

.sync-dot {
  display: inline-block;
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--ok);
  margin-right: 5px;
  animation: pulse-dot 2s ease infinite;
  vertical-align: middle;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .55; transform: scale(.8); }
}

@media (prefers-reduced-motion: reduce) {
  .staff-card, .view-btn, .btn-action, .btn-login, .bilan-week-btn { transition: none; }
  .anim-in { animation: none; }
}

/* ─── Filtre hebdomadaire Bilan (Lundi au Dimanche) ─── */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.bilan-week-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 6px 13px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted2);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--stroke-med);
  cursor: pointer;
  transition: all .2s ease;
  user-select: none;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(30, 64, 175, 0.04);
}
.bilan-week-btn:hover:not(.active) {
  background: rgba(29, 78, 216, 0.08);
  color: var(--muted);
  border-color: rgba(29, 78, 216, 0.25);
  transform: translateY(-1px);
}
.bilan-week-btn.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.20) 0%, rgba(245, 158, 11, 0.10) 100%);
  color: #78350f;
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.16), inset 0 0 0 1px rgba(245, 158, 11, 0.12);
  transform: translateY(-1px);
}
.bilan-week-btn .week-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(29, 78, 216, 0.35);
  transition: all .2s ease;
}
.bilan-week-btn.active .week-indicator {
  background: var(--accent);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.8);
}
