/* Appli mobile Suite Agence : pensée pour le pouce (gros boutons en bas d'écran), couleurs du logiciel. */
:root {
  --blue: #163A73;
  --blue-light: #E8EEF8;
  --yellow: #F5C400;
  --text: #1C2430;
  --muted: #5B6676;
  --line: #D9DEE6;
  --bg: #F4F6FA;
  --card: #FFFFFF;
  --red: #B42318;
  --red-light: #FDECEA;
  --green: #1E7B3A;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: none;
}
button { font: inherit; }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }

/* ---------- Écran type : bandeau, contenu, boutons en bas ---------- */
.screen { min-height: 100dvh; display: flex; flex-direction: column; }
.bar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 12px;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: var(--blue); color: #fff;
  border-bottom: 4px solid var(--yellow);
}
.bar h1 { margin: 0; font-size: 20px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-logo {
  flex: none; width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--yellow); color: var(--blue); font-weight: 800; font-size: 15px;
}
.bar-back {
  flex: none; width: 44px; height: 44px; margin-left: -8px;
  border: 0; border-radius: 10px; background: transparent; color: #fff;
  font-size: 34px; line-height: 1;
}
.bar-back:active { background: rgba(255, 255, 255, .15); }

.content { flex: 1; padding: 20px 16px 24px; }
.lead { font-size: 18px; margin: 0 0 16px; }
.note { color: var(--muted); font-size: 15px; }

.actions {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: rgba(244, 246, 250, .96);
  border-top: 1px solid var(--line);
}

/* ---------- Boutons (au moins 52 px de haut : faciles au pouce) ---------- */
.primary, .secondary, .danger, .link {
  width: 100%; min-height: 52px; padding: 12px 16px;
  border-radius: 12px; border: 2px solid transparent; font-weight: 600;
}
.primary { background: var(--blue); color: #fff; }
.primary:active { background: #0F2A55; }
.primary:disabled { opacity: .6; }
.secondary { background: var(--card); color: var(--blue); border-color: var(--blue); }
.danger { background: var(--red-light); color: var(--red); border-color: var(--red); }
.link { background: transparent; color: var(--blue); min-height: 44px; text-decoration: underline; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

/* ---------- Champs ---------- */
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-weight: 600; margin-bottom: 6px; }
.pin {
  width: 100%; height: 56px; padding: 0 16px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card);
  font-size: 26px; letter-spacing: 8px; text-align: center;
}
.pin:focus { outline: none; border-color: var(--blue); }
.message { min-height: 1.4em; margin: 4px 0 0; font-weight: 600; }
.message.error { color: var(--red); }

/* ---------- Listes et textes ---------- */
.steps { padding-left: 22px; margin: 0 0 16px; }
.steps li { margin-bottom: 10px; }
.plain { padding-left: 20px; }
.key {
  display: inline-block; min-width: 26px; padding: 0 6px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--card); text-align: center;
}
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0 0 8px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* ---------- Tuiles des outils ---------- */
.tile {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  min-height: 84px; padding: 14px 16px; margin-bottom: 12px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-left: 6px solid var(--yellow); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
.tile:active { background: var(--blue-light); }
.tile-icon { font-size: 34px; flex: none; }
.tile-text b { display: block; font-size: 18px; color: var(--blue); }
.tile-text small { display: block; color: var(--muted); font-size: 15px; margin-top: 2px; }

/* ---------- Lecture d'un QR code ---------- */
.scan { position: fixed; inset: 0; background: #000; color: #fff; }
.scan video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute; left: 50%; top: 42%; width: min(70vw, 300px); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 4px solid var(--yellow); border-radius: 18px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45);
}
.scan-title {
  position: absolute; left: 16px; right: 16px; top: calc(20px + var(--safe-top));
  margin: 0; text-align: center; font-size: 18px; font-weight: 600;
}
.scan .actions { position: absolute; left: 0; right: 0; bottom: 0; background: transparent; border: 0; }

/* ---------- Bandeau de mise à jour ---------- */
.update {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-bottom)); z-index: 10;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--blue); color: #fff; border-radius: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.update[hidden] { display: none; }
.update span { flex: 1; font-size: 15px; }
.update button {
  flex: none; min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px;
  background: var(--yellow); color: var(--blue); font-weight: 700;
}
