/* ==========================================================================
   Nakomi - Feuille de style principale (mobile d'abord)
   ========================================================================== */

[hidden] { display: none !important; }

:root {
  --navy: #0B1F33;
  --navy-soft: #16293D;
  --mint: #0E9F6E;
  --mint-soft: #E6F6F0;
  --amber: #F0A22E;
  --amber-soft: #FDF3E2;
  --red: #E5484D;
  --red-soft: #FDEBEC;
  --blue: #2F6FED;
  --blue-soft: #EAF1FE;
  --grey: #8A98A6;
  --line: #E3EAF1;
  --bg: #F4F7FA;
  --white: #FFFFFF;
  --text: #16202B;
  --shadow: 0 1px 2px rgba(11, 31, 51, 0.06), 0 8px 24px rgba(11, 31, 51, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0 0 10px; line-height: 1.25; color: var(--navy); }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 8px; }
a { color: var(--blue); }

.muted { color: var(--grey); }
.small { font-size: 0.86rem; }
.center { text-align: center; }
.danger-text { color: var(--red); }

.ico { flex: none; }

/* ---------------- Structure application ---------------- */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 14px 26px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--navy);
  color: var(--white);
  padding-top: env(safe-area-inset-top, 0px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
}

.topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-titles { display: flex; flex-direction: column; min-width: 0; }
.topbar-titles strong { font-size: 0.98rem; }
.topbar-titles .small { font-size: 0.76rem; color: rgba(255, 255, 255, 0.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 6px; flex: none; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--mint);
  color: var(--white);
  flex: none;
}
.brand-mark.small { width: 32px; height: 32px; border-radius: 10px; }
.brand-name { font-size: 1.5rem; margin: 0; }
.brand-sub { margin: 2px 0 0; color: rgba(255, 255, 255, 0.75); font-size: 0.9rem; }
.brand-title { font-size: 1.4rem; color: var(--navy); }

.topbar .btn-ghost { color: var(--white); border-color: rgba(255, 255, 255, 0.28); background: transparent; }
.topbar .btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

.btn-icon { position: relative; padding: 8px 10px; }

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: var(--white);
  font-size: 0.7rem;
  line-height: 18px;
  text-align: center;
  font-weight: 700;
}

.notif-panel {
  background: var(--white);
  border-top: 1px solid var(--line);
  max-height: 60vh;
  overflow-y: auto;
  padding: 12px 14px;
}
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.notif-list { display: grid; gap: 8px; }
.notif-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--white); }
.notif-item.is-unread { border-left: 3px solid var(--blue); background: var(--blue-soft); }
.notif-title { font-weight: 600; font-size: 0.92rem; color: var(--navy); }

.offline-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--amber-soft);
  color: #7A4E05;
  border-bottom: 1px solid #F2D8A8;
  padding: 10px 14px;
  font-size: 0.85rem;
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  gap: 2px;
  background: var(--white);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -6px 20px rgba(11, 31, 51, 0.06);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  color: var(--grey);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 10px;
}
.tab .ico { color: currentColor; }
.tab.is-active { color: var(--mint); background: var(--mint-soft); }

/* ---------------- Cartes ---------------- */

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-narrow { max-width: 460px; width: 100%; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }

.hero-card { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-soft) 100%); color: var(--white); border: none; }
.hero-card h2, .hero-card .hero-greet { color: var(--white); }
.hero-top { display: flex; align-items: center; gap: 12px; }
.hero-greet { font-size: 1.2rem; font-weight: 700; margin: 0; }
.hero-state { margin-top: 10px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--mint);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.05rem;
  flex: none;
}

/* ---------------- Indicateurs ---------------- */

.kpi-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.kpi-grid-small { grid-template-columns: repeat(2, 1fr); }
.kpi {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hero-card .kpi { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.16); }
.hero-card .kpi-label { color: rgba(255, 255, 255, 0.75); }
.hero-card .kpi-value { color: var(--white); }
.kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.kpi-label { font-size: 0.78rem; color: var(--grey); }
.kpi-ok { border-left: 4px solid var(--mint); }
.kpi-warn { border-left: 4px solid var(--amber); }
.kpi-danger { border-left: 4px solid var(--red); }

/* ---------------- Pointage ---------------- */

.punch-card { text-align: center; }
.btn-punch {
  width: 100%;
  padding: 20px 16px;
  font-size: 1.06rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  border-radius: 14px;
  background: var(--mint);
  color: var(--white);
  border: none;
}
.btn-punch:hover { background: #0C8A5F; }
.btn-punch[disabled] { background: var(--line); color: var(--grey); }

.punch-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.fact { background: var(--bg); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 3px; }
.fact-label { font-size: 0.76rem; color: var(--grey); }
.fact-value { font-size: 1.06rem; font-weight: 700; color: var(--navy); }

.punch-checks { display: grid; gap: 8px; margin-top: 12px; text-align: left; }
.check-line { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--white); font-size: 0.88rem; }
.check-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--grey); flex: none; }
.check-line.ok .check-dot { background: var(--mint); }
.check-line.ko .check-dot { background: var(--red); }
.check-line.warn .check-dot { background: var(--amber); }
.check-label { flex: 1; color: var(--navy); }
.check-value { font-weight: 600; font-size: 0.84rem; }

.punch-progress { display: grid; gap: 8px; margin: 12px 0; }
.step { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--grey); }
.step-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); flex: none; }
.step-run .step-dot { background: var(--blue); animation: pulse 1.1s infinite; }
.step-ok .step-dot { background: var(--mint); }
.step-warn .step-dot { background: var(--amber); }
.step-ko .step-dot { background: var(--red); }
.step-ok, .step-run { color: var(--navy); }

@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.35; } 100% { opacity: 1; } }

.result { border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; border: 1px solid var(--line); }
.result-ok { background: var(--mint-soft); border-color: #BDE7D6; }
.result-warn { background: var(--amber-soft); border-color: #F2D8A8; }
.result-ko { background: var(--red-soft); border-color: #F5C6C8; }
.result h3 { margin-bottom: 6px; }

.site-line { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.site-line:last-child { border-bottom: none; }
.site-icon { color: var(--mint); flex: none; margin-top: 2px; }

/* ---------------- Journees, planning ---------------- */

.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.week-label { font-weight: 600; font-size: 0.9rem; text-align: center; }

.day-block { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.day-block.is-today { border-color: var(--mint); background: var(--mint-soft); }
.day-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.day-punches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.punch-chip { font-size: 0.76rem; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); }
.punch-chip.ok { border-color: #BDE7D6; background: var(--mint-soft); color: #0A6B4A; }
.punch-chip.warn { border-color: #F2D8A8; background: var(--amber-soft); color: #7A4E05; }
.punch-chip.ko { border-color: #F5C6C8; background: var(--red-soft); color: #9C1F23; }

.day-detail { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.day-detail summary { cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 0.92rem; }
.day-detail-body { padding-top: 10px; }

.week-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.week-day { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; }
.week-day.is-today { border-color: var(--mint); }
.week-day-head { font-weight: 700; font-size: 0.86rem; margin-bottom: 8px; color: var(--navy); }
.field-mini { margin-bottom: 6px; }
.field-mini span { font-size: 0.74rem; color: var(--grey); display: block; }

/* ---------------- Listes en direct ---------------- */

.live-list { display: grid; gap: 8px; }
.live-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.live-right { text-align: right; }

.anomaly-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.anomaly-line:last-child { border-bottom: none; }

.anomaly-card { border-left: 4px solid var(--amber); }
.anomaly-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.anomaly-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ---------------- Graphiques ---------------- */

.chart-box { position: relative; width: 100%; min-height: 200px; }
.chart { display: block; width: 100%; }

.mini-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.mini-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.mini-fill { width: 100%; max-width: 34px; background: var(--mint); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.mini-label { font-size: 0.68rem; color: var(--grey); }

.status-bars { display: grid; gap: 8px; }
.status-bar-row { display: grid; grid-template-columns: 1fr; gap: 4px; }
.sb-label { font-size: 0.82rem; color: var(--navy); }
.sb-track { display: block; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.sb-fill { display: block; height: 100%; border-radius: 999px; }
.sb-value { font-size: 0.8rem; font-weight: 600; color: var(--grey); }

/* ---------------- Tableaux ---------------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll { max-height: 60vh; overflow-y: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th, .data-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table th { background: var(--bg); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--grey); white-space: nowrap; }
.data-table tbody tr:hover { background: #FAFCFE; }
.empty { color: var(--grey); text-align: center; padding: 18px 10px; }
.cell-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------- Etiquettes et pastilles ---------------- */

.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; white-space: nowrap; }
.st-vert { background: var(--mint-soft); color: #0A6B4A; }
.st-orange { background: var(--amber-soft); color: #7A4E05; }
.st-rouge { background: var(--red-soft); color: #9C1F23; }
.st-gris { background: #EEF2F6; color: #5B6B7C; }
.st-bleu { background: var(--blue-soft); color: #1C4CB8; }

.badge-ok, .badge-ko, .badge-none, .badge-warn {
  display: inline-block;
  padding: 2px 7px;
  margin: 2px 4px 2px 0;
  border-radius: 6px;
  font-size: 0.72rem;
  white-space: nowrap;
}
.badge-ok { background: var(--mint-soft); color: #0A6B4A; }
.badge-ko { background: var(--red-soft); color: #9C1F23; }
.badge-none { background: #EEF2F6; color: #5B6B7C; }
.badge-warn { background: var(--amber-soft); color: #7A4E05; }

/* ---------------- Boutons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--mint); color: var(--white); }
.btn-primary:hover { background: #0C8A5F; }
.btn-ghost { background: var(--white); color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #C93B3F; }
.btn-admin { background: var(--blue); color: var(--white); }
.btn-admin:hover { background: #2559C4; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 18px; font-size: 1rem; }
.btn-xl { padding: 20px 18px; font-size: 1.06rem; }
.btn-small { padding: 7px 11px; font-size: 0.82rem; border-radius: 9px; }

.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.export-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------- Formulaires ---------------- */

.form { display: grid; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label, .field > span { font-size: 0.8rem; font-weight: 600; color: var(--navy); }
.field-wide { grid-column: 1 / -1; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="date"], input[type="time"], select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }

.filter-bar, .filter-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.check-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; }
.check input { width: 18px; height: 18px; flex: none; }

/* ---------------- Messages ---------------- */

.alert { border-radius: var(--radius-sm); padding: 11px 13px; font-size: 0.88rem; margin-bottom: 10px; border: 1px solid transparent; }
.alert-danger { background: var(--red-soft); border-color: #F5C6C8; color: #9C1F23; }
.alert-warning { background: var(--amber-soft); border-color: #F2D8A8; color: #7A4E05; }
.alert-success { background: var(--mint-soft); border-color: #BDE7D6; color: #0A6B4A; }
.alert-info { background: var(--blue-soft); border-color: #C6D9FC; color: #1C4CB8; }

.toast-wrap {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--navy);
  color: var(--white);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.88rem;
  box-shadow: 0 10px 30px rgba(11, 31, 51, 0.25);
  animation: toastIn 0.22s ease;
}
.toast-success { background: #0C7A56; }
.toast-danger { background: #B9363A; }
.toast-warning { background: #A96A0C; }
.toast-out { opacity: 0; transform: translateY(8px); transition: all 0.35s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.loading { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 12px; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--mint); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Fenetres ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(11, 31, 51, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}
.modal {
  width: 100%;
  max-width: 520px;
  margin: auto;
  max-height: 88vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.scan-view { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #0B1F33; border-radius: 12px; overflow: hidden; margin-bottom: 10px; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 16%; border: 3px solid rgba(255, 255, 255, 0.85); border-radius: 12px; }

/* ---------------- Installation ---------------- */

.install-btn { white-space: nowrap; }
.install-steps { display: grid; gap: 12px; margin: 12px 0; }
.install-step { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.istep-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; color: var(--navy); }
.install-step ol { margin: 0; padding-left: 18px; font-size: 0.88rem; }

/* ---------------- Ecrans de connexion ---------------- */

.screen-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.code-block { background: var(--navy); color: var(--white); padding: 10px 12px; border-radius: 10px; font-size: 0.85rem; overflow-x: auto; }

.screen-auth { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.auth-brand {
  background: linear-gradient(155deg, var(--navy) 0%, #123252 100%);
  color: var(--white);
  padding: calc(28px + env(safe-area-inset-top, 0px)) 22px 26px;
}
.auth-brand.admin-brand { background: linear-gradient(155deg, #142A4E 0%, #1E3C6E 100%); }
.auth-brand .brand-block { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.auth-pitch { color: rgba(255, 255, 255, 0.85); font-size: 0.92rem; }
.auth-points { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.auth-points li { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: rgba(255, 255, 255, 0.92); }
.auth-points .ico { color: var(--mint); }
.admin-brand .auth-points .ico { color: #8FB2FF; }
.auth-panel { padding: 20px 16px 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.card-auth { padding: 20px; }
.auth-note { font-size: 0.82rem; color: var(--grey); margin-top: 10px; }
.auth-links { margin-top: 12px; font-size: 0.86rem; }
.legal-note { font-size: 0.76rem; color: var(--grey); margin-top: 14px; text-align: center; max-width: 420px; }
.card-password { text-align: center; }
.card-password .form { text-align: left; margin-top: 12px; }
.card-password .brand-mark { margin: 0 auto 10px; }

/* ---------------- Ecran QR du site ---------------- */

.screen-qr { background: var(--navy); color: var(--white); min-height: 100vh; display: flex; flex-direction: column; }
.qr-header { padding: calc(18px + env(safe-area-inset-top, 0px)) 18px 14px; display: grid; gap: 12px; }
.qr-head-brand { display: flex; align-items: center; gap: 10px; }
.qr-head-brand .brand-mark { background: var(--mint); }
.qr-head-brand .small { color: rgba(255, 255, 255, 0.7); display: block; }
.qr-head-site h1 { color: var(--white); font-size: 1.3rem; margin: 0; }
.qr-head-site p { color: rgba(255, 255, 255, 0.75); margin: 2px 0 0; font-size: 0.9rem; }
.qr-main { flex: 1; padding: 0 18px 18px; display: grid; gap: 16px; }
.qr-card { background: var(--white); border-radius: 20px; padding: 18px; text-align: center; }
.qr-image svg { width: 100%; max-width: 330px; height: auto; }
.qr-code-line { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.qr-code-value { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; font-size: 1.15rem; color: var(--navy); letter-spacing: 0.06em; }
.qr-timer { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; }
.qr-timer-label { font-size: 0.84rem; color: var(--grey); }
.qr-timer-value { font-weight: 700; color: var(--amber); }
.qr-progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.qr-progress span { display: block; height: 100%; background: var(--mint); transition: width 1s linear; }
.qr-help { background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 16px; padding: 14px 16px; }
.qr-help-title { font-weight: 700; margin-bottom: 6px; }
.qr-help ol { margin: 0 0 8px; padding-left: 18px; font-size: 0.9rem; color: rgba(255, 255, 255, 0.9); }
.qr-help .small, .qr-help .muted { color: rgba(255, 255, 255, 0.72); }
.qr-footer { padding: 12px 18px calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.8rem; color: rgba(255, 255, 255, 0.6); }
.qr-footer .btn-ghost { color: var(--white); border-color: rgba(255, 255, 255, 0.3); background: transparent; }

/* ==========================================================================
   Tablette et ordinateur
   ========================================================================== */

@media (min-width: 768px) {
  body { font-size: 15.5px; }
  .app-main { padding: 22px 22px 34px; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .kpi-grid-small { grid-template-columns: repeat(4, 1fr); }
  .punch-facts { grid-template-columns: repeat(4, 1fr); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar, .filter-grid { grid-template-columns: repeat(4, 1fr); align-items: end; }
  .check-grid { grid-template-columns: repeat(2, 1fr); }
  .week-grid { grid-template-columns: repeat(4, 1fr); }
  .install-steps { grid-template-columns: repeat(3, 1fr); }
  .status-bar-row { grid-template-columns: 220px 1fr 60px; align-items: center; }
  .auth-wrap { grid-template-columns: 1.05fr 1fr; }
  .auth-brand { display: flex; flex-direction: column; justify-content: center; padding: 48px 42px; }
  .auth-panel { padding: 40px; }
  .tabbar { position: sticky; bottom: 0; }
  .app-shell { padding-bottom: 0; }
  .toast-wrap { left: auto; right: 18px; width: 360px; bottom: 18px; }
  .modal-backdrop { align-items: center; }
  .qr-main { grid-template-columns: 1.2fr 1fr; align-items: start; }
  .qr-image svg { max-width: 360px; }
}

@media (min-width: 1024px) {
  .app-main { max-width: 1180px; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Tableaux transformes en cartes sur mobile */
@media (max-width: 767px) {
  .table-wrap { overflow-x: visible; }
  .mobile-cards thead { display: none; }
  .mobile-cards tr { display: block; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 10px; background: var(--white); }
  .mobile-cards td { display: flex; justify-content: space-between; gap: 10px; border: none; padding: 5px 0; font-size: 0.88rem; }
  .mobile-cards td::before { content: attr(data-label); font-weight: 600; color: var(--grey); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.03em; flex: none; }
  .data-table:not(.mobile-cards) { min-width: 640px; }
}

/* ---------------- Barre basse des ecrans de connexion ---------------- */

.tabbar .tab[type="button"] {
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
}
.auth-tabbar { position: fixed; }
.auth-tabbar .tab { color: var(--navy); }

@media (max-width: 767px) {
  .auth-wrap { padding-bottom: 78px; }
}
