/* =====================================================================
   Office Online — feuille de style unique.
   Palette pilotée par des variables : le thème sombre ne redéfinit que
   les jetons de couleur, jamais les règles de mise en page.
   ===================================================================== */

:root {
  color-scheme: light dark;

  --bg:        #f6f7fb;
  --surface:   #ffffff;
  --surface-2: #f2f4f9;
  --surface-3: #e8ebf3;
  --overlay:   rgba(15, 23, 42, .42);

  --fg:        #111827;
  --fg-muted:  #5b6478;
  --fg-faint:  #8b93a7;

  --line:      #e2e6ef;
  --line-soft: #eef1f7;

  --accent:      #4f7cff;
  --accent-fg:   #ffffff;
  --accent-soft: #e9efff;
  --accent-line: #c7d7ff;

  --doc:    #4f7cff;
  --sheet:  #16a34a;
  --slides: #ef7a3d;
  --form:   #7c3aed;

  --danger:      #dc2626;
  --danger-soft: #fee2e2;
  --warn:        #b45309;
  --ok:          #15803d;

  --radius:    10px;
  --radius-lg: 16px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-2: 0 4px 12px rgba(16, 24, 40, .10), 0 2px 4px rgba(16, 24, 40, .06);
  --shadow-3: 0 18px 44px rgba(16, 24, 40, .18), 0 4px 12px rgba(16, 24, 40, .10);

  --editor-bg: #f9fbfd;

  --sidebar-w: 232px;
  --topbar-h:  56px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --serif: Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0b1220;
    --surface:   #121a2b;
    --surface-2: #182135;
    --surface-3: #212c44;
    --overlay:   rgba(2, 6, 16, .62);

    --fg:        #e8ecf6;
    --fg-muted:  #9aa5bd;
    --fg-faint:  #6b768f;

    --line:      #26314a;
    --line-soft: #1c2439;

    --accent-soft: #1c2a4d;
    --accent-line: #2f4477;
    --editor-bg: #0d1524;

    --danger-soft: #3b1418;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-2: 0 4px 12px rgba(0, 0, 0, .35);
    --shadow-3: 0 18px 44px rgba(0, 0, 0, .5);
  }
}

/* ---- socle ---- */

* { box-sizing: border-box; }
html { height: 100%; }
body {
  /* Colonne de la hauteur exacte de la fenêtre : une bannière ajoutée au-dessus de
     l'application réduit sa place au lieu de faire défiler la page entière. */
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- écran de démarrage ---- */

.boot {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: center;
  gap: 18px; color: var(--fg-muted); background: var(--bg); z-index: 200;
}
.boot-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #6a9bff, #3f63e0);
  animation: pulse 1.3s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.9); } 50% { opacity: 1; transform: scale(1); } }
.noscript { padding: 24px; text-align: center; }

/* ---- structure ---- */

.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; flex: 1; min-height: 0; }
.main { overflow: auto; position: relative; min-width: 0; }
/* Le routeur y place le focus pour les lecteurs d'écran : pas d'anneau sur un conteneur. */
.main:focus, .main:focus-visible { outline: none; }

/* ---- barre latérale ---- */

.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border-right: 1px solid var(--line);
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; height: var(--topbar-h); padding: 0 14px 0 16px; flex: none; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--fg); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; flex: none; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: -.03em; color: var(--fg); }
.sidebar .sidebar-close { display: none; }

.sidebar-create { padding: 4px 12px 10px; flex: none; }
.btn-create { justify-content: flex-start; gap: 10px; border-radius: 12px; padding: 10px 14px; font-weight: 600; box-shadow: var(--shadow-1); }
.btn-create svg { width: 18px; height: 18px; }

.sidebar-nav { padding: 2px 10px 8px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; flex: 1; min-height: 0; scrollbar-width: thin; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px;
  color: var(--fg-muted); font-size: 13.5px; font-weight: 500; min-width: 0; flex: none;
}
.nav-link:hover { background: var(--surface-2); color: var(--fg); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-icon { width: 20px; height: 20px; display: grid; place-items: center; flex: none; }
.nav-icon svg { width: 18px; height: 18px; }
.nav-icon .file-icon { width: 22px; height: 22px; border-radius: 6px; }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Chaque outil garde sa couleur : on le reconnaît d'un coup d'œil. */
.nav-tool-doc[aria-current="page"], .nav-tool-doc:hover .nav-icon { color: var(--doc); }
.nav-tool-sheet[aria-current="page"], .nav-tool-sheet:hover .nav-icon { color: var(--sheet); }
.nav-tool-slides[aria-current="page"], .nav-tool-slides:hover .nav-icon { color: var(--slides); }
.nav-tool-form[aria-current="page"], .nav-tool-form:hover .nav-icon { color: var(--form); }
.nav-tool-draw[aria-current="page"], .nav-tool-draw:hover .nav-icon { color: #0f9d8a; }
.nav-tool-doc[aria-current="page"] { background: color-mix(in srgb, var(--doc) 12%, transparent); }
.nav-tool-sheet[aria-current="page"] { background: color-mix(in srgb, var(--sheet) 12%, transparent); }
.nav-tool-slides[aria-current="page"] { background: color-mix(in srgb, var(--slides) 12%, transparent); }
.nav-tool-form[aria-current="page"] { background: color-mix(in srgb, var(--form) 12%, transparent); }
.nav-tool-draw[aria-current="page"] { background: color-mix(in srgb, #0f9d8a 12%, transparent); }

.nav-section { padding: 14px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-faint); flex: none; }
.nav-recents { display: flex; flex-direction: column; gap: 1px; }
.nav-recent { font-weight: 450; padding: 6px 10px; }
.nav-empty { padding: 4px 10px 8px; font-size: 12.5px; color: var(--fg-faint); }

.sidebar-foot { border-top: 1px solid var(--line-soft); padding: 10px; flex: none; }
.storage { padding: 0 7px 6px; }
.storage-bar { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin: 4px 0 5px; }
.storage-bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

.account { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px; border: 0; border-radius: var(--radius); background: none; cursor: pointer; text-align: left; }
.account:hover { background: var(--surface-2); }
.account-name { font-weight: 600; font-size: 13px; }
.account-mail { font-size: 11.5px; color: var(--fg-faint); }
.account-text { min-width: 0; }
.account-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Espace temporaire (visiteur sans compte) */
.temp-card { background: #fff8e6; border: 1px solid #f5d99a; border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
@media (prefers-color-scheme: dark) { .temp-card { background: #3a2c10; border-color: #5a441a; } }
.temp-head { display: flex; align-items: center; gap: 8px; color: #7c4a03; font-size: 13px; }
@media (prefers-color-scheme: dark) { .temp-head { color: #f5d99a; } }
.temp-head svg { width: 17px; height: 17px; flex: none; }
.temp-card p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--fg-muted); }
.temp-card .btn { justify-content: center; }
.temp-card .btn svg { width: 16px; height: 16px; }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-size: 11.5px; font-weight: 700;
  background: var(--accent); text-transform: uppercase;
}
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }

/* Pastille de type : fond teinté, glyphe plein — lisible de 16 à 44 px. */
.file-icon {
  --tint: #94a3b8;
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--tint) 14%, transparent);
  color: var(--tint);
}
.file-icon svg { width: 62%; height: 62%; }
.file-icon-doc { --tint: var(--doc); }
.file-icon-sheet { --tint: var(--sheet); }
.file-icon-slides { --tint: var(--slides); }
.file-icon-form { --tint: var(--form); }
.file-icon-draw { --tint: #0f9d8a; }
.file-icon-folder { --tint: #7b8794; }
/* Variante pleine, pour les fonds colorés (badge de l'éditeur). */
.file-icon.solid { background: var(--tint); color: #fff; }

/* ---- barre latérale réduite (pendant l'édition) ----
   Elle se replie en rail et se déplie au survol, par-dessus le contenu : le document ne
   se reflow pas, et les récents restent accessibles d'un coup d'œil. */

@media (min-width: 901px) {
  body.in-editor { --sidebar-w: 62px; }
  body.in-editor .app { position: relative; }
  /* La barre sort du flux de la grille : sans cela, le contenu remonterait dans la
     première colonne (celle du rail) et se retrouverait caché dessous. */
  body.in-editor .main { grid-column: 2; }
  body.in-editor .sidebar {
    position: absolute; top: 0; bottom: 0; left: 0; width: 62px; z-index: 60;
    transition: width .16s ease, box-shadow .16s ease;
  }
  body.in-editor .sidebar:hover,
  body.in-editor .sidebar:focus-within { width: 236px; box-shadow: var(--shadow-3); }

  /* État replié : seules les icônes subsistent. */
  body.in-editor .sidebar:not(:hover):not(:focus-within) .brand-name,
  body.in-editor .sidebar:not(:hover):not(:focus-within) .nav-label,
  body.in-editor .sidebar:not(:hover):not(:focus-within) .nav-section,
  body.in-editor .sidebar:not(:hover):not(:focus-within) .nav-empty,
  body.in-editor .sidebar:not(:hover):not(:focus-within) .account-text,
  body.in-editor .sidebar:not(:hover):not(:focus-within) .btn-create span,
  body.in-editor .sidebar:not(:hover):not(:focus-within) .storage,
  body.in-editor .sidebar:not(:hover):not(:focus-within) .temp-card p,
  body.in-editor .sidebar:not(:hover):not(:focus-within) .temp-head strong,
  body.in-editor .sidebar:not(:hover):not(:focus-within) .temp-card .btn span,
  body.in-editor .sidebar:not(:hover):not(:focus-within) .temp-card .btn-ghost { display: none; }

  body.in-editor .sidebar:not(:hover):not(:focus-within) .sidebar-brand { justify-content: center; padding: 0; }
  body.in-editor .sidebar:not(:hover):not(:focus-within) .btn-create { justify-content: center; padding: 10px 0; }
  body.in-editor .sidebar:not(:hover):not(:focus-within) .nav-link { justify-content: center; padding: 8px 0; }
  body.in-editor .sidebar:not(:hover):not(:focus-within) .account { justify-content: center; padding: 6px 0; }
  body.in-editor .sidebar:not(:hover):not(:focus-within) .temp-card { padding: 8px 4px; justify-items: center; }
  body.in-editor .sidebar:not(:hover):not(:focus-within) .temp-head { justify-content: center; }
  body.in-editor .sidebar:not(:hover):not(:focus-within) .temp-card .btn { padding: 8px 0; width: 100%; }
  /* Au-delà de six, les récents déborderaient du rail. */
  body.in-editor .sidebar:not(:hover):not(:focus-within) .nav-recent:nth-of-type(n+7) { display: none; }
  body.in-editor .sidebar:not(:hover):not(:focus-within) .nav-recents { margin-top: 10px; border-top: 1px solid var(--line-soft); padding-top: 10px; }

  body.in-editor .sidebar-create { padding: 4px 12px 10px; }
  body.in-editor .sidebar-nav { padding: 2px 12px 8px; }
  body.in-editor .sidebar-foot { padding: 10px; }

  .app { transition: grid-template-columns .16s ease-out; }
}

/* ---- boutons ---- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--fg); font-weight: 550; cursor: pointer;
  white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: #4069e8; border-color: #4069e8; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-ghost { background: none; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  padding: 6px; border: 0; border-radius: 8px; background: none; color: var(--fg-muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

/* ---- champs ---- */

.field { display: grid; gap: 5px; margin-bottom: 13px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--fg-muted); }
.input, .select, textarea.input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--fg);
}
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-error { color: var(--danger); font-size: 12.5px; }
.hint { color: var(--fg-faint); font-size: 12.5px; }

/* ---- menus contextuels ---- */

.menu {
  position: fixed; z-index: 120; min-width: 208px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-3); animation: menu-in .1s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border: 0; border-radius: 8px; background: none; color: var(--fg); cursor: pointer; text-align: left;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); text-decoration: none; }
.menu-item[disabled] { opacity: .45; cursor: default; }
.menu-item.danger { color: var(--danger); }
.menu-item svg { width: 17px; height: 17px; flex: none; color: var(--fg-muted); }
.menu-item.danger svg { color: var(--danger); }
.menu-item .file-icon { width: 22px; height: 22px; border-radius: 6px; }
.menu-sep { height: 1px; margin: 5px 4px; background: var(--line-soft); }
.menu-label { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-faint); }
.menu-item small { margin-left: auto; color: var(--fg-faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }

/* ---- fenêtres modales ---- */

.overlay { position: fixed; inset: 0; z-index: 110; background: var(--overlay); display: grid; place-items: center; padding: 20px; }
.modal {
  width: min(560px, 100%); max-height: 88dvh; overflow: auto;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
  animation: modal-in .14s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.99); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 8px; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 8px 20px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px 18px; border-top: 1px solid var(--line-soft); }
.modal-wide { width: min(760px, 100%); }

/* ---- modal de création plein écran ---- */

.create-modal {
  position: fixed; inset: 0; z-index: 150; background: var(--overlay);
  display: grid; place-items: center; padding: 20px; animation: modal-in .14s ease-out;
}
.create-sheet {
  width: min(880px, 100%); max-height: 92dvh; overflow: auto;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-3);
}
.create-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 26px 6px; }
.create-head h2 { margin: 0 0 3px; font-size: 22px; letter-spacing: -.02em; }
.create-head p { margin: 0; }
.create-body { padding: 8px 26px 26px; }
.create-section { margin: 18px 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-faint); }
.create-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.create-grid.compact { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.create-card {
  display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--fg); cursor: pointer;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.create-card:hover, .create-card:focus-visible { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-2); outline: none; }
.create-card-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.create-card-icon svg { width: 22px; height: 22px; }
.create-card-body { display: grid; gap: 2px; min-width: 0; }
.create-card-title { font-weight: 600; font-size: 14.5px; }
.create-card-desc { font-size: 12.5px; color: var(--fg-muted); line-height: 1.4; }
@media (max-width: 640px) { .create-sheet { border-radius: 14px; } .create-body { padding: 8px 16px 20px; } .create-head { padding: 18px 16px 6px; } }

/* ---- notifications ---- */

.toasts { position: fixed; z-index: 300; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 15px; pointer-events: auto;
  background: #111827; color: #fff; border-radius: 10px; box-shadow: var(--shadow-3);
  font-size: 13.5px; animation: toast-in .16s ease-out;
}
@media (prefers-color-scheme: dark) { .toast { background: #e8ecf6; color: #111827; } }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: #15803d; color: #fff; }
.toast button { border: 0; background: none; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---- barre supérieure ---- */

.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.topbar .spacer { flex: 1; }
.topbar .burger, .editor-top .burger { display: none; }

.search {
  position: relative; flex: 1; max-width: 460px;
}
.search input {
  width: 100%; padding: 8px 12px 8px 34px; border: 1px solid transparent; border-radius: 9px;
  background: var(--surface-2); color: var(--fg);
}
.search input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--fg-faint); }

/* ---- drive ---- */

.page { padding: 22px 26px 80px; max-width: 1320px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.crumbs { display: flex; align-items: center; gap: 4px; color: var(--fg-muted); font-size: 13.5px; flex-wrap: wrap; }
.crumbs a { color: var(--fg-muted); }
.crumbs .sep { color: var(--fg-faint); }
.crumbs b { color: var(--fg); font-weight: 600; }

.home-sub { margin: -10px 0 20px; }
.home-section { margin: 26px 0 12px; font-size: 15px; }
.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; margin-bottom: 26px; }
.template {
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer;
  padding: 0; overflow: hidden; text-align: left; transition: border-color .12s, transform .12s, box-shadow .12s;
}
.template:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.template-preview { height: 96px; display: grid; place-items: center; background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }
.template-preview .file-icon { width: 40px; height: 40px; border-radius: 11px; }
.template-name { display: block; padding: 9px 11px; font-size: 13px; font-weight: 550; }

.toolbar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 11px; cursor: pointer; color: var(--fg-muted); font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.files { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.files-head, .file-row {
  display: grid; grid-template-columns: 1fr 150px 110px 40px; align-items: center; gap: 12px; padding: 0 14px;
}
.files-head { height: 38px; border-bottom: 1px solid var(--line-soft); color: var(--fg-faint); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.files-head button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font: inherit; text-align: left; }
.file-row { height: 50px; border-bottom: 1px solid var(--line-soft); cursor: pointer; color: var(--fg); }
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: var(--surface-2); text-decoration: none; }
.file-row:focus-visible { background: var(--surface-2); }
.file-name { display: flex; align-items: center; gap: 11px; min-width: 0; font-weight: 550; }
.file-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name .file-icon { width: 28px; height: 28px; border-radius: 8px; }
.file-meta { color: var(--fg-muted); font-size: 13px; }
.file-badge { font-size: 11px; padding: 2px 7px; border-radius: 20px; background: var(--surface-3); color: var(--fg-muted); font-weight: 600; }
.star { color: var(--fg-faint); }
.star.on { color: #f59f00; fill: #f59f00; }

.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.card {
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden;
  cursor: pointer; color: var(--fg); display: block; transition: border-color .12s, box-shadow .12s;
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow-2); text-decoration: none; }
.card-preview { height: 118px; background: var(--surface-2); display: grid; place-items: center; border-bottom: 1px solid var(--line-soft); }
.card-preview .file-icon { width: 44px; height: 44px; border-radius: 12px; }
.card-body { padding: 10px 12px; display: flex; align-items: center; gap: 9px; }
.card-body .file-icon { width: 22px; height: 22px; border-radius: 6px; }
.card-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-sub { color: var(--fg-faint); font-size: 12px; }

.empty { text-align: center; padding: 60px 20px; color: var(--fg-muted); }
.empty h3 { margin: 14px 0 6px; color: var(--fg); font-size: 17px; }
.empty-mark { width: 54px; height: 54px; margin: 0 auto; color: var(--fg-faint); }

/* ---- éditeurs : ossature commune ----
   Disposition reprise des suites bureautiques : titre et barre de menus empilés à gauche,
   actions à droite, puis la barre d'outils en pilule sur toute la largeur. */

.editor { display: flex; flex-direction: row; height: 100%; min-height: 0; background: var(--editor-bg); }
.editor-column { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.editor-top { display: flex; align-items: flex-start; gap: 8px; padding: 8px 14px 4px; background: var(--surface); }
.editor-home { display: grid; place-items: center; width: 36px; height: 36px; margin-top: 2px; flex: none; }
.editor-home .file-icon { width: 30px; height: 30px; border-radius: 8px; }
.editor-home:hover { text-decoration: none; opacity: .85; }

.editor-identity { min-width: 0; flex: 1; display: grid; gap: 1px; }
.editor-titlerow { display: flex; align-items: center; gap: 2px; min-width: 0; }
.editor-menurow { display: flex; align-items: center; gap: 12px; min-width: 0; }

.doc-title {
  border: 1px solid transparent; border-radius: 6px; padding: 2px 7px;
  font-size: 17px; font-weight: 500; letter-spacing: -.01em;
  background: none; min-width: 60px; max-width: 46ch; text-overflow: ellipsis;
}
.doc-title:hover { border-color: var(--line); }
.doc-title:focus { outline: none; border-color: var(--accent); background: var(--surface); }

.star-btn { width: 28px; height: 28px; padding: 5px; }
.star-btn.on { color: #f59f00; }
.star-btn.on svg { fill: #f59f00; }

.editor-actions { display: flex; align-items: center; gap: 8px; margin-top: 2px; flex: none; }
.btn-share {
  background: var(--accent-soft); border-color: transparent; color: var(--accent);
  border-radius: 20px; padding: 7px 16px; font-weight: 600;
}
.btn-share:hover { background: var(--accent-line); }
.btn-share svg { width: 16px; height: 16px; }

.doc-sub { font-size: 11.5px; color: var(--fg-faint); display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--fg-faint); flex: none; }
.dot.live { background: #16a34a; }
.dot.off { background: #dc2626; }
.dot.sync { background: #f59f00; }

.peers { display: flex; align-items: center; }
.peers .avatar { margin-left: -7px; border: 2px solid var(--surface); }
.peers .avatar:first-child { margin-left: 0; }

/* ---- barre de menus ---- */

.editor-menus { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.editor-menus::-webkit-scrollbar { display: none; }
.menubar { display: flex; gap: 1px; }
.menubar-item {
  border: 0; background: none; color: var(--fg); cursor: pointer;
  padding: 3px 9px; border-radius: 6px; font-size: 13.5px; white-space: nowrap;
}
.menubar-item:hover { background: var(--surface-2); }
.menubar-item.open { background: var(--surface-3); }

/* ---- barre d'outils ---- */

.toolbar-shell { padding: 2px 12px 8px; background: var(--surface); }
.toolbar {
  display: flex; align-items: center; gap: 2px;
  padding: 3px 8px; border-radius: 22px; background: var(--surface-2);
  overflow-x: auto; scrollbar-width: thin;
}
.toolbar::-webkit-scrollbar { height: 5px; }
.toolbar .icon-btn { width: 30px; height: 30px; border-radius: 50%; }
.toolbar .icon-btn:hover { background: var(--surface-3); }
.toolbar .icon-btn[aria-pressed="true"] { background: var(--accent-line); color: var(--accent); }
.tool-sep { width: 1px; height: 20px; background: var(--line); margin: 0 5px; flex: none; }
.tool-select {
  height: 28px; padding: 0 6px; border: 1px solid transparent; border-radius: 6px;
  background: none; color: var(--fg); cursor: pointer; font-size: 13.5px;
}
.tool-select:hover { background: var(--surface-3); }
.color-swatch { width: 15px; height: 15px; border-radius: 4px; border: 1px solid var(--line); }

/* Sélecteur de taille avec incréments, comme dans les traitements de texte usuels. */
.size-stepper { display: flex; align-items: center; gap: 1px; flex: none; }
.size-stepper input {
  width: 34px; height: 26px; text-align: center; border: 1px solid var(--line);
  border-radius: 6px; background: var(--surface); font-size: 13px;
  -moz-appearance: textfield;
}
.size-stepper input::-webkit-outer-spin-button,
.size-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.size-stepper .icon-btn { width: 24px; height: 24px; }
.size-stepper .icon-btn svg { width: 14px; height: 14px; }

.editor-row { flex: 1; display: flex; min-height: 0; }
.editor-body { flex: 1; overflow: auto; min-height: 0; min-width: 0; position: relative; }

/* ---- volet d'assistant IA ---- */

.btn-ai {
  border-radius: 20px; padding: 7px 13px; font-weight: 600; gap: 6px;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff); border-color: transparent; color: #4338ca;
}
.btn-ai:hover { background: linear-gradient(135deg, #e0e7ff, #ede9fe); }
.btn-ai[aria-pressed="true"] { background: #4338ca; color: #fff; }
.btn-ai svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
@media (prefers-color-scheme: dark) {
  .btn-ai { background: #1e1b4b; color: #c7d2fe; }
  .btn-ai:hover { background: #312e81; }
}

.ai-panel {
  display: none; position: relative; flex: none; width: 380px; min-width: 300px; max-width: 720px;
  flex-direction: column; background: var(--surface); border-left: 1px solid var(--line);
  min-height: 0; height: 100%; align-self: stretch;
}
.ai-head { min-height: 56px; }
.ai-panel.open { display: flex; }
.ai-resize { position: absolute; left: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 5; }
.ai-resize:hover { background: var(--accent-line); }

.ai-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line-soft); }
.ai-title { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; }
.ai-title svg { fill: #6366f1; stroke: none; }
.ai-head-actions { display: flex; gap: 2px; }

.ai-thread { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.ai-empty { text-align: center; padding: 28px 10px 10px; color: var(--fg-muted); display: grid; gap: 8px; justify-items: center; }
.ai-empty svg { fill: #6366f1; stroke: none; }
.ai-empty h3 { margin: 4px 0 0; color: var(--fg); font-size: 15px; }
.ai-empty p { margin: 0 0 8px; font-size: 13px; line-height: 1.5; max-width: 30ch; }

.ai-msg { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.ai-msg.user { align-items: flex-end; }
.ai-msg.user .ai-bubble { background: var(--accent); color: #fff; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.ai-msg.assistant .ai-bubble { background: var(--surface-2); border-radius: 4px 14px 14px 14px; }
.ai-bubble { padding: 9px 12px; font-size: 13.5px; line-height: 1.55; max-width: 92%; word-break: break-word; }
.ai-bubble:empty { display: none; }
.ai-bubble p { margin: 0 0 .5em; }
.ai-bubble p:last-child { margin-bottom: 0; }
.ai-bubble ul, .ai-bubble ol { margin: .3em 0 .5em; padding-left: 1.3em; }
.ai-bubble h4, .ai-bubble h5, .ai-bubble h6 { margin: .5em 0 .25em; font-size: 1em; }
.ai-bubble code { font: .88em var(--mono); background: var(--surface-3); padding: .1em .3em; border-radius: 4px; }
.ai-bubble pre { font: 12px/1.45 var(--mono); background: var(--surface-3); padding: 8px 10px; border-radius: 8px; overflow-x: auto; white-space: pre; }
.ai-cursor { display: inline-block; width: 7px; height: 14px; margin-left: 2px; background: var(--fg-muted); vertical-align: -2px; animation: ai-blink 1s steps(2) infinite; }
@keyframes ai-blink { 50% { opacity: 0; } }

.ai-tools { display: flex; flex-direction: column; gap: 3px; }
.ai-tools:empty { display: none; }
.ai-tool {
  display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--fg-muted);
  padding: 4px 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line-soft);
  animation: menu-in .12s ease-out;
}
.ai-tool-dot { width: 7px; height: 7px; border-radius: 50%; background: #f59f00; flex: none; animation: ai-blink 1s steps(2) infinite; }
.ai-tool.done .ai-tool-dot { background: #16a34a; animation: none; }
.ai-tool.error .ai-tool-dot { background: #dc2626; animation: none; }
.ai-tool-name { font-weight: 600; color: var(--fg); }
.ai-tool-detail { margin-left: auto; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46%; }
.ai-note { color: var(--fg-faint); font-size: 12.5px; font-style: italic; }
.ai-error { color: var(--danger); font-size: 13px; }
.ai-revert {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-top: 2px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg-muted); border-radius: 16px;
  padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.ai-revert:hover { background: var(--surface-2); color: var(--fg); }
.ai-revert:disabled { opacity: .55; cursor: default; }
.ai-revert svg { width: 13px; height: 13px; }

.ai-composer { border-top: 1px solid var(--line-soft); padding: 8px 12px 10px; }
.ai-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.ai-quick:empty { display: none; }
.ai-chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--fg-muted); border-radius: 14px;
  padding: 3px 10px; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.ai-chip:hover { border-color: var(--accent); color: var(--accent); }
.ai-inputrow { display: flex; align-items: flex-end; gap: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 12px; background: var(--surface); }
.ai-inputrow:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ai-input { flex: 1; border: 0; background: none; resize: none; outline: none; font: inherit; font-size: 13.5px; line-height: 1.45; max-height: 180px; padding: 3px 0; }
.ai-send { width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none; }
.ai-send svg { width: 15px; height: 15px; transform: rotate(90deg); }
.ai-send.busy { background: var(--fg-muted); }
.ai-send.busy svg { transform: none; }
.ai-send:disabled { opacity: .45; cursor: not-allowed; }
.ai-hint { font-size: 11px; color: var(--fg-faint); margin-top: 6px; }

@media (max-width: 900px) {
  .ai-shell.open .ai-panel { position: fixed; inset: 0 0 0 auto; width: min(100vw, 420px) !important; z-index: 95; box-shadow: var(--shadow-3); }
  .ai-rail { width: 40px; }
  .ai-rail-label { display: none; }
  .btn-ai span { display: none; }
  .btn-ai { padding: 7px 9px; }
}

/* ---- règle ---- */

.ruler {
  position: sticky; top: 0; z-index: 20; height: 24px; padding-top: 6px;
  background: var(--editor-bg); width: 100%; overflow: hidden; display: grid; justify-items: center;
}
.ruler-inner { position: relative; height: 100%; background: var(--surface); border-radius: 0 0 3px 3px; }
.ruler-tick { position: absolute; top: 12px; width: 1px; height: 5px; background: var(--fg-faint); opacity: .6; }
.ruler-num { position: absolute; top: 2px; font-size: 9px; color: var(--fg-faint); transform: translateX(-50%); }
.ruler-margin { position: absolute; top: 0; bottom: 0; background: var(--surface-3); opacity: .55; }

/* ---- raccourcis (fenêtre d'aide) ---- */

.shortcuts { display: grid; gap: 2px; }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.shortcut-row:last-child { border-bottom: 0; }
.shortcut-row kbd {
  font: 12px var(--mono); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 2px 7px; white-space: nowrap; color: var(--fg-muted);
}

/* ---- traitement de texte ---- */

.paper-wrap { padding: 0 16px 120px; display: grid; grid-template-columns: minmax(0, 816px) auto; gap: 20px; justify-content: center; align-items: start; }
.paper-column { display: grid; justify-items: center; min-width: 0; width: 100%; }
.editor-body { container-type: inline-size; }
/* Le volet d'assistant réduit la place : le plan disparaît avant que la page ne déborde. */
@container (max-width: 1120px) { .doc-outline { display: none; } }
@container (max-width: 880px) { .paper { padding: 48px 40px; } }
.paper {
  width: 816px; max-width: 100%; min-height: 1056px; padding: 72px; margin-top: 20px;
  background: var(--surface); border-radius: 4px; box-shadow: var(--shadow-2);
  position: relative;
}
@media (prefers-color-scheme: dark) { .paper { background: #101828; } }
.doc-content { outline: none; font-size: 16px; line-height: 1.65; }
.doc-content > * { margin: 0 0 10px; }
.doc-content h1 { font-size: 30px; line-height: 1.22; margin: 22px 0 10px; font-weight: 680; letter-spacing: -.02em; }
.doc-content h2 { font-size: 23px; line-height: 1.28; margin: 20px 0 8px; font-weight: 660; letter-spacing: -.01em; }
.doc-content h3 { font-size: 19px; margin: 18px 0 7px; font-weight: 640; }
.doc-content h4 { font-size: 16.5px; margin: 16px 0 6px; font-weight: 640; }
.doc-content h1:first-child, .doc-content h2:first-child { margin-top: 0; }
.doc-content .b-quote { border-left: 3px solid var(--line); padding: 2px 0 2px 15px; color: var(--fg-muted); font-style: italic; }
.doc-content .b-code {
  font-family: var(--mono); font-size: 13.5px; background: var(--surface-2);
  padding: 11px 14px; border-radius: 8px; white-space: pre-wrap; line-height: 1.5;
}
.doc-content .b-hr { border-top: 1px solid var(--line); height: 0; margin: 20px 0; }
.doc-content .b-pagebreak { border-top: 2px dashed var(--line); margin: 26px 0; position: relative; }
.doc-content .b-pagebreak::after {
  content: "Saut de page"; position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  background: var(--surface); padding: 0 8px; font-size: 10.5px; color: var(--fg-faint);
}
.doc-content .b-li { display: flex; gap: 9px; align-items: baseline; }
.doc-content .b-li .marker { flex: none; color: var(--fg-muted); user-select: none; min-width: 17px; }
.doc-content .b-li .marker.check { cursor: pointer; }
.doc-content .b-todo.done .b-text { color: var(--fg-faint); text-decoration: line-through; }
.doc-content .b-text { flex: 1; min-width: 0; }
.doc-content .b-img { text-align: center; }
.doc-content .b-img img { max-width: 100%; border-radius: 6px; }
.doc-content code { font-family: var(--mono); font-size: .89em; background: var(--surface-2); padding: .1em .32em; border-radius: 4px; }
.doc-content a { text-decoration: underline; }
.doc-content [data-empty]::before { content: attr(data-empty); color: var(--fg-faint); pointer-events: none; position: absolute; }

/* ---- tableaux dans un document ---- */

.doc-content .b-table {
  border-collapse: collapse; width: 100%; margin: 12px 0; table-layout: fixed;
}
.doc-content .b-table td, .doc-content .b-table th {
  border: 1px solid var(--line); padding: 6px 9px; vertical-align: top; min-width: 40px;
}
.doc-content .b-table th { background: var(--surface-2); font-weight: 600; text-align: left; }
.doc-content .b-table p { margin: 0; }
.doc-content .b-table td > *:last-child, .doc-content .b-table th > *:last-child { margin-bottom: 0; }

.table-picker { padding: 6px 8px 8px; }
.table-picker-grid { display: grid; grid-template-columns: repeat(8, 18px); gap: 2px; }
.table-picker-cell { width: 18px; height: 18px; border: 1px solid var(--line); border-radius: 2px; cursor: pointer; }
.table-picker-cell.on { background: var(--accent-soft); border-color: var(--accent); }
.table-picker-label { text-align: center; font-size: 12px; color: var(--fg-muted); padding-top: 7px; }

/* ---- image : sélection, poignée, zone de dépôt ---- */

.doc-content .b-img { position: relative; display: block; }
.doc-content .b-img.selected img { outline: 2px solid var(--accent); outline-offset: 2px; }
.doc-content .b-img .img-handle {
  position: absolute; right: 0; bottom: 4px; width: 12px; height: 12px;
  background: var(--surface); border: 2px solid var(--accent); border-radius: 3px;
  cursor: nwse-resize; opacity: 0; transition: opacity .12s;
}
.doc-content .b-img:hover .img-handle, .doc-content .b-img.selected .img-handle { opacity: 1; }

.drop-zone {
  position: absolute; inset: 12px; z-index: 30; display: none;
  align-items: center; justify-content: center; gap: 10px; flex-direction: column;
  border: 2px dashed var(--accent); border-radius: 12px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  font-weight: 600; pointer-events: none;
}
.drop-zone.on { display: flex; animation: drop-in .14s ease-out; }
.drop-zone svg { width: 34px; height: 34px; }
@keyframes drop-in { from { opacity: 0; transform: scale(.99); } }

.remote-caret { position: absolute; width: 2px; pointer-events: none; z-index: 5; transition: transform .08s linear; }
.remote-caret::after {
  content: attr(data-name); position: absolute; top: -17px; left: -1px; white-space: nowrap;
  font-size: 10.5px; font-weight: 650; color: #fff; padding: 1px 5px; border-radius: 4px 4px 4px 0;
  background: inherit;
}

.doc-outline { position: sticky; top: 30px; align-self: start; width: 208px; padding: 22px 12px; font-size: 13px; }
.doc-outline a { display: block; padding: 3px 8px; border-radius: 6px; color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-outline a:hover { background: var(--surface-2); color: var(--fg); text-decoration: none; }
.doc-outline .lvl2 { padding-left: 18px; }
.doc-outline .lvl3 { padding-left: 30px; font-size: 12.5px; }

.wordcount { position: absolute; right: 18px; bottom: 16px; padding: 5px 11px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); font-size: 12px; color: var(--fg-muted); }

/* ---- tableur ---- */

.sheet-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.formula-bar { display: flex; align-items: center; gap: 8px; padding: 5px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.cell-ref {
  width: 88px; flex: none; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); font-family: var(--mono); font-size: 12.5px; text-align: center;
}
.formula-input {
  flex: 1; padding: 5px 9px; border: 1px solid transparent; border-radius: 7px;
  background: var(--surface-2); font-family: var(--mono); font-size: 13px;
}
.formula-input:focus { outline: none; background: var(--surface); border-color: var(--accent); }

.grid-scroll { flex: 1; overflow: auto; position: relative; background: var(--surface); min-height: 0; }
.grid-canvas { position: relative; }
.gcell, .ghead {
  position: absolute; box-sizing: border-box; overflow: hidden; white-space: nowrap;
  border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  padding: 0 5px; display: flex; align-items: center; font-size: 13px;
}
.ghead {
  background: var(--surface-2); color: var(--fg-muted); font-size: 11.5px; font-weight: 620;
  justify-content: center; z-index: 3; user-select: none; border-color: var(--line);
}
.ghead.col { top: 0; position: sticky; }
.ghead.sel { background: var(--accent-soft); color: var(--accent); }
.ghead.resizer { cursor: col-resize; }
.gcell.num { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.gcell.center { justify-content: center; }
.gcell.err { color: var(--danger); }
.gcell.formula-cell::after { content: ""; position: absolute; top: 1px; right: 1px; width: 0; height: 0; border-top: 4px solid var(--accent); border-left: 4px solid transparent; }

.grid-corner { position: sticky; top: 0; left: 0; z-index: 5; }
.sel-box { position: absolute; border: 2px solid var(--accent); pointer-events: none; z-index: 4; border-radius: 2px; }
.sel-fill { position: absolute; width: 7px; height: 7px; background: var(--accent); border: 1px solid var(--surface); pointer-events: auto; cursor: crosshair; right: -4px; bottom: -4px; }
.sel-range { position: absolute; background: color-mix(in srgb, var(--accent) 12%, transparent); pointer-events: none; z-index: 2; }
.peer-cell { position: absolute; border: 2px solid; pointer-events: none; z-index: 4; border-radius: 2px; }
.peer-cell::after { content: attr(data-name); position: absolute; top: -16px; left: -2px; font-size: 10px; font-weight: 650; color: #fff; background: inherit; padding: 0 4px; border-radius: 3px; white-space: nowrap; }
.cell-editor {
  position: absolute; z-index: 8; border: 2px solid var(--accent); border-radius: 2px; padding: 0 4px;
  background: var(--surface); font-size: 13px; outline: none; min-width: 60px; box-shadow: var(--shadow-2);
}

.tabs { display: flex; align-items: center; gap: 4px; padding: 5px 10px; background: var(--surface); border-top: 1px solid var(--line); overflow-x: auto; }
.tab { display: flex; align-items: center; gap: 6px; padding: 5px 12px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--fg-muted); font-size: 13px; white-space: nowrap; }
.tab:hover { background: var(--surface-2); }
.tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 620; }

/* ---- présentation ---- */

.slides-wrap { display: grid; grid-template-columns: 178px 1fr; height: 100%; min-height: 0; }
.slide-list { overflow-y: auto; padding: 12px 10px; background: var(--surface); border-right: 1px solid var(--line); display: grid; gap: 10px; align-content: start; }
.slide-thumb { position: relative; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--surface-2); aspect-ratio: 16/9; }
.slide-thumb[aria-current="true"] { border-color: var(--accent); }
.slide-row { display: grid; grid-template-columns: 18px 1fr; align-items: start; gap: 4px; }
.slide-row .num { font-size: 11px; color: var(--fg-faint); text-align: right; padding-top: 4px; font-variant-numeric: tabular-nums; }
.slide-list > .btn { grid-column: 1 / -1; }
.slide-stage-wrap { overflow: auto; display: grid; place-items: center; padding: 24px; background: var(--surface-3); min-height: 0; }
.slide-stage { position: relative; background: #fff; box-shadow: var(--shadow-2); flex: none; }
.slide-el { position: absolute; box-sizing: border-box; }
.slide-el.selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.slide-el .txt { width: 100%; height: 100%; display: flex; flex-direction: column; padding: 4px; outline: none; white-space: pre-wrap; word-break: break-word; overflow: hidden; }
.handle { position: absolute; width: 9px; height: 9px; background: var(--surface); border: 1.5px solid var(--accent); border-radius: 2px; z-index: 10; }
.handle.rot { border-radius: 50%; cursor: grab; }
.present-layer { position: fixed; inset: 0; z-index: 400; background: #000; display: grid; place-items: center; }
.present-stage { position: relative; background: #fff; }
.present-hud { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; background: rgba(20,24,34,.86); color: #fff; padding: 7px 12px; border-radius: 22px; font-size: 13px; opacity: .25; transition: opacity .18s; }
.present-hud:hover { opacity: 1; }
.present-hud button { background: none; border: 0; color: #fff; cursor: pointer; padding: 3px 7px; border-radius: 6px; }
.present-hud button:hover { background: rgba(255,255,255,.16); }

/* ---- volet de notes du présentateur ---- */

.slide-column { display: grid; grid-template-rows: 1fr auto; min-height: 0; min-width: 0; }
.notes-pane { border-top: 1px solid var(--line); background: var(--surface); padding: 8px 16px 12px; min-height: 84px; max-height: 32%; overflow: auto; }
.notes-input {
  min-height: 46px; outline: none; font-size: 13.5px; line-height: 1.5; color: var(--fg);
  white-space: pre-wrap; border-radius: 8px; padding: 6px 8px;
}
.notes-input:focus { background: var(--surface-2); }
.notes-input.empty::before { content: attr(data-placeholder); color: var(--fg-faint); }

.btn-newslide { background: var(--surface); border-color: var(--line); font-weight: 600; border-radius: 18px; }
.btn-newslide:hover { background: var(--surface-3); }
.btn-newslide svg { width: 17px; height: 17px; }

/* ---- constructeur de formulaire ---- */

.form-editor { min-height: 100%; padding: 22px 16px 120px; }
.form-canvas { max-width: 760px; margin: 0 auto; display: grid; gap: 12px; }
.form-canvas.wide { max-width: 1040px; }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; position: relative; }
.form-card h3 { margin: 0 0 12px; font-size: 15px; }
.form-head { border-top: 8px solid var(--accent); }
.form-title-input { width: 100%; border: 0 !important; border-bottom: 1px solid transparent !important; font-size: 26px; font-weight: 600; background: none; padding: 4px 0; outline: none; }
.form-title-input:focus { border-bottom-color: var(--accent) !important; }
.form-desc-input { width: 100%; border: 0 !important; border-bottom: 1px solid transparent !important; background: none; resize: none; padding: 4px 0; outline: none; color: var(--fg-muted); font: inherit; }
.form-desc-input:focus { border-bottom-color: var(--accent) !important; }
.form-input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 6px 2px; outline: none; font: inherit; }
.form-input:focus { border-bottom: 2px solid var(--accent); }
textarea.form-input { resize: none; }
.form-q { border-left: 4px solid transparent; transition: box-shadow .12s, border-color .12s; cursor: default; }
.form-q.focused { border-left-color: var(--accent); box-shadow: var(--shadow-2); }
.form-q.drop { outline: 2px dashed var(--accent); }
.form-q.section { border-top: 6px solid var(--accent); background: var(--surface-2); }
.form-q-head { display: flex; align-items: center; gap: 12px; }
.form-q-num { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); color: var(--fg-muted); font-size: 12px; display: grid; place-items: center; flex: none; }
.form-q-title { flex: 1; font-size: 16px; font-weight: 500; }
.form-type { width: 200px; flex: none; }
.form-q-desc { font-size: 13px; margin-top: 4px; }
.form-options { margin-top: 10px; display: grid; gap: 4px; }
.form-option { display: flex; align-items: center; gap: 10px; }
.form-option-mark { width: 20px; color: var(--fg-faint); text-align: center; flex: none; }
.form-option .form-input { flex: 1; }
.form-option.add, .form-option.other { color: var(--fg-muted); font-size: 13.5px; padding: 4px 0; }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.link-btn:hover { text-decoration: underline; }
.form-scale { display: grid; gap: 8px; margin-top: 10px; }
.form-scale-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.form-scale-labels { display: flex; align-items: center; gap: 8px; color: var(--fg-muted); font-size: 13px; }
.form-scale-labels .form-input { max-width: 240px; }
.form-stars { color: #f59f00; letter-spacing: 3px; font-size: 20px; }
.form-preview-input { margin-top: 10px; padding: 8px 2px; border-bottom: 1px dotted var(--line); color: var(--fg-faint); font-size: 13.5px; max-width: 320px; }
.form-preview-input.long { max-width: 100%; }
.form-q-foot { display: flex; align-items: center; gap: 4px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.form-q-foot .tool-sep { flex: none; }
.form-toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--fg-muted); cursor: pointer; margin-left: 4px; }
.form-toggle input { accent-color: var(--accent); }
.form-add { display: flex; justify-content: center; padding: 6px 0 20px; }
.form-tabs button { padding: 5px 13px; }
.form-rule { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.form-rule .select, .form-rule .input { width: auto; padding: 5px 8px; }
.form-setting { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; cursor: pointer; }
.form-setting input { margin-top: 3px; accent-color: var(--accent); }
.form-theme-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.form-theme-row label { width: 90px; color: var(--fg-muted); font-size: 13px; }
.form-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.form-swatch.on { box-shadow: 0 0 0 2px var(--accent); }

.form-resp-head { display: flex; align-items: center; gap: 14px; }
.form-resp-count { font-size: 30px; font-weight: 650; letter-spacing: -.02em; }
.form-resp-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-resp-q { font-size: 15px; margin: 0 0 4px; }
.form-bars { display: grid; gap: 6px; margin-top: 10px; }
.form-bar { display: grid; grid-template-columns: minmax(80px, 200px) 1fr 90px; align-items: center; gap: 10px; font-size: 13px; }
.form-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-bar-track { height: 10px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.form-bar-fill { display: block; height: 100%; border-radius: 5px; background: var(--accent); min-width: 2px; }
.form-bar-n { color: var(--fg-muted); font-variant-numeric: tabular-nums; text-align: right; }
.form-samples { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--fg-muted); }
.form-samples li { margin: 3px 0; }
.form-table-wrap { overflow-x: auto; margin-top: 8px; }
.form-table { border-collapse: collapse; font-size: 13px; width: 100%; }
.form-table th, .form-table td { border-bottom: 1px solid var(--line-soft); padding: 7px 9px; text-align: left; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.form-table th { color: var(--fg-muted); font-weight: 600; font-size: 12px; }

/* ---- rendu public ---- */

body.in-public .sidebar, body.in-public .sidebar-scrim, body.in-public .verify-banner { display: none !important; }
body.in-public .app { grid-template-columns: 1fr; }
.pub-form { min-height: 100%; padding: 32px 16px 60px; --accent: #4f7cff; color: #111827; }
.pub-form.dark { color: #e5e7eb; }
.pub-wrap { max-width: 680px; margin: 0 auto; }
.pub-card { background: #fff; border-radius: 14px; box-shadow: 0 2px 12px rgba(16,24,40,.08); padding: 26px 30px 22px; border-top: 8px solid var(--accent); }
.pub-form.dark .pub-card { background: #172033; }
.pub-progress { height: 5px; background: rgba(0,0,0,.08); border-radius: 3px; overflow: hidden; margin: -8px 0 18px; }
.pub-progress span { display: block; height: 100%; background: var(--accent); transition: width .25s; }
.pub-head h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.02em; }
.pub-desc { margin: 0 0 8px; opacity: .75; line-height: 1.5; white-space: pre-wrap; }
.pub-q { padding: 16px 0; border-top: 1px solid rgba(0,0,0,.06); }
.pub-form.dark .pub-q { border-top-color: rgba(255,255,255,.08); }
.pub-q.has-error .pub-input, .pub-q.has-error .pub-choices { outline: 2px solid #dc2626; outline-offset: 2px; border-radius: 6px; }
.pub-label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.pub-req { color: #dc2626; }
.pub-help { font-size: 13px; opacity: .7; margin-bottom: 8px; }
.pub-input { width: 100%; max-width: 480px; padding: 9px 11px; border: 1px solid #d0d5dd; border-radius: 8px; font: inherit; background: #fff; color: #111827; }
.pub-input.inline { width: auto; max-width: 240px; padding: 5px 8px; }
textarea.pub-input { max-width: 100%; resize: vertical; }
.pub-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.pub-choices { display: grid; gap: 6px; }
.pub-choices.row { grid-auto-flow: column; justify-content: start; gap: 18px; }
.pub-choice { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 5px 0; }
.pub-choice input[type=radio], .pub-choice input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.pub-scale { display: flex; gap: 6px; flex-wrap: wrap; }
.pub-scale-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid #d0d5dd; background: #fff; color: #111827; cursor: pointer; font-weight: 600; }
.pub-scale-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pub-scale-labels { display: flex; justify-content: space-between; font-size: 12px; opacity: .7; margin-top: 6px; max-width: 480px; }
.pub-stars { display: flex; gap: 4px; }
.pub-star { border: 0; background: none; font-size: 30px; color: #d0d5dd; cursor: pointer; padding: 0 2px; line-height: 1; }
.pub-star.on { color: #f59f00; }
.pub-error { color: #dc2626; font-size: 12.5px; min-height: 16px; margin-top: 4px; }
.pub-section { padding: 6px 0 4px; }
.pub-section h2 { margin: 0 0 4px; font-size: 20px; }
.pub-statement { padding: 12px 14px; background: rgba(0,0,0,.04); border-radius: 8px; margin: 10px 0; font-size: 14px; }
.pub-statement p { margin: 4px 0 0; white-space: pre-wrap; }
.pub-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; gap: 10px; }
.pub-primary { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; padding: 10px 22px; }
.pub-pagenum { text-align: center; margin-top: 10px; }
.pub-thanks { text-align: center; padding: 20px 0; display: grid; gap: 10px; justify-items: center; }
.pub-check { width: 54px; height: 54px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; padding: 13px; }
.pub-thanks h2 { margin: 0; }
.pub-summary { text-align: left; width: 100%; margin-top: 12px; display: grid; gap: 14px; }
.pub-summary .form-bar-fill { background: var(--accent); }
.pub-foot { text-align: center; margin-top: 18px; font-size: 12px; opacity: .6; }
.pub-foot a { color: inherit; }

/* ---- tableau blanc ---- */

.draw-wrap { position: relative; width: 100%; height: 100%; overflow: hidden; }
.draw-stage { position: absolute; inset: 0; }
.draw-canvas { display: block; outline: none; touch-action: none; }
.draw-tool { position: relative; width: 34px; height: 34px; border-radius: 8px !important; }
.draw-tool[aria-pressed="true"] { background: var(--accent-soft) !important; color: var(--accent); }
.draw-glyph { font-size: 15px; line-height: 1; }
.draw-key { position: absolute; right: 3px; bottom: 1px; font-size: 8.5px; color: var(--fg-faint); }
.draw-tool[aria-pressed="true"] .draw-key { color: var(--accent); }
.draw-props {
  position: absolute; left: 12px; top: 12px; width: 212px; max-height: calc(100% - 24px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2);
  padding: 10px 12px; display: grid; gap: 10px; z-index: 5; font-size: 12.5px;
}
.draw-prop-label { color: var(--fg-muted); font-size: 11.5px; margin-bottom: 4px; }
.draw-swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.draw-swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; }
.draw-swatch.none { background: repeating-linear-gradient(45deg, #ddd 0 3px, #fff 3px 6px); }
.draw-swatch.on { box-shadow: 0 0 0 2px var(--accent); }
.draw-segs { display: flex; gap: 4px; flex-wrap: wrap; }
.draw-segs button { min-width: 30px; height: 28px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--fg); cursor: pointer; font-size: 13px; display: grid; place-items: center; }
.draw-segs button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.draw-segs button svg { width: 15px; height: 15px; }
.draw-range { width: 100%; accent-color: var(--accent); }
.draw-zoom { position: absolute; left: 12px; bottom: 12px; display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-1); overflow: hidden; z-index: 5; }
.draw-zoom button { border: 0; background: none; padding: 6px 10px; cursor: pointer; color: var(--fg); font-size: 13px; }
.draw-zoom button:hover { background: var(--surface-2); }
.draw-zoom-value { min-width: 60px; font-variant-numeric: tabular-nums; }
.draw-overlay { position: absolute; inset: 0; pointer-events: none; }
.draw-textedit {
  position: absolute; pointer-events: auto; border: 0; outline: 1px dashed var(--accent); background: transparent;
  resize: none; overflow: hidden; padding: 0; margin: 0; white-space: pre; font: inherit;
}

/* ---- partage ---- */

.share-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.share-row .avatar { flex: none; }
.share-id { flex: 1; min-width: 0; }
.share-id div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-id small { color: var(--fg-faint); }
.link-box { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.link-box input { flex: 1; font-family: var(--mono); font-size: 12px; }

/* ---- révélation du lien de partage ----
   Le lien existe déjà dans le DOM mais reste illisible : flou et pulsation pendant la
   vérification, puis révélation nette ou message de blocage. */

.link-gate { margin-top: 10px; }
.link-box-wrap { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.link-url {
  padding: 13px 14px; font-family: var(--mono); font-size: 12.5px; color: var(--fg-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: filter .45s ease, opacity .45s ease;
}
.link-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  gap: 9px; font-size: 13px; color: var(--fg-muted);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  transition: opacity .35s ease;
}

.is-checking .link-url { filter: blur(6px); animation: link-pulse 1.1s ease-in-out infinite; }
.is-locked .link-url { filter: blur(7px); opacity: .75; }
.is-ready .link-url { filter: none; color: var(--fg); user-select: all; }
.is-ready .link-overlay { opacity: 0; pointer-events: none; }

@keyframes link-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

.link-spinner {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 2px solid var(--accent-line); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link-locked { display: grid; gap: 2px; justify-items: center; text-align: center; padding: 0 14px; }
.link-locked strong { font-size: 13.5px; color: var(--fg); }
.link-locked span { font-size: 12.5px; }

.link-actions { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.link-actions .btn { flex: none; }

@media (prefers-reduced-motion: reduce) {
  .is-checking .link-url { animation: none; }
  .link-spinner { animation-duration: 2s; }
}

/* ---- bannière de vérification ---- */

.verify-banner {
  flex: none;
  display: flex; align-items: center; gap: 10px; padding: 9px 16px; font-size: 13px;
  background: #fff8e6; color: #7c4a03; border-bottom: 1px solid #f5d99a;
}
@media (prefers-color-scheme: dark) {
  .verify-banner { background: #3a2c10; color: #f5d99a; border-bottom-color: #5a441a; }
}
.verify-banner svg { width: 17px; height: 17px; flex: none; }
.verify-banner .btn { margin-left: auto; }
.verify-banner .btn-ghost { color: inherit; }

/* ---- authentification (page pleine) ---- */

body.in-auth .sidebar, body.in-auth .verify-banner { display: none !important; }
body.in-auth .app { grid-template-columns: 1fr; }

.auth-page { display: grid; grid-template-columns: 1fr; min-height: 100%; background: var(--bg); }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: min(420px, 100%); }
.auth-brand { display: inline-flex; align-items: center; gap: 11px; margin-bottom: 26px; color: var(--fg); }
.auth-brand:hover { text-decoration: none; }
.auth-brand img { border-radius: 12px; }
.auth-brand span { font-size: 25px; font-weight: 700; letter-spacing: -.03em; }
.auth-card h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.02em; }
.auth-card p.sub { margin: 0 0 26px; color: var(--fg-muted); line-height: 1.5; }
.auth-form .input { padding: 11px 13px; }
.auth-submit { padding: 11px; font-size: 15px; border-radius: 10px; margin-top: 4px; }
.auth-status { margin: 10px 0 0; font-size: 13px; color: var(--fg-muted); text-align: center; }
.auth-alt { margin-top: 20px; text-align: center; color: var(--fg-muted); font-size: 13.5px; }

.auth-aside { display: none; }
.auth-points { display: grid; gap: 16px; align-content: center; max-width: 380px; }
.auth-points-title { font-size: 19px; font-weight: 650; letter-spacing: -.02em; line-height: 1.35; margin-bottom: 4px; }
.auth-point { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--fg-muted); line-height: 1.5; }
.auth-point-icon { width: 30px; height: 30px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; flex: none; color: var(--accent); }
.auth-point-icon svg { width: 16px; height: 16px; }

@media (min-width: 900px) {
  .auth-page { grid-template-columns: 1fr 1fr; }
  .auth-aside {
    display: grid; place-items: center; padding: 40px;
    background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 12%, var(--bg)), var(--bg) 70%);
    border-left: 1px solid var(--line);
  }
}

.landing { max-width: 980px; margin: 0 auto; padding: 60px 24px 90px; }
.landing h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.1; letter-spacing: -.03em; margin: 0 0 16px; }
.landing .lede { font-size: 17px; color: var(--fg-muted); max-width: 58ch; margin: 0 0 28px; }
.landing-actions { display: flex; gap: 11px; flex-wrap: wrap; margin-bottom: 46px; }
.landing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.landing-card { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--surface); }
.landing-card h3 { margin: 12px 0 6px; font-size: 15.5px; }
.landing-card p { margin: 0; color: var(--fg-muted); font-size: 13.5px; }

.guest-banner {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px; font-size: 13px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-bottom: 1px solid var(--accent-line);
}
.guest-banner .btn { margin-left: auto; }
/* Rappel « espace temporaire » : flottant en bas du document, jamais dans le bandeau d'outils. */
.temp-toast {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 10px; max-width: min(560px, calc(100% - 32px));
  padding: 9px 10px 9px 14px; border-radius: 999px; font-size: 13px;
  background: #fff8e6; color: #7c4a03; border: 1px solid #f5d99a; box-shadow: var(--shadow-2);
}
.temp-toast svg { width: 17px; height: 17px; flex: none; color: #b45309; }
.temp-toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.temp-toast .btn { flex: none; border-radius: 999px; padding: 5px 14px; }
.temp-toast .btn svg { width: 15px; height: 15px; color: currentColor; }
@media (prefers-color-scheme: dark) { .temp-toast { background: #3a2c10; color: #f5d99a; border-color: #5a441a; } }
@media (max-width: 640px) { .temp-toast span { display: none; } }
.guest-banner svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.share-row > svg { width: 18px; height: 18px; flex: none; color: var(--fg-muted); }
.toast svg { width: 17px; height: 17px; flex: none; }
.empty-mark svg { width: 100%; height: 100%; }

/* ---- adaptatif ---- */

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 268px; z-index: 100;
    transform: translateX(-100%); transition: transform .18s ease-out; box-shadow: var(--shadow-3);
  }
  .app.nav-open .sidebar { transform: none; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 90; background: var(--overlay); }
  .sidebar .sidebar-close { display: inline-grid; }
  .topbar .burger, .editor-top .burger { display: inline-grid; }
  .files-head, .file-row { grid-template-columns: 1fr 40px; }
  .file-meta { display: none; }
  .page { padding: 16px 14px 80px; }
  .paper { padding: 34px 22px; min-height: auto; }
  .doc-outline { display: none; }
  .slides-wrap { grid-template-columns: 1fr; grid-template-rows: 92px 1fr; }
  .slide-list { grid-auto-flow: column; grid-auto-columns: 132px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
}

@media print {
  html, body { height: auto; display: block; overflow: visible; }
  .sidebar, .topbar, .toolbar, .editor-top, .toasts, .wordcount, .doc-outline, .guest-banner { display: none !important; }
  .app { display: block; height: auto; }
  .paper { box-shadow: none; width: auto; padding: 0; }
  .editor, .editor-body { height: auto; overflow: visible; display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
