/* ==========================================================================
   Ailink — sobre et moderne, avec des touches de couleur (la couleur principale suit la personnalisation du client)
   ========================================================================== */

:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f0f1f8;
  --text: #191b2e;
  --muted: #6b6f8a;
  --border: #e4e6f0;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0ff;
  --violet: #7c3aed;
  --pink: #db2777;
  --teal: #0d9488;
  --blue: #0284c7;
  --amber: #d97706;
  --success: #059669;
  --success-soft: #e7f8f1;
  --warning: #d97706;
  --warning-soft: #fff5e5;
  --danger: #dc2626;
  --danger-soft: #feecec;
  --info-soft: #e8f4fd;
  --brand-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #db2777 100%);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 50, .04), 0 4px 16px rgba(20, 22, 50, .06);
  --shadow-lg: 0 10px 40px rgba(20, 22, 50, .18);
  --sidebar: 248px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

/* Mode sombre : choisi par l'utilisateur (data-theme="dark"), ou automatique selon l'appareil
   tant qu'il n'a pas imposé le mode clair. Les deux blocs doivent rester identiques. */
:root[data-theme="dark"] {
  --bg: #0e0f1c;
  --surface: #171930;
  --surface-2: #20233d;
  --text: #e9eaf6;
  --muted: #9a9dbb;
  --border: #2b2f4d;
  --primary: #818cf8;
  --primary-hover: #a5b4fc;
  --primary-soft: #23264a;
  --success-soft: #0f2b24;
  --warning-soft: #33260f;
  --danger-soft: #3a1717;
  --info-soft: #102838;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --on-primary: #0e0f1c;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f1c;
    --surface: #171930;
    --surface-2: #20233d;
    --text: #e9eaf6;
    --muted: #9a9dbb;
    --border: #2b2f4d;
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --primary-soft: #23264a;
    --success-soft: #0f2b24;
    --warning-soft: #33260f;
    --danger-soft: #3a1717;
    --info-soft: #102838;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --on-primary: #0e0f1c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 750; letter-spacing: -.02em; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: .35rem 0; }
a { color: var(--primary); text-decoration: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.pad { padding: 12px 16px; }
.text-pink { color: var(--pink); font-weight: 650; }
.icon { flex-shrink: 0; vertical-align: middle; }

/* ---------- Démarrage ---------- */
.splash { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 24px; }
.splash img { border-radius: 18px; box-shadow: var(--shadow-lg); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--primary-soft); border-top-color: var(--primary); animation: spin .8s linear infinite; }
.loading { display: grid; place-items: center; padding: 48px 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Structure ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand img { border-radius: 10px; }
.brand strong { display: block; font-size: 1.02rem; letter-spacing: -.01em; }
.brand small { color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.side-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--muted); font-weight: 550; transition: background .15s, color .15s;
}
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: var(--primary-soft); color: var(--primary); }
.side-link.active .icon { color: var(--primary); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--border); }
.side-user > div { min-width: 0; }
.side-user strong { display: block; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user small { color: var(--muted); font-size: .78rem; }

.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: none; }
.view { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 28px 48px; }
.tabbar { display: none; }
.drawer-backdrop { display: none; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow-lg); width: min(300px, 85vw); padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
  body.drawer-open .sidebar { transform: none; }
  body.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; background: rgba(10, 12, 30, .45); z-index: 35; }
  .main { margin-left: 0; padding-bottom: calc(70px + var(--safe-bottom)); }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
    background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
  }
  .brand-compact { padding: 0; flex: 1; }
  .brand-compact img { border-radius: 8px; }
  .view { padding: 18px 16px 32px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border); padding: 6px 6px calc(6px + var(--safe-bottom));
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px;
    border: 0; background: none; color: var(--muted); font-size: .7rem; font-weight: 600; border-radius: 12px; cursor: pointer;
  }
  .tab.active { color: var(--primary); }
  .tab.active .icon { background: var(--primary-soft); border-radius: 10px; padding: 3px 12px; width: 46px; height: 28px; }
  h1 { font-size: 1.35rem; }
}

/* ---------- En-têtes de page ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .muted { margin-top: 4px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; width: 100%; margin-bottom: 4px; }
.profile-head { display: flex; align-items: center; gap: 14px; flex: 1; }
.section-title { font-size: 1.05rem; margin-bottom: 12px; }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-flush { padding: 0; overflow: hidden; }
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .card-title { margin: 0; }
.title-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--brand-gradient); color: #fff; }
.error-card { display: flex; align-items: center; gap: 12px; color: var(--danger); flex-wrap: wrap; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 650; font-size: .93rem; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, transform .1s, box-shadow .15s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--on-primary, #fff); box-shadow: 0 4px 14px rgba(79, 70, 229, .3); }
.btn-primary:hover { background: var(--primary-hover); }
.theme-btn { flex-shrink: 0; }
.auth-theme { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; z-index: 2; }
.side-user .theme-btn { margin-left: auto; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: .84rem; border-radius: 10px; }
.btn-lg { padding: 14px 22px; font-size: 1rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.link { font-weight: 600; font-size: .88rem; }
.loading-btn { position: relative; color: transparent !important; }
.loading-btn::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .7s linear infinite; }
.only-mobile { display: none; }
@media (max-width: 900px) { .only-mobile { display: inline-flex; } }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 600; font-size: .88rem; }
.input {
  width: 100%; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; /* 16px : évite le zoom auto sur iPhone */
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.input:disabled { opacity: .6; }
.input-sm { padding: 7px 10px; width: auto; font-size: 14px; }
.input-code { font-size: 1.6rem; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.input-group { display: flex; position: relative; }
.input-group .input { padding-right: 46px; }
.input-addon { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); width: 38px; height: 38px; cursor: pointer; border-radius: 9px; }
.form-grid { display: grid; gap: 0 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid.two { grid-template-columns: 1fr; } }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 10px; font-size: .9rem; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; cursor: pointer; font-weight: 550; }
.check input, .user-check input { width: 18px; height: 18px; accent-color: var(--primary); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

/* ---------- Pastilles ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 650; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip-success { background: var(--success-soft); color: var(--success); }
.chip-warning { background: var(--warning-soft); color: var(--warning); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-info { background: var(--info-soft); color: var(--blue); }
.chip-light { background: rgba(255, 255, 255, .2); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.type-badge { display: inline-block; padding: 2px 9px; border-radius: 8px; font-size: .76rem; font-weight: 700; }
.tb-in { background: var(--success-soft); color: var(--success); }
.tb-break_start { background: var(--warning-soft); color: var(--warning); }
.tb-break_end { background: var(--primary-soft); color: var(--primary); }
.tb-out { background: var(--danger-soft); color: var(--danger); }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex-shrink: 0; letter-spacing: .02em; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25); }

/* ---------- Bandeaux ---------- */
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin: 12px 16px 0; border-radius: 14px; }
.banner strong { display: block; font-size: .92rem; }
.banner small { color: var(--muted); }
.banner-update { background: var(--primary-soft); color: var(--primary); }
.banner-install { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.banner-pending { background: var(--warning-soft); color: var(--warning); margin: 0 0 16px; }
.banner-pending small { color: inherit; opacity: .85; }
@media (min-width: 901px) { .banner { margin: 16px 28px 0; } .banner-pending { margin: 0 0 16px; } }
.offline-chip { margin-right: 4px; }

/* ---------- Notifications et fenêtres ---------- */
#toasts { position: fixed; left: 50%; bottom: calc(86px + var(--safe-bottom)); transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
@media (min-width: 901px) { #toasts { bottom: 28px; } }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: #1f2140; color: #fff; box-shadow: var(--shadow-lg); font-weight: 550; opacity: 0; transform: translateY(10px); transition: all .25s; }
.toast.show { opacity: 1; transform: none; }
.toast-success { background: #047857; }
.toast-error { background: #b91c1c; }
.modal-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(10, 12, 30, .5); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .2s; }
.modal-overlay.show { opacity: 1; }
.modal { background: var(--surface); border-radius: 20px; width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateY(12px) scale(.98); transition: transform .2s; }
.modal-wide { width: min(760px, 100%); }
.modal-overlay.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.modal-body { padding: 8px 20px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 18px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .modal-overlay { align-items: end; padding: 0; }
  .modal { border-radius: 22px 22px 0 0; width: 100%; padding-bottom: var(--safe-bottom); }
  .modal-actions .btn { flex: 1; }
}

/* ---------- Écrans de connexion ---------- */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; position: relative; overflow: hidden; }
.auth-glow { position: absolute; inset: -30% -10% auto; height: 70%; background: var(--brand-gradient); filter: blur(90px); opacity: .22; pointer-events: none; }
.auth-card { position: relative; width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 32px 26px; box-shadow: var(--shadow-lg); text-align: center; }
.auth-card h1 { margin-top: 14px; }
.auth-logo { width: 68px; height: 68px; border-radius: 18px; box-shadow: 0 8px 24px rgba(79, 70, 229, .35); }
.auth-form { text-align: left; margin-top: 22px; }
.auth-form .btn-ghost { margin-top: 8px; }
.auth-foot { position: relative; color: var(--muted); font-size: .8rem; margin-top: 18px; }
.mfa-setup { text-align: left; margin-top: 16px; }
.steps { padding-left: 20px; margin: 8px 0; }
.steps li { margin-bottom: 6px; }
.qr-wrap { display: grid; place-items: center; margin: 10px 0; }
.qr { border-radius: 12px; width: 190px; height: 190px; image-rendering: pixelated; border: 1px solid var(--border); }
.secret { margin: 8px 0 12px; }
.secret summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: .88rem; }
.secret code { display: block; margin-top: 8px; padding: 10px; background: var(--surface-2); border-radius: 10px; font-size: .95rem; word-break: break-all; }

/* ---------- Écran de pointage ---------- */
.punch-page { max-width: 560px; margin: 0 auto; }
.punch-hero {
  position: relative; border-radius: 24px; padding: 22px 22px 20px; color: #fff; overflow: hidden;
  background: var(--brand-gradient); box-shadow: 0 14px 40px rgba(79, 70, 229, .3); margin-bottom: 18px;
}
.punch-hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.punch-hero.mode-working { background: linear-gradient(135deg, #059669 0%, #0d9488 55%, #0284c7 100%); box-shadow: 0 14px 40px rgba(5, 150, 105, .3); }
.punch-hero.mode-break { background: linear-gradient(135deg, #d97706 0%, #ea580c 60%, #db2777 100%); box-shadow: 0 14px 40px rgba(217, 119, 6, .3); }
.punch-hero.mode-forgotten { background: linear-gradient(135deg, #b91c1c 0%, #db2777 100%); }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; position: relative; z-index: 1; }
.hello { font-size: 1.15rem; font-weight: 700; }
.date { opacity: .85; text-transform: capitalize; font-size: .92rem; }
.clock { font-size: 3.4rem; font-weight: 780; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin: 10px 0 8px; position: relative; z-index: 1; }
.clock span { font-size: 1.6rem; opacity: .65; font-weight: 600; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .18); padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: .92rem; position: relative; z-index: 1; }
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.mode-working .status-pill .dot, .mode-break .status-pill .dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.7); } }
.site-field { margin-bottom: 4px; }

.punch-actions { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 22px 0 10px; }
.punch-btn {
  --c1: #10b981; --c2: #059669;
  position: relative; width: 200px; height: 200px; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  background: radial-gradient(circle at 30% 25%, var(--c1), var(--c2));
  box-shadow: 0 18px 40px color-mix(in srgb, var(--c2) 45%, transparent), inset 0 -6px 16px rgba(0, 0, 0, .15);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: transform .12s ease, box-shadow .2s;
}
.punch-btn:active { transform: scale(.95); }
.punch-btn:disabled { opacity: .7; }
.punch-btn strong { font-size: 1.45rem; font-weight: 780; }
.punch-btn small { font-size: .78rem; opacity: .9; }
.punch-btn-ring { position: absolute; inset: -10px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--c1) 35%, transparent); animation: ring 2.4s ease-out infinite; }
@keyframes ring { 0% { transform: scale(.94); opacity: 1; } 100% { transform: scale(1.12); opacity: 0; } }
.act-in { --c1: #34d399; --c2: #059669; }
.act-out { --c1: #fb7185; --c2: #e11d48; }
.act-break { --c1: #fbbf24; --c2: #d97706; }
.act-resume { --c1: #818cf8; --c2: #4f46e5; }
.secondary-act { min-width: 200px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.secondary-act.act-break { color: #b45309; }
.secondary-act.act-out { color: #e11d48; }
.geo-hint { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: .8rem; text-align: center; margin: 4px 0 18px; }

/* ---------- Chiffres clés ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 2px; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); }
.stat small { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.stat strong { font-size: 1.45rem; font-weight: 760; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .small-strong { font-size: 1rem; }
.stat-violet::before { background: var(--violet); }
.stat-pink::before { background: var(--pink); }
.stat-teal::before { background: var(--teal); }
.stat-blue::before { background: var(--blue); }
.stat-amber::before { background: var(--amber); }
.progress { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--brand-gradient); transition: width .4s; }
.progress.over span { background: linear-gradient(90deg, #f59e0b, #db2777); }
.progress-sm { height: 5px; margin-top: 4px; }

/* ---------- Tableau de bord ---------- */
.kpis .kpi { display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: var(--radius); color: #fff; box-shadow: var(--shadow); text-decoration: none; }
.kpi strong { font-size: 2rem; font-weight: 800; line-height: 1.1; margin-top: 6px; }
.kpi small { font-weight: 600; opacity: .92; }
.kpi-present { background: linear-gradient(135deg, #10b981, #0d9488); }
.kpi-break { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.kpi-absent { background: linear-gradient(135deg, #64748b, #475569); }
.kpi-requests { background: var(--surface); color: var(--text) !important; border: 1px solid var(--border); }
.kpi-requests .icon { color: var(--muted); }
.kpi-requests.has { background: linear-gradient(135deg, #7c3aed, #db2777); color: #fff !important; border: 0; }
.kpi-requests.has .icon { color: #fff; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.person {
  text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); cursor: pointer; transition: transform .12s, box-shadow .15s; border-top: 4px solid var(--border);
}
.person:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.person.st-present { border-top-color: #10b981; }
.person.st-break { border-top-color: #f59e0b; }
.person.st-left { border-top-color: #6366f1; }
.person-head { display: flex; align-items: center; gap: 10px; }
.person-head strong { display: block; }
.person-time { text-align: right; }
.person-time small { display: block; color: var(--muted); font-size: .72rem; }
.status-tag { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 650; color: var(--muted); }
.status-tag i { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.status-tag.st-present { color: var(--success); } .status-tag.st-present i { background: #10b981; animation: pulse 1.6s infinite; }
.status-tag.st-break { color: var(--warning); } .status-tag.st-break i { background: #f59e0b; }
.status-tag.st-left { color: var(--primary); } .status-tag.st-left i { background: #6366f1; }
.person-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.person-stats small { display: block; color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.person-stats strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.person-last { margin-top: 8px; }
.geo-ok { color: var(--teal); }
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list a { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 6px; border-radius: 10px; color: var(--text); font-size: .88rem; }
.alert-list a:hover { background: var(--surface-2); }
.alert-list .dot, .alert-list .dot { width: 9px; height: 9px; border-radius: 50%; }

/* ---------- Carte ---------- */
.map { height: 260px; border-radius: 12px; overflow: hidden; z-index: 0; }
.map-large { height: min(62vh, 620px); border-radius: 0; }
.map-popup { display: flex; flex-direction: column; gap: 4px; font-family: var(--font); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.geo-link { display: inline-flex; align-items: center; gap: 3px; font-size: .82rem; font-weight: 600; color: var(--teal); }

/* ---------- Listes ---------- */
.list-card { padding: 0; overflow: hidden; }
.list-card.bordered { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.list-row:last-child { border-bottom: 0; }
.list-row.wrap { flex-wrap: wrap; }
.list-row.clickable { cursor: pointer; }
.list-row.clickable:hover { background: var(--surface-2); }
.list-row.inactive { opacity: .55; }
.list-week { width: 120px; text-align: right; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input[type=search] { max-width: 320px; }
.empty { display: grid; place-items: center; gap: 8px; text-align: center; color: var(--muted); padding: 40px 16px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.audit-row { align-items: flex-start; }
.changes { margin: 6px 0 0; padding-left: 18px; font-size: .84rem; }
.changes del { color: var(--danger); }
.changes ins { color: var(--success); text-decoration: none; font-weight: 600; }

/* ---------- Période ---------- */
.period-picker { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.segmented { display: inline-flex; background: var(--surface-2); padding: 4px; border-radius: 12px; }
.seg { border: 0; background: none; padding: 7px 14px; border-radius: 9px; font-weight: 650; font-size: .88rem; color: var(--muted); cursor: pointer; }
.seg.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.segmented-block { display: flex; width: 100%; margin-bottom: 14px; }
.segmented-block .seg { flex: 1; padding: 9px 8px; }
.period-nav, .period-custom { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.period-nav strong { min-width: 150px; text-align: center; }

/* ---------- Détail des journées ---------- */
.days { display: flex; flex-direction: column; gap: 8px; }
.day { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.day.has-anomaly { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.day summary { display: grid; grid-template-columns: 110px 1fr auto auto 20px; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; }
.day summary::-webkit-details-marker { display: none; }
.day summary > .icon { color: var(--muted); transition: transform .2s; }
.day[open] summary > .icon { transform: rotate(180deg); }
.day[open] summary { background: var(--surface-2); }
.day-times { font-variant-numeric: tabular-nums; }
.day-worked strong { font-variant-numeric: tabular-nums; }
.day-flags { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.day-break { font-size: .84rem; }
@media (max-width: 640px) {
  .day summary { grid-template-columns: 1fr auto 20px; }
  .day-times { grid-column: 1; grid-row: 2; font-size: .88rem; color: var(--muted); }
  .day-break { display: none; }
  .day-worked { grid-column: 2; grid-row: 1 / span 2; }
  .day summary > .icon { grid-column: 3; grid-row: 1 / span 2; }
}
.punch-list { list-style: none; margin: 0; padding: 6px 14px 10px; }
.punch-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.punch-list li:last-child { border-bottom: 0; }
.punch-list .row-actions { margin-left: auto; }
.note { font-style: italic; }
.add-in-day { margin: 0 14px 12px; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; color: var(--muted); font-weight: 650; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }

/* ---------- Mini-frise du jour ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { display: flex; align-items: center; gap: 10px; padding: 8px 0 8px 22px; position: relative; flex-wrap: wrap; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline li:first-child::before { top: 50%; }
.timeline li:last-child::before { bottom: 50%; }
.t-dot { position: absolute; left: 0; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 2px currentColor; }
.t-in .t-dot { color: #10b981; background: #10b981; }
.t-break_start .t-dot { color: #f59e0b; background: #f59e0b; }
.t-break_end .t-dot { color: #6366f1; background: #6366f1; }
.t-out .t-dot { color: #e11d48; background: #e11d48; }
.timeline strong { font-variant-numeric: tabular-nums; min-width: 46px; }

/* ---------- Paramètres ---------- */
.settings { max-width: 860px; }
.settings-section .card-title { font-size: 1.05rem; margin-bottom: 14px; }
.radio-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.radio-cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .radio-cards { grid-template-columns: 1fr; } }
.radio-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1.5px solid var(--border); border-radius: 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card small { color: var(--muted); font-size: .82rem; }
.radio-card.active { border-color: var(--primary); background: var(--primary-soft); }
.radio-card.active strong { color: var(--primary); }
.radio-card:focus-within { box-shadow: 0 0 0 4px var(--primary-soft); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch-row small { display: block; }
.switch { position: relative; width: 48px; height: 28px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--border); transition: background .2s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:disabled + i { opacity: .5; }
.sticky-save { position: sticky; bottom: 16px; display: flex; justify-content: flex-end; z-index: 5; }
@media (max-width: 900px) { .sticky-save { bottom: calc(80px + var(--safe-bottom)); } .sticky-save .btn { width: 100%; } }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.swatch.active { box-shadow: 0 0 0 3px var(--text); }

/* ---------- Comptes ---------- */
.credentials { display: grid; gap: 10px; background: var(--surface-2); border-radius: 12px; padding: 14px; margin: 10px 0; }
.credentials small { display: block; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.temp-pwd { font-size: 1.3rem; font-weight: 700; letter-spacing: .08em; color: var(--primary); }
.profile-card { display: flex; align-items: center; gap: 16px; }
.prose p { margin: 0 0 10px; }

/* ---------- Exports ---------- */
.chips-select { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip-btn { border: 1.5px solid var(--border); background: var(--surface); padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: .88rem; cursor: pointer; }
.chip-btn.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.user-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.user-check { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.user-check.inactive { opacity: .6; }
.export-actions .btn-row { margin: 6px 0 10px; }

/* ---------- Système ---------- */
.demo-card { border-left: 4px solid var(--violet); }
.demo-card.is-on { border-left-color: var(--success); }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.checks li { display: flex; align-items: center; gap: 8px; }
.checks .ok { color: var(--success); }
.checks .ko { color: var(--danger); }
.upload-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.upload-row .input { flex: 1; min-width: 220px; }

/* ---------- Version imprimable ---------- */
.print-view { max-width: 900px; }
.print-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.print-page { background: #fff; color: #111; border-radius: 12px; padding: 28px; margin-bottom: 20px; box-shadow: var(--shadow); }
.print-page .muted { color: #666; }
.print-page .table th, .print-page .table td { border-color: #e5e5e5; color: #111; }
.print-page .table th { color: #555; }
.print-header { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 3px solid; border-image: var(--brand-gradient) 1; }
.print-company { font-size: 1.3rem; color: #4f46e5; }
.print-period { text-align: right; }
.print-employee h2 { margin-bottom: 10px; }
.print-totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.print-totals div { background: #f4f5fb; border-radius: 10px; padding: 10px; display: flex; flex-direction: column; }
.print-totals small { color: #666; font-size: .72rem; text-transform: uppercase; }
.print-totals strong { font-size: 1.2rem; }
.print-page h3 { margin: 16px 0 6px; font-size: .95rem; }
.print-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.print-table { font-size: .82rem; }
.print-table tfoot td { font-weight: 700; border-top: 2px solid #ccc; }
.signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 30px; }
.signatures div { border-top: 1px solid #999; padding-top: 6px; height: 70px; font-size: .8rem; color: #666; }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .no-print, .tabbar, .topbar, .sidebar, .banner, #toasts { display: none !important; }
  .view { padding: 0; max-width: none; }
  .print-page { box-shadow: none; padding: 0; margin: 0; border-radius: 0; page-break-after: always; break-after: page; }
  .print-page:last-child { page-break-after: auto; break-after: auto; }
  .print-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-totals div { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  tr { break-inside: avoid; }
}

/* Personnalisation : sélecteur de couleur */
.input-color { height: 44px; padding: 4px; cursor: pointer; }

/* Menu groupé par module */
.side-group { margin: 14px 12px 4px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); opacity: .8; }
.side-group:first-child { margin-top: 2px; }

/* Accueil commun : un résumé par module */
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.home-card { display: flex; flex-direction: column; gap: 14px; }
.home-card .card-title { margin: 0; }
.home-figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.home-figures div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.home-figures strong { font-size: 1.5rem; line-height: 1.1; }
.home-figures small { color: var(--muted); font-size: .8rem; }
.home-figures .alert strong { color: var(--danger, #dc2626); }
.home-card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

/* Application de démonstration : comptes à essayer sur l'écran de connexion */
.demo-accounts { margin-top: 18px; padding: 14px; border-radius: 14px; background: var(--primary-soft); text-align: left; }
.demo-accounts p { margin: 0 0 10px; }
.demo-account-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* Tableau de bord du pointage : salarié en congé ou jour férié (module absences) */
.person.st-off { border-top-color: #0ea5e9; }
.status-tag.st-off { color: #0284c7; } .status-tag.st-off i { background: #0ea5e9; }
.day-off-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.day.day-off { opacity: .9; }

/* ---------- Pastilles du menu, cloche, notifications ---------- */
.side-link, .tab, .bell { position: relative; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; line-height: 20px; text-align: center;
}
.nav-badge[hidden] { display: none; }
.tab .nav-badge, .bell .nav-badge { position: absolute; top: 0; right: calc(50% - 22px); margin: 0; min-width: 17px; height: 17px; line-height: 17px; font-size: .66rem; padding: 0 4px; border: 2px solid var(--surface); box-sizing: content-box; }
.bell .nav-badge { right: -2px; top: -2px; }
.nav-badge-dot { min-width: 8px !important; width: 8px; height: 8px !important; padding: 0 !important; right: calc(50% - 16px) !important; top: 4px !important; }
.bell.active { color: var(--primary); background: var(--primary-soft); }
.side-user .side-bell { margin-left: auto; }
.side-user .side-bell + .theme-btn { margin-left: 0; }
.notif-list { display: flex; flex-direction: column; }
.notif { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--surface-2); }
.notif .notif-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); color: var(--muted); flex-shrink: 0; }
.notif.unread .notif-icon { background: var(--primary-soft); color: var(--primary); }
.notif.unread strong::after { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-left: 8px; vertical-align: middle; }
.notif p { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.notif small { color: var(--muted); font-size: .76rem; }
.day-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.day-pick { width: 36px; height: 36px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 700; cursor: pointer; }
.day-pick.active { border-color: var(--primary); background: var(--primary); color: var(--on-primary, #fff); }

/* ---------- Absences et planning ---------- */
.type-dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; vertical-align: middle; }
.pending-dot { background: repeating-linear-gradient(135deg, var(--muted) 0 2px, transparent 2px 4px); border: 1px solid var(--muted); }
.hol-dot { background: var(--info-soft); border: 1px solid var(--blue); }
.off-dot { background: var(--surface-2); border: 1px solid var(--border); }
.block { display: block; }
.right { text-align: right; }
.text-danger { color: var(--danger); }
.cell-user { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.w-day { min-width: 110px; }
.count-preview { font-size: .88rem; font-weight: 600; margin-bottom: 6px; }
.count-preview:empty { display: none; }
.types-box { margin-top: 18px; }
.planning-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.planning-title { margin-left: 6px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg-btn { border: 0; background: none; padding: 6px 14px; border-radius: 9px; font-weight: 650; color: var(--muted); cursor: pointer; }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.planning { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .84rem; }
.planning th, .planning td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
.planning .p-name { position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; padding: 8px 12px; font-weight: 600; min-width: 150px; }
.planning thead th { background: var(--surface); }
.planning .p-day { text-align: center; padding: 6px 4px; font-weight: 650; min-width: 110px; }
.planning-month .p-day { min-width: 30px; }
.planning-month .p-name { min-width: 130px; }
.planning .p-day small { display: block; color: var(--muted); font-size: .7rem; font-weight: 600; }
.planning .p-day.today { color: var(--primary); }
.planning .p-day.today span { background: var(--primary); color: var(--on-primary, #fff); border-radius: 8px; padding: 1px 6px; }
.planning .p-day.hol, .planning .p-cell.hol { background: var(--info-soft); }
.planning .p-day.we { color: var(--muted); }
.p-cell { position: relative; height: 52px; padding: 3px; vertical-align: top; cursor: pointer; transition: background .12s; }
.planning-month .p-cell { height: 40px; }
.p-cell:hover { background: var(--surface-2); }
.p-cell.off { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, transparent 6px 12px); }
.p-cell.today { box-shadow: inset 0 0 0 2px var(--primary-soft); }
.p-abs { display: flex; align-items: center; border-radius: 7px; background: var(--c); color: #fff; flex: 1; min-height: 18px; padding: 0 6px; overflow: hidden; }
.p-abs.p-half { height: auto; flex: 0 0 calc(50% - 1px); }
.p-abs.p-pm { margin-top: auto; }
.p-inner { display: flex; flex-direction: column; gap: 2px; height: 46px; }
.planning-month .p-inner { height: 34px; }
.p-abs + .p-abs.p-pm { margin-top: 0; }
.p-abs.p-pending { background: repeating-linear-gradient(135deg, var(--c) 0 6px, color-mix(in srgb, var(--c) 55%, white) 6px 12px); }
.p-abs-label { font-size: .72rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-site { width: 100%; margin-top: 3px; font-size: .76rem; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); padding: 3px 4px; }
.p-abs + .p-site { margin-top: 3px; }
.p-site-tag { display: inline-block; margin-top: 2px; font-size: .66rem; font-weight: 700; background: var(--primary-soft); color: var(--primary); border-radius: 5px; padding: 1px 4px; }
.planning-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 2px 0; font-size: .82rem; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.planning:not(.planning-month) { table-layout: fixed; min-width: 860px; }
.planning:not(.planning-month) .p-name { width: 170px; }
.planning:not(.planning-month) .p-day { min-width: 0; }
.switch-row + .switch-row { margin-top: 14px; }

/* ---------- Parc matériel et véhicules ---------- */
.seg-count { display: inline-block; margin-left: 6px; min-width: 20px; padding: 0 6px; border-radius: 9px; background: var(--surface-2); font-size: .74rem; color: var(--muted); }
.seg-btn.active .seg-count { background: var(--primary-soft); color: var(--primary); }
.list-due { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; max-width: 45%; }
.list-due small { line-height: 1.25; }
.holder { display: inline-flex; align-items: center; gap: 4px; }
.kind-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; background: var(--primary-soft); color: var(--primary); }
.kind-icon.kind-equipment { background: var(--warning-soft); color: var(--warning); }
.kind-icon.kind-ppe { background: var(--success-soft); color: var(--success); }
.cell-user .kind-icon { width: 26px; height: 26px; border-radius: 8px; }
.stat-btn { text-align: left; cursor: pointer; font: inherit; color: inherit; transition: border-color .15s, box-shadow .15s; }
.stat-btn:hover:not(:disabled) { border-color: var(--primary); }
.stat-btn:disabled { cursor: default; }
.stat-link { color: var(--primary); font-size: .8rem; font-weight: 650; }
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.doc { display: flex; flex-direction: column; gap: 6px; position: relative; min-width: 0; }
.doc-thumb { display: grid; place-items: center; height: 110px; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-meta { display: flex; flex-direction: column; min-width: 0; }
.doc-name { font-size: .84rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .icon-btn { position: absolute; top: 6px; right: 6px; background: var(--surface); box-shadow: var(--shadow); }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-cols > .card { margin-bottom: 16px; }
@media (max-width: 900px) { .two-cols { grid-template-columns: 1fr; gap: 0; } .list-due { max-width: none; } }
.w-date { min-width: 88px; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.strike { text-decoration: line-through; opacity: .7; }
.pre { white-space: pre-wrap; }
ul.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
details.more { margin-top: 12px; }
details.more > summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: .88rem; margin-bottom: 10px; }
.my-item-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.my-item-head h2 { font-size: 1.1rem; }
.my-item .btn-row { margin-top: 14px; }
.my-item p .icon { vertical-align: -3px; }
.input-auto { width: auto; }
.input-lg { font-size: 1.4rem; text-align: center; padding: 14px; }
.dl-group .section-title { display: flex; align-items: center; gap: 6px; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table tfoot th { border-top: 2px solid var(--border); color: var(--text); text-transform: none; font-size: .9rem; letter-spacing: 0; }
.retired-note { display: flex; align-items: center; gap: 12px; } .retired-note small { display: block; color: var(--muted); }
.table .right, .table th.right { text-align: right; }

/* ---------- Bons d'intervention ---------- */
.field-label { font-weight: 650; font-size: .9rem; margin: 4px 0 8px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bon-row { color: inherit; text-decoration: none; }
.bon-date { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; line-height: 1.1; }
.bon-date strong { font-size: 1.1rem; }
.bon-date small { font-size: .68rem; font-weight: 700; text-transform: uppercase; }
.seg-wrap { flex-wrap: wrap; }
.seg-count.alert { background: var(--danger); color: #fff; }
.iv-rows { display: flex; flex-direction: column; gap: 10px; }
.iv-row { display: grid; gap: 8px; align-items: center; }
.iv-worker { grid-template-columns: minmax(140px, 1fr) auto auto; }
.iv-times { display: flex; align-items: center; gap: 6px; }
.iv-times .input { width: 110px; }
.iv-dur { min-width: 58px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--muted); }
.iv-item { grid-template-columns: minmax(140px, 1fr) 80px 80px auto; }
.iv-item.with-prices { grid-template-columns: minmax(140px, 1fr) 72px 70px 96px 76px auto; }
@media (max-width: 700px) {
  .iv-worker { grid-template-columns: 1fr auto; }
  .iv-worker .iv-times { grid-column: 1 / -1; grid-row: 2; }
  .iv-item, .iv-item.with-prices { grid-template-columns: 1fr 1fr auto; }
  .iv-item .input:first-child { grid-column: 1 / -1; }
  .iv-item .icon-btn { grid-column: 3; grid-row: 1; }
  .iv-item .input:first-child { grid-column: 1 / 3; }
}
.start-btn { margin-bottom: 16px; }
.bon-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.btn.disabled { opacity: .5; pointer-events: none; }
.sync-note { display: flex; align-items: center; gap: 10px; }
.check-list { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.check-list .check { margin-bottom: 4px; }
.sign-dialog { display: flex; flex-direction: column; gap: 14px; }
.sign-summary { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; max-height: 32vh; overflow: auto; }
.sign-summary p { margin: 0 0 6px; }
.sig-pad { display: flex; flex-direction: column; gap: 6px; }
.sig-head { display: flex; align-items: center; justify-content: space-between; }
.sig-area { position: relative; border: 2px dashed var(--border); border-radius: 14px; overflow: hidden; background: #fff; }
.sig-canvas { display: block; width: 100%; touch-action: none; cursor: crosshair; }
.sig-hint { position: absolute; inset: 0; display: grid; place-items: center; color: #94a3b8; font-weight: 600; pointer-events: none; }
.sig-hint[hidden] { display: none; }
@media (max-width: 700px) { .iv-times .input { width: auto; flex: 1; min-width: 0; } }
.bon-row .grow > .muted.small:first-of-type { white-space: nowrap; }
.sig-images { display: flex; gap: 16px; flex-wrap: wrap; margin: 6px 0 10px; }
.sig-images figure { margin: 0; }
.sig-images img { height: 70px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
@media (max-width: 900px) { body.no-tabbar .main { padding-bottom: var(--safe-bottom); } }
