/* ================= Chronos — thème sobre bleu/gris ================= */
:root {
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-50:  #eff6ff;
  --indigo:   #4f46e5;
  --green-600:#16a34a;
  --green-50: #ecfdf5;
  --amber-600:#d97706;
  --amber-50: #fffbeb;
  --red-600:  #dc2626;
  --red-50:   #fef2f2;

  --ink:      #0f172a;
  --slate-700:#334155;
  --slate-500:#64748b;
  --slate-400:#94a3b8;
  --slate-300:#cbd5e1;
  --slate-200:#e2e8f0;
  --slate-100:#f1f5f9;
  --slate-50: #f8fafc;
  --bg:       #f4f6fb;
  --white:    #ffffff;

  --radius:   16px;
  --radius-sm:10px;
  --shadow-sm:0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
  --shadow-md:0 4px 12px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.04);
  --shadow-lg:0 12px 32px rgba(15,23,42,.14);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
.hidden { display: none !important; }
h1,h2,h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
button { font-family: inherit; cursor: pointer; }
a { text-decoration: none; color: inherit; }

/* ---------- Bannière démo ---------- */
.demo-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(90deg, #1e293b, #334155);
  color: #e2e8f0; font-size: 12.5px; font-weight: 500;
  padding: 6px 12px; letter-spacing: .02em; cursor: pointer;
  transition: transform .3s ease;
}
.demo-banner.hide { transform: translateY(-100%); }
.demo-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--amber-600); box-shadow: 0 0 0 3px rgba(217,119,6,.25);
  animation: pulse 2s infinite;
}
@keyframes pulse { 50% { opacity: .5; } }

/* ---------- Boutons ---------- */
.btn {
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 16px; font-size: 14px; font-weight: 600;
  transition: all .15s ease; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--blue-700); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--white); color: var(--blue-700); border-color: var(--slate-200); }
.btn-secondary:hover { border-color: var(--blue-500); background: var(--blue-50); }
.btn-ghost { background: transparent; color: var(--slate-500); border-color: transparent; }
.btn-ghost:hover { background: var(--slate-100); color: var(--ink); }
.btn-block { width: 100%; }
.btn-icon { padding: 8px 12px; font-size: 16px; }
.btn-mini { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-approve { background: var(--green-600); color: #fff; }
.btn-approve:hover { filter: brightness(1.05); }
.btn-reject { background: var(--white); color: var(--red-600); border-color: var(--slate-200); margin-left: 6px; }
.btn-reject:hover { background: var(--red-50); border-color: var(--red-600); }

/* ================= CONNEXION ================= */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 15% -10%, rgba(37,99,235,.18), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(79,70,229,.16), transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--white);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 36px 32px; border: 1px solid var(--slate-200);
}
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.brand-logo { width: 52px; height: 52px; flex: none; }
.brand-logo.sm { width: 30px; height: 30px; }
.brand-logo svg { width: 100%; height: 100%; }
.brand-logo svg circle { fill: var(--blue-600); }
.brand-logo svg path { stroke: #fff; stroke-width: 7; }
.brand-name { font-size: 24px; color: var(--ink); }
.brand-tag { margin: 2px 0 0; font-size: 13px; color: var(--slate-500); }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--slate-700); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 14px; font-size: 14.5px;
  border: 1px solid var(--slate-300); border-radius: var(--radius-sm);
  background: var(--slate-50); color: var(--ink); transition: all .15s;
}
.field input:focus {
  outline: none; border-color: var(--blue-500);
  background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.login-hint { text-align: center; font-size: 12.5px; color: var(--slate-400); margin: 14px 0 0; }

/* ================= APP LAYOUT ================= */
.app { padding-top: 29px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 29px; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  background: var(--white); border-bottom: 1px solid var(--slate-200);
  padding: 10px 20px; box-shadow: var(--shadow-sm);
}
.topbar-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.role-switch { display: flex; background: var(--slate-100); border-radius: 10px; padding: 3px; }
.role-btn {
  border: none; background: transparent; padding: 6px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--slate-500); transition: all .15s;
}
.role-btn.active { background: #fff; color: var(--blue-700); box-shadow: var(--shadow-sm); }

.user-chip { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
  background: linear-gradient(135deg, var(--blue-600), var(--indigo)); color: #fff;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.user-name { font-size: 14px; font-weight: 600; }

.menu-toggle { display: none; flex-direction: column; gap: 4px; background: none; border: none; padding: 6px; }
.menu-toggle span { width: 20px; height: 2px; background: var(--slate-700); border-radius: 2px; }

.layout { flex: 1; display: flex; }
.sidebar {
  width: 232px; flex: none; background: var(--white);
  border-right: 1px solid var(--slate-200); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: 14.5px; font-weight: 600; color: var(--slate-500); transition: all .15s;
}
.nav-item:hover { background: var(--slate-100); color: var(--ink); }
.nav-item.active { background: var(--blue-50); color: var(--blue-700); }
.nav-ico { font-size: 16px; width: 20px; text-align: center; }
.nav-manager { display: none; }
body.is-manager .nav-manager { display: flex; }

.sidebar-backdrop { display: none; }

.content { flex: 1; padding: 26px; max-width: 1180px; width: 100%; margin: 0 auto; }
.view-head { margin-bottom: 22px; }
.view-head h2 { font-size: 22px; }
.view-sub { margin: 4px 0 0; color: var(--slate-500); font-size: 14px; }

/* ---------- Cartes génériques ---------- */
.card {
  background: var(--white); border: 1px solid var(--slate-200);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h3 { font-size: 15.5px; }
.pill { font-size: 12.5px; font-weight: 700; color: var(--blue-700); background: var(--blue-50); padding: 4px 10px; border-radius: 999px; }
.pill-muted { color: var(--slate-500); background: var(--slate-100); }

/* ================= POINTAGE ================= */
.punch-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px; }
.punch-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 30px 24px; }
.clock { font-size: 46px; font-weight: 800; letter-spacing: 1px; color: var(--ink); font-variant-numeric: tabular-nums; }
.clock-date { color: var(--slate-500); font-size: 14px; text-transform: capitalize; }
.punch-status {
  margin-top: 6px; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--slate-500); background: var(--slate-100); padding: 5px 14px; border-radius: 999px;
}
.punch-status.active { color: var(--green-600); background: var(--green-50); }
.btn-punch {
  margin-top: 12px; padding: 16px 40px; font-size: 16px; font-weight: 700; color: #fff;
  border: none; border-radius: 14px; background: linear-gradient(135deg, var(--blue-600), var(--indigo));
  box-shadow: 0 8px 20px rgba(37,99,235,.32); transition: all .18s;
}
.btn-punch:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(37,99,235,.4); }
.btn-punch.out { background: linear-gradient(135deg, var(--red-600), #b91c1c); box-shadow: 0 8px 20px rgba(220,38,38,.3); }
.punch-meta { font-size: 13px; color: var(--slate-500); min-height: 18px; }

.punch-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.punch-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--slate-200); border-radius: var(--radius-sm); background: var(--slate-50);
}
.punch-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; flex: none; }
.punch-ico.in { background: var(--green-50); color: var(--green-600); }
.punch-ico.out { background: var(--amber-50); color: var(--amber-600); }
.punch-info { display: flex; flex-direction: column; }
.punch-info strong { font-size: 14px; }
.punch-info span { font-size: 12.5px; color: var(--slate-500); font-variant-numeric: tabular-nums; }
.punch-item .badge { margin-left: auto; }
.empty { padding: 24px; text-align: center; color: var(--slate-400); font-size: 13.5px; }

/* ---------- Badges ---------- */
.badge { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge-approved, .badge-approved { color: var(--green-600); background: var(--green-50); }
.badge-pending { color: var(--amber-600); background: var(--amber-50); }
.badge-rejected { color: var(--red-600); background: var(--red-50); }

/* ================= TABLEAU DE BORD ================= */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { display: flex; align-items: center; gap: 14px; padding: 18px; }
.stat-ico {
  width: 46px; height: 46px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-size: 20px;
}
.tone-blue   .stat-ico { background: var(--blue-50); }
.tone-indigo .stat-ico { background: #eef2ff; }
.tone-green  .stat-ico { background: var(--green-50); }
.tone-amber  .stat-ico { background: var(--amber-50); }
.stat-value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.stat-label { font-size: 12.5px; color: var(--slate-500); margin-top: 2px; }

.dash-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 20px; }

/* Graphique barres */
.chart { display: flex; align-items: flex-end; justify-content: space-around; gap: 12px; height: 220px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-val { font-size: 11px; font-weight: 700; color: var(--slate-500); margin-bottom: 6px; }
.bar-track { flex: 1; width: 60%; max-width: 46px; display: flex; align-items: flex-end; }
.bar-fill {
  width: 100%; border-radius: 8px 8px 4px 4px; min-height: 6px;
  background: linear-gradient(180deg, var(--blue-500), var(--blue-600));
  transition: height .5s cubic-bezier(.22,1,.36,1);
}
.bar-fill.pending { background: linear-gradient(180deg, #fbbf24, var(--amber-600)); }
.bar-label { font-size: 12px; font-weight: 600; color: var(--slate-500); margin-top: 8px; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--slate-400); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--slate-200);
}
.data-table td { padding: 12px; border-bottom: 1px solid var(--slate-100); color: var(--slate-700); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--slate-50); }
.ta-right { text-align: right; }
.muted { color: var(--slate-400); }

/* ================= VALIDATION ================= */
.validation-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.filters { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.segmented { display: inline-flex; background: var(--slate-100); border-radius: 10px; padding: 3px; }
.seg {
  border: none; background: transparent; padding: 7px 15px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--slate-500); transition: all .15s;
}
.seg.active { background: #fff; color: var(--blue-700); box-shadow: var(--shadow-sm); }
.filter-count { font-size: 13px; color: var(--slate-500); }
.emp-cell { display: flex; align-items: center; gap: 10px; }
.validation-table td { vertical-align: middle; }

/* ================= TOASTS ================= */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(12px); transition: all .3s ease; max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #065f46; }
.toast-error { background: #991b1b; }

/* ================= RESPONSIVE ================= */
@media (max-width: 900px) {
  .punch-grid, .dash-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .menu-toggle { display: flex; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .user-name { display: none; }
  .role-switch { order: 3; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: var(--shadow-lg); width: 240px; padding-top: 20px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: rgba(15,23,42,.4); opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .content { padding: 18px 14px; }
  .clock { font-size: 38px; }
  .topbar-right { gap: 8px; }
}
@media (max-width: 460px) {
  .stat-grid { grid-template-columns: 1fr; }
  .role-btn, .seg { padding: 6px 10px; font-size: 12px; }
  .validation-head { flex-direction: column; }
  .btn-reject { margin-left: 0; margin-top: 6px; }
}
