/* UDOPS — appli des adhérents UDPS 28 (clair / sombre automatique)
   Même charte et mêmes gabarits que l'Espace Bureau (app.udps28.fr) :
   Bleu #002B6B · Rouge #E30613 · Blanc · Montserrat (titres) · Arial (textes) */
@font-face {
  font-family: "Montserrat";
  src: url("/fonts/montserrat.woff2") format("woff2-variations"), url("/fonts/montserrat.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --blue: #002B6B;
  --red: #E30613;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --text: #1b1f24;
  --muted: #5c6670;
  --border: #e2e5e9;
  --primary: #002B6B;
  --on-primary: #ffffff;
  --primary-soft: #e6ecf5;
  --accent: #E30613;
  --danger: #C70511;
  --accent-soft: #fdecee;
  --ok: #2b8a3e;
  --ok-soft: #ebfbee;
  --warn: #b35c00;
  --warn-soft: #fff4e5;
  --info: #1864ab;
  --info-soft: #e7f1fb;
  --neutral-soft: #eef0f3;
  --bar: #4c7bd9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: Arial, Helvetica, sans-serif;
  --font-title: "Montserrat", Arial, Helvetica, sans-serif;
  --tabbar-h: 60px;
  --side-w: 250px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --surface: #182029;
    --surface-2: #1d2631;
    --text: #e6e9ee;
    --muted: #9aa5b1;
    --border: #2c3642;
    --primary: #8fb4e3;
    --on-primary: #0f1419;
    --primary-soft: #1f2f45;
    --danger: #ff6b6b;
    --accent-soft: #3a1d22;
    --ok: #69db7c;
    --ok-soft: #173322;
    --warn: #ffb35c;
    --warn-soft: #3a2a15;
    --info: #74c0fc;
    --info-soft: #182c40;
    --neutral-soft: #26303b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
a { color: var(--primary); }
h1, h2, h3 { font-family: var(--font-title); line-height: 1.25; margin: 0; }
h1 { font-weight: 700; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ================= Structure : barre latérale (ordinateur), barre du haut + onglets (téléphone) ================= */
.shell { min-height: 100vh; }
.sidebar { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--blue); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
/* Logo UDOPS (couleurs sur fond blanc) posé sur une pastille blanche dans les barres bleues */
.logo-tile { display: block; flex: none; background: #fff; border-radius: 10px; padding: 3px 6px; }
.brand .logo { display: block; height: 36px; width: auto; }
.brand-sub { font: 600 13px var(--font-title); opacity: .9; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--on-primary);
  font-weight: 700; font-size: 13px; text-decoration: none;
}
.topbar .avatar { background: #fff; color: var(--blue); }

.app {
  max-width: 1100px; margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
}

.tabbar {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px 7px;
  color: var(--muted); text-decoration: none; font-size: 11px;
}
.tab svg { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--primary); font-weight: 700; }
.tab .badge, .nav .badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.tab .badge { position: absolute; top: 3px; left: calc(50% + 6px); }

.fab {
  position: fixed; z-index: 11; right: 16px;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; text-decoration: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
}
.fab svg { width: 26px; height: 26px; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: var(--side-w) 1fr; }
  .topbar, .tabbar { display: none !important; }
  .sidebar {
    display: flex; flex-direction: column; gap: 6px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    padding: 18px 14px; background: var(--blue); color: #fff;
  }
  .sidebar[hidden] { display: none !important; }
  .sidebar .brand { flex-direction: column; align-items: stretch; gap: 8px; padding: 4px 4px 18px; text-align: center; }
  .sidebar .logo-tile { padding: 10px 14px; border-radius: 14px; }
  .sidebar .logo { height: auto; width: 100%; max-width: 190px; margin: 0 auto; }
  .sidebar .brand-sub { font-size: 14px; white-space: normal; }
  .sidebar .side-btn { margin: 0 4px 10px; white-space: normal; text-align: center; line-height: 1.25; }
  .sidebar .side-new { background: var(--red); border-color: var(--red); color: #fff; }
  .sidebar .side-eb { background: #fff; color: var(--blue); border-color: #fff; font-size: 13px; margin-bottom: 14px; }
  .sidebar .side-eb:hover { background: rgba(255, 255, 255, .88); }
  .nav { display: flex; flex-direction: column; gap: 2px; }
  .nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
    color: rgba(255, 255, 255, .85); text-decoration: none; font-weight: 500;
  }
  .nav a svg { width: 18px; height: 18px; flex: none; }
  .nav a:hover { background: rgba(255, 255, 255, .08); }
  .nav a[aria-current="page"] { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 700; }
  .nav a .badge { margin-left: auto; }
  .nav-sep { height: 1px; margin: 8px 6px; background: rgba(255, 255, 255, .15); }
  .sidebar .me { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255, 255, 255, .15); font-size: 13px; }
  .sidebar .me strong { display: block; font-size: 14px; }
  .sidebar .me .btn { margin-top: 10px; width: 100%; background: transparent; color: #fff; border-color: rgba(255, 255, 255, .3); }
  .app { padding: 28px 32px 48px; width: 100%; }
  .fab { bottom: 28px; right: 32px; }
}
/* Écran de connexion : pas de barres, fond bleu comme l'Espace Bureau */
body.is-login { background: var(--blue); }
body.is-login .shell { display: block; }
body.is-login .app { max-width: none; padding: 24px 16px; }

/* ================= En-têtes de page ================= */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; line-height: 1.2; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.stack { display: grid; gap: 10px; }
.section { margin-top: 20px; }
.section-tight { margin-top: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.section-head a { font-size: 13.5px; font-weight: 600; text-decoration: none; }
.count { font: 700 12px var(--font); padding: 1px 8px; border-radius: 999px; background: var(--neutral-soft); color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.center { text-align: center; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
p { margin: 0 0 8px; }
p:last-child { margin-bottom: 0; }

/* ================= Tableau de bord (accueil) ================= */
.since {
  display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px;
  background: var(--primary-soft); border-radius: var(--radius); padding: 14px 16px;
}
.since svg { width: 22px; height: 22px; color: var(--primary); flex: none; margin-top: 1px; }
.since p { margin: 0; }
.since .when { font-size: 13px; color: var(--muted); margin-top: 2px; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  display: block; text-decoration: none; color: inherit; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.tile:hover { border-color: var(--primary); }
.tile .n { display: block; font: 800 28px/1.1 var(--font-title); font-variant-numeric: tabular-nums; }
.tile .l { font-size: 13px; color: var(--muted); }
.tile.is-alert .n { color: var(--danger); }

.home-notices { margin-bottom: 16px; }
.dash-grid { display: grid; gap: 16px; }
@media (min-width: 1000px) { .dash-grid { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.dash-grid > .stack { gap: 16px; }

/* ================= Cartes ================= */
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  color: inherit; text-decoration: none;
}
.card > h2 { font-size: 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }

/* Lignes cliquables avec barre de couleur à gauche (comme les tâches de l'Espace Bureau) */
.item {
  position: relative; display: block;
  padding: 12px 12px 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  color: inherit; text-decoration: none; overflow: hidden;
}
.item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--bar); }
.card .item, .dash-grid .item { background: var(--surface-2); }
a.item:hover { border-color: var(--primary); }
.item.important::before { background: var(--accent); }
.item.event-poste::before, .item.event-maraude::before { background: var(--accent); }
.item.event-formation::before { background: #1d6fb8; }
.item.event-reunion::before, .item.event-vie::before { background: var(--bar); }
.item.cancelled { opacity: .65; }
.item.cancelled h3 { text-decoration: line-through; }
.item h3 { font: 600 15px/1.35 var(--font); margin: 4px 0; overflow-wrap: anywhere; }
.item.unread h3 { font-weight: 700; }
.item.unread h3::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); margin-right: 8px; vertical-align: 2px;
}
.card-row { display: flex; gap: 12px; align-items: flex-start; }
.card-row > .grow { flex: 1; min-width: 0; }

.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.meta svg { width: 14px; height: 14px; display: block; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--primary-soft); color: var(--primary);
}
.chip.red { background: var(--accent-soft); color: var(--danger); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.grey, .chip.line { background: var(--surface); color: var(--text); border: 1px solid var(--border); font-weight: 500; }
.chip.grey { color: var(--muted); }
.chip svg { width: 14px; height: 14px; }

.date-box {
  flex: none; width: 50px; text-align: center;
  border-radius: 10px; background: var(--primary-soft); color: var(--primary);
  padding: 6px 0; font-family: var(--font-title); line-height: 1.1;
}
.date-box b { display: block; font-size: 19px; }
.date-box span { font-size: 11.5px; text-transform: uppercase; font-weight: 700; }

/* Filtres : pastilles (comme les « chips » de l'Espace Bureau) */
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 2px 16px 10px; margin: 0 -16px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .filters { flex-wrap: wrap; margin: 0; padding: 2px 0 10px; } }
.filter {
  flex: none; border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 5px 12px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  color: var(--text); text-decoration: none;
}
.filter:hover { border-color: var(--primary); }
.filter[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

/* ================= Agenda : vue mois (comme le calendrier de l'Espace Bureau) ================= */
:root { --c-poste: #E30613; --c-maraude: #e8590c; --c-formation: #1d6fb8; --c-reunion: #4c7bd9; --c-vie: #7b4fc9; }
.ag-mine-card .stack { gap: 8px; }
.ag-row {
  display: flex; gap: 10px; align-items: center; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: inherit; text-decoration: none;
}
.ag-row:hover { border-color: var(--primary); }
.ag-row > span:nth-child(2) { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ag-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c-reunion); }
.ag-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.ag-bar .btn.small { min-width: 36px; font-size: 16px; }
.ag-bar .btn.small:last-of-type { font-size: 13px; }
.ag-title { margin: 0 6px; font-size: 20px; text-transform: capitalize; min-width: 10ch; text-align: center; }
.ag-legend { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.ag-key { font-size: 12px; padding: 2px 8px; border: 1px solid var(--border); border-left: 4px solid var(--c-reunion); border-radius: 6px; background: var(--surface); }
.ag-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.ag-head { padding: 6px; font-size: 12px; font-weight: 600; text-align: center; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.ag-cell { min-height: 104px; padding: 4px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ag-cell:nth-child(7n) { border-right: none; }
.ag-out { background: var(--surface-2); }
.ag-out > * { opacity: .5; }
.ag-today { box-shadow: inset 0 0 0 2px var(--accent); }
.ag-num { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; padding: 0 2px; }
.ag-add { color: var(--muted); text-decoration: none; padding: 0 6px; border-radius: 4px; font-size: 14px; opacity: 0; }
.ag-cell:hover .ag-add, .ag-add:focus-visible { opacity: 1; }
.ag-add:hover { background: var(--accent); color: #fff; }
.ag-ev {
  display: block; font-size: 12px; line-height: 1.3; padding: 2px 5px;
  border: 1px solid var(--border); border-left: 4px solid var(--c-reunion); border-radius: 5px;
  background: var(--surface); color: inherit; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ag-ev:hover, .ag-ev:focus-visible { border-color: var(--accent); }
.ag-ev.ag-mine { background: var(--primary-soft); }
.ag-ev.ag-cancelled { text-decoration: line-through; opacity: .6; }
.ag-poste { border-left-color: var(--c-poste) !important; }
.ag-maraude { border-left-color: var(--c-maraude) !important; }
.ag-formation { border-left-color: var(--c-formation) !important; }
.ag-reunion { border-left-color: var(--c-reunion) !important; }
.ag-vie { border-left-color: var(--c-vie) !important; }
.ag-dot.ag-poste { background: var(--c-poste); }
.ag-dot.ag-maraude { background: var(--c-maraude); }
.ag-dot.ag-formation { background: var(--c-formation); }
.ag-dot.ag-vie { background: var(--c-vie); }
.ag-list { display: none; }
.ag-today-txt { color: var(--accent); }
@media (max-width: 760px) {
  .ag-grid, .ag-legend { display: none; }
  .ag-list { display: block; }
  .ag-title { min-width: 0; font-size: 18px; }
}
/* Mêmes couleurs sur les cartes d'événements */
.item.event-maraude::before { background: var(--c-maraude); }
.item.event-vie::before { background: var(--c-vie); }

.month { font: 700 12px var(--font-title); text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 18px 2px 6px; }

/* ================= Boutons et formulaires ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--primary);
  background: var(--primary); color: var(--on-primary);
  font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--border); }
.btn.block { width: 100%; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn svg { width: 18px; height: 18px; flex: none; }
.list .btns { flex-wrap: nowrap; flex: none; gap: 6px; }
.list .btn { white-space: nowrap; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 42px; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
textarea.input { min-height: 110px; resize: vertical; }
.input:focus-visible, .filter:focus-visible, .btn:focus-visible, .item:focus-visible, .tile:focus-visible, .nav a:focus-visible, .tab:focus-visible {
  outline: 3px solid var(--info); outline-offset: 2px;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.code-input { font: 700 28px var(--font-title); letter-spacing: .3em; text-align: center; }
.error { color: var(--danger); font-weight: 700; font-size: 14px; }
.error:empty { display: none; }
form.card { max-width: 760px; }

/* ================= Détails ================= */
.detail, .detail ~ section { max-width: 820px; }
.detail h2 { font-size: 22px; margin: 6px 0 10px; }
.detail h3 { font-size: 15px; margin-bottom: 4px; }
.detail .hero { width: 100%; max-width: 760px; border-radius: 10px; margin: 10px 0; display: block; }
.kv { display: grid; grid-template-columns: 26px 1fr; gap: 10px 8px; margin: 14px 0; }
.kv svg { width: 20px; height: 20px; color: var(--muted); }
.box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.box.warn { background: var(--warn-soft); border-color: transparent; }
.status-banner { border-radius: 10px; padding: 12px 14px; font-weight: 600; }
.status-banner.ok { background: var(--ok-soft); color: var(--ok); }
.status-banner.info { background: var(--info-soft); color: var(--info); }
.status-banner.grey { background: var(--neutral-soft); color: var(--muted); }
.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 2px dashed var(--primary); border-radius: 10px; padding: 10px 14px;
  font: 700 20px var(--font-title); letter-spacing: .05em;
}
.partner-logo { width: 52px; height: 52px; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--border); flex: none; }
.partner-logo.ph { display: grid; place-items: center; font: 800 19px var(--font-title); color: var(--blue); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.code-row { flex-wrap: wrap; }
.code-row .grow { flex-basis: 180px; }
.code-form { display: flex; gap: 6px; align-items: center; flex: 1 1 240px; }
.code-form .input { min-height: 36px; padding: 4px 10px; flex: 1; min-width: 0; }
details > summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; }
.selection-row { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.selection-row .controls { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.selection-row select { min-height: 36px; padding: 4px 10px; width: auto; }
.selection-row .check { margin: 0; font-size: 14px; }

progress.meter { width: 100%; height: 8px; margin: 4px 0 10px; border: 0; border-radius: 99px; overflow: hidden; background: var(--surface-2); -webkit-appearance: none; appearance: none; }
progress.meter::-webkit-progress-bar { background: var(--neutral-soft); border-radius: 99px; }
progress.meter::-webkit-progress-value { background: var(--primary); border-radius: 99px; }
progress.meter::-moz-progress-bar { background: var(--primary); border-radius: 99px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); font-size: 13px; color: var(--muted); }
.stat b { display: block; font: 800 26px/1.1 var(--font-title); color: var(--text); }

.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 16px 4px; }
.install {
  display: flex; gap: 12px; align-items: center;
  background: var(--blue); color: #fff; border-radius: var(--radius); padding: 14px 16px;
}
.install .grow { flex: 1; }
.install .btn { background: #fff; color: var(--blue); border-color: #fff; }
.install-steps { margin: 8px 0 0; padding-left: 20px; }

/* ================= Connexion ================= */
.login { min-height: calc(100vh - 48px); display: flex; align-items: center; justify-content: center; }
.login > div { width: min(440px, 100%); }
.login-card { width: 100%; padding: 28px 24px; }
.login-logo { display: block; width: 100%; max-width: 260px; margin: 0 auto 10px; }
.login h1 { font-size: 20px; text-align: center; margin-bottom: 6px; }
.login .lead { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.login .error { text-align: center; }
.login-foot { text-align: center; font-size: 12.5px; color: rgba(255, 255, 255, .75); margin-top: 14px; }

/* ================= Toast ================= */
.toast {
  position: fixed; z-index: 100; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
  max-width: calc(100vw - 32px);
  background: #1b1f24; color: #fff; padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3); font-size: 14px;
}
.toast.error { background: var(--danger); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

.spinner { width: 28px; height: 28px; margin: 40px auto; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* Téléphone en paysage : barre du haut fine, onglets sur une ligne */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1100px) {
  .topbar { position: static; padding: 4px max(16px, env(safe-area-inset-right)) 4px max(16px, env(safe-area-inset-left)); }
  .brand .logo { height: 26px; }
  .tab { flex-direction: row; justify-content: center; gap: 6px; padding: 6px 2px; font-size: 12px; }
  .tab svg { width: 18px; height: 18px; }
  .app { padding-bottom: 64px; }
}
