/* ==========================================================================
   Nodeline — atelier (application installable) et pages simples

   Grammaire Material 3 : barre d'application en haut, onglets en bas,
   indicateur en pastille, listes à couche d'état, grandes zones tactiles.
   Le verre dépoli est réservé aux éléments qui flottent au-dessus du
   contenu — barres, savebar, bulles — jamais aux blocs de lecture.
   ========================================================================== */

.app {
  --tabbar-h: 4.5rem;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --content-max: 48rem;
}

/* --------------------------------------------------------------------------
   Structure
   -------------------------------------------------------------------------- */

.sidebar { display: none; }
.shell { min-height: 100dvh; display: flex; flex-direction: column; }

.appbar {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: 2.75rem minmax(0, 1fr) auto; align-items: center; gap: 0.5rem;
  min-height: 3.75rem;
  padding: max(0.5rem, env(safe-area-inset-top)) 0.75rem 0.5rem;
  background: var(--glass-strong);
  box-shadow: 0 1px 0 var(--outline);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .appbar {
    background: var(--glass);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
  }
}

.appbar__back, .appbar__brand {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem;
  border-radius: 50%; color: var(--on-surface); text-decoration: none;
  transition: background var(--dur-m);
}
.appbar__back:hover { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.appbar__brand .logo__mark { width: 2rem; }
.appbar__title {
  text-align: center; font-weight: 650; font-size: 1.0625rem; letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.appbar__actions { display: flex; gap: 0.35rem; min-width: 2.75rem; justify-content: flex-end; }

.content {
  flex: 1; width: 100%; max-width: var(--content-max); margin: 0 auto;
  display: grid; gap: 1.1rem; align-content: start;
  padding: 1rem 1rem calc(var(--tabbar-h) + var(--safe-bottom) + 2rem);
}

/* --------------------------------------------------------------------------
   Barre d'onglets (téléphone) — indicateur en pastille
   -------------------------------------------------------------------------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: var(--glass-strong);
  box-shadow: 0 -1px 0 var(--outline);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .tabbar {
    background: var(--glass);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
  }
}
.tabbar a {
  display: grid; justify-items: center; align-content: center; gap: 0.25rem;
  text-decoration: none; color: var(--on-surface-variant); font-weight: 550;
  -webkit-user-select: none; user-select: none;
}
.tabbar__icon {
  position: relative; display: grid; place-items: center;
  width: 4rem; height: 2rem; border-radius: var(--r-full);
  transition: background var(--dur-m) var(--ease), color var(--dur-m);
}
.tabbar__icon .icon { width: 1.4rem; height: 1.4rem; }
.tabbar__label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.01em; }
.tabbar a:hover .tabbar__icon { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.tabbar a[aria-current] { color: var(--on-surface); }
.tabbar a[aria-current] .tabbar__icon { background: var(--primary-container); color: var(--on-primary-container); }

.badge-dot {
  position: absolute; top: -0.15rem; right: 0.75rem;
  min-width: 1.1rem; height: 1.1rem; padding: 0 0.3rem;
  border-radius: var(--r-full); background: var(--error); color: var(--on-error);
  font-size: 0.7rem; font-weight: 700; line-height: 1.1rem; text-align: center;
}

/* --------------------------------------------------------------------------
   Rail latéral (écran large)
   -------------------------------------------------------------------------- */

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 17.5rem minmax(0, 1fr); }
  .tabbar { display: none; }

  .sidebar {
    position: sticky; top: 0; height: 100dvh;
    display: flex; flex-direction: column; gap: 1.5rem;
    padding: 1.5rem 0.9rem;
    background: var(--glass-strong);
    box-shadow: 1px 0 0 var(--outline);
  }
  @supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .sidebar { background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
  }

  .sidebar__logo { padding: 0 0.7rem; }
  .sidebar__nav { display: grid; gap: 0.2rem; }
  .sidebar__nav a {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 0.8rem 1rem; border-radius: var(--r-full);
    text-decoration: none; font-weight: 600; font-size: var(--text-sm);
    color: var(--on-surface-variant);
    transition: background var(--dur-m) var(--ease), color var(--dur-m);
  }
  .sidebar__nav a:hover { background: color-mix(in srgb, var(--on-surface) 7%, transparent); color: var(--on-surface); }
  .sidebar__nav a[aria-current] { background: var(--primary-container); color: var(--on-primary-container); }

  .sidebar__foot { margin-top: auto; display: grid; gap: 0.35rem; }
  .sidebar__user {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem; border-radius: var(--r-full); text-decoration: none;
    transition: background var(--dur-m);
  }
  .sidebar__user:hover { background: color-mix(in srgb, var(--on-surface) 7%, transparent); }
  .sidebar__user small { display: block; color: var(--on-surface-muted); font-size: var(--text-xs); }
  .sidebar__site {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.6rem 1rem; border-radius: var(--r-full); text-decoration: none;
    color: var(--on-surface-variant); font-weight: 550; font-size: var(--text-sm);
    transition: background var(--dur-m);
  }
  .sidebar__site:hover { background: color-mix(in srgb, var(--on-surface) 7%, transparent); }

  .badge-count {
    margin-left: auto; min-width: 1.4rem; padding: 0 0.4rem;
    border-radius: var(--r-full); background: var(--error); color: var(--on-error);
    font-size: 0.75rem; font-weight: 700; line-height: 1.4rem; text-align: center;
  }

  .appbar { padding-inline: 2rem; background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .appbar__brand { visibility: hidden; }
  .content { padding: 0.5rem 2rem 4rem; gap: 1.25rem; }
}

/* --------------------------------------------------------------------------
   Application ouverte : son menu remplace la navigation de l'atelier
   -------------------------------------------------------------------------- */

.app--bare { --tabbar-h: 0px; }

.appbar--application { grid-template-columns: auto minmax(0, 1fr) auto; }
.appbar__apps {
  display: inline-flex; align-items: center; gap: 0.3rem;
  height: 2.5rem; padding: 0 0.7rem 0 0.45rem;
  border-radius: var(--r-full); background: var(--surface-container);
  color: var(--on-surface); font-size: var(--text-sm); font-weight: 650; text-decoration: none;
  transition: background var(--dur-m);
}
.appbar__apps:hover { background: var(--surface-high); }
.appbar__apps .icon { width: 1.2rem; height: 1.2rem; }
.appbar__heading { display: flex; align-items: center; justify-content: center; min-width: 0; }
.appbar--application .appbar__title { min-width: 0; line-height: 1.2; }
.appbar__title .appbar__app {
  display: block; color: var(--on-surface-muted);
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.appbar__title span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 30rem) {
  .appbar__apps { width: 2.5rem; padding: 0; justify-content: center; }
  .appbar__apps-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

.tabbar--2 { grid-template-columns: repeat(2, 1fr); }
.tabbar--3 { grid-template-columns: repeat(3, 1fr); }
.tabbar--4 { grid-template-columns: repeat(4, 1fr); }
.tabbar--5 { grid-template-columns: repeat(5, 1fr); }
.tabbar--5 .tabbar__icon { width: 3.5rem; }

/* Le résumé occupe exactement la case de l'onglet : en grille, le contenu masqué d'un
   <details> garde une rangée et décale « Plus » de quelques pixels. */
.tabbar__more { position: relative; }
.tabbar__more summary {
  position: absolute; inset: 0;
  display: grid; justify-items: center; align-content: center; gap: 0.25rem;
  list-style: none; cursor: pointer; color: var(--on-surface-variant); font-weight: 550;
  -webkit-user-select: none; user-select: none;
}
.tabbar__more summary::-webkit-details-marker { display: none; }
.tabbar__more summary:hover .tabbar__icon { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.tabbar__more[open] summary, .tabbar__more.is-current summary { color: var(--on-surface); }
.tabbar__more[open] .tabbar__icon, .tabbar__more.is-current .tabbar__icon { background: var(--primary-container); color: var(--on-primary-container); }
.tabbar__sheet {
  position: fixed; right: 0.75rem; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 0.5rem); z-index: 50;
  display: grid; gap: 0.1rem; min-width: 14rem; padding: 0.4rem;
  border-radius: var(--r-lg); background: var(--card);
  box-shadow: inset 0 0 0 1px var(--outline), var(--e4);
  animation: sheet-in var(--dur-m) var(--ease);
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: none; } }
.tabbar .tabbar__sheet a {
  display: flex; align-items: center; justify-items: start; gap: 0.75rem;
  padding: 0.75rem 0.9rem; border-radius: var(--r-md);
  color: var(--on-surface); font-size: var(--text-sm); font-weight: 600;
}
.tabbar .tabbar__sheet a:hover { background: color-mix(in srgb, var(--on-surface) 7%, transparent); }
.tabbar .tabbar__sheet a[aria-current] { background: var(--primary-container); color: var(--on-primary-container); }
.tabbar .tabbar__sheet .tabbar__sheet-apps { margin-top: 0.2rem; box-shadow: 0 -1px 0 var(--outline); border-radius: 0 0 var(--r-md) var(--r-md); color: var(--on-surface-variant); }

@media (min-width: 900px) {
  .app-rail__home { display: flex; align-items: center; gap: 0.75rem; padding: 0 0.5rem; color: inherit; text-decoration: none; }
  .app-rail__home strong { display: block; font-size: 1.0625rem; font-weight: 750; letter-spacing: -0.015em; }
  .app-rail__home small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--on-surface-muted); font-size: var(--text-xs); line-height: 1.35; }
  .app-rail__logo { flex: none; width: 2.75rem; height: 2.75rem; border-radius: var(--r-lg); box-shadow: 0 6px 14px -8px rgba(20, 10, 50, 0.6); }
  .app--application .appbar__apps { display: none; }
  .app--application .appbar__heading { justify-content: flex-start; }
  .app--application .appbar__title { text-align: left; }
}

/* --------------------------------------------------------------------------
   Titres
   -------------------------------------------------------------------------- */

.page-title { font-size: clamp(1.75rem, 1.45rem + 1.4vw, 2.25rem); font-weight: 750; letter-spacing: -0.032em; margin-top: 0.25rem; }
.page-intro { margin-top: -0.5rem; color: var(--on-surface-variant); }
.hello { display: grid; gap: 0.15rem; }
.hello .page-title { margin-top: 0; }
.list-title {
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--on-surface-muted); margin: 0.85rem 0 -0.4rem 0.3rem;
}
.block { display: grid; gap: 0.75rem; }
.block__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.block__head h2 { font-size: 1.1875rem; font-weight: 700; letter-spacing: -0.015em; }

/* --------------------------------------------------------------------------
   Pastilles d'icône
   -------------------------------------------------------------------------- */

.bubble {
  display: inline-grid; place-items: center; flex: none;
  width: 2.5rem; height: 2.5rem; border-radius: var(--r-sm);
  background: var(--primary-container); color: var(--on-primary-container);
}
.bubble .icon { width: 1.3rem; height: 1.3rem; }
.bubble--lg { width: 3.25rem; height: 3.25rem; border-radius: var(--r-md); }
.bubble--lg .icon { width: 1.6rem; height: 1.6rem; }
.bubble--accent { background: var(--primary); color: var(--on-primary); }
.bubble--coral { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.bubble--sun { background: var(--warn-container); color: var(--warn); }
.bubble--mint { background: var(--secondary-container); color: var(--on-secondary-container); }
.bubble--ink { background: var(--surface-inverse); color: var(--on-surface-inverse); }
.bubble--soft { background: var(--surface-high); color: var(--on-surface-variant); }

/* --------------------------------------------------------------------------
   Cartes et bannières
   -------------------------------------------------------------------------- */

.card {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.7rem;
  padding: 1.25rem; border-radius: var(--r-lg);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--outline);
}
.form { grid-template-columns: minmax(0, 1fr); }
.form > *, .card > *, .item__body > * { min-width: 0; }

.card--link {
  text-decoration: none;
  transition: transform var(--dur-s) var(--ease), box-shadow var(--dur-m) var(--ease), background var(--dur-m);
}
.card--link:hover { box-shadow: inset 0 0 0 1px transparent, var(--e2); }
.card--link:active { transform: scale(0.99); }
.card--dashed {
  grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 1rem;
  background: transparent; box-shadow: inset 0 0 0 1.5px var(--outline-strong);
}
.card__title { font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em; }
.card__meta { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.card__excerpt { color: var(--on-surface-variant); }

.banner {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 1rem 1.1rem; border-radius: var(--r-lg);
  background: var(--primary-container); color: var(--on-primary-container);
  text-decoration: none;
  transition: transform var(--dur-s) var(--ease), box-shadow var(--dur-m);
}
.banner:hover { box-shadow: var(--e2); }
.banner:active { transform: scale(0.99); }
.banner .bubble { background: color-mix(in srgb, var(--on-primary-container) 14%, transparent); color: inherit; }
.banner__text { display: grid; gap: 0.1rem; flex: 1; min-width: 0; }
.banner__text span { color: inherit; opacity: 0.82; font-size: var(--text-sm); line-height: 1.4; }
.banner__go { color: inherit; opacity: 0.7; }

/* Statistiques */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.stat {
  display: grid; gap: 0.1rem; padding: 1.1rem; border-radius: var(--r-lg);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--outline);
  text-decoration: none;
  transition: box-shadow var(--dur-m) var(--ease), transform var(--dur-s) var(--ease);
}
a.stat:hover { box-shadow: inset 0 0 0 1px transparent, var(--e2); }
a.stat:active { transform: scale(0.99); }
.stat .bubble { margin-bottom: 0.55rem; }
.stat__value { font-size: 1.875rem; font-weight: 750; letter-spacing: -0.035em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat__value small { font-size: 0.55em; color: var(--on-surface-muted); font-weight: 600; }
.stat__label { color: var(--on-surface-variant); font-size: var(--text-sm); line-height: 1.35; }

/* Tuiles d'application */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: 0.7rem; }
.tile {
  display: grid; justify-items: center; gap: 0.5rem;
  padding: 1rem 0.4rem; border-radius: var(--r-lg);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--outline);
  text-decoration: none; text-align: center;
  transition: transform var(--dur-s) var(--ease), box-shadow var(--dur-m) var(--ease);
}
.tile:hover { box-shadow: inset 0 0 0 1px transparent, var(--e2); }
.tile:active { transform: scale(0.96); }
.tile__name { font-weight: 600; font-size: 0.875rem; line-height: 1.25; }

.empty {
  display: grid; justify-items: center; gap: 0.5rem;
  padding: 2.5rem 1.25rem; border-radius: var(--r-lg);
  background: var(--surface-container); color: var(--on-surface-muted);
  text-align: center; font-weight: 500;
}
.empty .icon { width: 2rem; height: 2rem; opacity: 0.7; }

/* --------------------------------------------------------------------------
   Listes (style réglages)
   -------------------------------------------------------------------------- */

.list {
  list-style: none; padding: 0; overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--outline);
}
.list > li + li { box-shadow: 0 -1px 0 var(--outline); }

.row {
  display: flex; align-items: center; gap: 0.9rem;
  width: 100%; min-height: 3.75rem; padding: 0.8rem 1.1rem;
  border: 0; background: transparent; text-align: left; text-decoration: none; color: var(--on-surface);
  transition: background var(--dur-m);
}
a.row:hover, button.row:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
a.row:active, button.row:active { background: color-mix(in srgb, var(--on-surface) 10%, transparent); }
.row__text { display: grid; gap: 0.05rem; flex: 1; min-width: 0; }
.row__text strong { font-weight: 600; }
.row__text > span { color: var(--on-surface-muted); font-size: 0.875rem; line-height: 1.35; }
.row__go { color: var(--on-surface-muted); width: 1.1rem; height: 1.1rem; }
.switch-row { cursor: pointer; }
.switch-row .switch { flex: none; }

.pill {
  display: inline-flex; align-items: center; padding: 0.15rem 0.6rem;
  border-radius: var(--r-xs); background: var(--surface-high); color: var(--on-surface-variant);
  font-size: 0.8rem; font-weight: 600; white-space: nowrap; vertical-align: middle;
}
.pill--accent { background: var(--primary-container); color: var(--on-primary-container); }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); font-weight: 700;
}
.avatar--lg { width: 3.25rem; height: 3.25rem; font-size: 1.3rem; }
.avatar--soft { background: var(--primary-container); color: var(--on-primary-container); }
.profile-card {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.1rem; border-radius: var(--r-lg);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--outline);
  text-decoration: none; transition: box-shadow var(--dur-m);
}
a.profile-card:hover { box-shadow: inset 0 0 0 1px transparent, var(--e2); }

/* --------------------------------------------------------------------------
   Boutons d'icône
   -------------------------------------------------------------------------- */

.icon-btn {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-grid; place-items: center; flex: none;
  width: 2.5rem; height: 2.5rem; padding: 0;
  border: 0; border-radius: 50%;
  background: var(--surface-high); color: var(--on-surface-variant); text-decoration: none;
  transition: background var(--dur-m), color var(--dur-m), box-shadow var(--dur-m);
}
.icon-btn:hover { background: var(--surface-highest); color: var(--on-surface); }
.icon-btn--danger { background: var(--error-container); color: var(--on-error-container); }
.icon-btn--danger:hover { background: var(--error); color: var(--on-error); }
.icon-btn--primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--e1); }
.icon-btn--primary:hover { background: var(--primary-hover); box-shadow: var(--e2); }
.appbar .icon-btn { background: transparent; }
.appbar .icon-btn:hover { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.appbar .icon-btn--primary { background: var(--primary); color: var(--on-primary); }

/* --------------------------------------------------------------------------
   Messages
   -------------------------------------------------------------------------- */

.messages { list-style: none; padding: 0; display: grid; gap: 0.7rem; }
.message {
  display: grid; gap: 0.8rem; padding: 1.1rem 1.15rem;
  border-radius: var(--r-lg);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--outline);
}
.message--new { background: var(--primary-container); color: var(--on-primary-container); box-shadow: none; }
.message--new .message__body, .message--new .subtle { color: inherit; opacity: 0.85; }
.message__head { display: flex; align-items: center; gap: 0.8rem; }
.message__who { display: grid; min-width: 0; }
.message__who .subtle { font-size: 0.875rem; }
.message__body { color: var(--on-surface-variant); overflow-wrap: anywhere; }
.message__actions { display: flex; align-items: center; gap: 0.6rem; }
.message__email { flex: 1; min-width: 0; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Notifications
   -------------------------------------------------------------------------- */

.push { gap: 1rem; }
.push__head { display: flex; gap: 1rem; align-items: center; }
.push__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.push__actions form { display: contents; }

.logout { margin-top: 0.75rem; }
.version { text-align: center; font-size: var(--text-xs); }

/* --------------------------------------------------------------------------
   Formulaires
   -------------------------------------------------------------------------- */

.form { display: grid; gap: 1.1rem; }
.form__group { border: 0; padding: 0; display: grid; gap: 1rem; }
.form__group legend { font-weight: 700; font-size: 1.0625rem; margin-bottom: 0.75rem; float: left; width: 100%; }
.form__row { display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem; gap: 0.75rem; }

/* Bouton segmenté Material */
.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  border-radius: var(--r-full); box-shadow: inset 0 0 0 1px var(--outline-strong); overflow: hidden;
}
.segmented label { position: relative; cursor: pointer; }
.segmented label + label { box-shadow: inset 1px 0 0 var(--outline-strong); }
.segmented input { position: absolute; opacity: 0; }
.segmented span {
  display: block; padding: 0.7rem 0.6rem; text-align: center;
  font-weight: 600; font-size: var(--text-sm); color: var(--on-surface-variant);
  transition: background var(--dur-m), color var(--dur-m);
}
.segmented label:hover span { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
.segmented input:checked + span { background: var(--secondary-container); color: var(--on-secondary-container); }
.segmented input:focus-visible + span { box-shadow: var(--ring); }

.setup:has(#driver-sqlite:checked) .setup__mysql { display: none; }
.setup__php { text-align: center; font-size: var(--text-xs); }

/* Barre d'enregistrement flottante */
.savebar {
  position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 0.75rem); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.55rem 0.55rem 0.55rem 1.25rem;
  border-radius: var(--r-full);
  background: var(--glass-strong); border: 1px solid var(--glass-line);
  box-shadow: var(--glass-sheen), var(--e4);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .savebar { background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
}
.savebar .subtle { font-size: 0.875rem; font-weight: 550; }
[data-editor].is-dirty [data-dirty-label] { color: var(--primary); font-weight: 650; }
@media (min-width: 900px) { .savebar { bottom: 1.25rem; } }

.danger-zone {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 1rem 1.15rem; border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 1.5px var(--error-container);
}

/* Répéteur : éléments repliables */
.repeater { border: 0; padding: 0; display: grid; gap: 0.55rem; min-width: 0; }
.repeater, .repeater__list, .item__body { grid-template-columns: minmax(0, 1fr); }
.repeater > *, .repeater__list > * { min-width: 0; }
.repeater__legend { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; margin-bottom: 0.4rem; float: left; width: 100%; }
.repeater__list { display: grid; gap: 0.55rem; counter-reset: item; }

/* Replié : un cran au-dessus de la carte qui le contient, pour rester lisible
   aussi bien sur fond clair que sur fond sombre. */
.item {
  border-radius: var(--r-md); background: var(--surface-high); counter-increment: item;
  transition: background var(--dur-m), box-shadow var(--dur-m);
}
.item[open] { background: var(--card); box-shadow: inset 0 0 0 1.5px var(--primary); }
.item__head { display: flex; align-items: center; gap: 0.75rem; min-height: 3.5rem; padding: 0.6rem 1rem; cursor: pointer; list-style: none; }
.item__head::-webkit-details-marker { display: none; }
.item__no::before {
  content: counter(item); display: inline-grid; place-items: center;
  width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: var(--surface-high); font-size: var(--text-xs); font-weight: 700; color: var(--on-surface-variant);
}
.item[open] .item__no::before { background: var(--primary); color: var(--on-primary); }
.item__title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__chevron { color: var(--on-surface-muted); transition: transform var(--dur-m) var(--ease); }
.item[open] .item__chevron { transform: rotate(180deg); }
.item__body { display: grid; gap: 1rem; padding: 0.25rem 1rem 1rem; }
.item__tools { display: flex; gap: 0.5rem; align-items: center; padding-top: 0.6rem; border-top: 1px solid var(--outline); }
.item__tools .btn { margin-left: auto; }

/* Champ média */
.media-field { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 0.75rem; align-items: center; }
.media-field__preview {
  display: grid; place-items: center; width: 4.5rem; aspect-ratio: 1;
  border-radius: var(--r-md); overflow: hidden;
  background: var(--surface-high); color: var(--on-surface-muted); font-weight: 700;
}
.media-field__preview img { width: 100%; height: 100%; object-fit: cover; }
.media-field__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.media-field__controls label { cursor: pointer; }
.media-field__status { font-size: 0.875rem; }
.field .media-field__path { grid-column: 1 / -1; min-height: 2.75rem; padding: 0.55rem 0.85rem; font-size: 0.9rem; }

/* Médias */
.upload-btn { cursor: pointer; }
.media-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr)); gap: 0.7rem; }
.media {
  display: grid; border-radius: var(--r-md); overflow: hidden;
  background: var(--card); box-shadow: inset 0 0 0 1px var(--outline);
}
.media__thumb { display: grid; place-items: center; aspect-ratio: 1; background: var(--surface-high); color: var(--on-surface-muted); }
.media__thumb img { width: 100%; height: 100%; object-fit: cover; }
.media__pdf { width: 2.5rem; height: 2.5rem; }
.media__meta { display: grid; padding: 0.6rem 0.75rem 0; font-size: var(--text-xs); min-width: 0; }
.media__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media__actions { display: flex; justify-content: space-between; padding: 0.5rem 0.6rem 0.7rem; }
.media__actions .icon-btn { width: 2.25rem; height: 2.25rem; }

/* --------------------------------------------------------------------------
   Carnet
   -------------------------------------------------------------------------- */

.searchbar { position: relative; }
.searchbar .icon { position: absolute; left: 1.1rem; top: 50%; transform: translateY(-50%); color: var(--on-surface-muted); }
.searchbar .input { padding-left: 3rem; border-radius: var(--r-full); background: var(--surface-container); box-shadow: none; }
.searchbar .input:focus { box-shadow: inset 0 0 0 2px var(--primary), var(--ring); }

.composer { display: flex; gap: 0.5rem; }
.composer .input { flex: 1; border-radius: var(--r-full); background: var(--surface-container); box-shadow: none; }
.composer .input:focus { box-shadow: inset 0 0 0 2px var(--primary), var(--ring); }
.composer .icon-btn { width: 3.25rem; height: 3.25rem; border-radius: var(--r-md); }

.notes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 0.7rem; }
.note-card {
  display: grid; gap: 0.3rem; height: 100%;
  padding: 1.1rem 1.15rem; border-radius: var(--r-lg);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--outline);
  text-decoration: none; transition: box-shadow var(--dur-m), transform var(--dur-s) var(--ease);
}
.note-card:hover { box-shadow: inset 0 0 0 1px transparent, var(--e2); }
.note-card:active { transform: scale(0.99); }
.note-card strong { display: flex; align-items: center; gap: 0.35rem; font-size: 1.0625rem; font-weight: 650; }
.note-card--pinned { background: var(--warn-container); box-shadow: none; }
.note-card--pinned strong .icon { color: var(--warn); }
.note-card__excerpt { color: var(--on-surface-variant); font-size: var(--text-sm); }
.note-card__date { font-size: var(--text-xs); }

.note-editor__title {
  width: 100%; border: 0; background: transparent;
  font-size: 1.75rem; font-weight: 750; letter-spacing: -0.03em; padding: 0.25rem 0;
}
.note-editor__title:focus { outline: none; }
.note-editor__body {
  width: 100%; min-height: 50vh; padding: 1.1rem;
  border: 0; border-radius: var(--r-lg);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--outline);
  font-size: 1.0625rem; line-height: 1.7; resize: vertical;
}
.note-editor__body:focus { outline: none; box-shadow: inset 0 0 0 2px var(--primary), var(--ring); }
.note-editor .switch.card { padding: 1rem 1.15rem; }

/* --------------------------------------------------------------------------
   Bulle de confirmation
   -------------------------------------------------------------------------- */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h, 0px) + var(--safe-bottom, 0px) + 1rem); z-index: 60;
  padding: 0.8rem 1.3rem; border-radius: var(--r-sm);
  background: var(--surface-inverse); color: var(--on-surface-inverse);
  font-weight: 550; font-size: var(--text-sm); box-shadow: var(--e3);
  transform: translate(-50%, 1rem); opacity: 0;
  transition: transform var(--dur-m) var(--ease-spring), opacity var(--dur-s); pointer-events: none;
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

/* --------------------------------------------------------------------------
   Pages simples (connexion, installation, erreurs)
   -------------------------------------------------------------------------- */

.plain__main {
  position: relative; min-height: 100dvh;
  display: grid; align-content: center; justify-items: center; gap: 1.5rem;
  padding: max(2rem, env(safe-area-inset-top)) 1rem max(2rem, env(safe-area-inset-bottom));
  overflow: hidden;
}
.plain__art { position: absolute; top: -4rem; right: -4rem; width: 17rem; opacity: 0.85; pointer-events: none; }
.plain__logo { position: relative; }

.panel {
  position: relative; width: min(100%, 26rem); display: grid; gap: 1rem;
  padding: clamp(1.5rem, 5vw, 2.25rem); border-radius: var(--r-xl);
  background: var(--glass-strong); border: 1px solid var(--glass-line);
  box-shadow: var(--glass-sheen), var(--e4);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .panel { background: color-mix(in srgb, var(--card) 82%, transparent); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
}
.panel--wide { width: min(100%, 34rem); }
.panel h1 { font-size: 1.625rem; font-weight: 760; letter-spacing: -0.03em; }
.panel__code { font-weight: 700; color: var(--primary); }
.panel__back {
  display: inline-flex; align-items: center; gap: 0.3rem; justify-self: center;
  color: var(--on-surface-variant); font-weight: 550; text-decoration: none; font-size: var(--text-sm);
}
.panel__back:hover { color: var(--on-surface); }
.panel .switch { padding: 0.25rem 0; }

@media (max-width: 480px) { .plain__art { width: 11rem; top: -2.5rem; right: -3rem; } }

/* Application autonome, vue par un joueur : l'application à la place du retour vers l'atelier. */
.appbar__apps--brand img { width: 2rem; height: 2rem; border-radius: 0.5rem; }
.app-rail__logout { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
