/* OV Pointage — application agent (mobile d'abord) */
:root {
    --pt-bg: #0d1520;
    --pt-card: #1a2332;
    --pt-card2: #1f2d40;
    --pt-line: rgba(201,168,76,0.18);
    --pt-gold: #c9a84c;
    --pt-gold-dark: #a8883c;
    --pt-gold-light: #e0c97a;
    --pt-text: #eef0f5;
    --pt-muted: rgba(238,240,245,0.62);
    --pt-green: #22c55e;
    --pt-red: #ef4444;
    --pt-orange: #f59e0b;
    --pt-blue: #3b82f6;
    --pt-radius: 18px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body.pt-body {
    background: var(--pt-bg);
    color: var(--pt-text);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    min-height: 100%;
}
body.pt-body { padding: calc(var(--safe-top) + 12px) 16px calc(var(--safe-bottom) + 24px); max-width: 560px; margin: 0 auto; }

a { color: var(--pt-gold-light); }
.pt-muted { color: var(--pt-muted); }
.pt-small { font-size: .85rem; }
.pt-gps { display: inline-flex; gap: 6px; align-items: center; margin-top: 10px; padding: 4px 10px; border-radius: 999px;
  font-size: .78rem; background: rgba(255,255,255,.07); color: var(--pt-muted); max-width: 100%; text-align: left; }
.pt-gps.ok { background: rgba(34,197,94,.14); color: #86efac; }
.pt-gps.err { background: rgba(239,68,68,.14); color: #fca5a5; border-radius: 10px; }

/* Marque */
.pt-brand { display: flex; align-items: center; gap: 12px; margin: 8px 0 20px; }
.pt-brand-logo { width: 48px; height: 48px; border-radius: 12px; }
.pt-brand-name { font-weight: 800; letter-spacing: 2px; color: var(--pt-gold); font-size: .95rem; }
.pt-brand-sub { color: var(--pt-muted); font-size: .8rem; }

/* Écrans d'accès centrés */
.pt-access { max-width: 440px; margin: 0 auto; padding-top: 4vh; }
.pt-access h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; }

/* Cartes */
.pt-card {
    background: var(--pt-card);
    border: 1px solid var(--pt-line);
    border-radius: var(--pt-radius);
    padding: 18px;
    margin-bottom: 14px;
}
.pt-card h2 { font-size: 1rem; font-weight: 700; margin: 0 0 10px; color: var(--pt-gold-light); }
.pt-card-label { font-size: .72rem; text-transform: uppercase; letter-spacing: 1.2px; color: var(--pt-muted); margin-bottom: 4px; }

/* Formulaires */
.pt-input {
    width: 100%;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(201,168,76,0.3);
    color: #fff;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 1.1rem;
    outline: none;
}
.pt-input:focus { border-color: var(--pt-gold); background: rgba(255,255,255,0.1); }
.pt-input::placeholder { color: rgba(255,255,255,0.35); }
.pt-pin { letter-spacing: 14px; text-align: center; font-size: 1.8rem; font-weight: 700; -webkit-text-security: disc; }
label.pt-label { display: block; font-size: .85rem; color: var(--pt-muted); margin: 14px 0 6px; }

.pt-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; border: 0; border-radius: 14px;
    padding: 15px 18px; font-size: 1.05rem; font-weight: 700;
    text-decoration: none; cursor: pointer; transition: transform .08s, opacity .2s;
}
.pt-btn:active { transform: scale(.98); }
.pt-btn:disabled { opacity: .5; }
.pt-btn-gold { background: linear-gradient(135deg, var(--pt-gold), var(--pt-gold-dark)); color: #111; }
.pt-btn-ghost { background: rgba(255,255,255,0.06); color: var(--pt-text); border: 1px solid var(--pt-line); }
.pt-btn-green { background: var(--pt-green); color: #fff; }
.pt-btn-red { background: var(--pt-red); color: #fff; }

.pt-check { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0; font-size: .95rem; }
.pt-check input { width: 24px; height: 24px; flex-shrink: 0; accent-color: var(--pt-gold); margin-top: 2px; }

.pt-alert { border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: .95rem; }
.pt-alert-danger { background: rgba(239,68,68,0.14); border: 1px solid rgba(239,68,68,0.4); color: #fecaca; }
.pt-alert-info { background: rgba(59,130,246,0.12); border: 1px solid rgba(59,130,246,0.35); color: #bfdbfe; }

/* Texte RGPD */
.pt-rgpd { max-height: 46vh; overflow-y: auto; padding-right: 6px; font-size: .92rem; line-height: 1.5; }
.pt-rgpd.full { max-height: none; }
.pt-rgpd h3 { font-size: .95rem; color: var(--pt-gold-light); margin: 14px 0 6px; font-weight: 700; }
.pt-rgpd h3:first-child { margin-top: 0; }
.pt-rgpd p, .pt-rgpd ul { margin-bottom: 8px; color: rgba(238,240,245,0.85); }
.pt-rgpd ul { padding-left: 20px; }

/* En-tête application */
.pt-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.pt-hello { font-size: 1.25rem; font-weight: 700; }
.pt-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--pt-card2);
    display: flex; align-items: center; justify-content: center; color: var(--pt-gold); font-weight: 700; border: 2px solid var(--pt-line); flex-shrink: 0; }
.pt-icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--pt-line); background: var(--pt-card);
    color: var(--pt-text); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; flex-shrink: 0; }

/* Horloge */
.pt-clock { font-size: 3rem; font-weight: 800; letter-spacing: 1px; line-height: 1; font-variant-numeric: tabular-nums; }
.pt-date { color: var(--pt-muted); text-transform: capitalize; margin-top: 4px; }

/* Bouton de pointage principal */
.pt-main-btn {
    width: 70%; aspect-ratio: 1 / 1; max-width: 240px; margin: 8px auto 4px; display: flex;
    flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    border-radius: 50%; border: 0; color: #fff; font-weight: 800; font-size: 1.2rem;
    box-shadow: 0 0 0 10px rgba(255,255,255,0.04), 0 18px 40px rgba(0,0,0,0.45);
}
.pt-main-btn i { font-size: 2.6rem; }
.pt-main-btn.start { background: radial-gradient(circle at 30% 30%, #34d399, #15803d); }
.pt-main-btn.stop { background: radial-gradient(circle at 30% 30%, #f87171, #b91c1c); }
.pt-main-btn.soon { background: radial-gradient(circle at 30% 30%, #4b5563, #1f2937); color: rgba(255,255,255,0.75); }

.pt-main-btn.busy { opacity: .7; pointer-events: none; animation: ptPulse 1.2s infinite; }
@keyframes ptPulse { 50% { transform: scale(.96); } }
[hidden] { display: none !important; }

.pt-chrono { font-size: 1.6rem; font-weight: 800; color: var(--pt-gold-light); font-variant-numeric: tabular-nums; margin-top: 4px; }
.pt-service-info { margin-top: 14px; }
.pt-sites { text-align: left; }
.pt-site-choice {
    display: flex; gap: 12px; align-items: center; padding: 12px 14px; margin-top: 8px;
    border: 1px solid var(--pt-line); border-radius: 14px; background: rgba(255,255,255,0.04); cursor: pointer;
}
.pt-site-choice input { width: 22px; height: 22px; accent-color: var(--pt-gold); flex-shrink: 0; }
.pt-site-choice:has(input:checked) { border-color: var(--pt-gold); background: rgba(201,168,76,0.1); }
.pt-total { font-size: 2rem; font-weight: 800; color: var(--pt-gold-light); margin: 6px 0 4px; }

/* SOS : appui long */
.pt-sos {
    position: relative; overflow: hidden; width: 100%; border: 2px solid rgba(239,68,68,0.6); border-radius: var(--pt-radius);
    background: rgba(239,68,68,0.12); color: #fecaca; padding: 16px; font-weight: 800; font-size: 1.05rem; margin-bottom: 14px;
    user-select: none; -webkit-user-select: none; touch-action: none;
}
.pt-sos-fill { position: absolute; inset: 0; width: 0; background: rgba(239,68,68,0.55); transition: width 0s; }
.pt-sos.holding .pt-sos-fill { width: 100%; transition: width 2s linear; }
.pt-sos.sent { background: #b91c1c; color: #fff; border-color: #b91c1c; }
.pt-sos-label { position: relative; }

/* Scanner QR */
.pt-scan { margin-top: 14px; }
.pt-scan video { width: 100%; max-height: 55vh; border-radius: 14px; background: #000; object-fit: cover; border: 3px solid var(--pt-gold); }

/* Onglets, puces, photos (signalement) */
.pt-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.pt-tabs a { text-align: center; padding: 11px; border-radius: 14px; background: var(--pt-card); border: 1px solid var(--pt-line);
    color: var(--pt-muted); text-decoration: none; font-weight: 600; }
.pt-tabs a.active { background: rgba(201,168,76,0.15); border-color: var(--pt-gold); color: var(--pt-gold-light); }
.pt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pt-chip input { display: none; }
.pt-chip span { display: inline-block; padding: 8px 13px; border-radius: 20px; border: 1px solid var(--pt-line);
    background: rgba(255,255,255,0.04); font-size: .9rem; cursor: pointer; }
.pt-chip input:checked + span { background: var(--pt-gold); color: #111; border-color: var(--pt-gold); font-weight: 700; }
.pt-gravite .g-haute input:checked + span { background: #f97316; border-color: #f97316; color: #fff; }
.pt-gravite .g-critique input:checked + span { background: var(--pt-red); border-color: var(--pt-red); color: #fff; }
.pt-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pt-photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; }
.pt-photo img { width: 100%; height: 100%; object-fit: cover; }
.pt-photo button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0;
    background: rgba(0,0,0,.65); color: #fff; line-height: 1; }
select.pt-input { appearance: auto; }
select.pt-input option { color: #111; }

/* Actions rapides */
.pt-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 14px; }
.pt-action {
    background: var(--pt-card); border: 1px solid var(--pt-line); border-radius: var(--pt-radius);
    padding: 16px 12px; text-align: center; color: var(--pt-text); text-decoration: none; font-weight: 600; font-size: .92rem;
}
.pt-action i { display: block; font-size: 1.5rem; margin-bottom: 8px; color: var(--pt-gold); }
.pt-action.sos i { color: var(--pt-red); }
.pt-action.disabled { opacity: .45; pointer-events: none; }

/* Liste d'infos */
.pt-info-row { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-top: 1px solid rgba(255,255,255,0.06); }
.pt-info-row:first-of-type { border-top: 0; }
.pt-info-row i { width: 20px; color: var(--pt-gold); margin-top: 3px; text-align: center; }

.pt-badge { display: inline-block; border-radius: 20px; padding: 3px 10px; font-size: .75rem; font-weight: 700; }
.pt-badge-green { background: rgba(34,197,94,0.16); color: #86efac; }
.pt-badge-orange { background: rgba(245,158,11,0.16); color: #fcd34d; }
.pt-badge-grey { background: rgba(255,255,255,0.08); color: var(--pt-muted); }

/* Notification flash */
.pt-toast {
    position: fixed; left: 16px; right: 16px; top: calc(var(--safe-top) + 12px); z-index: 2000; max-width: 528px; margin: 0 auto;
    padding: 14px 16px; border-radius: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    animation: ptToast 6s forwards; pointer-events: none;
}
.pt-toast-success { background: #166534; color: #fff; }
.pt-toast-danger { background: #991b1b; color: #fff; }
.pt-toast-info { background: #1e3a8a; color: #fff; }
@keyframes ptToast { 0% { opacity: 0; transform: translateY(-10px); } 6%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; visibility: hidden; } }

/* Bandeau d'installation */
.pt-install { display: none; }
.pt-install.show { display: block; }
.pt-install [data-ios], .pt-install [data-install-btn] { display: none; }

.pt-footer-links { text-align: center; margin-top: 18px; font-size: .85rem; }
.pt-footer-links a { color: var(--pt-muted); margin: 0 8px; text-decoration: none; }
