html:has(body.beta-app),
html:has(body.beta-app) body {
  overscroll-behavior-x: none;
  overscroll-behavior-y: none;
  overscroll-behavior: none;
  touch-action: pan-y pinch-zoom;
}

body.beta-app {
  --b-bg: #e8eef8;
  --b-line: rgba(20, 32, 51, 0.1);
  --b-text: #0f1a2a;
  --b-muted: #5a6b82;
  --b-blue: #2563eb;
  --b-nav: #2563eb;
  --b-row: rgba(37, 99, 235, 0.14);
  --b-pill: rgba(255, 255, 255, 0.55);
  --b-input: rgba(255, 255, 255, 0.62);
  --b-hover: rgba(255, 255, 255, 0.42);
  --b-track: rgba(20, 32, 51, 0.12);
  --b-danger: #e11d48;
  --b-soft: rgba(255, 255, 255, 0.48);
  --b-glass: rgba(255, 255, 255, 0.52);
  --b-glass-strong: rgba(255, 255, 255, 0.72);
  --b-glass-border: rgba(255, 255, 255, 0.55);
  --b-glass-border-dark: rgba(20, 32, 51, 0.08);
  --b-blur: 22px;
  --b-blur-strong: 36px;
  --b-shadow-soft: 0 8px 32px rgba(15, 26, 42, 0.08), 0 1px 0 rgba(255, 255, 255, 0.5) inset;
  --b-shine: linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.08) 40%, transparent 70%);
  --b-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --b-wash: radial-gradient(120% 80% at 10% -10%, rgba(37, 99, 235, 0.18), transparent 55%),
            radial-gradient(90% 70% at 100% 0%, rgba(56, 189, 248, 0.14), transparent 50%),
            radial-gradient(80% 60% at 50% 110%, rgba(37, 99, 235, 0.1), transparent 55%),
            linear-gradient(180deg, #eef3fb 0%, #e2e9f4 100%);
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--b-wash);
  background-color: var(--b-bg);
  color: var(--b-text);
  color-scheme: light;
  transition: background-color 0.35s var(--b-ease), color 0.35s var(--b-ease);
  /* Bloque le swipe précédent/suivant du navigateur ; le JS gère menu / mail. */
  overscroll-behavior-x: none;
  overscroll-behavior-y: none;
  overscroll-behavior: none;
  touch-action: pan-y pinch-zoom;
}

/* Capteurs de bord : bande fine. Pas de pointer-events pour ne pas bloquer Réglages / thème. */
.b-edge-guard {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 16px;
  z-index: 20;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}
.b-edge-guard--l { left: 0; }
.b-edge-guard--r { right: 0; }

html.theme-dark body.beta-app,
html[data-theme="dark"] body.beta-app {
  --b-bg: #070b14;
  --b-line: rgba(255, 255, 255, 0.08);
  --b-text: #f0f4fa;
  --b-muted: #9aacc4;
  --b-blue: #3b82f6;
  --b-nav: #3b82f6;
  --b-row: rgba(59, 130, 246, 0.22);
  --b-pill: rgba(255, 255, 255, 0.08);
  --b-input: rgba(255, 255, 255, 0.08);
  --b-hover: rgba(255, 255, 255, 0.1);
  --b-track: rgba(255, 255, 255, 0.12);
  --b-danger: #fb7185;
  --b-soft: rgba(255, 255, 255, 0.06);
  --b-glass: rgba(18, 26, 40, 0.55);
  --b-glass-strong: rgba(22, 32, 48, 0.72);
  --b-glass-border: rgba(255, 255, 255, 0.14);
  --b-glass-border-dark: rgba(255, 255, 255, 0.06);
  --b-shadow-soft: 0 12px 40px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
  --b-shine: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02) 45%, transparent 70%);
  --b-wash: radial-gradient(100% 70% at 0% 0%, rgba(59, 130, 246, 0.28), transparent 50%),
            radial-gradient(80% 60% at 100% 10%, rgba(14, 165, 233, 0.16), transparent 45%),
            radial-gradient(70% 50% at 50% 100%, rgba(37, 99, 235, 0.18), transparent 50%),
            linear-gradient(180deg, #0a101c 0%, #060910 100%);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  html:not(.theme-light):not([data-theme="light"]) body.beta-app {
    --b-bg: #070b14;
    --b-line: rgba(255, 255, 255, 0.08);
    --b-text: #f0f4fa;
    --b-muted: #9aacc4;
    --b-blue: #3b82f6;
    --b-nav: #3b82f6;
    --b-row: rgba(59, 130, 246, 0.22);
    --b-pill: rgba(255, 255, 255, 0.08);
    --b-input: rgba(255, 255, 255, 0.08);
    --b-hover: rgba(255, 255, 255, 0.1);
    --b-track: rgba(255, 255, 255, 0.12);
    --b-danger: #fb7185;
    --b-soft: rgba(255, 255, 255, 0.06);
    --b-glass: rgba(18, 26, 40, 0.55);
    --b-glass-strong: rgba(22, 32, 48, 0.72);
    --b-glass-border: rgba(255, 255, 255, 0.14);
    --b-glass-border-dark: rgba(255, 255, 255, 0.06);
    --b-shadow-soft: 0 12px 40px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
    --b-shine: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02) 45%, transparent 70%);
    --b-wash: radial-gradient(100% 70% at 0% 0%, rgba(59, 130, 246, 0.28), transparent 50%),
              radial-gradient(80% 60% at 100% 10%, rgba(14, 165, 233, 0.16), transparent 45%),
              radial-gradient(70% 50% at 50% 100%, rgba(37, 99, 235, 0.18), transparent 50%),
              linear-gradient(180deg, #0a101c 0%, #060910 100%);
    color-scheme: dark;
  }
}

body.beta-app h1,
body.beta-app h2 {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

.b-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 14px;
  border-bottom: 1px solid var(--b-line);
  background: var(--b-bg);
  flex: none;
}

.b-iconbtn.b-menu { display: none; }

.b-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--b-text);
  text-decoration: none;
  font-size: 16px;
  flex: none;
}

.b-brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: block;
}

.b-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--b-blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.b-search {
  position: relative;
  flex: 1 1 280px;
  max-width: 460px;
  margin-left: 8px;
}

.b-search input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--b-line);
  border-radius: 10px;
  background: var(--b-input);
  color: var(--b-text);
  padding: 0 58px 0 12px;
  font: inherit;
  font-size: 14px;
}

.b-search input:focus {
  outline: none;
  border-color: var(--b-blue);
}

.b-kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--b-line);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--b-muted);
  font-family: inherit;
  font-size: 12px;
  background: transparent;
}

body.beta-app .theme-controls {
  margin-left: auto;
  gap: 8px;
  flex-wrap: nowrap;
}

body.beta-app .theme-pills {
  background: var(--b-pill);
  border: 1px solid var(--b-line);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  overflow: visible;
}

body.beta-app .theme-pill {
  border: 0;
  border-radius: 8px;
  padding: 5px 10px;
  color: var(--b-muted);
  background: transparent;
  font-size: 13px;
  line-height: 1.2;
}

body.beta-app .theme-pill:hover {
  color: var(--b-text);
  background: var(--b-hover);
  text-decoration: none;
}

body.beta-app .theme-pill--active {
  background: var(--b-blue);
  color: #fff;
}

.b-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  height: 36px;
  padding: 0 12px 0 4px;
  border: 1px solid var(--b-line);
  border-radius: 999px;
  color: var(--b-text);
  font-size: 13px;
  background: var(--b-soft);
}

.b-user > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.b-user__avatar {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #243044;
  color: #d5deea;
  flex: none;
  overflow: hidden;
}

.b-user__avatar svg { width: 16px; height: 16px; }
.b-user__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 1;
}
.b-user__photo + svg { opacity: 0; }

.b-user__dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--b-bg);
}

.b-logout {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--b-line);
  border-radius: 10px;
  color: var(--b-text);
  background: transparent;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
  flex: none;
}

.b-logout:hover { background: var(--b-hover); text-decoration: none; }

.b-flash {
  padding: 8px 16px;
  background: #16345c;
  color: #e7eef8;
  font-size: 14px;
}

.b-flash--error { background: #4a2030; }
.b-flash--ok { background: #143528; }

.b-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 212px minmax(280px, 1fr) minmax(400px, 1.2fr);
}

.b-shell--wide {
  grid-template-columns: 212px minmax(0, 1fr);
}

.b-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 12px 10px 12px;
  border-right: 1px solid var(--b-line);
  background: var(--b-bg);
  overflow: hidden;
}

.b-compose {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  margin: 0 0 10px;
  border-radius: 10px;
  background: var(--b-blue);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 13.5px;
  flex: none;
}

.b-compose:hover { filter: brightness(1.06); text-decoration: none; }

.b-side__nav {
  display: grid;
  gap: 1px;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.b-side__label {
  margin: 12px 10px 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--b-muted);
}

.b-side__sep {
  height: 1px;
  margin: 10px 8px 6px;
  background: var(--b-line);
}

.b-subhead {
  margin: 18px 0 10px;
  font-size: 15px;
  font-weight: 700;
}

.b-nav {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 9px;
  color: var(--b-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 650;
}

.b-nav > span:not(.b-nav__badge):not(.b-nav__face) {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.b-nav svg { color: var(--b-muted); flex: none; width: 18px; height: 18px; }
.b-nav:hover { background: var(--b-hover); text-decoration: none; }

.b-nav.is-active {
  background: var(--b-nav);
  color: #fff;
}

.b-nav.is-active svg { color: #fff; }

.b-nav__face {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  overflow: hidden;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}
.b-nav__face img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  background: #fff;
}
.b-nav__face-letter {
  position: relative;
  z-index: 0;
}
/* Masquer la lettre seulement une fois la photo réellement chargée (évite trou / décalage). */
.b-nav__face.has-photo .b-nav__face-letter {
  visibility: hidden;
}

.b-nav__badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--b-blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.b-nav.is-active .b-nav__badge {
  background: rgba(255, 255, 255, 0.22);
}

.b-admin {
  margin-top: 8px;
  flex: none;
}

.b-admin summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  color: var(--b-muted);
  font-size: 12px;
  cursor: pointer;
  list-style: none;
}

.b-admin summary::-webkit-details-marker { display: none; }
.b-admin summary svg { width: 16px; height: 16px; }

.b-storage {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--b-line);
  flex: none;
}

.b-storage__label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--b-muted);
  font-size: 12px;
}

.b-meter {
  height: 4px;
  margin-top: 8px;
  border-radius: 99px;
  background: var(--b-track);
  overflow: hidden;
}

.b-meter span {
  display: block;
  height: 100%;
  background: var(--b-blue);
}

.b-list,
.b-read,
.b-wide {
  min-width: 0;
  min-height: 0;
  background: var(--b-bg);
}

.b-list,
.b-read { border-right: 1px solid var(--b-line); }
.b-read { border-right: 0; }

.b-list {
  display: flex;
  flex-direction: column;
}

.b-list__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 8px;
  min-width: 0;
}

.b-list__head > div:first-child {
  min-width: 0;
  flex: 1;
}

.b-list__head h1,
.b-wide h1,
.b-subject {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.b-subject { font-size: 28px; margin: 6px 0 18px; }

.b-list__head p,
.b-lead {
  margin: 4px 0 0;
  color: var(--b-muted);
  font-size: 13px;
}

.b-list__head p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.b-list__tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.b-iconbtn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--b-line);
  background: transparent;
  color: var(--b-muted);
  text-decoration: none;
  cursor: pointer;
  padding: 0;
}

.b-iconbtn:hover { background: var(--b-hover); color: var(--b-text); text-decoration: none; }
.b-iconbtn.is-disabled { opacity: 0.35; }

.b-sort { position: relative; }
.b-sort__btn {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--b-line);
  border-radius: 8px;
  color: var(--b-text);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
}
.b-sort__btn::-webkit-details-marker { display: none; }
.b-sort__btn svg { width: 14px; height: 14px; }

.b-sort__menu,
.b-more__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 8;
  min-width: 170px;
  padding: 6px;
  border: 1px solid var(--b-line);
  border-radius: 10px;
  background: var(--b-soft);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.b-sort__menu a,
.b-more__panel a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--b-text);
  text-decoration: none;
  font-size: 13px;
}

.b-sort__menu a:hover,
.b-more__panel a:hover,
.b-sort__menu a.is-active {
  background: var(--b-hover);
  text-decoration: none;
}

.b-list__scroll { overflow: auto; min-height: 0; padding-bottom: 12px; }

.b-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px 8px 8px;
  padding: 12px 8px 4px;
  border-top: 1px solid var(--b-line);
}
.b-pager__label {
  font-size: 13px;
  font-weight: 650;
  color: var(--b-muted);
  min-width: 7rem;
  text-align: center;
}
.b-pager .b-btn.is-disabled,
.b-btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

.b-row {
  position: relative;
  display: grid;
  grid-template-columns: 12px 40px minmax(0, 1fr) auto;
  grid-template-areas:
    "dot avatar from date"
    "dot avatar subject subject"
    "dot avatar preview star";
  gap: 2px 10px;
  align-items: center;
  margin: 4px 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--b-text);
}

.b-row.is-active { background: var(--b-row); }
.b-row:hover { background: var(--b-hover); }
.b-row.is-active:hover { background: var(--b-row); }

.b-row__hit {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.b-dot {
  grid-area: dot;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  justify-self: center;
}

.b-row.is-unread .b-dot { background: #3b82f6; }

.b-avatar {
  grid-area: avatar;
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  flex: none;
}
.b-avatar__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 1;
  background: #fff;
}
.b-avatar__letter { position: relative; z-index: 0; }
/* Lettre visible tant que la vraie photo n’a pas chargé (plus d’identicon géométrique). */
.b-avatar.has-photo .b-avatar__letter { visibility: hidden; }
.b-list__scroll.is-live-updated {
  animation: b-live-flash 0.65s ease;
}
@keyframes b-live-flash {
  0% { background: transparent; }
  35% { background: rgba(37, 99, 235, 0.08); }
  100% { background: transparent; }
}

.b-from,
.b-subjectline,
.b-preview {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.b-from { grid-area: from; font-weight: 700; font-size: 14px; }
.b-date { grid-area: date; justify-self: end; color: var(--b-muted); font-size: 12px; white-space: nowrap; }
.b-subjectline { grid-area: subject; font-size: 14px; }
.b-preview { grid-area: preview; color: var(--b-muted); font-size: 13px; }

.b-row.is-active .b-date,
.b-row.is-active .b-preview { color: #c9d7ea; }

.b-star {
  grid-area: star;
  position: relative;
  z-index: 2;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--b-muted);
  cursor: pointer;
  justify-self: end;
  padding: 0;
}

.b-star.is-on { color: #f5c451; }
.b-star.is-on svg path { fill: #f5c451; }

.b-read {
  overflow: auto;
  padding: 14px 22px 32px;
}

.b-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-height: 34px;
}

.b-toolbar__actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
}

.b-toolbar form,
.b-actions form { margin: 0; }

.b-more { position: relative; }
.b-more summary { list-style: none; }
.b-more summary::-webkit-details-marker { display: none; }

.b-who {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
  padding-right: 168px;
}

.b-who .b-avatar { grid-column: 1; grid-row: 1 / span 2; }
.b-who__from { grid-column: 2; grid-row: 1; font-size: 14px; }
.b-who__to {
  grid-column: 2;
  grid-row: 2;
  color: var(--b-muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.b-who__date {
  position: absolute;
  right: 34px;
  top: 2px;
  color: var(--b-muted);
  font-size: 13px;
  white-space: nowrap;
}
.b-who .b-star { position: absolute; right: 0; top: -4px; }

.b-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

@media (min-width: 961px) {
  .b-actions { flex-wrap: nowrap; }
}

.b-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--b-line);
  background: transparent;
  color: var(--b-text);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.b-btn:hover { background: var(--b-hover); text-decoration: none; }

.b-btn--primary {
  background: var(--b-blue);
  border-color: var(--b-blue);
  color: #fff;
}

.b-btn--primary:hover { filter: brightness(1.06); background: var(--b-blue); }

.b-btn--danger {
  background: var(--b-danger);
  border-color: var(--b-danger);
  color: #fff;
}

.b-btn--danger:hover { filter: brightness(1.06); background: var(--b-danger); }

.b-letter {
  margin-top: 22px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.55;
  color: var(--b-text);
  background: transparent;
}

.b-attach {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--b-line);
  border-radius: 12px;
  background: var(--b-soft);
}

.b-attach__title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--b-muted);
}

.b-attach__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.b-attach__item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.b-attach__thumb {
  display: block;
  width: 88px;
  height: 88px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--b-line);
  flex: none;
  background: var(--b-input);
}

.b-attach__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.b-attach__pdf {
  display: block;
  width: 100%;
  min-height: 220px;
  max-height: 420px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  flex: 1 1 100%;
}

.b-attach__meta {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.b-attach__meta strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.b-attach__meta span {
  color: var(--b-muted);
  font-size: 12px;
}

.b-attach__meta .b-btn {
  justify-self: start;
  margin-top: 4px;
}

.b-read.is-loading {
  opacity: 0.72;
}

.b-read__skeleton {
  margin-top: 24px;
  color: var(--b-muted);
  font-size: 14px;
}

.b-empty {
  margin: 28px 16px;
  color: var(--b-muted);
}

.b-empty--read {
  margin-top: 80px;
  text-align: center;
}

.b-back { display: none; margin-bottom: 10px; }

.b-textlink { color: var(--b-blue); font-size: 13px; }

.b-wide { overflow: auto; padding: 22px 28px 40px; }
.b-wide .b-lead { margin-bottom: 16px; max-width: 640px; }

.b-form { display: grid; gap: 12px; max-width: 720px; }

.b-field { display: grid; gap: 6px; font-size: 13px; color: var(--b-muted); }

.b-field input,
.b-field textarea {
  width: 100%;
  border: 1px solid var(--b-line);
  border-radius: 10px;
  background: var(--b-input);
  color: var(--b-text);
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
}

.b-field textarea { min-height: 220px; resize: vertical; }

.b-providers,
.b-linked,
.b-accounts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-width: 760px;
}

.b-providers a,
.b-account,
.b-linked li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--b-line);
  border-radius: 12px;
  background: var(--b-soft);
  color: var(--b-text);
  text-decoration: none;
}

.b-providers a:hover { background: var(--b-hover); text-decoration: none; }

.b-account { align-items: center; }
.b-account strong,
.b-account span { display: block; }
.b-account span { color: var(--b-muted); font-size: 13px; margin-top: 2px; }
.b-account__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

body.beta-app .dots-menu__btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border-color: var(--b-line);
  background: transparent;
  color: var(--b-text);
}

body.beta-app .dots-menu__btn:hover { background: var(--b-hover); }

body.beta-app .dots-menu__panel {
  border-color: var(--b-line);
  border-radius: 10px;
  background: var(--b-soft);
  color: var(--b-text);
}

body.beta-app .dots-menu__label { color: var(--b-muted); }

body.beta-app .dots-menu__panel select,
body.beta-app .dots-menu__panel .btn-tiny {
  border-color: var(--b-line);
  background: var(--b-input);
  color: var(--b-text);
}

.b-backdrop { display: none; }

.b-letter-frame {
  display: block;
  width: 100%;
  min-height: 240px;
  margin-top: 18px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color-scheme: light;
}

.b-settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 18px;
}

.b-settings-tabs a {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--b-line);
  color: var(--b-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
  background: var(--b-soft);
}

.b-settings-tabs a:hover { color: var(--b-text); background: var(--b-hover); text-decoration: none; }
.b-settings-tabs a.is-active {
  background: var(--b-blue);
  border-color: var(--b-blue);
  color: #fff;
}

.b-fieldset {
  border: 1px solid var(--b-line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0;
  max-width: 720px;
  background: var(--b-soft);
}

.b-fieldset legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--b-text);
}

.b-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  color: var(--b-text);
  font-size: 14px;
}

.b-help { color: var(--b-muted); font-size: 13px; max-width: 720px; }

.b-linked li { align-items: flex-start; flex-wrap: wrap; }
.b-linked strong,
.b-linked small { display: block; }
.b-linked small { color: var(--b-muted); margin-top: 2px; font-size: 13px; }
.b-linked__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.b-shortcuts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-width: 640px;
}

.b-shortcuts li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--b-line);
  border-radius: 12px;
  background: var(--b-soft);
  font-size: 14px;
}

.b-kbd-inline {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid var(--b-line);
  border-radius: 6px;
  background: var(--b-input);
  font: inherit;
  font-size: 12px;
  color: var(--b-text);
}

body.beta-compact .b-row {
  min-height: 44px;
  padding-top: 6px;
  padding-bottom: 6px;
  grid-template-areas:
    "dot avatar from date"
    "dot avatar subject star";
}
body.beta-compact .b-subjectline { font-size: 13px; }
body.beta-compact .b-preview { display: none; }

@media (max-width: 860px) {
  .b-user > span:last-child { display: none; }
  .b-user { padding-right: 4px; }
  /* Masquer le thème dans la barre seulement — garder celui des Réglages. */
  .b-bar .theme-controls { display: none; }
  .b-logout { display: none; }
}

@media (max-width: 960px) {
  .b-iconbtn.b-menu { display: inline-flex; }
  .b-shell,
  .b-shell--wide {
    grid-template-columns: 1fr;
    min-height: 0;
    overflow: hidden;
  }
  .b-shell--wide .b-wide {
    min-height: 0;
    height: 100%;
    overflow: auto;
  }
  .b-shell { position: relative; }
  .b-side {
    position: fixed;
    z-index: 40;
    top: 58px;
    bottom: 0;
    left: 0;
    width: min(300px, 88vw);
    transform: translate3d(-105%, 0, 0);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 8px 0 28px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    visibility: hidden;
    touch-action: none;
    will-change: transform;
    backface-visibility: hidden;
  }
  body.mail-nav-open .b-side,
  body.is-drawer-dragging .b-side {
    pointer-events: auto;
    visibility: visible;
  }
  body.mail-nav-open .b-side {
    transform: translate3d(0, 0, 0);
    touch-action: pan-y;
  }
  body.is-drawer-dragging .b-side,
  .b-side.is-dragging {
    transition: none !important;
  }
  .b-backdrop {
    position: fixed;
    inset: 58px 0 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 30;
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  }
  body.mail-nav-open .b-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  body.is-drawer-dragging .b-backdrop {
    pointer-events: auto;
    transition: none !important;
  }
  .b-shell,
  .b-list,
  .b-read,
  .b-wide,
  .b-bar,
  .b-list__scroll {
    touch-action: pan-y pinch-zoom;
    overscroll-behavior-x: none;
    overscroll-behavior-y: contain;
  }
  .b-read { display: none; }
  .b-shell.is-reading .b-list {
    display: flex;
  }
  .b-shell.is-reading .b-read {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 6;
    background: var(--b-bg);
    box-shadow: -6px 0 24px rgba(0, 0, 0, 0.14);
    transform: translate3d(0, 0, 0);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
    backface-visibility: hidden;
  }
  .b-shell.is-reading .b-read.is-dragging {
    transition: none !important;
  }
  body.is-drawer-dragging,
  body.is-read-dragging {
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
  }
  body.is-drawer-dragging .b-side,
  body.is-read-dragging .b-read,
  body.is-read-dragging .b-wide,
  body.is-read-dragging .b-main {
    -webkit-transform: translateZ(0);
  }
  .b-wide.is-dragging,
  .b-main.is-dragging {
    transition: none !important;
    will-change: transform;
  }
  .b-back { display: inline-block; }
  .b-back[hidden] { display: none !important; }
  .b-search { max-width: none; margin-left: 0; flex-basis: 0; }
  .b-kbd { display: none; }
  .b-bar { gap: 8px; padding: 0 10px; }
  .b-brand strong { font-size: 15px; }
  .b-list,
  .b-read,
  .b-wide { padding-left: 14px; padding-right: 14px; }
  .b-wide { padding: 16px 14px 32px; }
  .b-tools { gap: 6px; }
  .b-who { padding-right: 0; }
  .b-who__date {
    position: static;
    display: block;
    margin-top: 4px;
  }
  .b-who .b-star { position: static; margin-left: auto; }
  .b-who {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    grid-template-areas:
      "avatar from star"
      "avatar to star"
      "avatar date star";
    align-items: start;
    gap: 2px 10px;
  }
  .b-avatar { grid-area: avatar; }
  .b-who__from { grid-area: from; }
  .b-who__to { grid-area: to; }
  .b-who__date { grid-area: date; }
  .b-who .b-star { grid-area: star; }
  /* Pas de sticky : ça masquait le corps / les PJ sur mobile. */
  .b-actions {
    position: static;
    padding: 0;
    margin: 12px 0 18px;
    background: none;
  }
  .b-btn { min-height: 44px; }
  .b-linked__actions { width: 100%; margin-left: 0; }
  .b-shell.is-reading .b-read {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 12px 14px max(28px, env(safe-area-inset-bottom, 0px));
    -webkit-transform: translateZ(0);
  }
  .b-subject {
    font-size: 18px;
    line-height: 1.3;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .b-letter {
    margin-top: 14px;
    font-size: 15px;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
  }
  .b-letter-frame {
    display: block;
    width: 100% !important;
    max-width: 100%;
    min-height: 42vh;
    margin-top: 14px;
    border-radius: 10px;
  }
  .b-attach {
    margin-top: 16px;
    margin-bottom: 8px;
    padding: 10px;
    max-width: 100%;
    overflow: hidden;
  }
  .b-attach__item {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .b-attach__thumb {
    width: min(100%, 200px);
    height: auto;
    aspect-ratio: 1;
    max-width: 100%;
  }
  .b-attach__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--b-input);
  }
  /* iOS / Android : les PDF en iframe sont souvent cassés → lien seulement. */
  .b-attach__pdf {
    display: none !important;
  }
  .b-attach__meta {
    width: 100%;
  }
  .b-attach__meta strong {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .b-attach__meta .b-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    box-sizing: border-box;
  }
}

@supports (padding: max(0px)) {
  body.beta-app .b-bar {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
}

/* ——— Auth (même langage que l’app bêta) ——— */
body.beta-auth {
  min-height: 100dvh;
}

body.beta-auth .b-auth-spacer {
  flex: 1;
}

body.beta-auth .b-auth {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 40px;
}

body.beta-auth .b-auth__panel {
  width: min(420px, 100%);
  margin: 0 auto;
}

body.beta-auth .b-auth__panel h1 {
  margin: 0 0 16px;
  font-size: 26px;
  line-height: 1.2;
  color: var(--b-text);
}

body.beta-auth .b-lead {
  margin: 0 0 16px;
  max-width: none;
  font-size: 14px;
  line-height: 1.5;
}

body.beta-auth .b-form {
  max-width: none;
}

body.beta-auth .b-actions--auth {
  position: static;
  padding: 4px 0 0;
  background: none;
  justify-content: stretch;
}

body.beta-auth .b-actions--auth .b-btn {
  width: 100%;
  justify-content: center;
  min-height: 42px;
}

body.beta-auth .b-auth__forgot {
  margin: -4px 0 0;
  text-align: right;
  font-size: 13px;
}

body.beta-auth .b-auth__alt {
  margin: 14px 0 0;
  text-align: center;
}

body.beta-auth .b-auth__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 16px;
  color: var(--b-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.beta-auth .b-auth__divider::before,
body.beta-auth .b-auth__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--b-line);
}

body.beta-auth .b-btn--google {
  width: 100%;
  justify-content: center;
  min-height: 42px;
  background: var(--b-soft);
  border-color: var(--b-line);
  color: var(--b-text);
  font-weight: 600;
}

body.beta-auth .b-btn--google:hover {
  background: var(--b-hover);
}

body.beta-auth .b-google-icon {
  display: inline-flex;
}

body.beta-auth .b-code {
  letter-spacing: 0.28em;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

body.beta-auth .b-auth__foot {
  width: min(420px, 100%);
  margin: 32px auto 0;
  text-align: center;
  color: var(--b-muted);
  font-size: 13px;
}

body.beta-auth .b-auth__foot p {
  margin: 8px 0 0;
}

body.beta-auth .pixr-family {
  margin: 0 0 10px;
  color: var(--b-muted);
  font-size: 13px;
}

body.beta-auth .pixr-family a {
  color: var(--b-blue);
}

body.beta-auth .pixr-family__current {
  color: var(--b-text);
  font-weight: 600;
}

@media (max-width: 860px) {
  body.beta-auth .theme-controls {
    display: flex !important;
  }
}

/* ============================================================
   Liquid Glass — surfaces, motion, Instagram-style polish
   ============================================================ */

.b-glass,
.b-bar,
.b-side,
.b-list,
.b-read,
.b-wide,
body.beta-app .theme-pills,
.b-user,
.b-search input,
.b-field input,
.b-field textarea,
.b-field select,
.b-btn,
.b-logout,
.b-iconbtn,
.b-settings-tabs a,
.b-fieldset,
.b-providers a,
.b-linked li,
.b-sort__menu,
.b-more__panel,
body.beta-app .dots-menu__panel,
body.beta-app .pixr-dialog__card,
body.beta-app .cookie-dialog__card {
  background: var(--b-glass);
  -webkit-backdrop-filter: blur(var(--b-blur)) saturate(1.35);
  backdrop-filter: blur(var(--b-blur)) saturate(1.35);
  border: 1px solid var(--b-glass-border);
  box-shadow: var(--b-shadow-soft);
  background-image: var(--b-shine);
  background-blend-mode: soft-light, normal;
}

.b-bar {
  position: relative;
  z-index: 40;
  height: 60px;
  padding: 0 16px;
  border-bottom: 1px solid var(--b-glass-border-dark);
  background: var(--b-glass-strong);
  -webkit-backdrop-filter: blur(var(--b-blur-strong)) saturate(1.45);
  backdrop-filter: blur(var(--b-blur-strong)) saturate(1.45);
}

.b-side {
  border-right: 1px solid var(--b-glass-border-dark);
  background: var(--b-glass);
  -webkit-backdrop-filter: blur(var(--b-blur-strong)) saturate(1.4);
  backdrop-filter: blur(var(--b-blur-strong)) saturate(1.4);
}

.b-list,
.b-read {
  background: rgba(255, 255, 255, 0.18);
  border: 0;
  box-shadow: none;
  background-image: none;
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
}

html.theme-dark body.beta-app .b-list,
html.theme-dark body.beta-app .b-read,
html[data-theme="dark"] body.beta-app .b-list,
html[data-theme="dark"] body.beta-app .b-read {
  background: rgba(10, 16, 28, 0.35);
}

@media (prefers-color-scheme: dark) {
  html:not(.theme-light):not([data-theme="light"]) body.beta-app .b-list,
  html:not(.theme-light):not([data-theme="light"]) body.beta-app .b-read {
    background: rgba(10, 16, 28, 0.35);
  }
}

.b-read {
  border-right: 1px solid var(--b-glass-border-dark);
}

.b-wide {
  background: var(--b-glass);
  border-radius: 0;
  -webkit-backdrop-filter: blur(var(--b-blur)) saturate(1.3);
  backdrop-filter: blur(var(--b-blur)) saturate(1.3);
}

.b-search input {
  border-radius: 14px;
  height: 38px;
  border-color: var(--b-glass-border);
  transition: border-color 0.2s var(--b-ease), box-shadow 0.2s var(--b-ease), transform 0.2s var(--b-ease);
}

.b-search input:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18), var(--b-shadow-soft);
}

body.beta-app .theme-pills {
  border-radius: 14px;
  padding: 3px;
}

body.beta-app .theme-pill {
  border-radius: 11px;
  transition: background 0.2s var(--b-ease), color 0.2s var(--b-ease), transform 0.18s var(--b-ease);
}

body.beta-app .theme-pill:active {
  transform: scale(0.96);
}

.b-user {
  border-radius: 999px;
  border-color: var(--b-glass-border);
}

.b-logout,
.b-iconbtn,
.b-btn {
  border-radius: 12px;
  border-color: var(--b-glass-border);
  transition: transform 0.18s var(--b-ease), background 0.2s var(--b-ease), filter 0.2s var(--b-ease), box-shadow 0.2s var(--b-ease);
}

.b-logout:hover,
.b-iconbtn:hover,
.b-btn:hover {
  transform: translateY(-1px);
}

.b-logout:active,
.b-iconbtn:active,
.b-btn:active,
.b-nav:active,
.b-compose:active {
  transform: scale(0.97);
}

.b-btn--primary,
.b-compose,
.b-settings-tabs a.is-active,
body.beta-app .theme-pill--active {
  background: var(--b-blue) !important;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 55%) !important;
  color: #fff !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.28), 0 1px 0 rgba(255, 255, 255, 0.25) inset;
  border-color: transparent !important;
  transition: transform 0.18s var(--b-ease), filter 0.2s var(--b-ease), box-shadow 0.2s var(--b-ease);
}

.b-btn--danger {
  background: var(--b-danger) !important;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 55%) !important;
  color: #fff !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  border-color: transparent !important;
}

.b-compose {
  border-radius: 14px;
  height: 40px;
}

.b-nav {
  border-radius: 12px;
  transition: background 0.2s var(--b-ease), transform 0.18s var(--b-ease), color 0.2s var(--b-ease);
}

.b-nav.is-active {
  background: var(--b-nav) !important;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 60%) !important;
  color: #fff !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  border-color: transparent !important;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.25);
}

.b-nav__badge {
  animation: b-badge-pop 0.45s var(--b-ease) both;
}

.b-row {
  border-radius: 16px;
  border: 1px solid transparent;
  transition: background 0.22s var(--b-ease), border-color 0.22s var(--b-ease), transform 0.22s var(--b-ease), box-shadow 0.22s var(--b-ease);
}

.b-row:hover {
  background: var(--b-glass);
  border-color: var(--b-glass-border);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  backdrop-filter: blur(14px) saturate(1.25);
  box-shadow: var(--b-shadow-soft);
  transform: translateY(-1px);
}

.b-row.is-active {
  background: var(--b-row);
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 6px 22px rgba(37, 99, 235, 0.15);
}

.b-row.is-active:hover {
  background: var(--b-row);
}

.b-row.is-enter-prep {
  opacity: 0;
  transform: translateY(-16px) scale(0.98);
  filter: blur(3px);
  pointer-events: none;
}

.b-row.is-enter {
  animation: b-row-cascade 0.4s var(--b-ease) both;
  will-change: transform, opacity, filter;
}

.b-list__scroll.is-list-loading .b-row {
  opacity: 0;
  pointer-events: none;
}

.b-list-loading {
  margin: 18px 12px !important;
  text-align: center;
  animation: b-flash-in 0.25s var(--b-ease) both;
}

.b-flash {
  background: var(--b-glass-strong);
  -webkit-backdrop-filter: blur(var(--b-blur)) saturate(1.3);
  backdrop-filter: blur(var(--b-blur)) saturate(1.3);
  border-bottom: 1px solid var(--b-glass-border);
  color: var(--b-text);
  animation: b-flash-in 0.35s var(--b-ease) both;
}

.b-flash--error {
  background: rgba(225, 29, 72, 0.18);
  color: #fff;
}

.b-flash--ok {
  background: rgba(34, 197, 94, 0.18);
  color: var(--b-text);
}

.b-settings-tabs a {
  border-radius: 999px;
  transition: transform 0.18s var(--b-ease), background 0.2s var(--b-ease), color 0.2s var(--b-ease);
}

.b-settings-tabs a:active {
  transform: scale(0.97);
}

.b-fieldset,
.b-providers a,
.b-linked li {
  border-radius: 16px;
}

.b-field input,
.b-field textarea,
.b-field select {
  border-radius: 12px;
  border-color: var(--b-glass-border);
  transition: border-color 0.2s var(--b-ease), box-shadow 0.2s var(--b-ease);
}

.b-field input:focus,
.b-field textarea:focus,
.b-field select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.b-sort__menu,
.b-more__panel,
body.beta-app .dots-menu__panel {
  border-radius: 16px;
  overflow: hidden;
  -webkit-backdrop-filter: blur(var(--b-blur-strong)) saturate(1.4);
  backdrop-filter: blur(var(--b-blur-strong)) saturate(1.4);
  animation: b-pop-in 0.28s var(--b-ease) both;
}

body.beta-app .pixr-dialog__backdrop,
body.beta-app .cookie-dialog .pixr-dialog__backdrop {
  background: rgba(8, 12, 22, 0.42);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
}

body.beta-app .pixr-dialog__card,
body.beta-app .cookie-dialog__card {
  border-radius: 22px;
  background: var(--b-glass-strong);
  -webkit-backdrop-filter: blur(var(--b-blur-strong)) saturate(1.5);
  backdrop-filter: blur(var(--b-blur-strong)) saturate(1.5);
  border: 1px solid var(--b-glass-border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28), var(--b-shadow-soft);
  animation: b-dialog-in 0.38s var(--b-ease) both;
}

.b-letter-frame {
  border-radius: 16px;
  box-shadow: var(--b-shadow-soft);
  border: 1px solid var(--b-glass-border-dark);
}

.b-user__dot {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--b-glass-strong);
}

/* Backdrop drawer — glass dim + settings mobile */
@media (max-width: 960px) {
  .b-backdrop {
    background: rgba(8, 12, 22, 0.38);
    -webkit-backdrop-filter: blur(16px) saturate(1.25);
    backdrop-filter: blur(16px) saturate(1.25);
    transition: opacity 0.32s var(--b-ease), backdrop-filter 0.32s var(--b-ease);
  }

  .b-side {
    border-right: 1px solid var(--b-glass-border);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.22);
  }

  .b-bar {
    background: var(--b-glass-strong);
  }

  .b-wide {
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
    border: 0;
    background-image: none;
    padding: 14px 14px 40px;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .b-wide .b-fieldset,
  .b-wide .b-form,
  .b-wide .b-help,
  .b-wide .b-providers,
  .b-wide .b-linked,
  .b-wide .b-shortcuts {
    max-width: 100%;
  }

  .b-settings-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 4px;
    margin-bottom: 14px;
    scrollbar-width: none;
  }

  .b-settings-tabs::-webkit-scrollbar { display: none; }

  .b-settings-tabs a {
    flex: 0 0 auto;
    height: 40px;
    padding: 0 14px;
    font-size: 14px;
  }

  /* Thème dans Réglages : gros, cliquable, pleine largeur */
  .b-wide .theme-controls {
    display: flex !important;
    width: 100%;
    margin: 4px 0 0;
  }

  .b-wide .theme-pills {
    display: flex;
    width: 100%;
    border-radius: 14px;
    padding: 4px;
    gap: 4px;
  }

  .b-wide .theme-pill {
    flex: 1 1 0;
    text-align: center;
    padding: 12px 8px;
    font-size: 14px;
    border-radius: 11px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .b-fieldset {
    padding: 14px;
    border-radius: 16px;
  }

  .b-btn {
    min-height: 44px;
    padding: 0 16px;
  }

  .b-providers a,
  .b-linked li {
    min-height: 48px;
  }

  body.is-drawer-dragging .b-backdrop,
  body.mail-nav-open .b-backdrop {
    opacity: 1;
  }
}

html.theme-dark body.beta-app .b-row.is-active .b-date,
html.theme-dark body.beta-app .b-row.is-active .b-preview,
html[data-theme="dark"] body.beta-app .b-row.is-active .b-date,
html[data-theme="dark"] body.beta-app .b-row.is-active .b-preview {
  color: rgba(226, 236, 250, 0.72);
}

@media (prefers-color-scheme: dark) {
  html:not(.theme-light):not([data-theme="light"]) body.beta-app .b-row.is-active .b-date,
  html:not(.theme-light):not([data-theme="light"]) body.beta-app .b-row.is-active .b-preview {
    color: rgba(226, 236, 250, 0.72);
  }
}

/* Auth glass panel */
body.beta-auth .b-auth__card,
body.beta-auth .auth-card,
body.beta-auth main {
  position: relative;
}

body.beta-auth .b-form,
body.beta-auth .auth-form {
  background: var(--b-glass-strong);
  -webkit-backdrop-filter: blur(var(--b-blur-strong)) saturate(1.45);
  backdrop-filter: blur(var(--b-blur-strong)) saturate(1.45);
  border: 1px solid var(--b-glass-border);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--b-shadow-soft);
  background-image: var(--b-shine);
}

/* Keyframes */
@keyframes b-row-cascade {
  from {
    opacity: 0;
    transform: translateY(-18px) scale(0.97);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes b-badge-pop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes b-flash-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes b-pop-in {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes b-dialog-in {
  from { opacity: 0; transform: translateY(16px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes b-bar-shine {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.b-brand img {
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.2);
  transition: transform 0.25s var(--b-ease);
}

.b-brand:hover img {
  transform: scale(1.06);
}

.b-brand strong {
  letter-spacing: -0.02em;
}

@media (prefers-reduced-motion: reduce) {
  body.beta-app,
  body.beta-app * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .b-row.is-enter {
    animation: none;
  }
}
