/* GMAO KOKI — design plat, mobile d'abord */
:root {
  --bg: #F2F4F8;
  --surface: #FFFFFF;
  --surface-2: #F6F8FB;
  --text: #0F172A;
  --text-2: #334155;
  --muted: #64748B;
  --line: #E3E8EF;
  --navy: #0B1B3F;
  --primary: #1F4FD8;
  --primary-d: #173DB0;
  --primary-soft: #E6EDFD;
  --accent: #F26B1D;
  --accent-soft: #FDEBDD;
  --green: #0E9F6E;
  --green-soft: #DDF5EB;
  --amber: #D98B06;
  --amber-soft: #FCF0D5;
  --violet: #7048E8;
  --violet-soft: #ECE6FD;
  --red: #DC2F2F;
  --red-soft: #FCE4E4;
  --radius: 14px;
  --top-h: 60px;
  --tab-h: 64px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
/* Structure d'application : barre du haut / contenu défilant / menu. Le menu fait partie du flux
   et reste donc collé en bas, même quand la barre d'adresse ou le clavier du mobile bougent. */
body {
  margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ic { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- Démarrage & marque ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--navy); z-index: 100; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 800;
  display: grid; place-items: center; font-size: 20px; flex: none;
}
.brand-mark.lg { width: 64px; height: 64px; font-size: 34px; border-radius: 18px; }
.brand-mark.xl { width: 76px; height: 76px; font-size: 42px; border-radius: 22px; }

/* ---------- Barre du haut ---------- */
.topbar {
  flex: none; position: relative; z-index: 20; background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 12px; min-height: calc(var(--top-h) + var(--safe-t));
  padding: calc(10px + var(--safe-t)) 16px 10px;
}
.tb-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tb-title strong { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title small { font-size: 12.5px; color: #A9B6D3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .icon-btn { color: #fff; background: rgba(255, 255, 255, .08); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--text-2);
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.icon-btn:active { transform: scale(.95); }

.sync-pill {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 7px 12px;
  font-size: 12.5px; font-weight: 700; cursor: pointer; background: rgba(255, 255, 255, .1); color: #fff; white-space: nowrap;
}
.sync-pill .ic { width: 16px; height: 16px; }
.sync-pill .sdot { width: 8px; height: 8px; border-radius: 50%; background: #34D399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .25); }
.sync-pill.pend { background: var(--amber); }
.sync-pill.off { background: #475569; }
.sync-pill.err { background: var(--red); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Structure ---------- */
.view {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
  padding: 16px max(16px, calc((100% - 728px) / 2)) 96px;
}
body.bare .topbar, body.bare .tabbar { display: none; }
body.bare .view { padding: 0; }
/* Clavier ouvert sur mobile : on libère la place du menu et du bouton flottant */
@media (pointer: coarse) {
  body.kbd .tabbar, body.kbd .fab { display: none; }
}

.tabbar {
  flex: none; position: relative; z-index: 20; background: var(--surface);
  border-top: 1px solid var(--line); display: flex; padding-bottom: var(--safe-b);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--tab-h); font-size: 11.5px; font-weight: 600; color: var(--muted); position: relative;
}
.tab .ic { width: 23px; height: 23px; }
.tab.on { color: var(--primary); }
.tab.on::before { content: ""; position: absolute; top: 0; width: 36px; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
.tab-badge {
  position: absolute; top: 7px; left: calc(50% + 5px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.tab-badge.red { background: var(--red); }

/* ---------- Titres & textes ---------- */
.page-head { margin: 4px 0 14px; }
.page-head h1 { font-size: 22px; margin: 0 0 2px; letter-spacing: -.3px; }
.page-head p { margin: 0; color: var(--muted); }
.section-title {
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700;
  margin: 22px 4px 10px; display: flex; align-items: center; gap: 8px;
}
.section-title .ic { width: 16px; height: 16px; }
.section-title .count { margin-left: auto; background: var(--line); color: var(--text-2); border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.hint { color: var(--muted); font-size: 13.5px; margin: 8px 0 0; }
.hint.pad { padding: 0 4px; }

/* ---------- Cartes & listes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head h2 { font-size: 15px; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-head h2 .ic { color: var(--primary); width: 18px; height: 18px; }
.card-head h2 small { color: var(--muted); font-weight: 600; }
.list { display: flex; flex-direction: column; gap: 10px; }
.search-list { margin-bottom: 14px; }

.row-card, .resume-card {
  display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; min-height: 70px; transition: border-color .15s, transform .1s;
}
.row-card:active, .resume-card:active, .icard:active { transform: scale(.99); border-color: var(--primary); }
.row-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }
.row-ic.accent { background: var(--accent-soft); color: var(--accent); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-main strong { font-size: 15.5px; }
.row-main small { color: var(--muted); font-size: 13px; }
.row-chev { color: #A0AEC0; }
.badge { min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.resume-card { border: 1.5px dashed #F5B58E; background: #FFF8F3; }
.mini-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.ms { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.ms-en_cours { background: var(--primary-soft); color: var(--primary); }
.ms-en_pause { background: var(--amber-soft); color: #8A5A00; }
.ms-en_attente { background: var(--violet-soft); color: var(--violet); }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 36px 16px; color: var(--muted); }
.empty .ic { width: 40px; height: 40px; color: #B8C3D6; margin-bottom: 4px; }
.empty strong { color: var(--text-2); font-size: 16px; }
.empty p { margin: 0; font-size: 14px; }

/* ---------- Recherche & étapes ---------- */
.search {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0 14px; height: 50px; margin-bottom: 12px; color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; height: 100%; font-size: 16px; color: var(--text); }
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.stepper { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.step {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; height: 100%;
  background: var(--surface); border: 1px solid var(--line); min-width: 0;
}
.step-n { width: 24px; height: 24px; border-radius: 50%; background: var(--line); color: var(--muted); font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.step-n .ic { width: 14px; height: 14px; }
.step-l { display: flex; flex-direction: column; min-width: 0; font-size: 13px; font-weight: 700; line-height: 1.2; }
.step-l small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.step-l span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper li:not(.done):not(.cur) .step-l span { color: #A0AEC0; }
.stepper li.done .step-n { background: var(--green); color: #fff; }
.stepper li.cur .step { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.stepper li.cur .step-n { background: var(--primary); color: #fff; }

/* ---------- Cartes d'intervention ---------- */
.icard { display: block; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.icard.is-en_cours { border-left-color: var(--primary); }
.icard.is-en_pause { border-left-color: var(--amber); }
.icard.is-en_attente { border-left-color: var(--violet); }
.icard.is-terminee { border-left-color: var(--green); }
.icard-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.icard-top .chip { margin-left: auto; }
.num { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.num-local { color: #B07000; }
.dot-pending { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.icard-title { font-weight: 700; font-size: 15.5px; margin-bottom: 6px; }
.icard-sub { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; margin: -2px 0 6px; min-width: 0; }
.icard-sub .ic { width: 14px; height: 14px; }
.icard-sub span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icard-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.icard-time { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text-2); }
.icard-time .ic { width: 15px; height: 15px; }
.icard-time.running { color: var(--primary); }
.icard-date { margin-left: auto; font-size: 12.5px; white-space: nowrap; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 8px;
  border-radius: 6px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
}
.tag .ic { width: 13px; height: 13px; }
.pr-haute { background: var(--amber-soft); color: #8A5A00; border-color: transparent; }
.pr-urgente { background: var(--red-soft); color: var(--red); border-color: transparent; }
.tag-relay { background: var(--accent-soft); color: #B84A0C; border-color: transparent; }
.tag-local { background: var(--amber-soft); color: #8A5A00; border-color: transparent; }

.chip { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.st-en_cours { background: var(--primary-soft); color: var(--primary); }
.st-en_pause { background: var(--amber-soft); color: #8A5A00; }
.st-en_attente { background: var(--violet-soft); color: var(--violet); }
.st-terminee { background: var(--green-soft); color: #08744F; }

.av {
  --h: 220; width: 32px; height: 32px; border-radius: 50%; background: hsl(var(--h) 70% 92%); color: hsl(var(--h) 55% 30%);
  font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; flex: none;
}
.av .ic { width: 17px; height: 17px; }
.av.sm { width: 26px; height: 26px; font-size: 10.5px; }
.av.xl { width: 56px; height: 56px; font-size: 19px; }
.av-stack { display: flex; }
.av-stack .av { margin-right: -6px; box-shadow: 0 0 0 2px var(--surface); }

.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); flex: none; animation: pulse 1.6s infinite; }
.pulse.light { background: #fff; animation-name: pulse-light; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(31, 79, 216, .5); } 70%, 100% { box-shadow: 0 0 0 8px rgba(31, 79, 216, 0); } }
@keyframes pulse-light { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .6); } 70%, 100% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); } }

.run-banner { display: flex; align-items: center; gap: 12px; background: var(--primary); color: #fff; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.rb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rb-main strong, .rb-main small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-main small { color: #C9D6FA; font-size: 12.5px; }
.rb-time { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 17px; }

/* ---------- Ligne ---------- */
.line-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.ls { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; text-align: center; }
.ls strong { display: block; font-size: 22px; line-height: 1.1; }
.ls span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.ls:nth-child(1) strong { color: var(--primary); }
.ls:nth-child(2) strong { color: var(--amber); }
.ls:nth-child(3) strong { color: var(--violet); }
.ls:nth-child(4) strong { color: var(--green); }

.chips-scroll { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 2px 16px; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.fchip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13.5px; cursor: pointer; color: var(--text-2);
}
.fchip span { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 0 6px; }
.fchip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.fchip.on span { background: rgba(255, 255, 255, .15); color: #fff; }

.fab {
  position: fixed; right: max(16px, calc(50% - 364px)); bottom: calc(var(--tab-h) + var(--safe-b) + 16px); z-index: 15;
  display: inline-flex; align-items: center; gap: 8px; height: 54px; padding: 0 20px 0 16px; border-radius: 27px;
  background: var(--accent); color: #fff; font-weight: 700; box-shadow: 0 8px 20px rgba(242, 107, 29, .35);
}
.fab .ic { width: 22px; height: 22px; }
.fab:active { transform: scale(.97); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 18px;
  border-radius: 12px; border: 1px solid transparent; font-weight: 700; font-size: 15px; cursor: pointer;
  background: var(--surface-2); color: var(--text); transition: transform .08s, background-color .15s; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn .ic { width: 19px; height: 19px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-success { background: var(--green); color: #fff; }
.btn-warn { background: var(--amber); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text-2); }
.btn-relay { background: var(--accent-soft); color: #B84A0C; border-color: #F8CDB0; }
.btn-danger-ghost { background: transparent; border-color: #F3C4C4; color: var(--red); }
.btn-lg { height: 56px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.icon-only { width: 46px; padding: 0; flex: none; }
.link-btn { border: 0; background: none; color: var(--primary); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; padding: 6px 0; }
.link-btn .ic { width: 16px; height: 16px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }

/* ---------- Formulaires ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.field > span { font-size: 13.5px; font-weight: 700; color: var(--text-2); }
.field > span small { display: block; font-weight: 500; color: var(--muted); font-size: 12.5px; }
.field input, .field textarea, .select {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px;
  font-size: 16px; outline: 0; transition: border-color .15s, box-shadow .15s;
}
.field input { height: 50px; }
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field textarea:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.select {
  height: 46px; padding: 0 40px 0 14px; margin-bottom: 14px; appearance: none; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 18px;
}

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { position: relative; cursor: pointer; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; color: var(--text-2);
}
.pill input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.pill input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-soft); }

.user-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.user-pick + .user-pick { margin-top: 8px; }
.upick {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px; min-width: 0;
}
.upick > span:not(.av) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upick input { position: absolute; opacity: 0; pointer-events: none; }
.upick-check { width: 20px; height: 20px; padding: 2px; color: transparent; border-radius: 6px; border: 1.5px solid var(--line); }
.upick:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.upick:has(input:checked) .upick-check { background: var(--primary); border-color: var(--primary); color: #fff; }
.upick:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--primary-soft); }

.switch-row {
  position: relative; display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer;
}
.switch-row > span:first-child { flex: 1; display: flex; flex-direction: column; }
.switch-row small { color: var(--muted); font-size: 12.5px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 48px; height: 28px; border-radius: 14px; background: #CBD5E1; position: relative; transition: background-color .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch-row input:checked ~ .switch { background: var(--green); }
.switch-row input:checked ~ .switch::after { transform: translateX(20px); }

.form-actions {
  display: flex; gap: 10px; position: sticky; bottom: -96px; /* compense la marge basse du contenu (place du bouton flottant) */
  background: linear-gradient(rgba(242, 244, 248, 0), var(--bg) 35%); padding: 18px 0 12px;
}
.form-actions .btn { flex: 1; }
.context-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 14px; }

/* ---------- Détail intervention ---------- */
.d-head { margin: 2px 0 14px; }
.d-head-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.d-head h1 { font-size: 22px; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.3px; overflow-wrap: anywhere; }
.relay-link { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); color: #B84A0C; font-weight: 600; font-size: 14px; }
.relay-link .ic { width: 17px; height: 17px; }
.notice { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--violet-soft); color: var(--violet); font-size: 14px; margin-top: 10px; }
.notice .ic { width: 18px; height: 18px; }
.notice-warn { background: var(--amber-soft); color: #7A5000; margin: 0; }

.chrono-card { text-align: center; padding: 20px 16px 10px; }
.chrono-card.running { border-color: #B9CBF7; background: linear-gradient(180deg, #F1F5FE, #fff 65%); }
.chrono-label { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.chrono-card.running .chrono-label { color: var(--primary); }
.chrono { font-size: clamp(40px, 13vw, 56px); font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; line-height: 1.1; margin: 6px 0 4px; }
.chrono-sub { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.chrono-sub .ic { width: 16px; height: 16px; }
.chrono-sub strong { color: var(--text); font-variant-numeric: tabular-nums; }
.chrono-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 6px; }
.chrono-actions .btn:only-child { grid-column: 1 / -1; }

.people { display: flex; flex-direction: column; gap: 10px; }
.person { display: flex; align-items: center; gap: 10px; }
.person div { display: flex; flex-direction: column; }
.person small { color: var(--muted); font-size: 12.5px; }

.desc { margin: 0 0 12px; white-space: pre-wrap; color: var(--text-2); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; overflow-wrap: anywhere; }
.timeline { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.tl-item { display: flex; gap: 10px; }
.tl-body { flex: 1; min-width: 0; background: var(--surface-2); border-radius: 4px 12px 12px 12px; padding: 8px 12px; }
.tl-meta { font-size: 12.5px; color: var(--muted); }
.tl-meta strong { color: var(--text-2); }
.tl-body p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-form { display: flex; gap: 8px; align-items: flex-end; }
.note-form textarea {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; min-height: 46px;
  font-size: 16px; outline: 0; resize: none; background: var(--surface);
}
.note-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.ph { aspect-ratio: 1; max-width: 100%; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); padding: 0; cursor: pointer; display: block; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1.5px dashed #B8C3D6; color: var(--primary); font-size: 12.5px; font-weight: 700; }

.entries { list-style: none; margin: 0; padding: 0; }
.entries li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.entries li:first-child { border-top: 0; padding-top: 0; }
.entries li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.entries small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-dur { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meta-foot { text-align: center; color: var(--muted); font-size: 12.5px; margin: 16px 0; }
.sum-row { display: flex; justify-content: space-between; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.sum-row + .sum-row { margin-top: -8px; }

/* ---------- Feuilles modales ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(11, 27, 63, .45); opacity: 0; transition: opacity .2s; }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--surface);
  border-radius: 20px 20px 0 0; padding: 6px 16px calc(20px + var(--safe-b)); transform: translateY(100%); transition: transform .22s ease-out;
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 6px auto 4px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-head h3 { margin: 0; font-size: 18px; }
.sheet-text { color: var(--text-2); margin: 0; }
.sheet-body > .sheet-text { margin-bottom: 16px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.qchip { height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; }
.qchip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.dur-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .92); display: grid; place-items: center; padding: 16px; }
.lightbox img { max-height: 100%; border-radius: 8px; }
.lightbox .icon-btn { position: absolute; top: calc(12px + var(--safe-t)); right: 12px; color: #fff; background: rgba(255, 255, 255, .14); }

.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b) + 84px); z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { display: flex; align-items: center; gap: 8px; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; max-width: 100%; }
.toast.show { opacity: 1; transform: none; }
.toast-err { background: var(--red); }
.toast .ic { width: 18px; height: 18px; }
body.bare .toasts { bottom: 24px; }

/* ---------- Connexion ---------- */
.login {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b));
  background: radial-gradient(1200px 520px at 50% -10%, #1C3A86 0%, var(--navy) 62%);
}
.login-hero { text-align: center; color: #fff; margin-bottom: 26px; }
.login-hero .brand-mark { margin: 0 auto 16px; box-shadow: 0 12px 30px rgba(242, 107, 29, .35); }
.login-hero h1 { margin: 0; font-size: 30px; letter-spacing: -.5px; font-weight: 800; }
.login-hero h1 span { color: var(--accent); }
.login-hero p { margin: 6px 0 0; color: #A9B6D3; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; padding: 24px 20px; display: flex; flex-direction: column; gap: 14px; }
.login-card h2 { margin: 0; font-size: 20px; }
.pw { position: relative; display: block; }
.pw input { padding-right: 52px; }
.pw .icon-btn { position: absolute; right: 5px; top: 5px; }
.form-error { margin: 0; color: var(--red); background: var(--red-soft); padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.login-note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; margin: 0; }
.login-note .ic { width: 16px; height: 16px; }
.login-foot { color: #6F7FA6; font-size: 12.5px; margin-top: 20px; }
.login-foot a { color: #A9B6D3; text-decoration: underline; }

/* ---------- Tableau de bord ---------- */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: #E4E8F0; border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 10px; }
.seg button { border: 0; background: transparent; height: 38px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--text-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpi { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 14px 18px; display: flex; flex-direction: column; gap: 2px; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--k); }
.kpi-l { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-v { font-size: 26px; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.5px; white-space: nowrap; }
.kpi small { color: var(--muted); font-size: 12px; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.vbars { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 3px; align-items: end; height: 160px; }
.vbar { display: flex; flex-direction: column; align-items: center; height: 100%; gap: 4px; min-width: 0; }
.vbar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.vbar-fill { width: 100%; max-width: 28px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; }
.vbar-l { font-size: 10.5px; color: var(--muted); height: 14px; white-space: nowrap; }
.chart-foot { font-size: 12px; color: var(--muted); margin-top: 6px; text-align: right; }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 5px; }
.hbar-top span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-top strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-top small { color: var(--muted); font-weight: 600; }
.hbar-track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 4px; background: var(--primary); }
.stack { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface-2); margin: 4px 0 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

/* ---------- Compte ---------- */
.profile { display: flex; align-items: center; gap: 14px; }
.profile > div { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.profile strong { font-size: 17px; }
.profile small { color: var(--muted); overflow-wrap: anywhere; }
.sync-status { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); margin-bottom: 8px; }
.sync-status div { display: flex; flex-direction: column; }
.sync-status small { color: var(--muted); }
.sync-status .sdot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.s-ok .sdot { background: var(--green); }
.s-pend .sdot { background: var(--amber); }
.s-off .sdot { background: #64748B; }
.s-err .sdot { background: var(--red); }
.s-busy .sdot { background: var(--primary); animation: pulse 1.6s infinite; }
.kv { margin: 0 0 14px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv div:first-child { border-top: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; }
.failed { border: 1px solid #F3C4C4; background: #FFF7F7; border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.failed h3 { margin: 0 0 6px; font-size: 14px; color: var(--red); display: flex; gap: 6px; align-items: center; }
.failed h3 .ic { width: 17px; height: 17px; }
.failed-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.failed-row div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.failed-row small { color: var(--muted); font-size: 12.5px; }
.app-version { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
