:root {
  --blue: #009CDE;
  --blue-dark: #0077A8;
  --ink: #1b2a33;
  --muted: #6b7c86;
  --line: #e3eaee;
  --bg: #ffffff;
  --soft: #f3f8fb;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }

.top { padding: 14px 20px 0; text-align: center; border-bottom: 1px solid var(--line); }
.logo { height: 34px; width: auto; display: block; margin: 0 auto 10px; }
.tabs { display: flex; gap: 4px; max-width: 420px; margin: 0 auto; }
.tabs button {
  flex: 1; padding: 12px 8px; background: none; border: 0; border-bottom: 3px solid transparent;
  font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--blue-dark); border-bottom-color: var(--blue); }

main { max-width: 420px; margin: 0 auto; padding: 20px; }

.identity { text-align: center; margin-bottom: 16px; }
h1 { font-size: 1.5rem; margin: 0; line-height: 1.2; }
.role { margin: 4px 0 0; color: var(--muted); white-space: pre-line; }

.qr-card {
  display: block; width: 100%; padding: 18px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 156, 222, .12); cursor: zoom-in;
}
#qr, #qr-big { width: 100%; aspect-ratio: 1; }
#qr svg, #qr-big svg { width: 100%; height: 100%; display: block; shape-rendering: crispEdges; }
.empty { display: grid; place-items: center; height: 100%; min-height: 100%; color: var(--muted); text-align: center; font-size: .95rem; }

.hint { text-align: center; color: var(--muted); font-size: .9rem; margin: 14px 0 0; }
.meta { text-align: center; color: var(--muted); font-size: .75rem; margin: 4px 0 0; min-height: 1em; }

.actions { display: grid; gap: 10px; margin-top: 20px; }
button.primary, button.secondary {
  font: inherit; font-weight: 600; padding: 14px 16px; border-radius: 12px; cursor: pointer; width: 100%;
}
button.primary { background: var(--blue); color: #fff; border: 0; }
button.primary:active { background: var(--blue-dark); }
button.secondary { background: #fff; color: var(--blue-dark); border: 1.5px solid var(--blue); }
.install { margin-top: 10px; }
.ios-hint { margin: 14px 0 0; padding: 12px; background: var(--soft); border-radius: 10px; font-size: .85rem; color: var(--muted); text-align: center; }

.form { display: grid; gap: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: grid; gap: 6px; font-size: .85rem; font-weight: 600; color: var(--muted); }
input, select {
  font: inherit; font-size: 16px; /* 16px : évite le zoom auto d'iOS */ color: var(--ink);
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.adv { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.adv summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.adv label { margin-top: 12px; }

#present {
  position: fixed; inset: 0; z-index: 10; background: #fff; display: grid; place-items: center; cursor: zoom-out;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.present-inner { width: min(92vw, 70vh); text-align: center; }
#qr-big { aspect-ratio: 1; }
#present-name { font-size: 1.25rem; font-weight: 700; margin: 16px 0 0; }

@media (prefers-color-scheme: dark) {
  /* Le QR reste noir sur blanc : seul le décor passe en sombre. */
  :root { --bg: #0f1a21; --ink: #eef4f7; --muted: #93a6b1; --line: #25353f; --soft: #17252e; }
  .tabs button[aria-selected="true"] { color: var(--blue); }
  button.secondary, input, select { background: var(--bg); color: var(--ink); }
  button.secondary { color: var(--blue); }
  .logo { filter: brightness(1.15); }
}
