:root {
  --bg: #f4f6f9; --surface: #ffffff; --text: #1c2430; --muted: #5d6b7e; --line: #dde3ec;
  --primary: #1f4e8c; --primary-text: #ffffff; --danger: #b3261e; --warn-bg: #fff4d6; --warn-line: #e6c35c;
  --error-bg: #fde8e6; --ok-bg: #e5f4ea; --radius: 12px; --bar: 4rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161d; --surface: #1a212b; --text: #e8edf4; --muted: #9aa8bb; --line: #2c3745;
    --primary: #6aa3ea; --primary-text: #0c1522; --danger: #f2877f; --warn-bg: #3a3213; --warn-line: #7a6820;
    --error-bg: #3b1d1b; --ok-bg: #16301f;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
.lead, .hint { color: var(--muted); }
.hint { font-size: .875rem; margin: .35rem 0 0; }
.hint-warn { color: var(--danger); }
.icon { width: 1.4rem; height: 1.4rem; flex: none; }
.icon-lg { width: 2rem; height: 2rem; color: var(--primary); }

/* Mise en page : barre du bas sur téléphone, menu à gauche sur ordinateur */
main { padding: 1rem 1rem calc(var(--bar) + 1.5rem + env(safe-area-inset-bottom)); max-width: 62rem; margin: 0 auto; }
.bare main { padding-bottom: 2rem; }
.sidebar { display: none; }
.bottombar { position: fixed; inset: auto 0 0 0; height: calc(var(--bar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: var(--surface); border-top: 1px solid var(--line); z-index: 10; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  text-decoration: none; color: var(--muted); font-size: .75rem; min-width: 0; }
.tab.is-active { color: var(--primary); font-weight: 600; }
.page-head { margin: .5rem 0 1rem; }

@media (min-width: 900px) {
  body.with-nav { display: grid; grid-template-columns: 17rem 1fr; min-height: 100vh; }
  .sidebar { display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem 1rem; background: var(--surface);
    border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; }
  .bottombar { display: none; }
  main { padding: 2rem; width: 100%; }
}
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--text); font-weight: 700; }
.brand-text small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
.brand-mark { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 10px;
  background: var(--primary); color: var(--primary-text); font-weight: 700; }
.sidebar nav { display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.nav-link { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: 8px; text-decoration: none; color: var(--text); }
.nav-link:hover { background: var(--bg); }
.nav-link.is-active { background: var(--bg); color: var(--primary); font-weight: 600; }
.soon { margin-left: auto; font-style: normal; font-size: .7rem; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 .5rem; }
.logout .who { color: var(--muted); font-size: .85rem; margin-bottom: .35rem; }

/* Cartes, formulaires, boutons */
.card, .tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1rem; }
.card-center { max-width: 26rem; margin: 2vh auto; }
.card-center .card { margin-bottom: 0; }
.brand-block { display: flex; align-items: center; gap: .75rem; margin: 1.5rem 0 1rem; }
.brand-block h1 { font-size: 1.3rem; margin: 0; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.tile { text-decoration: none; color: var(--text); display: block; margin: 0; }
.tile p { color: var(--muted); font-size: .9rem; margin: 0 0 .75rem; }
.badge { display: inline-block; font-size: .75rem; padding: .1rem .6rem; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.field { margin-bottom: 1rem; }
label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem; }
input, textarea, select { width: 100%; padding: .65rem .75rem; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; }
input:focus, textarea:focus, select:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 1px; }
.btn, .menu-button { display: inline-flex; justify-content: center; align-items: center; padding: .65rem 1.1rem; font: inherit; font-weight: 600;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; text-decoration: none; min-height: 2.75rem; }
.btn-primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); padding-left: 0; }
.btn-block { width: 100%; margin-top: .5rem; }
.alert { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid var(--line); }
.alert-error { background: var(--error-bg); border-color: var(--danger); }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.flash { background: var(--ok-bg); border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; margin-bottom: 1rem; }
.tabs { display: flex; gap: .25rem; overflow-x: auto; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .6rem .9rem; text-decoration: none; color: var(--muted); white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.menu-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.menu-list li + li { border-top: 1px solid var(--line); }
.menu-list a, .menu-button { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .9rem 1rem; text-decoration: none; color: var(--text); border: 0; border-radius: 0; justify-content: flex-start; background: transparent; }
.qr { display: block; width: 14rem; max-width: 100%; margin: 1rem auto; background: #fff; padding: .5rem; border-radius: 8px; }
.secret, .codes code { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .05em; word-break: break-all; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.codes li { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .5rem; text-align: center; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
@media print { .sidebar, .bottombar, .btn { display: none !important; } body { background: #fff; color: #000; } }
