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

/* L'attribut hidden doit gagner même sur les règles display ci-dessous
   (.overlay est en display:flex, ce qui écraserait le hidden natif). */
[hidden] { display: none !important; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: #f3f5f9;
  color: #1c2333;
}

header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: #101828;
  color: #fff;
}

header h1 { font-size: 20px; margin-right: 12px; }

nav { display: flex; gap: 4px; flex: 1; }

.tab {
  background: none;
  border: none;
  color: #98a4bd;
  font-size: 15px;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.tab.active { background: #1d2a44; color: #fff; }

.header-right { display: flex; gap: 8px; }

section.tab-content { padding: 24px; max-width: 1100px; margin: 0 auto; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

input, select, textarea {
  padding: 9px 12px;
  border: 1px solid #cdd5e1;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  font-family: inherit;
}

textarea { resize: vertical; width: 100%; }

.btn {
  padding: 9px 14px;
  border: 1px solid #cdd5e1;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  color: #1c2333;
  display: inline-block;
}

.btn:hover { background: #eef1f6; }
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.danger { color: #b91c1c; border-color: #f3c1c1; }
.btn.danger:hover { background: #fdf0f0; }
.btn.ghost { background: transparent; color: #cbd5e1; border-color: #33415e; }
.btn.ghost:hover { background: #1d2a44; }
.btn.small { padding: 5px 10px; font-size: 13px; }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08); }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid #eef1f6; font-size: 14px; }
th { background: #f8fafc; font-weight: 600; color: #475569; }
tr:last-child td { border-bottom: none; }

.badge-pill {
  font-family: ui-monospace, monospace;
  background: #eef2ff;
  color: #3730a3;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12.5px;
}

.status { padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.status.present { background: #dcfce7; color: #166534; }
.status.absent { background: #f1f5f9; color: #64748b; }
.status.inactive { background: #fee2e2; color: #991b1b; }

.muted { color: #64748b; font-size: 13.5px; margin-bottom: 12px; }
.error { color: #b91c1c; font-size: 13.5px; min-height: 18px; margin-top: 8px; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 14, 24, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.card {
  background: #fff;
  border-radius: 14px;
  padding: 28px;
  width: 380px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 20px 50px rgba(9, 14, 24, 0.35);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card.wide { width: 720px; max-height: 85vh; overflow-y: auto; }
.card.center { text-align: center; }
.card h1, .card h2 { font-size: 19px; }

.scan-zone {
  border: 2px dashed #93c5fd;
  border-radius: 12px;
  padding: 26px;
  background: #eff6ff;
  color: #1e40af;
}

.scan-anim {
  width: 46px;
  height: 46px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 3px solid #bfdbfe;
  border-top-color: #2563eb;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.day-block { background: #fff; border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(16,24,40,0.06); }
.day-block h4 { font-size: 14px; margin-bottom: 8px; display: flex; justify-content: space-between; }
.interval { font-family: ui-monospace, monospace; font-size: 13.5px; padding: 2px 0; display: flex; gap: 10px; align-items: center; }
.warn { color: #b45309; font-weight: 600; }

.report-emp { background: #fff; border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(16,24,40,0.06); }
.report-emp h3 { font-size: 15.5px; display: flex; justify-content: space-between; margin-bottom: 8px; }
.report-emp table { box-shadow: none; }
.report-emp td { word-break: break-word; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  header { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  header h1 { margin-right: 0; }
  nav { order: 3; width: 100%; flex: none; }
  .header-right { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }

  section.tab-content { padding: 14px; }

  .btn { padding: 11px 14px; } /* cibles tactiles */
  .btn.small { padding: 9px 12px; }

  .toolbar input, .toolbar select { flex: 1 1 130px; min-width: 0; }
  .toolbar .btn { flex: 0 0 auto; }
  .toolbar label { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; }
  .toolbar label input { flex: 1; min-width: 0; }

  /* Tableau employés → cartes empilées */
  #employees-table { box-shadow: none; background: none; border-radius: 0; }
  #employees-table thead { display: none; }
  #employees-table, #employees-table tbody { display: block; }
  #employees-table tr {
    display: block;
    background: #fff;
    border-radius: 10px;
    padding: 8px 14px 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
  }
  #employees-table td { display: block; border: none; padding: 5px 0; font-size: 14.5px; }
  #employees-table td:first-child { font-size: 16px; padding-top: 8px; }
  #employees-table td:last-child { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
  #employees-table td:last-child .btn { flex: 1 1 40%; text-align: center; margin: 0; }

  .report-emp { padding: 12px; }
  .report-emp h3 { flex-direction: column; gap: 4px; }
  .report-emp th, .report-emp td { padding: 8px; font-size: 13px; }

  .card { padding: 20px; }
  .card.wide { max-height: 90dvh; }
  .overlay { padding: 12px; }
}
