/* ============ Pointeuse — feuille de style ============ */
:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --border: #d9e0ea;
  --text: #16202e;
  --muted: #64748b;
  --primary: #1f6feb;
  --primary-dark: #1857b8;
  --green: #17915b;
  --green-soft: #e4f6ed;
  --amber: #b8770d;
  --amber-soft: #fdf3df;
  --red: #c8372d;
  --red-soft: #fdeceb;
  --slate-soft: #eef1f6;
  --shadow: 0 1px 2px rgba(16,26,40,.06), 0 8px 24px rgba(16,26,40,.07);
  --radius: 14px;
  --mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e141c;
    --surface: #161e29;
    --surface-2: #1c2632;
    --border: #2a3644;
    --text: #e6edf5;
    --muted: #8fa0b4;
    --primary: #4c93ff;
    --primary-dark: #3a7fe6;
    --green: #35c07f;
    --green-soft: #143224;
    --amber: #e3a53a;
    --amber-soft: #33280f;
    --red: #f0645a;
    --red-soft: #3a1a18;
    --slate-soft: #212c3a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- En-tête ---------- */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.header-top {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.brand .logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(140deg, var(--primary), #7c4dff);
  color: #fff; display: grid; place-items: center; font-size: 22px;
  flex: none;
}
.brand h1 { font-size: 18px; }
.brand p { font-size: 12.5px; color: var(--muted); text-transform: capitalize; }

.horloge {
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  line-height: 1;
}

.tabs {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 12px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
}
.tabs button {
  background: none; border: 0; cursor: pointer;
  padding: 10px 14px 12px;
  color: var(--muted); font-weight: 550; font-size: 14px;
  border-bottom: 2.5px solid transparent;
  white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Structure ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 22px 20px 70px; }
.vue { display: none; animation: fade .18s ease; }
.vue.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}
.card > h2 { font-size: 15px; margin-bottom: 4px; }
.sub { font-size: 13px; color: var(--muted); }
.card > h2 + .sub { margin-bottom: 14px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.spacer { flex: 1 1 auto; }

/* ---------- Champs ---------- */
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); font-weight: 550; }
input[type=text], input[type=number], input[type=date], input[type=time],
input[type=password], select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 11px;
  color: var(--text);
  min-width: 0;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent);
  outline-offset: 1px;
  border-color: var(--primary);
}
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }

/* ---------- Boutons ---------- */
.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 9px;
  padding: 8px 14px;
  font-weight: 550;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: filter .12s, transform .06s;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.green   { background: var(--green); border-color: var(--green); color: #fff; }
.btn.amber   { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn.red     { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost   { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: none; border-radius: 7px; padding: 5px 11px; cursor: pointer; font-size: 13px; font-weight: 550; color: var(--muted); }
.seg button.active { background: var(--primary); color: #fff; }

/* ---------- Statistiques ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .k { font-size: 12px; color: var(--muted); font-weight: 550; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 27px; font-weight: 680; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat.green .v { color: var(--green); }
.stat.amber .v { color: var(--amber); }
.stat.red .v   { color: var(--red); }

/* ---------- Bandeau badge ---------- */
.badge-bar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: linear-gradient(120deg, color-mix(in srgb, var(--primary) 12%, var(--surface)), var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.badge-bar .lab { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.badge-bar input {
  font-family: var(--mono); font-size: 21px; letter-spacing: .35em;
  width: 140px; text-align: center; padding: 8px 10px;
  background: var(--surface);
}

/* ---------- Cartes employés ---------- */
.grid-employes { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 14px; }
.emp-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 15px; display: flex; flex-direction: column; gap: 12px;
  border-left: 4px solid var(--border);
}
.emp-card.st-in    { border-left-color: var(--green); }
.emp-card.st-pause { border-left-color: var(--amber); }
.emp-card.st-out   { border-left-color: color-mix(in srgb, var(--muted) 45%, transparent); }

.emp-head { display: flex; align-items: center; gap: 11px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 680; font-size: 15px; color: #fff;
}
.emp-head .nom { font-weight: 620; }
.emp-head .poste { font-size: 12.5px; color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 620; padding: 3px 9px; border-radius: 999px;
  white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.in    { background: var(--green-soft); color: var(--green); }
.pill.pause { background: var(--amber-soft); color: var(--amber); }
.pill.out   { background: var(--slate-soft); color: var(--muted); }

.emp-meta {
  display: flex; justify-content: space-between; gap: 8px;
  background: var(--surface-2); border-radius: 10px; padding: 9px 11px; font-size: 13px;
}
.emp-meta div { text-align: center; flex: 1; }
.emp-meta .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.emp-meta .v { font-weight: 620; font-variant-numeric: tabular-nums; }
.emp-actions { display: flex; gap: 8px; }
.emp-actions .btn { flex: 1; justify-content: center; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 620; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 680; background: var(--surface-2); border-top: 2px solid var(--border); }
.vide { padding: 34px; text-align: center; color: var(--muted); background: var(--surface); }

/* ---------- Barres de rapport ---------- */
.bar-track { background: var(--slate-soft); border-radius: 999px; height: 9px; min-width: 90px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--primary); }
.bar-fill.over { background: var(--amber); }
.ecart-pos { color: var(--green); font-weight: 600; }
.ecart-neg { color: var(--red); font-weight: 600; }

/* ---------- Modale ---------- */
dialog {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  padding: 0; box-shadow: 0 24px 60px rgba(0,0,0,.3);
  width: min(480px, 94vw);
}
dialog::backdrop { background: rgba(9,14,22,.55); }
.modal-head { padding: 16px 18px 0; }
.modal-head h3 { font-size: 16px; }
.modal-head .sub { margin-top: 3px; }
.modal-body { padding: 14px 18px; display: grid; gap: 12px; }
.modal-foot { padding: 14px 18px; display: flex; gap: 9px; justify-content: flex-end; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Pavé numérique ---------- */
.pin-display {
  font-family: var(--mono); font-size: 30px; letter-spacing: .5em;
  text-align: center; padding: 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; min-height: 58px;
}
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button {
  padding: 14px; font-size: 19px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 10px; cursor: pointer;
}
.keypad button:hover { background: var(--slate-soft); }

/* ---------- Notifications ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; display: grid; gap: 9px; z-index: 90; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: 11px; padding: 11px 15px; box-shadow: 0 12px 30px rgba(0,0,0,.18);
  min-width: 250px; max-width: 360px; animation: slide .22s ease;
}
.toast.ok  { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast .t { font-weight: 620; font-size: 14px; }
.toast .d { font-size: 13px; color: var(--muted); }
@keyframes slide { from { opacity: 0; transform: translateX(20px); } }

/* ---------- Divers ---------- */
.tag { font-size: 11px; font-weight: 620; padding: 2px 7px; border-radius: 6px; background: var(--slate-soft); color: var(--muted); }
.tag.corr  { background: var(--amber-soft); color: var(--amber); }
.tag.cours { background: var(--green-soft); color: var(--green); }
.danger-zone { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.inactif { opacity: .55; }

@media (max-width: 620px) {
  .horloge { font-size: 26px; }
  main { padding: 16px 12px 60px; }
  .header-top { padding: 12px; }
  .grid2 { grid-template-columns: 1fr; }
}

/* ---------- Impression ---------- */
@media print {
  .app-header, .btn, .badge-bar, #toasts, .no-print, .seg { display: none !important; }
  body { background: #fff; color: #000; }
  main { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; margin-bottom: 14px; }
  .vue { display: none !important; }
  .vue.active { display: block !important; }
  table { font-size: 11px; }
  th, td { padding: 4px 6px; }
  .table-wrap { border: 1px solid #999; }
}

/* ---------- Écran d'accès (version en ligne) ---------- */
#ecranAcces {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 20px;
  background: var(--bg);
  overflow-y: auto;
}
#ecranAcces[hidden] { display: none; }
.acces-carte {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  display: grid; gap: 13px;
}
.acces-logo {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(140deg, var(--primary), #7c4dff);
  color: #fff; display: grid; place-items: center; font-size: 26px;
  margin-bottom: 2px;
}
.acces-carte h2 { font-size: 20px; }
.acces-carte .btn { justify-content: center; padding: 11px; margin-top: 4px; }
.acces-msg:empty { display: none; }
.acces-msg {
  background: var(--red-soft); color: var(--red);
  border-radius: 9px; padding: 9px 12px; font-size: 13.5px; font-weight: 550;
}
#zoneCompte { display: flex; align-items: center; gap: 8px; }
#zoneCompte:empty { display: none; }
.tabs button[hidden] { display: none; }
