/* Morin Sécurité civile — couleurs du logo */
:root {
  --navy: #0B1F3A;
  --navy-2: #13294B;
  --navy-3: #1F3A63;
  --orange: #F26B1D;
  --orange-dark: #D9560C;
  --bg: #F4F6F9;
  --card: #FFFFFF;
  --text: #0B1F3A;
  --muted: #5A6A80;
  --line: #E1E6EE;
  --ok: #1E8E5A;
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Montserrat", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.45; min-height: 100vh; }
button { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(var(--safe-top) + 8px) 12px 8px;
  background: var(--navy); color: #fff;
  border-bottom: 3px solid var(--orange);
}
.topbar-title { flex: 1; min-width: 0; text-align: center; }
.topbar-muni { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 10px; display: grid; place-items: center; cursor: pointer; }
.icon-btn:active { background: rgba(255,255,255,.12); }

.brand-mini { font-weight: 800; font-size: 20px; letter-spacing: .04em; line-height: 1; display: inline-flex; align-items: center; }
.o-mark {
  display: inline-block; width: .82em; height: .82em; margin: 0 .03em;
  border: .15em solid currentColor; border-radius: 50%; position: relative;
}
.o-mark::after {
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -58%);
  border-left: .2em solid transparent; border-right: .2em solid transparent; border-bottom: .32em solid var(--orange);
}

/* ---------- Contenu ---------- */
main { padding: 16px 16px calc(84px + var(--safe-bottom)); max-width: 760px; margin: 0 auto; outline: none; }
h1 { font-size: 22px; margin: 4px 0 4px; letter-spacing: .01em; }
h2 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 24px 0 10px; }
.lead { color: var(--muted); margin: 0 0 16px; }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--orange-dark); }

.card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); padding: 16px; }
.list { display: grid; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 14px; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; min-height: 64px;
}
.row:active { background: #EEF2F7; }
.row-body { flex: 1; min-width: 0; }
.row-title { font-weight: 700; }
.row-sub { font-size: 14px; color: var(--muted); }
.chev { color: var(--muted); flex: none; }
.num {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px;
}

/* ---------- Accueil ---------- */
.hero { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 20px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -40px; top: -20px; width: 140px; height: 30px; background: var(--orange); transform: rotate(35deg); }
.hero .kicker { color: #FFB37F; }
.hero h1 { color: #fff; margin-top: 6px; }
.hero p { margin: 4px 0 0; opacity: .85; font-size: 14px; }
.tagline { display: flex; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .1em; margin-top: 14px; }
.tagline .on { color: var(--orange); }
.tagline .sep { color: var(--orange); }

.choices { display: grid; gap: 12px; margin-top: 16px; }
.choice {
  display: flex; align-items: center; gap: 16px; text-decoration: none;
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--line);
  border-left: 6px solid var(--orange); padding: 20px 16px; min-height: 96px;
}
.choice:active { background: #EEF2F7; }
.choice-ico { flex: none; width: 52px; height: 52px; border-radius: 14px; background: var(--navy); display: grid; place-items: center; }
.choice-ico svg { width: 28px; height: 28px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.choice-title { font-weight: 800; font-size: 18px; }
.choice-sub { color: var(--muted); font-size: 14px; }
.choice.secondary { border-left-color: var(--navy); min-height: 72px; padding: 14px 16px; }
.choice.secondary .choice-ico { background: var(--orange); width: 44px; height: 44px; }

.ccmu { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; font-size: 14px; }
.ccmu strong { display: block; }

/* ---------- Sections du plan ---------- */
.points { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.points li { position: relative; padding-left: 22px; }
.points li::before { content: ""; position: absolute; left: 2px; top: .45em; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 10px solid var(--orange); }
.resume { white-space: pre-line; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; border-radius: 999px; background: #E8EDF5; text-decoration: none; font-weight: 600; font-size: 14px; }

/* ---------- Fiche de rôle ---------- */
.role-head { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 18px; }
.role-head .kicker { color: #FFB37F; }
.role-head h1 { color: #fff; }
.role-head p { margin: 8px 0 0; opacity: .9; font-size: 15px; }

.phases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 16px 0 12px; background: #E3E8F0; padding: 4px; border-radius: 12px; position: sticky; top: calc(var(--safe-top) + 70px); z-index: 5; }
.phase-btn { border: 0; background: transparent; padding: 10px 4px; border-radius: 9px; font-weight: 700; font-size: 14px; cursor: pointer; min-height: 44px; }
.phase-btn[aria-selected="true"] { background: var(--navy); color: #fff; }
.phase-btn .count { display: block; font-size: 11px; font-weight: 600; opacity: .75; }

.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-bottom: 12px; }
.progress > div { height: 100%; background: var(--orange); transition: width .2s; }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.check {
  display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; cursor: pointer; min-height: 56px;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.box { flex: none; width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--navy-3); display: grid; place-items: center; margin-top: 1px; }
.box svg { width: 16px; height: 16px; stroke: #fff; stroke-width: 3; fill: none; opacity: 0; }
.check input:checked + .box { background: var(--ok); border-color: var(--ok); }
.check input:checked + .box svg { opacity: 1; }
.check input:checked ~ .check-text { color: var(--muted); text-decoration: line-through; }
.check input:focus-visible + .box { outline: 3px solid var(--orange); outline-offset: 2px; }
.check-num { font-weight: 800; color: var(--orange-dark); margin-right: 4px; }

/* ---------- Contacts ---------- */
.search { width: 100%; font: inherit; padding: 12px 14px 12px 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235A6A80' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") no-repeat 12px center / 20px; min-height: 48px; }
.search:focus { outline: 2px solid var(--orange); border-color: transparent; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; cursor: pointer; min-height: 40px; }
.filter[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }

.contact { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.contact-top { display: flex; gap: 12px; align-items: center; }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.contact-name { font-weight: 700; }
.contact-fn { font-size: 14px; color: var(--muted); }
.badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; background: #FFE6D6; color: var(--orange-dark); margin-left: 6px; vertical-align: 2px; }
.badge.sub { background: #E3E8F0; color: var(--navy-3); }
.phones { display: grid; gap: 8px; margin-top: 12px; }
.call {
  display: flex; align-items: center; gap: 12px; text-decoration: none; min-height: 52px;
  background: var(--orange); color: #fff; border-radius: 12px; padding: 10px 14px; font-weight: 700;
}
.call:active { background: var(--orange-dark); }
.call svg { flex: none; width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2; stroke-linejoin: round; }
.call .lbl { font-size: 12px; font-weight: 600; opacity: .9; display: block; text-transform: uppercase; letter-spacing: .06em; }
.call.alt { background: var(--navy); }
.call.alt:active { background: var(--navy-3); }
.mail { display: inline-block; margin-top: 10px; font-size: 14px; color: var(--navy-3); }
.empty { text-align: center; color: var(--muted); padding: 32px 8px; }

/* ---------- Barre d'onglets ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + var(--safe-bottom));
}
.tabbar a { display: grid; justify-items: center; gap: 2px; text-decoration: none; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0; min-height: 48px; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--navy); }
.tabbar a.active svg { stroke: var(--orange); }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--navy); color: #fff; margin: -16px -16px calc(-84px - var(--safe-bottom)); position: relative; overflow: hidden; }
.login::before, .login::after { content: ""; position: absolute; width: 360px; height: 40px; background: var(--orange); transform: rotate(-35deg); }
.login::before { left: -140px; bottom: 60px; }
.login::after { right: -150px; top: 50px; box-shadow: 0 -24px 0 var(--navy-3); }
.login-card { width: 100%; max-width: 380px; position: relative; z-index: 1; }
.logo-block { background: #fff; color: var(--navy); border-radius: 18px; padding: 24px 20px 18px; text-align: center; }
.logo-big { font-size: 52px; font-weight: 800; letter-spacing: .03em; line-height: 1; display: inline-flex; align-items: center; }
.logo-big .o-mark { border-width: .14em; }
.logo-sub { font-weight: 700; letter-spacing: .18em; font-size: 13px; margin-top: 8px; }
.logo-sub + .logo-sub { margin-top: 2px; }
.logo-line { height: 3px; background: var(--orange); margin: 12px 0 10px; }
.logo-tag { font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.logo-tag .on { color: var(--orange); }
.login form { margin-top: 24px; display: grid; gap: 12px; }
.login label { font-size: 14px; font-weight: 600; }
.login input { font: inherit; font-size: 18px; letter-spacing: .1em; text-transform: uppercase; text-align: center; padding: 14px; border-radius: 12px; border: 2px solid transparent; min-height: 54px; }
.login input:focus { outline: none; border-color: var(--orange); }
.btn { border: 0; border-radius: 12px; background: var(--orange); color: #fff; font-weight: 800; font-size: 17px; padding: 14px; min-height: 54px; cursor: pointer; }
.btn:active { background: var(--orange-dark); }
.btn:disabled { opacity: .6; }
.error { background: #FDE3E3; color: #9B1C1C; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.login .hint { font-size: 13px; opacity: .75; text-align: center; }

/* ---------- Menu ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(11,31,58,.5); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 520px; border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + var(--safe-bottom)); display: grid; gap: 8px; }
.sheet-info { font-size: 14px; color: var(--muted); padding: 4px 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.sheet-info strong { color: var(--text); display: block; font-size: 16px; }
.sheet-btn { border: 0; background: #EEF2F7; border-radius: 12px; padding: 14px; font-weight: 700; min-height: 50px; cursor: pointer; text-align: left; }
.sheet-btn.danger { color: #B42318; }
.sheet-btn.ghost { background: transparent; text-align: center; }

.offline { background: #FFF4E5; color: #8A4B00; border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px; }

/* ---------- Plan de base : étapes, réflexe, groupes ---------- */
.etapes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.etapes li { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.etapes .num { width: 30px; height: 30px; font-size: 14px; background: var(--orange); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.card.ccmu { margin-top: 20px; }
.reflexe { margin-top: 12px; background: #FFF1E8; border-left: 5px solid var(--orange); border-radius: 12px; padding: 12px 14px; font-weight: 600; }
.reflexe .kicker { margin-bottom: 4px; }
.group-title { font-size: 15px; margin: 18px 0 8px; color: var(--navy-3); }
.group { margin-top: 12px; }
.group h3 { margin: 0 0 4px; font-size: 16px; }
.group .points { margin-top: 8px; }
.modele { background: var(--bg); border-radius: 10px; padding: 12px; font-size: 14px; margin: 8px 0; }
.copy { border: 0; background: var(--navy); color: #fff; border-radius: 10px; padding: 10px 14px; font-weight: 700; min-height: 44px; cursor: pointer; }
.nefait { margin-top: 18px; background: #F3F4F7; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.nefait h3 { margin: 0 0 6px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: #9B1C1C; }
.nefait ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.nefait li { position: relative; padding-left: 22px; font-size: 15px; }
.nefait li::before { content: "✗"; position: absolute; left: 2px; color: #B42318; font-weight: 800; }
.infos { margin-top: 20px; padding: 0; }
.infos summary { padding: 14px 16px; font-weight: 700; cursor: pointer; min-height: 48px; }
.infos dl { margin: 0; padding: 0 16px 14px; }
.infos dt { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 10px; }
.infos dd { margin: 2px 0 0; }
.row .num { font-size: 13px; }
