/* Subly web — palette « Encre & Aurore », reprise de l'app iPhone.
   Dark first. Les couleurs de texte respectent un contraste AA sur les surfaces des deux thèmes. */

:root {
  color-scheme: light dark;
  --bg: #07080c;
  --surface: #111318;
  --surface-2: #15171e;
  --stroke: rgb(255 255 255 / 0.08);
  --stroke-strong: rgb(255 255 255 / 0.14);
  --text: #f2f3f7;
  --text-2: #9aa0ae;
  --mint: #3be3b4;
  --indigo: #8290ff;
  --on-accent: #0b0c14;
  --switch-on: #5562e8;
  --warning: #ffb547;
  --danger: #ff6b6b;
  --aurora-mint: #3be3b4;
  --aurora-indigo: #6b7cff;
  --aurora: linear-gradient(135deg, var(--aurora-mint), var(--aurora-indigo));
  --glass: rgb(21 23 30 / 0.62);
  --glass-edge: rgb(255 255 255 / 0.16);
  --shadow: 0 18px 50px rgb(0 0 0 / 0.45);
  --scrim: rgb(2 3 6 / 0.55);
  --chart-1: #3987e5; --chart-2: #d95926; --chart-3: #199e70; --chart-4: #c98500; --chart-5: #d55181; --chart-other: #a3a9b8;

  --font: ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", "Nunito", var(--font);
  --radius: 22px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --spring: cubic-bezier(0.2, 0.9, 0.25, 1);
}

:root[data-scheme="light"] {
  --bg: #f2f3f7;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --stroke: rgb(0 0 0 / 0.07);
  --stroke-strong: rgb(0 0 0 / 0.12);
  --text: #0d0f15;
  --text-2: #585e6e;
  --mint: #0b8566;
  --indigo: #3e48c6;
  --on-accent: #ffffff;
  --switch-on: #3e48c6;
  --warning: #8f4a00;
  --danger: #c42b3a;
  --glass: rgb(255 255 255 / 0.66);
  --glass-edge: rgb(255 255 255 / 0.9);
  --shadow: 0 18px 50px rgb(20 24 40 / 0.16);
  --scrim: rgb(20 24 40 / 0.32);
  --chart-1: #2a78d6; --chart-2: #eb6834; --chart-3: #1baf7a; --chart-4: #eda100; --chart-5: #e87ba4; --chart-other: #5b6170;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 400 1rem/1.45 var(--font); letter-spacing: 0; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; touch-action: manipulation; }
a { color: var(--indigo); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Fond : aurore diffuse, jamais derrière du texte à faible contraste ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.backdrop::before, .backdrop::after { content: ""; position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; filter: blur(80px); opacity: 0.2; }
.backdrop::before { background: var(--aurora-indigo); top: -45vmax; left: -25vmax; }
.backdrop::after { background: var(--aurora-mint); bottom: -50vmax; right: -30vmax; opacity: 0.12; }
:root[data-scheme="light"] .backdrop::before { opacity: 0.16; }
:root[data-scheme="light"] .backdrop::after { opacity: 0.1; }

/* ---------- Typographie : approche optique, interlignage et chasse selon la taille ---------- */
.title-1 { font: 700 2.125rem/1.08 var(--font); letter-spacing: -0.022em; font-optical-sizing: auto; }
.title-2 { font: 650 1.375rem/1.2 var(--font); letter-spacing: -0.014em; }
.headline { font: 600 1.0625rem/1.3 var(--font); letter-spacing: -0.005em; }
.subhead { font: 500 0.9375rem/1.35 var(--font-rounded); color: var(--text-2); letter-spacing: 0.002em; }
.footnote { font: 500 0.8125rem/1.35 var(--font-rounded); color: var(--text-2); letter-spacing: 0.006em; }
.amount { font-family: var(--font-rounded); font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: -0.012em; }
.eyebrow { font: 600 0.75rem/1.2 var(--font-rounded); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-2); }

/* ---------- Structure ---------- */
#app { min-height: 100dvh; }
.shell { display: block; }
.main { max-width: 760px; margin: 0 auto; padding: 0 16px calc(var(--tabbar-h) + var(--safe-b) + 40px); }
.screen { animation: screen-in 0.38s var(--spring) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } }

/* Barre d'en-tête translucide : le titre large se replie au défilement, sans filet dur */
.topbar {
  position: sticky; top: 0; z-index: 20; margin: 0 -16px; padding: calc(var(--safe-t) + 8px) 16px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px;
}
.topbar::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: var(--scroll, 0);
  background: var(--glass); backdrop-filter: blur(22px) saturate(180%); -webkit-backdrop-filter: blur(22px) saturate(180%);
  -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent);
  bottom: -14px;
}
.topbar .small-title { position: absolute; left: 0; right: 0; text-align: center; font: 600 1rem var(--font); opacity: var(--scroll, 0); pointer-events: none; }
.topbar-actions { display: flex; gap: 6px; position: relative; }
.large-title { padding: 4px 0 14px; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--text);
  background: var(--glass); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 0 0 1px var(--stroke);
  transition: transform 0.12s ease-out, background 0.2s;
}
.icon-btn:active, .pressable:active { transform: scale(0.94); }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 18px; height: 18px; }
.icon.fill { fill: currentColor; stroke: none; }

/* ---------- Cartes ---------- */
.card {
  position: relative; background: var(--surface); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--stroke), inset 0 1px 0 rgb(255 255 255 / 0.04);
  --tint: transparent;
}
.card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(135deg, var(--tint), transparent 70%); pointer-events: none; }
.card > * { position: relative; }
.pressable { transition: transform 0.12s ease-out, box-shadow 0.2s; }
@media (hover: hover) { .pressable:hover { box-shadow: 0 0 0 1px var(--stroke-strong), 0 10px 30px rgb(0 0 0 / 0.18); } }

.hero { padding: 20px; border-radius: 28px; --tint: color-mix(in srgb, var(--aurora-indigo) 22%, transparent); }
.hero .big { font-size: clamp(2.6rem, 11vw, 3.4rem); line-height: 1.05; font-weight: 700; letter-spacing: -0.03em; margin: 2px 0 0; }
.progress { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--text-2) 18%, transparent); overflow: hidden; margin-top: 16px; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--aurora); transform-origin: left; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: space-between; margin-top: 10px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 0.05em; }

/* Filtres */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 16px 6px; margin: 0 -16px; scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 99px; display: inline-flex; align-items: center; gap: 6px;
  font: 600 0.875rem var(--font-rounded); color: var(--text-2); background: var(--surface); box-shadow: 0 0 0 1px var(--stroke);
  transition: transform 0.12s ease-out, background 0.2s, color 0.2s;
}
.chip:active { transform: scale(0.96); }
.chip[aria-pressed="true"], .chip[aria-selected="true"] { background: var(--text); color: var(--bg); box-shadow: none; }
.segmented { display: flex; padding: 3px; border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 1px var(--stroke); position: relative; }
.segmented button { flex: 1; min-height: 38px; border-radius: 11px; text-align: center; font: 600 0.875rem var(--font-rounded); color: var(--text-2); position: relative; z-index: 1; transition: color 0.2s, background 0.25s; }
.segmented button[aria-selected="true"] { color: var(--bg); background: var(--text); }
.segmented .thumb { position: absolute; top: 3px; bottom: 3px; border-radius: 11px; background: var(--text); z-index: 0; }

/* ---------- Ligne d'abonnement + actions au balayage ---------- */
.list { display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; }
.swipe { position: relative; border-radius: var(--radius); touch-action: pan-y; }
.swipe-actions { visibility: hidden; position: absolute; inset: 0; display: flex; justify-content: flex-end; align-items: stretch; gap: 8px; border-radius: var(--radius); }
.swipe-actions button { width: 76px; border-radius: 18px; color: #fff; display: grid; place-items: center; align-content: center; gap: 4px; font: 600 0.75rem var(--font-rounded); }
.swipe-actions .a-archive { background: #3e48c6; }
.swipe-actions .a-delete { background: #c42b3a; }
.swipe-front { position: relative; will-change: transform; }
.sub-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; width: 100%; min-height: 80px; }
.sub-main { flex: 1; min-width: 0; }
.sub-name { font: 600 1.0625rem/1.25 var(--font); letter-spacing: -0.008em; overflow-wrap: anywhere; }
.sub-meta { margin-top: 2px; }
.sub-side { text-align: right; display: grid; gap: 4px; justify-items: end; }
.sub-price { font-size: 1.0625rem; font-weight: 650; }
.sub-price small { font-weight: 500; color: var(--text-2); font-size: 0.8125rem; }
.badge { display: inline-flex; align-items: center; gap: 6px; font: 600 0.8125rem var(--font-rounded); padding: 3px 9px 3px 5px; border-radius: 99px; background: color-mix(in srgb, var(--text-2) 14%, transparent); color: var(--text); }
.badge.soon { background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--warning); }
.badge.today { background: var(--aurora); color: var(--on-accent); }
.ring { width: 16px; height: 16px; flex: none; }
.ring circle { fill: none; stroke-width: 3; }
.ring .track { stroke: color-mix(in srgb, currentColor 25%, transparent); }
.ring .value { stroke: currentColor; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; }

/* Avatar : monogramme sur dégradé de marque, symbole ou photo */
.avatar { width: var(--size, 52px); height: var(--size, 52px); border-radius: calc(var(--size, 52px) * 0.28); display: grid; place-items: center; flex: none; overflow: hidden; font-family: var(--font-rounded); font-weight: 700; font-size: calc(var(--size, 52px) * 0.38); letter-spacing: -0.02em; color: var(--ink, #fff); background: linear-gradient(145deg, var(--c1), var(--c2)); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.28); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar .icon { width: 52%; height: 52%; stroke-width: 1.9; }
.avatar.glow { box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.28), 0 8px 24px -6px var(--c2); }

/* ---------- Boutons ---------- */
.btn { min-height: 50px; padding: 0 22px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 650 1rem var(--font); letter-spacing: -0.005em; transition: transform 0.12s ease-out, opacity 0.2s; }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--aurora); color: #0b0c14; box-shadow: 0 10px 30px -10px var(--aurora-indigo), inset 0 1px 0 rgb(255 255 255 / 0.35); }
.btn.secondary { background: var(--surface); box-shadow: 0 0 0 1px var(--stroke-strong); }
.btn.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.link-btn { text-align: center; color: var(--indigo); font-weight: 600; min-height: 44px; padding: 0 6px; }

/* ---------- États vides illustrés ---------- */
.empty { text-align: center; display: grid; justify-items: center; gap: 10px; padding: 56px 20px 24px; }
.empty .art { width: 132px; height: 132px; margin-bottom: 8px; }
.empty p { margin: 0; max-width: 34ch; }
.empty .actions { display: grid; gap: 10px; width: min(320px, 100%); margin-top: 12px; }
.skeleton { background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--radius); height: 80px; box-shadow: 0 0 0 1px var(--stroke); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Barre d'onglets en verre ---------- */
.tabbar {
  position: fixed; z-index: 30; left: 50%; bottom: calc(10px + var(--safe-b)); transform: translateX(-50%);
  width: min(460px, calc(100% - 24px)); height: var(--tabbar-h); padding: 6px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  border-radius: 26px; background: var(--glass); backdrop-filter: blur(26px) saturate(190%); -webkit-backdrop-filter: blur(26px) saturate(190%);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 0 0 1px var(--stroke), var(--shadow);
}
.tab { border-radius: 20px; display: grid; place-items: center; align-content: center; gap: 2px; font: 600 0.6875rem var(--font-rounded); color: var(--text-2); position: relative; text-decoration: none; transition: color 0.2s, transform 0.12s ease-out; }
.tab:active { transform: scale(0.95); }
.tab[aria-current="page"] { color: var(--text); background: color-mix(in srgb, var(--text) 9%, transparent); }
.tab[aria-current="page"] .icon { color: var(--mint); }
.tab .pip { position: absolute; top: 8px; right: calc(50% - 20px); min-width: 16px; height: 16px; border-radius: 99px; background: var(--indigo); color: var(--on-accent); font-size: 0.6875rem; line-height: 16px; text-align: center; padding: 0 4px; }

/* ---------- Feuilles (sheets) ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); opacity: 0; }
.sheet {
  position: fixed; z-index: 51; left: 50%; bottom: 0; width: min(640px, 100%); max-height: min(94dvh, 900px); display: flex; flex-direction: column;
  background: var(--bg); border-radius: 28px 28px 0 0; box-shadow: 0 0 0 1px var(--stroke-strong), var(--shadow); overflow: hidden; will-change: transform;
  transform: translate(-50%, 100%);
}
.sheet-grab { padding: 10px 0 2px; touch-action: none; cursor: grab; display: grid; place-items: center; }
.sheet-grab i { width: 38px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--text-2) 40%, transparent); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 12px 8px; touch-action: none; }
.sheet-head h2 { margin: 0; font: 650 1.0625rem var(--font); text-align: center; flex: 1; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px calc(24px + var(--safe-b)); }
@media (min-width: 760px) {
  .sheet { bottom: 50%; border-radius: 28px; max-height: min(86dvh, 820px); }
  .sheet-grab { display: none; }
}

/* ---------- Formulaires groupés ---------- */
.group { background: var(--surface-2); border-radius: 18px; box-shadow: 0 0 0 1px var(--stroke); overflow: hidden; }
.group + .group, .group + .group-title, .group-title + .group { margin-top: 12px; }
.group-title { padding: 18px 6px 8px; }
.row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 16px; width: 100%; position: relative; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--stroke); }
.row > label, .row .label { flex: none; font-weight: 500; }
.row input, .row select, .row textarea { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; text-align: right; min-height: 40px; color: var(--text); }
.row input::placeholder, .row textarea::placeholder { color: var(--text-2); }
.row textarea { text-align: left; min-height: 84px; resize: vertical; padding-top: 8px; }
.row select { appearance: none; -webkit-appearance: none; padding-right: 4px; cursor: pointer; }
.row:focus-within { background: color-mix(in srgb, var(--indigo) 8%, transparent); }
.row .value { margin-left: auto; color: var(--text-2); text-align: right; }
.row.tappable { cursor: pointer; }
.hint { padding: 8px 8px 0; }
.error-text { color: var(--danger); }
.field-invalid { box-shadow: 0 0 0 1.5px var(--danger); }

.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { appearance: none; -webkit-appearance: none; width: 100%; height: 100%; margin: 0; border-radius: 99px; background: color-mix(in srgb, var(--text-2) 30%, transparent); transition: background 0.25s; cursor: pointer; }
.switch input:checked { background: var(--switch-on); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgb(0 0 0 / 0.3); transition: transform 0.3s var(--spring); pointer-events: none; }
.switch:has(input:checked)::after { transform: translateX(20px); }

.swatches, .symbols { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
.swatch { width: 40px; height: 40px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.18); display: grid; place-items: center; color: #fff; transition: transform 0.12s; }
.swatch:active { transform: scale(0.92); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--text); }
.symbol-btn { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--text-2) 12%, transparent); }
.symbol-btn[aria-pressed="true"] { background: var(--text); color: var(--bg); }

/* Recherche */
.search { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--stroke); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; min-height: 44px; }
.search:focus-within { box-shadow: 0 0 0 2px var(--indigo); }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; margin-top: 14px; }
.tile { display: grid; justify-items: center; gap: 8px; padding: 14px 6px 10px; border-radius: 18px; background: var(--surface); box-shadow: 0 0 0 1px var(--stroke); text-align: center; min-height: 112px; }
.tile span:last-child { font: 600 0.8125rem/1.2 var(--font-rounded); overflow-wrap: anywhere; }

/* ---------- Détail ---------- */
.detail-hero { text-align: center; display: grid; justify-items: center; gap: 6px; padding: 8px 0 18px; }
.detail-hero .big { font-size: 2.6rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 14px 16px; border-radius: 18px; background: var(--surface); box-shadow: 0 0 0 1px var(--stroke); }
.stat .v { font-size: 1.25rem; font-weight: 650; margin-top: 2px; }
.history-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; }

/* ---------- Graphiques ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 500 11px var(--font-rounded); fill: var(--text-2); }
.chart .grid { stroke: var(--stroke); stroke-width: 1; }
.chart .bar { transition: opacity 0.2s; }
.donut-wrap { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 18px; align-items: center; }
@media (max-width: 480px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } .donut-wrap .keys { width: 100%; } }
.keys { display: grid; gap: 8px; }
.key { display: flex; align-items: center; gap: 10px; }
.key .dot { margin: 0; width: 10px; height: 10px; border-radius: 3px; }
.key .amount { margin-left: auto; font-weight: 600; }
.panel { padding: 18px; }
.panel h3 { margin: 0 0 14px; }
.rank { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.rank .bar-track { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--text-2) 16%, transparent); margin-top: 6px; overflow: hidden; }
.rank .bar-track i { display: block; height: 100%; border-radius: 3px; background: var(--c, var(--indigo)); }

/* ---------- Rappels ---------- */
.day-head { padding: 22px 6px 8px; }
.reminder-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 64px; }
.reminder-row + .reminder-row { border-top: 1px solid var(--stroke); }

/* ---------- Onboarding ---------- */
.onboarding { position: fixed; inset: 0; z-index: 70; background: var(--bg); display: grid; grid-template-rows: 1fr auto; overflow: hidden; }
.onb-track { display: flex; width: 300%; height: 100%; will-change: transform; touch-action: pan-y; }
.onb-page { width: calc(100% / 3); display: grid; align-content: center; justify-items: center; gap: 14px; padding: 32px 28px; text-align: center; }
.onb-page .art { width: min(240px, 60vw); height: min(240px, 60vw); }
.onb-page p { max-width: 36ch; margin: 0; }
.onb-foot { padding: 12px 24px calc(24px + var(--safe-b)); display: grid; gap: 14px; justify-items: center; width: min(460px, 100%); margin: 0 auto; }
.pager { display: flex; gap: 8px; }
.pager i { width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--text-2) 40%, transparent); transition: width 0.3s var(--spring), background 0.3s; }
.pager i[aria-current="true"] { width: 24px; border-radius: 4px; background: var(--text); }

/* ---------- Toast ---------- */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 26px); transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-radius: 18px; background: var(--glass); backdrop-filter: blur(22px) saturate(180%); -webkit-backdrop-filter: blur(22px) saturate(180%); box-shadow: inset 0 1px 0 var(--glass-edge), 0 0 0 1px var(--stroke), var(--shadow); font-weight: 600; animation: toast-in 0.45s var(--spring) both; }
.toast .link-btn { margin-left: auto; }
.toast.leaving { animation: toast-out 0.25s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ---------- Grand écran : barre latérale à la place de la barre d'onglets ---------- */
@media (min-width: 900px) {
  .main { margin-left: max(260px, calc(50% - 380px + 130px)); margin-right: auto; padding-bottom: 60px; }
  .tabbar { left: 16px; bottom: 16px; top: 16px; transform: none; width: 220px; height: auto; grid-template-columns: 1fr; align-content: start; grid-auto-rows: 52px; border-radius: 28px; padding: 12px; }
  .tab { grid-auto-flow: column; justify-content: start; justify-items: start; padding: 0 14px; gap: 12px; font-size: 0.9375rem; align-content: center; }
  .tab .pip { position: static; margin-left: auto; }
  .toasts { bottom: 24px; }
}

/* ---------- Accessibilité : transparence, contraste, mouvement ---------- */
@media (prefers-reduced-transparency: reduce) {
  :root { --glass: var(--surface); }
  .icon-btn, .tabbar, .topbar::before, .toast { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --stroke: rgb(255 255 255 / 0.3); --text-2: #c4c9d6; }
  :root[data-scheme="light"] { --stroke: rgb(0 0 0 / 0.4); --text-2: #3a3f4c; }
  .backdrop { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .screen { animation: none; }
}
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.35s; }
