/*
  Coquille et calques d'AutoSEO (docs/DESIGN.md) : barre latérale, en-tête de page, fenêtres, tiroir, bandeaux, sections.
  Chargée APRÈS les anciennes feuilles (clarity-*, edit, articles, explain…) et AVANT les feuilles de pages (os-*.css) :
  elle fait foi pour les composants communs, les pages peuvent encore les ajuster.
*/

/* ——— Coquille ——— */
@media (min-width: 1025px) {
  body:has(.app) { background: var(--window); }
}
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; background: var(--window); }
.main { min-width: 0; }
/* Le panneau principal n'existe qu'à côté de la barre latérale ; une page sans barre (Tous mes sites, Aide…) reste à plat. */
.app > .main {
  margin: 8px 8px 8px 0; min-height: calc(100dvh - 16px); background: var(--ground);
  border-radius: 16px; box-shadow: 0 0 0 1px var(--border), var(--shadow-xs);
}

/* Barre latérale */
.sidebar {
  position: sticky; top: 0; z-index: 20; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 14px;
  padding: 16px 12px 12px; min-width: 0;
}
/* Pas de défilement propre : la cloche et les menus débordent de la barre. */
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 36px; padding: 0 2px; }
.side-toggle { width: 34px; height: 34px; }
.side-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Marque */
.brand { display: inline-flex; align-items: center; gap: 9px; padding: 0 6px; text-decoration: none; color: var(--text); font-weight: 500; font-size: 17px; letter-spacing: -0.035em; border-radius: 8px; }
.brand svg { flex: none; }
.brand span { font-weight: 500; }
.brand b { font-weight: 700; }
.brand-mark { transition: transform var(--slow) var(--ease-back); }
.brand:hover .brand-mark { transform: rotate(-10deg); }
.brand-ring { transform-origin: 13px 13px; animation: ring-in 0.8s var(--ease-out) both; }

/* Sélecteur de site */
.switcher { position: relative; }
.switcher-btn {
  width: 100%; min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 8px; cursor: pointer; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-xs), var(--highlight);
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--instant) var(--ease);
}
.switcher-btn:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm), var(--highlight); }
.switcher-btn:active { transform: scale(0.99); }
.switcher-btn > .icon, .switcher-btn > .muted { margin-left: auto; color: var(--faint); transition: transform var(--medium) var(--ease-out); }
.switcher-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; gap: 1px; }
.switcher-text strong { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-text small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-avatar {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; font-size: 14px; letter-spacing: -0.02em;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.switcher-menu {
  position: absolute; z-index: 45; top: calc(100% + 6px); left: 0; right: 0; min-width: 236px; padding: 5px; display: grid; gap: 1px;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); transform-origin: top center; animation: pop var(--medium) var(--ease-out);
}
.switcher-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; min-height: 40px; border-radius: 8px; text-decoration: none; font-size: 14px; color: var(--text); }
.switcher-item .site-avatar { width: 26px; height: 26px; border-radius: 8px; font-size: 12px; }
.switcher-item:hover, .switcher-item:focus-visible { background: var(--raised); outline: none; }
.switcher-item.is-current { background: var(--raised); font-weight: 500; }
.switcher-item svg { color: var(--muted); }
.switcher-add { color: var(--accent-ink); font-weight: 600; }
.switcher-add svg { color: inherit; }
.switcher-sep { height: 1px; background: var(--rule); margin: 4px 6px; }

/* Crédits */
.credits {
  display: grid; gap: 8px; padding: 12px; border-radius: 12px; text-decoration: none; color: var(--text);
  background: color-mix(in srgb, var(--surface) 55%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 70%, transparent);
  transition: background-color var(--fast);
}
.credits:hover { background: var(--surface); }
.credits-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.credits-plan { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 2px 7px; border-radius: 99px; background: var(--raised); }
.credits-count { font-size: 13.5px; color: var(--muted); display: flex; align-items: baseline; gap: 5px; }
.credits-count strong { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.credits .track { height: 4px; }
.credits-renew { font-size: 12px; line-height: 1.4; color: var(--muted); }
.credit-chip {
  display: none; flex: none; align-items: center; gap: 5px; min-height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); text-decoration: none; font-size: var(--fs-meta); color: var(--muted); box-shadow: var(--shadow-xs);
}
.credit-chip.is-shown { display: inline-flex; }
.credit-chip strong { font-size: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.credit-chip.is-low strong { color: var(--pill-warning-ink); }
/* Invitation au plan supérieur (rendue par views/plans.js) : un encart calme, pas un pointillé */
.sidebar .os-upgrade {
  display: grid; gap: 2px; padding: 11px 12px; border: 0; border-radius: 12px; text-decoration: none;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 13.5px; transition: background-color var(--fast);
}
.sidebar .os-upgrade:hover { background: color-mix(in srgb, var(--accent-soft) 70%, var(--accent-track)); }
.sidebar .os-upgrade strong { font-weight: 600; }
.sidebar .os-upgrade .side-label { white-space: normal; overflow: visible; }
.sidebar .os-upgrade span { color: color-mix(in srgb, var(--accent-ink) 72%, var(--muted)); font-size: 12.5px; line-height: 1.4; }

/* Navigation : une pastille glisse sous l'entrée active */
.pill-group { position: relative; isolation: isolate; }
.pill-group::before {
  content: ''; position: absolute; z-index: -1; left: 0; top: 0; width: var(--pill-w, 0); height: var(--pill-h, 0);
  transform: translate(var(--pill-x, 0), var(--pill-y, 0)); opacity: var(--pill-o, 0); border-radius: 10px; background: var(--active);
}
.pill-group.pill-ready::before { transition: transform var(--slow) var(--ease-out), opacity var(--fast); }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav.pill-group::before { background: var(--surface); box-shadow: var(--shadow-xs), 0 0 0 1px color-mix(in srgb, var(--border) 80%, transparent); }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; min-height: var(--target); padding: 0 10px; border-radius: 10px;
  color: var(--body); text-decoration: none; font-size: 14px; font-weight: 500; letter-spacing: -0.005em; border: 0; background: transparent; cursor: pointer;
  transition: color var(--fast), background-color var(--fast);
}
.nav-item svg { color: var(--muted); transition: color var(--fast), transform var(--medium) var(--ease-out); }
.nav-item:not(.is-active):hover { color: var(--text); background: color-mix(in srgb, var(--surface) 50%, transparent); }
.nav-item:not(.is-active):hover svg { color: var(--text); }
.nav-item.is-active { color: var(--text); }
.nav-item.is-active svg { color: var(--accent); }
.nav-item:active svg { transform: scale(0.9); }
.nav-short { display: none; }
.nav-count {
  margin-left: auto; display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  background: var(--accent); color: var(--accent-on); font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums;
}
.nav-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.8s var(--ease-in-out) infinite; }
.nav-more { display: none; position: relative; }
.nav-more-menu {
  position: absolute; z-index: 45; right: 0; bottom: calc(100% + 10px); min-width: 230px; padding: 5px; display: grid; gap: 1px;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); transform-origin: bottom right; animation: pop-up var(--medium) var(--ease-out);
}
.nav-more-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 9px; color: var(--text); text-decoration: none; font-size: 14.5px; }
.nav-more-item svg { color: var(--muted); }
.nav-more-item:hover, .nav-more-item.is-current { background: var(--raised); }
.nav-more-item.is-current svg { color: var(--accent); }

/* Ce qui tourne, prochaine étape (ancienne coquille) */
.side-status { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); font-size: var(--fs-small); font-weight: 500; text-decoration: none; line-height: 1.3; }
.side-next { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); text-decoration: none; font-size: 13.5px; }

/* Pied : aide, compte, cloche, thème */
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 8px; }
.side-row { display: flex; align-items: center; gap: 2px; margin-top: 6px; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent); }
.account-chip {
  flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; min-height: var(--target); padding: 0 8px 0 6px; border-radius: 10px;
  text-decoration: none; font-size: 14px; font-weight: 500; color: var(--text); transition: background-color var(--fast);
}
.account-chip:hover { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.account-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--inverse); color: var(--inverse-on); font-size: 12.5px; font-weight: 600; }
.sidebar .icon-btn:hover { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.debug-box { padding: 8px 10px; border: 1px dashed var(--control); border-radius: 8px; font-size: var(--fs-meta); color: var(--muted); }
/* Cloche (os/notifications.js) */
.ns-bell-btn .ns-badge, .sidebar .ns-badge { top: 5px; right: 4px; min-width: 16px; height: 16px; font-size: 10.5px; font-weight: 700; box-shadow: 0 0 0 2px var(--window); }
.sidebar .ns-bell-panel { border-radius: 14px; box-shadow: var(--shadow-lg); border: 0; animation: pop-up var(--medium) var(--ease-out); transform-origin: bottom left; }

/* Barre réduite à ses icônes (au-dessus de 1024 px), si la personne l'a demandé */
@media (min-width: 1025px) {
  :root[data-sidebar='collapsed'] { --sidebar-w: 72px; }
  :root[data-sidebar='collapsed'] .sidebar { padding: 16px 10px 12px; align-items: center; }
  :root[data-sidebar='collapsed'] .side-head { flex-direction: column; gap: 10px; }
  :root[data-sidebar='collapsed'] .brand span,
  :root[data-sidebar='collapsed'] .switcher-text, :root[data-sidebar='collapsed'] .switcher-btn > .icon, :root[data-sidebar='collapsed'] .switcher-btn > .muted,
  :root[data-sidebar='collapsed'] .credits-head, :root[data-sidebar='collapsed'] .credits-renew, :root[data-sidebar='collapsed'] .os-upgrade,
  :root[data-sidebar='collapsed'] .nav-count, :root[data-sidebar='collapsed'] .debug-box { display: none; }
  :root[data-sidebar='collapsed'] .side-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  :root[data-sidebar='collapsed'] .switcher, :root[data-sidebar='collapsed'] .nav, :root[data-sidebar='collapsed'] .side-foot { width: 100%; }
  :root[data-sidebar='collapsed'] .switcher-btn { justify-content: center; padding: 8px 0; }
  :root[data-sidebar='collapsed'] .nav-item { justify-content: center; padding: 0; }
  :root[data-sidebar='collapsed'] .credits { padding: 8px 6px; justify-items: center; text-align: center; }
  :root[data-sidebar='collapsed'] .credits-count strong { font-size: 17px; }
  :root[data-sidebar='collapsed'] .side-row { flex-direction: column; }
  :root[data-sidebar='collapsed'] .account-chip { flex: none; padding: 0; justify-content: center; }
  :root[data-sidebar='collapsed'] [data-tip] { position: relative; }
  :root[data-sidebar='collapsed'] [data-tip]:hover::after, :root[data-sidebar='collapsed'] [data-tip]:focus-visible::after {
    content: attr(data-tip); position: absolute; z-index: 50; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    padding: 6px 10px; border-radius: 8px; background: var(--inverse); color: var(--inverse-on);
    font-size: 13px; font-weight: 500; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-md); animation: fade-in var(--fast) var(--ease-out);
  }
}

/* ——— Page ——— */
.page {
  max-width: var(--page-max); margin: 0 auto; padding: 44px var(--page-pad-x) 96px; display: flex; flex-direction: column; gap: 28px;
}
.page-wide { max-width: 1320px; }
.page-narrow { max-width: 760px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; flex: 1 1 420px; }
.page-title {
  font-family: var(--display); font-size: var(--fs-title); font-weight: 400; line-height: 1.06; letter-spacing: var(--track-title);
  color: var(--text); text-wrap: balance;
}
.page-title-long { font-size: calc(var(--fs-title) * 0.82); line-height: 1.12; max-width: 860px; }
.page-sub { margin-top: 10px; color: var(--muted); font-size: var(--fs-text); line-height: 1.55; max-width: 64ch; text-wrap: pretty; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); margin-bottom: 12px; }
.crumb a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; transition: color var(--fast); }
.crumb a::before { content: ''; width: 7px; height: 7px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin-right: 1px; transition: transform var(--medium) var(--ease-out); }
.crumb a:hover { color: var(--text); }
.crumb a:hover::before { transform: translateX(-2px) rotate(45deg); }
.crumb > span[aria-hidden] { display: none; }

/* Section : un titre, une phrase, du contenu. Une carte par défaut ; .section-plain pour une section posée sur le fond. */
.section { display: grid; gap: 14px; min-width: 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.section-title { font-size: var(--fs-h2); font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; }
.section-sub { margin-top: 3px; font-size: 14px; color: var(--muted); }
.os-section { display: flex; flex-direction: column; }
.os-section .card-head { margin-bottom: 2px; }
.os-section .os-hint { margin: 0 0 12px; }

/* Bandeaux et encarts */
/* Le texte d'un bandeau coule librement (liens et gras en ligne) : le point repère est posé en absolu, jamais en flex. */
.notice, .os-notice {
  position: relative; display: block; padding: 11px 14px 11px 32px; border-radius: 12px; font-size: 14px; line-height: 1.5;
  background: var(--raised); color: var(--body);
}
.notice::before, .os-notice::before { content: ''; position: absolute; left: 15px; top: 18px; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.notice.is-warn, .os-notice.is-warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.notice.is-warn::before, .os-notice.is-warn::before { background: var(--warning); }
.notice.is-ok, .os-notice.is-ok, .notice.is-tip { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.notice.is-ok::before, .os-notice.is-ok::before, .notice.is-tip::before { background: var(--accent); }
.notice.is-error, .os-notice.is-error { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.notice.is-error::before, .os-notice.is-error::before { background: var(--negative); }
.notice.is-info, .os-notice.is-info { background: var(--raised); color: var(--body); }
.notice .link, .os-notice .link { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); font-weight: 600; }
.notice-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.os-email-banner, .os-gestion-banner { margin: 0; border-radius: 0; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; padding-left: 14px; }
.os-email-banner::before, .os-gestion-banner::before { position: static; }
.os-error { color: var(--negative); }

/* Statistique (un chiffre qui répond à une question) */
.stat { display: grid; gap: 2px; min-width: 0; }
.stat-label { font-size: var(--fs-meta); color: var(--muted); font-weight: 500; }
.stat-value { font-size: var(--fs-kpi); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: var(--fs-small); color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; }
.stats > .stat { padding: 2px 20px; }
.stats > .stat:first-child { padding-left: 0; }
.stats > .stat + .stat { border-left: 1px solid var(--rule); }

/* Liste de définitions courte */
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ——— Fenêtre ——— */
html:has(dialog[open]) { overflow: hidden; }
.dialog {
  width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 24px; margin: auto; overflow: auto;
  border: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.dialog[open] { animation: dialog-in var(--slow) var(--ease-out); }
.dialog::backdrop { background: var(--overlay); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: fade-in var(--medium) var(--ease-out); }
.dialog-title { font-size: 19px; font-weight: 600; line-height: 1.3; letter-spacing: -0.015em; text-wrap: balance; }
.dialog-text { margin-top: 8px; color: var(--body); font-size: 14.5px; line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.dialog-wide { width: min(720px, calc(100vw - 32px)); }
.os-dialog { width: min(500px, calc(100vw - 32px)); }

/* ——— Tiroir latéral ——— */
html:has(dialog.drawer[open]) { overflow: hidden; }
.drawer {
  margin: 0 0 0 auto; padding: 0; border: 0; width: min(560px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); border-radius: 0;
}
@media (min-width: 641px) {
  .drawer { margin: 8px 8px 8px auto; height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); border-radius: var(--radius-lg); }
}
.drawer[open] { display: flex; flex-direction: column; animation: drawer-in var(--panel) var(--ease-out); }
.drawer::backdrop { background: var(--overlay); animation: fade-in var(--medium) var(--ease-out); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 14px 24px; border-bottom: 1px solid var(--rule); }
.drawer-title { font-size: 19px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; }
.drawer-head .small { margin-top: 3px; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; gap: 24px; align-content: start; padding: 20px 24px 28px; }
.drawer-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 14px 24px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); background: var(--surface); }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ——— Briques d'explication (components/explain.js) ——— */
.xfold { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-xs); }
.xfold > summary { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; min-height: 52px; padding: 12px 16px; cursor: pointer; list-style: none; border-radius: var(--radius-card); transition: background-color var(--fast); }
.xfold > summary::-webkit-details-marker { display: none; }
.xfold > summary:hover { background: color-mix(in srgb, var(--raised) 70%, transparent); }
.xfold[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.xfold-summary { font-weight: 600; color: var(--text); font-size: var(--fs-body); }
.xfold-hint { color: var(--muted); font-size: var(--fs-small); }
.xfold-chevron { margin-left: auto; color: var(--muted); transition: transform var(--medium) var(--ease-out); }
.xfold[open] .xfold-chevron { transform: rotate(180deg); }
.xfold-body { padding: 4px 16px 18px; display: grid; gap: 12px; font-size: var(--fs-small); color: var(--body); line-height: 1.6; }
.xfold[open] .xfold-body { animation: rise var(--medium) var(--ease-out); }
.xcallout { grid-template-columns: 8px 1fr; gap: 12px; padding: 12px 14px; border-radius: 12px; }
.xcallout-mark { width: 7px; height: 7px; margin-top: 7px; border-radius: 50%; align-self: start; }
.xstep-num { width: 26px; height: 26px; font-size: 12.5px; }

/* Bouton à maintenir (hold.js) : le remplissage reste en clip-path, déjà fluide */
.hold-btn { color: var(--negative); }

/* ——— Téléphone et tablette : barre du haut, barre d'onglets en bas ——— */
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); background: var(--ground); }
  .app > .main { margin: 0; min-height: 0; border-radius: 0; box-shadow: none; background: transparent; }
  .sidebar {
    position: sticky; top: 0; z-index: 25; height: auto; overflow: visible; flex-direction: row; align-items: center; gap: 8px;
    padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  }
  /* Le flou vit sur un pseudo-élément : posé sur la barre elle-même, il piégerait la barre d'onglets fixe du bas. */
  .sidebar::before { content: ''; position: absolute; inset: 0; z-index: -1; background: color-mix(in srgb, var(--ground) 84%, transparent); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); }
  .side-head { padding: 0; }
  .side-toggle { display: none; }
  .brand { padding: 0 2px; }
  .brand span { display: none; }
  .switcher { flex: 1; min-width: 0; max-width: 360px; margin-right: auto; }
  .switcher-btn { min-height: 44px; padding: 5px 8px 5px 5px; border-radius: 12px; }
  .switcher-btn .site-avatar { width: 30px; height: 30px; }
  .credit-chip { display: inline-flex; }
  .credits, .sidebar .os-upgrade { display: none; }
  .side-foot { margin: 0; padding: 0; flex-direction: row; }
  .side-foot > .nav-item, .account-chip, .debug-box, .side-status, .side-next { display: none; }
  .side-row { margin: 0; padding: 0; border: 0; }
  .nav {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; margin: 0; flex-direction: row; justify-content: center; gap: 0;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 86%, transparent);
    border-top: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
    backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  }
  .nav.pill-group::before { border-radius: 14px; background: var(--accent-soft); box-shadow: none; }
  .nav-item, .nav-more > .nav-item {
    flex: 1; min-width: 0; max-width: 150px; flex-direction: column; justify-content: center; gap: 3px; min-height: 54px; padding: 4px 2px;
    border-radius: 14px; font-size: 11.5px; font-weight: 500; color: var(--muted);
  }
  .nav-item:not(.is-active):hover { background: transparent; }
  .nav-item.is-active { color: var(--accent-ink); }
  .nav-item.is-active svg { color: var(--accent-ink); }
  .nav-item .side-label { text-align: center; line-height: 1.15; max-width: 100%; white-space: normal; overflow: visible; }
  .nav-count { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; min-width: 17px; height: 17px; font-size: 10.5px; padding: 0 4px; box-shadow: 0 0 0 2px var(--surface); }
  .nav-full { display: none; }
  .nav-short { display: inline; }
  .nav-extra { display: none; }
  .nav-more { display: flex; flex: 1; min-width: 0; max-width: 150px; }
  .nav-more > .nav-item { max-width: none; width: 100%; }
  .nav-more > .nav-item.is-current { color: var(--accent-ink); }
  .nav-dot { position: absolute; top: 8px; left: calc(50% + 8px); margin: 0; }
  .page { padding: 28px var(--page-pad-x) 112px; gap: 22px; }
  .toast { left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); max-width: none; }
  .btn { min-height: 42px; }
  .btn-sm { min-height: 38px; }
  .chips-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--page-pad-x) * -1); padding: 0 var(--page-pad-x); }
  .chips-scroll .chip { flex: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi + .kpi { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .kpi:nth-child(even) { border-left: 1px solid var(--rule); }
  .kpi { padding: 16px var(--pad); }
  .kpi-lead .kpi-value { font-size: var(--fs-kpi); }
}
@media (max-width: 640px) {
  .switcher-btn .site-avatar { display: none; }
  .input { font-size: 16px; }
  .switcher-btn { padding-left: 12px; }
  .sidebar { gap: 6px; }
  .page { padding-top: 22px; }
  .page-head { gap: 14px; }
  .page-head > div:first-child { flex-basis: 100%; }
  .page-actions { width: 100%; }
  .page-actions > .btn-primary:only-child, .page-actions > .btn-primary:last-child { flex: 1; }
  .card { border-radius: 14px; }
  .dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; max-height: 92dvh; }
  .dialog[open] { animation: sheet-in var(--panel) var(--ease-out); }
  .dialog-actions { flex-direction: column-reverse; align-items: stretch; }
  .dialog-actions .btn { width: 100%; min-height: 46px; }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .drawer-foot .btn, .drawer-actions .btn { flex: 1 1 100%; }
  .stats > .stat { padding: 10px 0; }
  .stats > .stat + .stat { border-left: 0; border-top: 1px solid var(--rule); }
  /* Tableaux en lignes empilées */
  .table thead { display: none; }
  .table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--rule); }
  .table td { padding: 0; border: 0; }
  .table tbody tr:hover td { background: transparent; }
  .table td.num { text-align: right; }
  .table tr.is-selected { background: var(--accent-soft); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 10px; }
  .table tr.is-selected td { background: transparent; }
  .sort-menu { display: block; }
  .list-filters .input-search { max-width: none; width: 100%; flex: 1 1 100%; }
  .list-tools { flex-direction: column; align-items: stretch; gap: 8px; }
  .list-tools > .muted { padding-top: 0; }
  .list-filters { gap: 6px; }
  .filter-btn, .toggle { font-size: 13.5px; padding: 0 8px; }
  .bulk-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; top: 64px; }
  .bulk-actions { grid-column: 1 / -1; grid-row: 2; }
  .row:has(> .btn) { flex-wrap: wrap; row-gap: 8px; }
  .row:has(> .btn) .row-main { flex-basis: 100%; }
  .row:has(> .btn) > .btn { margin-left: auto; }
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .kpi:nth-child(even) { border-left: 0; }
  .kpi + .kpi { border-top: 1px solid var(--rule); }
}
@media (max-width: 359px) {
  .nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding-left: 4px; padding-right: 4px; }
  .nav-item, .nav-more { max-width: none; }
  .credit-chip span { display: none; }
}
