/* PWA terrain — style mobile-first ultra épuré */
:root {
  --navy: #0B1F3A;
  --orange: #e46c0c;
  --orange-dark: #c65a08;
  --ink: #0f172a;
  --ink-500: #64748b;
  --border: #e5e7eb;
  --bg: #f4f6f9;
  --card: #ffffff;
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --purple: #8b5cf6;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
  line-height: 1.5; -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.t-topbar {
  background: var(--navy); color: white;
  padding: env(safe-area-inset-top, 12px) 16px 12px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 10;
}
.t-topbar h1 { font-size: 1.2rem; margin: 0; font-weight: 700; letter-spacing: -0.01em; flex: 1; }
.t-topbar .back { color: white; text-decoration: none; font-size: 1.6rem; line-height: 1; }
.t-topbar .logout { color: white; opacity: 0.7; text-decoration: none; font-size: 0.85rem; padding: 6px 10px; }

main { padding: 16px; padding-bottom: 100px; max-width: 640px; margin: 0 auto; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 14px; }
.card h2 { margin: 0 0 10px; font-size: 1.15rem; letter-spacing: -0.01em; }
.card .lead { color: var(--ink-500); font-size: 0.95rem; margin: 0 0 12px; }

.btn { display: block; width: 100%; padding: 16px; border-radius: 10px; border: 0; font-family: inherit; font-weight: 700; font-size: 1.05rem; cursor: pointer; text-align: center; text-decoration: none; }
.btn-primary { background: var(--orange); color: white; }
.btn-primary:active { background: var(--orange-dark); }
.btn-navy { background: var(--navy); color: white; }
.btn-outline { background: white; color: var(--ink); border: 1.5px solid var(--border); }
.btn-red { background: var(--red); color: white; }
.btn-green { background: var(--green); color: white; }
.btn-yellow { background: var(--yellow); color: white; }
.btn-purple { background: var(--purple); color: white; }
.btn:disabled { opacity: 0.4; }
.btn + .btn { margin-top: 10px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-row .btn { margin: 0; }

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.92rem; color: var(--ink); }
.field input { width: 100%; padding: 14px; font-size: 1.05rem; border: 1.5px solid var(--border); border-radius: 10px; font-family: inherit; }
.field input:focus { outline: none; border-color: var(--orange); }

.job-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 12px; text-decoration: none; color: inherit; display: block; }
.job-card:active { background: var(--bg); }
.job-card .top { display: flex; justify-content: space-between; margin-bottom: 8px; }
.job-card .date { font-size: 0.78rem; font-weight: 700; color: var(--orange); text-transform: uppercase; letter-spacing: 0.05em; }
.job-card .statut { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; font-weight: 700; }
.job-card .titre { font-weight: 700; font-size: 1.05rem; margin-bottom: 6px; }
.job-card .meta { font-size: 0.85rem; color: var(--ink-500); }
.job-card .meta strong { color: var(--ink); }

.kv { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--ink-500); font-size: 0.88rem; }
.kv .v { font-weight: 700; text-align: right; }
.kv .v a { color: var(--orange); text-decoration: none; }

.tag { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.tag-planifie { background: #e5e7eb; color: #475569; }
.tag-confirme { background: #dbeafe; color: #1e40af; }
.tag-en_route { background: #ede9fe; color: #6d28d9; }
.tag-sur_place { background: #cffafe; color: #0e7490; }
.tag-en_cours { background: #fef3c7; color: #92400e; }
.tag-complete { background: #d1fae5; color: #065f46; }
.tag-probleme { background: #fee2e2; color: #991b1b; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 12px 14px 12px 28px; margin-bottom: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 10px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }

.toast { position: fixed; bottom: 20px; left: 20px; right: 20px; background: var(--ink); color: white; padding: 14px 18px; border-radius: 10px; text-align: center; font-weight: 600; transform: translateY(120%); transition: transform 0.25s ease; z-index: 100; }
.toast.show { transform: translateY(0); }
.toast.err { background: var(--red); }

.gps-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--ink-500); }
.gps-status.ok { color: var(--green); }
.gps-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-500); }
.gps-status.ok .dot { background: var(--green); }

.empty { padding: 40px 20px; text-align: center; color: var(--ink-500); font-style: italic; }

/* ─────────── Tuile de pointage (tableau de bord) ─────────── */
.punch-tile {
  display: flex; align-items: center; gap: 14px;
  padding: 18px; margin-bottom: 18px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; text-decoration: none; color: inherit;
}
.punch-tile:active { background: var(--bg); }
.punch-tile .pt-ico {
  width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.5rem;
  background: var(--bg); flex-shrink: 0;
}
.punch-tile .pt-txt { flex: 1; min-width: 0; }
.punch-tile .pt-txt strong { display: block; font-size: 1.05rem; }
.punch-tile .pt-txt small { color: var(--ink-500); font-size: 0.85rem; }
.punch-tile .pt-go { color: var(--ink-500); font-size: 1.3rem; flex-shrink: 0; }

/* L'employe n'a pas encore pointe : on attire l'oeil */
.punch-tile.todo { border-color: var(--orange); background: #fff7ed; }
.punch-tile.todo .pt-ico { background: var(--orange); color: #fff; }
.punch-tile.todo .pt-txt strong { color: var(--orange-dark); }

/* Journee en cours */
.punch-tile.active { border-color: var(--green); background: #ecfdf5; }
.punch-tile.active .pt-ico { background: var(--green); color: #fff; }

/* Journee close */
.punch-tile.done .pt-ico { background: #d1fae5; }
