/* ==========================================================
   SECURICAR — Portail
   ========================================================== */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --border: #dde2ea;
  --border-strong: #c5ccd8;
  --text: #16202f;
  --text-2: #4d5b70;
  --text-3: #7a879a;
  --accent: #1f5fd6;
  --accent-hover: #184fb5;
  --accent-soft: #e3ecfc;
  --accent-text: #174aa8;
  --on-accent: #ffffff;
  --danger: #c43d3d;
  --danger-soft: #fbe9e9;
  --success-soft: #e5f4ea;
  --success-text: #1f6a3a;
  --admin-soft: #eee9fb;
  --admin-text: #5a3fb0;
  --tile-hover: #f7f9fc;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 10px;
  --radius-lg: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f1420;
  --surface: #171e2c;
  --surface-2: #1f2838;
  --border: #2a3446;
  --border-strong: #3a465c;
  --text: #e8edf5;
  --text-2: #aab5c6;
  --text-3: #7f8ba0;
  --accent: #5b8ff0;
  --accent-hover: #7aa5f5;
  --accent-soft: #1d2d4d;
  --accent-text: #a9c4fa;
  --on-accent: #0b1220;
  --danger: #f07777;
  --danger-soft: #3a1f24;
  --success-soft: #16322a;
  --success-text: #8fd9aa;
  --admin-soft: #2a2347;
  --admin-text: #c7b8f7;
  --tile-hover: #1c2433;
  --shadow: none;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0f1420;
    --surface: #171e2c;
    --surface-2: #1f2838;
    --border: #2a3446;
    --border-strong: #3a465c;
    --text: #e8edf5;
    --text-2: #aab5c6;
    --text-3: #7f8ba0;
    --accent: #5b8ff0;
    --accent-hover: #7aa5f5;
    --accent-soft: #1d2d4d;
    --accent-text: #a9c4fa;
    --on-accent: #0b1220;
    --danger: #f07777;
    --danger-soft: #3a1f24;
    --success-soft: #16322a;
    --success-text: #8fd9aa;
    --admin-soft: #2a2347;
    --admin-text: #c7b8f7;
    --tile-hover: #1c2433;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--accent-text); }
h1 { font-size: 24px; font-weight: 650; margin: 8px 0 16px; }
h2 { font-size: 17px; font-weight: 650; margin: 0; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 12px; }
code { font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.i { flex: none; display: block; }

/* ===================== Barre du haut ===================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 650; font-size: 16px; }
.brand img { border-radius: 8px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 0; background: transparent; color: var(--text-2);
  cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.small { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

.when-dark { display: none; }
:root[data-theme="dark"] .when-dark { display: contents; }
:root[data-theme="dark"] .when-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .when-dark { display: contents; }
  :root[data-theme="auto"] .when-light { display: none; }
}

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text);
  font-weight: 650; font-size: 14px; cursor: pointer; list-style: none; flex: none;
}
.avatar::-webkit-details-marker { display: none; }
.avatar.static { cursor: default; }

.user-menu { position: relative; margin-left: 4px; }
.user-menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .15); padding: 12px; z-index: 30;
}
.user-menu-panel p { margin: 0; }
.user-menu-name { font-weight: 600; }
.user-menu-panel a, .user-menu-panel button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin-top: 6px; padding: 8px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; font: inherit;
  background: none; border: 0; cursor: pointer; text-align: left;
}
.user-menu-panel a:first-of-type { margin-top: 12px; }
.user-menu-panel a:hover, .user-menu-panel button:hover { background: var(--surface-2); }

/* ===================== Messages ===================== */
.flashes { max-width: 1180px; margin: 12px auto 0; padding: 0 16px; }
.flash { margin: 0 0 8px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.flash-success { background: var(--success-soft); color: var(--success-text); border-color: transparent; }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.preview-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 12px; padding: 10px 14px;
  border-radius: var(--radius); background: var(--admin-soft); color: var(--admin-text);
}
.preview-banner a { margin-left: auto; color: inherit; font-weight: 600; }

/* ===================== Accueil ===================== */
.portal { max-width: 1180px; margin: 0 auto; padding: 0 16px 48px; }

.hero { text-align: center; padding: 36px 0 20px; }
.clock { font-size: 56px; font-weight: 300; letter-spacing: .02em; line-height: 1.1; margin: 0; font-variant-numeric: tabular-nums; }
.date { color: var(--text-2); margin: 4px 0 24px; }

.search {
  position: relative; max-width: 620px; margin: 0 auto;
  display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow); padding: 0 18px; gap: 10px; color: var(--text-3);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input[type="search"] {
  flex: 1; min-width: 0; height: 50px; padding: 0; border: 0; border-radius: 0; outline: 0; box-shadow: none;
  background: transparent; color: var(--text); font: inherit; font-size: 16px;
}
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search-hint { min-height: 22px; margin: 8px 0 0; font-size: 13px; color: var(--text-3); }
.search-hint strong { color: var(--text-2); }

.chips {
  position: sticky; top: 58px; z-index: 10;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 10px 0; margin-bottom: 8px; background: var(--bg);
}
.chips::-webkit-scrollbar { display: none; }
.chips a {
  flex: none; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); text-decoration: none; font-size: 14px; white-space: nowrap;
}
.chips a:hover { color: var(--text); border-color: var(--border-strong); }
.chips a span { color: var(--text-3); font-size: 12px; margin-left: 2px; }
body.searching .chips { display: none; }

.space { margin-top: 28px; }
/* Lien vers une section (#espace-…) : son titre reste visible sous la barre et les onglets. */
.space, .category { scroll-margin-top: 124px; }
.space-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.space-head h2 { display: flex; align-items: center; gap: 8px; }
.count { color: var(--text-3); font-weight: 500; font-size: 13px; }
.category { margin-bottom: 18px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }

.tile-wrap { position: relative; min-width: 0; }
.tile {
  display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0;
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--text); text-decoration: none; font: inherit; text-align: left; cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.tile:hover { border-color: var(--border-strong); background: var(--tile-hover); }
.tile:active { transform: scale(.98); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }

.tile-icon {
  --hue: 215;
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; overflow: hidden;
  background: var(--tile-bg, var(--surface-2));
}
.tile-icon img { width: 28px; height: 28px; object-fit: contain; }
.tile-icon .letter {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: hsl(var(--hue) 65% 92%); color: hsl(var(--hue) 55% 32%); font-weight: 650; font-size: 17px;
}
:root[data-theme="dark"] .tile-icon .letter { background: hsl(var(--hue) 35% 24%); color: hsl(var(--hue) 70% 82%); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .tile-icon .letter { background: hsl(var(--hue) 35% 24%); color: hsl(var(--hue) 70% 82%); }
}
.tile-icon.small { width: 30px; height: 30px; border-radius: 8px; }
.tile-icon.small img { width: 22px; height: 22px; }
.tile-emoji { color: #fff; font-size: 20px; font-weight: 650; }

.badge {
  flex: none; font-size: 11px; line-height: 1; padding: 4px 7px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}

.tile-add { border-style: dashed; box-shadow: none; background: transparent; color: var(--text-2); }
.tile-add .tile-icon { background: transparent; color: var(--text-3); }

.tile-tools { display: none; position: absolute; top: 6px; right: 6px; gap: 2px; background: var(--surface); border-radius: 8px; }
.tile-tools form { margin: 0; }
body.editing-shortcuts #raccourcis .tile-tools { display: flex; }
body.editing-shortcuts #raccourcis .tile-wrap .tile { border-style: dashed; }

.link-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 0; padding: 4px 6px; margin-left: auto;
  color: var(--accent-text); font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; border-radius: 6px;
}
.link-btn:hover { background: var(--accent-soft); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: var(--danger-soft); }

.empty { text-align: center; color: var(--text-2); padding: 32px 0; }
.footer-note { text-align: center; color: var(--text-3); font-size: 13px; margin-top: 40px; }
.footer-note a { color: var(--text-2); }

/* Téléphone : grille d'icônes comme un écran d'accueil */
@media (max-width: 600px) {
  .hero { padding: 20px 0 12px; }
  .clock { font-size: 40px; }
  .date { margin-bottom: 16px; }
  .chips { top: 56px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px 4px; }
  .tile {
    flex-direction: column; gap: 6px; padding: 8px 2px;
    background: transparent; border-color: transparent; box-shadow: none; text-align: center;
  }
  .tile:hover { background: transparent; border-color: transparent; }
  .tile-icon { width: 54px; height: 54px; border-radius: 14px; background: var(--tile-bg, var(--surface)); box-shadow: var(--shadow); border: 1px solid var(--border); }
  .tile-icon img { width: 34px; height: 34px; }
  .tile-name { width: 100%; font-size: 12px; line-height: 1.25; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .tile .badge { position: absolute; top: 2px; right: 6px; padding: 2px 5px; font-size: 10px; }
  .tile-add .tile-icon { border-style: dashed; box-shadow: none; background: transparent; }
  body.editing-shortcuts #raccourcis .tile-wrap .tile { border-style: dashed; border-color: var(--border-strong); }
  .tile-tools { top: -4px; right: -2px; box-shadow: var(--shadow); }
  h3 { font-size: 12px; }
}

/* ===================== Pages ===================== */
.page { max-width: 1000px; margin: 0 auto; padding: 16px 16px 48px; }
.page.narrow, .narrow { max-width: 620px; }
.card.narrow { margin: 0; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; font-size: 14px; margin-top: 8px; }
.back:hover { color: var(--text); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px;
}
.card h2 { margin-bottom: 14px; }
.card-footer { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.card-footer > form:first-child { flex: 1; }

.page-center main { max-width: 400px; margin: 0 auto; }
.page-center { display: flex; align-items: center; justify-content: center; padding: 16px; }
.page-center .flashes { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 0; right: 0; max-width: 432px; }
.auth-card { width: 100%; text-align: center; padding: 32px 24px; }
.auth-card .form { text-align: left; margin-top: 20px; }
.auth-logo { margin: 0 auto 8px; display: block; }
.offline-icon { display: inline-flex; color: var(--text-3); margin-bottom: 8px; }

.passkey-login { margin-top: 20px; text-align: left; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 0; color: var(--text-3); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.form-error { margin: 10px 0 0; padding: 8px 12px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); font-size: 14px; text-align: left; }
.passkey-list { margin-bottom: 14px; }
.passkey-list .tile-icon { color: var(--text-2); }
.passkey-rename label { gap: 4px; }
.passkey-add { margin-top: 4px; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; }

/* ===================== Formulaires ===================== */
.form { display: flex; flex-direction: column; gap: 14px; }
label, legend { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 550; color: var(--text); }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
legend { margin-bottom: 8px; padding: 0; }
label.radio, label.checkbox { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
.hint { font-weight: 400; font-size: 13px; color: var(--text-2); }

input[type="text"], input[type="password"], input[type="number"], input[type="search"], select {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; font-weight: 400;
}
input:focus, select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="color"] { width: 100%; height: 42px; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); }
input[type="radio"], input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.block { width: 100%; }

.form-actions, .dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
/* Confirmation de déconnexion : la page garde sa barre du haut, la tuile est centrée dessous
   (page-center ferait de la barre un élément à côté de la tuile). */
.page-logout main.auth-card { max-width: 400px; width: calc(100% - 32px); margin: 12vh auto 0; }
/* Boutons d'une tuile étroite (confirmation de déconnexion) : centrés, à la ligne si besoin, jamais hors de la tuile. */
.form-actions.center { flex-wrap: wrap; justify-content: center; }
.form-actions.center .btn { flex: 1 1 180px; justify-content: center; }
.danger-zone { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.inline-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; flex: 1; margin: 0; }
.inline-form .grow { flex: 1 1 200px; }
.inline-form .narrow-field { width: 100px; }
.grow { flex: 1; }

.icon-preview { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; margin: 0; }

/* ===================== Dialogue ===================== */
.dialog {
  width: min(460px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
}
.dialog::backdrop { background: rgba(10, 15, 25, .45); }
.dialog form { display: flex; flex-direction: column; gap: 14px; }

/* ===================== Gestion ===================== */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 20px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  padding: 10px 12px; color: var(--text-2); text-decoration: none; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }

.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type="search"] { flex: 1 1 240px; width: auto; }
.toolbar p { margin: 0; }

.admin-space { margin-bottom: 28px; }
.admin-space > h2 { margin-bottom: 12px; }
.admin-category { margin-bottom: 16px; scroll-margin-top: 80px; }
.admin-category-head { display: flex; align-items: center; gap: 8px; }

.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.card .rows, .rows.card { border: 0; border-radius: 0; box-shadow: none; }
.rows.card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); }
.row-item:first-child { border-top: 0; }
.row-item form { margin: 0; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { color: var(--text); font-weight: 550; text-decoration: none; }
.row-title:hover { color: var(--accent-text); }
.row-sub { color: var(--text-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card > .rows > .row-item { padding-inline: 0; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  font: inherit; font-size: 12px; font-weight: 600; line-height: 1; padding: 6px 9px; border-radius: 999px;
  border: 0; cursor: pointer;
}
span.pill { cursor: default; }
.pill-all { background: var(--success-soft); color: var(--success-text); }
.pill-admin { background: var(--admin-soft); color: var(--admin-text); }

@media (max-width: 600px) {
  .row-item { flex-wrap: wrap; }
  .row-main { flex-basis: calc(100% - 60px); }
  .inline-form .narrow-field { width: 90px; }
  .row { grid-template-columns: 1fr; }
}

/* ===================== Couleur principale ===================== */
/* Le serveur pose --accent-l (thème clair), --accent-d (sombre) et --accent-on (texte sur la couleur)
   quand la couleur n'est pas le bleu d'origine (voir appearance.py). */
:root[data-accent-set] { --accent: var(--accent-l); --on-accent: var(--accent-on); }
:root[data-theme="dark"][data-accent-set] { --accent: var(--accent-d); --on-accent: #0b1220; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"][data-accent-set] { --accent: var(--accent-d); --on-accent: #0b1220; }
}
:root:not([data-accent="blue"]) {
  --accent-hover: color-mix(in srgb, var(--accent) 85%, #000);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, var(--surface));
  --accent-text: color-mix(in srgb, var(--accent) 82%, var(--text));
}
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 50%; vertical-align: -3px; }

/* ===================== Image de fond ===================== */
.background-layer {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
}
/* Le serveur pose --bg-fill (dégradé, motif, couleur ou photo), --bg-overlay, --bg-blur, --bg-brightness
   et --bg-saturate (voir appearance.py). */
.background-layer::before {
  content: ""; position: absolute; inset: -40px;
  background: var(--bg-fill, none);
  filter: blur(var(--bg-blur, 0px)) brightness(var(--bg-brightness, 1)) saturate(var(--bg-saturate, 1));
}
.background-layer.is-animated::before { animation: bg-flow 28s ease-in-out infinite alternate; }
@keyframes bg-flow { to { background-position: 100% 50%; } }
@media (prefers-reduced-motion: reduce) { .background-layer.is-animated::before { animation: none; } }
.background-layer::after { content: ""; position: absolute; inset: 0; background: var(--bg-overlay, rgba(0, 0, 0, .35)); }
body.has-background { background: #0b0f18; }
.has-background .hero, .has-background .space-head h2, .has-background .category-head h3,
.has-background .footer-note, .has-background .section-tools .link-btn {
  color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .55);
}
.has-background .date, .has-background .search-hint, .has-background .count, .has-background .weather .muted { color: rgba(255, 255, 255, .85); }
.has-background .chips { background: transparent; }
.has-background .page .back, .has-background .page h1 { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .55); }
/* Fond clair (ton calculé par le serveur) : texte sombre au lieu de blanc. */
.bg-light .hero, .bg-light .space-head h2, .bg-light .category-head h3,
.bg-light .footer-note, .bg-light .section-tools .link-btn { color: #16202f; text-shadow: none; }
.bg-light .date, .bg-light .search-hint, .bg-light .count, .bg-light .weather .muted { color: #33405a; }
.bg-light .page .back, .bg-light .page h1 { color: #16202f; text-shadow: none; }
.bg-light .weather-setup { color: #33405a; }
.has-background .tabs { background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 0 8px; }

/* ===================== Menus flottants (lanceur, cloche, profil) ===================== */
.popover {
  position: absolute; top: calc(100% + 8px); z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .18); padding: 12px;
}
.popover-title { margin: 4px 4px 8px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.popover-head { display: flex; align-items: center; gap: 8px; }
.popover-head .popover-title { margin-bottom: 4px; }
.popover-foot {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 10px 2px;
  border-top: 1px solid var(--border); color: var(--text-2); text-decoration: none; font-size: 14px;
}
.popover-foot:hover { color: var(--text); }

/* Lanceur : 4 applis par ligne, fenêtre compacte. */
.launcher { position: relative; margin-right: -4px; }
.launcher-panel { left: 0; width: min(360px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow-y: auto; padding: 10px; }
.launcher-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; margin-bottom: 8px; }
.launcher-item { position: relative; min-width: 0; }
.launcher-app {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 2px; border-radius: var(--radius);
  color: var(--text); text-decoration: none; font-size: 11.5px; text-align: center;
}
.launcher-app .tile-icon { width: 36px; height: 36px; }
.launcher-app .tile-icon img { width: 26px; height: 26px; }
.launcher-app:hover { background: var(--surface-2); }
.launcher-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.launcher-grid .tile-add { flex-direction: column; justify-content: center; gap: 5px; font-size: 11.5px; padding: 8px 2px; min-height: 76px; text-align: center; }

.bell { position: relative; }
.bell > .icon-btn { position: relative; }
.bell-count {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.bell-panel { right: 0; width: min(380px, calc(100vw - 24px)); }
.bell-list { list-style: none; margin: 0; padding: 0; max-height: min(60vh, 460px); overflow-y: auto; }
.bell-list > li.muted { padding: 10px; }
.bell-item {
  display: grid; gap: 2px; padding: 10px; border-radius: var(--radius);
  color: var(--text); text-decoration: none; border-left: 3px solid transparent;
}
.bell-item:hover { background: var(--surface-2); }
.bell-item.unread { background: var(--accent-soft); }
.bell-item.level-warning { border-left-color: #d99a00; }
.bell-item.level-critical { border-left-color: var(--danger); }
.bell-title { font-weight: 600; font-size: 14px; }
.bell-body { font-size: 13px; color: var(--text-2); }
.bell-time { font-size: 12px; color: var(--text-3); }

.user-menu-panel { min-width: 250px; }
.menu-label { margin: 12px 0 6px !important; font-size: 12px; font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--surface-2); }
.user-menu-panel .segmented button {
  flex-direction: column; justify-content: center; gap: 2px; margin: 0; padding: 6px 4px; font-size: 12px; text-align: center; color: var(--text-2);
}
.user-menu-panel .segmented button[aria-pressed="true"] { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow); }
.user-menu-panel .segmented + a { margin-top: 12px; }

/* ===================== Annonces, météo ===================== */
.announcement {
  --ann-c: var(--accent); --ann-on: var(--on-accent);
  display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; padding: 12px 14px;
  border-radius: var(--radius); border: 1px solid transparent; color: var(--text);
  background: color-mix(in srgb, var(--ann-c) 14%, var(--surface));
}
.announcement-warning { --ann-c: #d99a00; --ann-on: #1a1200; }
.announcement-critical { --ann-c: var(--danger); --ann-on: #ffffff; }
:root[data-theme="dark"] .announcement-warning { --ann-c: #f3c768; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .announcement-warning { --ann-c: #f3c768; } }
/* Couleur choisie par l'auteur (variables posées par announcements.py) : clair, puis sombre. */
.announcement[style*="--ann-l"] { --ann-c: var(--ann-l); --ann-on: var(--ann-on-l); }
:root[data-theme="dark"] .announcement[style*="--ann-d"] { --ann-c: var(--ann-d); --ann-on: var(--ann-on-d); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .announcement[style*="--ann-d"] { --ann-c: var(--ann-d); --ann-on: var(--ann-on-d); }
}
.ann-icon { display: inline-flex; margin-top: 1px; color: var(--ann-c); }
.ann-body { flex: 1; min-width: 0; }
.ann-body p { margin: 0; color: var(--text); white-space: pre-line; }
.ann-title { display: block; margin-bottom: 2px; }
.ann-pin { display: inline-flex; margin-top: 3px; color: var(--ann-c); }
/* Carte : fond de page, liseré de la couleur à gauche. */
.ann-card { background: var(--surface); border-color: var(--border); border-left: 4px solid var(--ann-c); box-shadow: var(--shadow); padding: 14px 16px; }
.ann-card .ann-title { font-size: 16px; }
/* Dégradé : la couleur en aplat dégradé, texte lisible dessus. */
.ann-gradient { background: linear-gradient(135deg, var(--ann-c), color-mix(in srgb, var(--ann-c) 68%, #000)); color: var(--ann-on); }
.ann-gradient .ann-icon, .ann-gradient .ann-pin, .ann-gradient .ann-body p, .ann-gradient .link-btn { color: var(--ann-on); }
.ann-gradient .link-btn:hover { background: rgba(255, 255, 255, .18); }
/* Compact : une ligne arrondie. */
.ann-compact { align-items: center; width: fit-content; max-width: 100%; padding: 6px 12px; border-radius: 999px; font-size: 14px; }
.ann-compact .ann-icon { margin-top: 0; }
.ann-compact .ann-icon svg { width: 16px; height: 16px; }
.ann-compact .ann-body p { display: inline; white-space: normal; }

/* Administration des annonces */
.ann-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.ann-item { padding: 14px 16px; margin: 0; }
.ann-item .announcement { margin-top: 0; }
.ann-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }
.ann-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.ann-actions form { margin: 0; }
.ann-preview-card { position: sticky; top: 70px; z-index: 5; }
.ann-preview-card .announcement { margin-top: 0; }
.icon-picks { gap: 6px; }
.icon-choice > span { padding: 8px 10px; }

.weather { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px; margin: -14px 0 18px; font-size: 14px; }
.weather-main { display: inline-flex; align-items: center; gap: 8px; }
.weather-main strong { font-size: 17px; }
.weather-details { display: inline-grid; grid-auto-flow: column; gap: 4px 22px; justify-content: center; text-align: left; font-size: 13px; }
.weather-item { display: inline-flex; gap: 6px; align-items: baseline; }
.weather-hours, .weather-days { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; max-width: 100%; flex-basis: 100%; }
.weather-slot { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; min-width: 52px; }
.weather-day { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; padding: 6px 10px; border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 14px; margin: 10px 0 14px; }
.weather-setup { display: inline-flex; align-items: center; gap: 6px; margin: -14px 0 18px; font-size: 13px; color: var(--text-3); text-decoration: none; }
.weather-setup:hover { color: var(--accent-text); }
.has-background .weather-setup { color: rgba(255, 255, 255, .8); }

/* ===================== Sections repliables ===================== */
details.space > summary, details.category > summary { list-style: none; cursor: pointer; }
details.space > summary::-webkit-details-marker, details.category > summary::-webkit-details-marker { display: none; }
.chevron { display: inline-flex; margin-left: auto; color: var(--text-3); transition: transform .2s; }
details:not([open]) > summary .chevron { transform: rotate(-90deg); }
details.space > summary.space-head { padding: 4px 0; border-radius: var(--radius); }
details.space > summary.space-head:hover .chevron, details.category > summary:hover .chevron { color: var(--text); }
.space-head .link-btn { margin-left: auto; }
.space-head .link-btn + .chevron { margin-left: 4px; }
.category-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.category-head h3 { margin: 0; }
details.category:not([open]) { margin-bottom: 8px; }
/* Une section (ou sous-section) repliée passe sous celles qui sont dépliées,
   dans leur ordre, et reprend sa place quand on la déplie. Pas pendant une
   recherche ni en mode modification (les flèches y rangent l'ordre enregistré). */
.sections, .categories { display: flex; flex-direction: column; }
.categories { gap: 10px; }
.categories > .category { margin-bottom: 0; }
.categories > .category[open] { margin-bottom: 8px; }
body:not(.editing):not(.searching) .sections > details:not([open]),
body:not(.editing):not(.searching) .categories > details:not([open]) { order: 1; }
::view-transition-group(*) { animation-duration: .28s; }
.order-tools { display: inline-flex; gap: 2px; margin-left: auto; }
body.editing .order-tools + .chevron { margin-left: 4px; }
.category-head .order-tools .icon-btn.small { width: 26px; height: 26px; }
.search-only { display: none; }
body.searching .search-only { display: block; }
body.searching details > summary .chevron { visibility: hidden; }

/* ===================== Modification du tableau de bord (admins) ===================== */
body:not(.editing) .admin-only, body:not(.editing) .is-empty { display: none !important; }
body:not(.editing) .admin-tools { display: none !important; }
body.editing .admin-tools { display: flex; }
body.editing .tile-wrap .tile, body.editing .launcher-app { outline: 1px dashed var(--border-strong); outline-offset: -1px; }
/* Place pour les boutons modifier / supprimer : ils ne cachent ni le nom ni le badge. */
@media (min-width: 601px) {
  body.editing .grid .tile-wrap .tile,
  body.editing-shortcuts #raccourcis .tile-wrap .tile { padding-right: 68px; }
  body.editing .grid .tile-wrap .tile-name,
  body.editing-shortcuts #raccourcis .tile-wrap .tile-name { white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
  body.editing .grid .tile-wrap .badge,
  body.editing-shortcuts #raccourcis .tile-wrap .badge { display: none; }
}
.chip-action {
  flex: none; display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 6px 12px;
  border-radius: 999px; border: 1px dashed var(--border-strong); background: var(--surface);
  color: var(--text-2); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.chip-action[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); border-style: solid; }
.section-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 12px; }
.section-tools .link-btn { margin-left: 0; }
.add-section { margin-top: 24px; }
.lock { color: var(--admin-text); flex: none; }
.tile-add.danger { color: var(--danger); border-color: var(--danger); }
.launcher-item .admin-tools { top: 2px; right: 2px; }

/* ===================== Sauvegardes (admins) ===================== */
.backup-summary { margin-left: 4px; font-size: 12px; }
/* align-items: start : chaque carte garde sa hauteur (déplier le détail
   d'une carte n'agrandit pas ses voisines). */
.backup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); align-items: start; gap: 12px; margin-bottom: 8px; }
.nas-card {
  display: flex; flex-direction: column; gap: 10px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  border-top: 3px solid var(--border-strong);
}
.nas-card.nas-ok { border-top-color: #22a861; }
.nas-card.nas-warning { border-top-color: #e0a100; }
.nas-card.nas-critical { border-top-color: var(--danger); }
.nas-head { display: flex; align-items: center; gap: 8px; }
.nas-head h3 { margin: 0; font-size: 15px; color: var(--text); text-transform: none; letter-spacing: 0; }
.nas-head .state-pill { margin-left: auto; }
.state-pill { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; line-height: 1; text-shadow: none; }
.state-ok { background: var(--success-soft); color: var(--success-text); }
.state-warning { background: #fff4d6; color: #8a5a00; }
.state-critical { background: var(--danger-soft); color: var(--danger); }
.state-neutral { background: var(--surface-2); color: var(--text-2); }
:root[data-theme="dark"] .state-warning { background: #3a2f12; color: #f3c768; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .state-warning { background: #3a2f12; color: #f3c768; } }
.nas-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.nas-facts dt { color: var(--text-2); }
.nas-facts dd { margin: 0; min-width: 0; }
.fact-bar { display: grid; gap: 4px; }
.bar { display: block; height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .4s; }
.bar-ok .bar-fill { background: #22a861; }
.bar-attention .bar-fill, .bar-warning .bar-fill { background: #e0a100; }
.bar-critique .bar-fill, .bar-critical .bar-fill { background: var(--danger); }
.nas-reasons { margin: 0; padding-left: 18px; font-size: 13px; color: var(--danger); }
.nas-services summary { cursor: pointer; font-size: 13px; color: var(--accent-text); }
.nas-table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 12px; }
.nas-table th { text-align: left; font-weight: 600; color: var(--text-2); padding: 4px 4px 6px; }
.nas-table td { padding: 5px 4px; border-top: 1px solid var(--border); }
.nas-table td:not(:first-child), .nas-table th:not(:first-child) { text-align: center; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.dot-ok { background: #22a861; }
.dot-warning { background: #e0a100; }
.dot-critical { background: var(--danger); }
.dot-neutral { background: #62aefc; opacity: .6; }
.nas-link { margin-top: auto; font-size: 13px; }

/* ===================== Paramètres ===================== */
.settings-page { max-width: 760px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { flex-direction: row; font-weight: 500; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice > span {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer;
}
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.preset-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.preset-choice { flex-direction: column; align-items: center; gap: 4px; font-weight: 400; font-size: 13px; cursor: pointer; }
.preset-choice input { position: absolute; opacity: 0; pointer-events: none; }
.preset-sample { display: block; width: 84px; height: 52px; border-radius: var(--radius); border: 2px solid transparent; }
.preset-choice input:checked + .preset-sample { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.current-background { display: flex; align-items: center; gap: 12px; }
.current-background img { border-radius: var(--radius); object-fit: cover; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="file"] { font: inherit; font-size: 14px; }
textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; font-weight: 400; resize: vertical;
}
textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inline-search { display: flex; gap: 8px; }
.inline-search input { flex: 1; }
.city-results { margin: -4px 0 12px; }
.city-choice { width: 100%; border: 0; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; flex-direction: column; align-items: flex-start; gap: 0; }
.city-choice:hover { background: var(--surface-2); }
.push-status { font-weight: 600; }
.form-actions.start { justify-content: flex-start; flex-wrap: wrap; }
.inline-checkbox { align-self: center; white-space: nowrap; }
.section-title { margin: 24px 0 12px; }
.level-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.level-dot.level-warning { background: #e0a100; }
.level-dot.level-critical { background: var(--danger); }
.pill-off { background: var(--surface-2); color: var(--text-3); }

@media (max-width: 600px) {
  .launcher-panel, .bell-panel { position: fixed; left: 12px; right: 12px; top: calc(56px + env(safe-area-inset-top)); width: auto; }
  .launcher-panel { right: auto; width: min(360px, calc(100vw - 24px)); }
  .launcher-panel { max-height: calc(100vh - 90px); }
  .chip-action span { display: none; }
  .weather-days, .weather-hours { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; }
  .backup-grid { grid-template-columns: 1fr; }
  .brand span { display: none; }
}

/* ===================== Paramètres : menu à gauche ===================== */
.settings-page { max-width: 1100px; }
.settings-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-nav { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav-label { margin: 16px 10px 6px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.settings-nav-label:first-child { margin-top: 0; }
.settings-nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius);
  color: var(--text-2); text-decoration: none; font-size: 14px;
}
.settings-nav a:hover { background: var(--surface-2); color: var(--text); }
.settings-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.has-background .settings-nav { background: var(--surface); border-radius: var(--radius-lg); padding: 8px; }
@media (max-width: 760px) {
  .settings-shell { grid-template-columns: 1fr; gap: 16px; }
  .settings-nav {
    position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px;
    padding-bottom: 6px; border-bottom: 1px solid var(--border);
  }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav-label { display: none; }
  .settings-nav a { flex: none; white-space: nowrap; }
}

/* ===================== Photo de profil ===================== */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar .letter { display: contents; }
.avatar.large { width: 44px; height: 44px; font-size: 18px; }
.avatar.xl { width: 64px; height: 64px; font-size: 26px; }
.user-menu-head { display: flex; align-items: center; gap: 12px; }
.user-menu-head > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.avatar-heading { display: flex; align-items: center; gap: 16px; }
.avatar-heading h2 { margin-bottom: 4px; }
.avatar-heading p { margin: 0; }
.avatar-library { display: flex; flex-direction: column; gap: 12px; }
.chip-button {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer;
}
.chip-button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.avatar-choice { position: relative; flex-direction: row; justify-content: center; cursor: pointer; }
.avatar-choice input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-choice img { width: 56px; height: 56px; border-radius: 50%; border: 2px solid transparent; background: var(--surface-2); }
.avatar-choice input:checked + img { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.avatar-choice input:focus-visible + img { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===================== Cloche : supprimer, effacer tout ===================== */
.bell-panel .popover-head { flex-wrap: wrap; row-gap: 2px; }
.bell-panel .popover-head .popover-title { flex-basis: 100%; }
.bell-panel .popover-head .link-btn { margin-left: 0; }
.bell-panel .popover-head .link-btn + .link-btn { margin-left: auto; }
.bell-row { display: flex; align-items: flex-start; gap: 2px; }
.bell-row .bell-item { flex: 1; min-width: 0; }
.bell-delete { flex: none; margin-top: 6px; opacity: .55; }
.bell-row:hover .bell-delete, .bell-delete:focus-visible { opacity: 1; }
@media (hover: none) { .bell-delete { opacity: .85; } }

/* ===================== Rôles ===================== */
.pills { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.pill-role { background: var(--accent-soft); color: var(--accent-text); }
.role-choice { align-items: flex-start; }
.role-choice > span { display: flex; flex-direction: column; gap: 2px; }
.role-choice.disabled { opacity: .55; }
.role-picks { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 12px; margin-top: 4px; border-radius: var(--radius); background: var(--surface-2); }
.role-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; margin-bottom: 12px; }
.role-apps label { font-size: 13px; }
.role-apps-title { grid-column: 1 / -1; margin: 6px 0 2px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.role-list { max-width: 200px; }

/* ===================== Apparence : couleurs, motifs, fond ===================== */
.accent-row { gap: 6px; }
.swatch-custom { border: 1px solid var(--border-strong); }
.choice > span input[type="color"] {
  position: static; opacity: 1; pointer-events: auto; width: 26px; height: 22px; padding: 0; margin-left: 4px;
  border: 1px solid var(--border-strong); border-radius: 6px; background: none; cursor: pointer;
}
.choice-row > input[type="color"] { width: 46px; height: 38px; padding: 2px; }
.color-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.color-pick > input[type="color"] { width: 64px; height: 42px; flex: none; }
.color-palette { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch-button { width: 26px; height: 26px; border: 1px solid var(--border-strong); cursor: pointer; padding: 0; }
.swatch-button:hover { transform: scale(1.12); }
.subhead { margin: 18px 0 10px; }
.preset-sample { border: 2px solid transparent; }

/* Champs date, heure et e-mail comme les autres champs. */
input[type="datetime-local"], input[type="date"], input[type="time"], input[type="email"], input[type="url"], input[type="tel"] {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; font-weight: 400;
}
input[type="datetime-local"]:focus, input[type="date"]:focus, input[type="time"]:focus, input[type="email"]:focus,
input[type="url"]:focus, input[type="tel"]:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Formulaire d'annonce : espace entre les champs de chaque bloc. */
.ann-form .card { display: flex; flex-direction: column; gap: 14px; }
.ann-form .card h2 { margin-bottom: 0; }
.ann-form .row { margin: 0; }

/* Prévisions par jour : cartes lisibles sur n'importe quel fond. */
.weather-day { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.has-background.bg-dark .weather-day { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .22); color: #fff; }
.has-background.bg-light .weather-day { background: rgba(255, 255, 255, .62); border-color: rgba(0, 0, 0, .08); color: #16202f; }
