/* VOID — Les Fils de Ma'at
   Palette tirée de l'emblème : lapis nuit, or antique, ivoire de la plume, papyrus pour les figures.
   Marcellus (capitales gravées) pour les titres, Hanken Grotesk pour la lecture. */

@font-face { font-family: "Marcellus"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/marcellus-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Marcellus"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/marcellus-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/fonts/hanken-grotesk-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Hanken Grotesk"; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url("/fonts/hanken-grotesk-latin-wght-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Hanken Grotesk"; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url("/fonts/hanken-grotesk-latin-ext-wght-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: dark;
  --ink: #08131f;          /* fond : le lapis de l'emblème */
  --well: #0a1726;         /* champs de saisie */
  --panel: #0e1c2d;        /* surfaces */
  --raised: #15263a;       /* éléments posés sur une surface */
  --line: #1f3349;         /* filets */
  --line-strong: #2c4560;
  --text: #ece5d3;         /* ivoire de la plume */
  --text-soft: #c9c3b4;
  --muted: #8a99ad;
  --gold: #c9a24a;         /* or antique */
  --gold-hi: #e4c47f;
  --gold-wash: rgba(201, 162, 74, 0.13);
  --gold-edge: rgba(201, 162, 74, 0.38);
  --papyrus: #f1e6cc;      /* fond des figures */
  --ruby: #e08a77;         /* le cœur de la balance */
  --ruby-wash: rgba(224, 138, 119, 0.12);
  --sage: #8cc6a4;
  --sage-wash: rgba(140, 198, 164, 0.12);
  --lilac: #b8b4e8;
  --display: "Marcellus", "Trajan Pro", "Times New Roman", serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --shadow: 0 24px 60px -20px rgba(0, 4, 12, 0.7), 0 2px 6px rgba(0, 4, 12, 0.35);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--ink);
  color: var(--text);
  font: 400 16px/1.6 var(--sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, .display { font-family: var(--display); font-weight: 400; letter-spacing: 0.01em; line-height: 1.2; }
a { color: var(--gold-hi); text-decoration: underline; text-decoration-color: var(--gold-edge); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--gold-hi); }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: rgba(201, 162, 74, 0.35); color: #fff; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; line-height: 1.5; }
.error { color: var(--ruby); font-size: 0.9rem; min-height: 1.3em; margin: 0.5rem 0 0; }
.error:empty { min-height: 0; margin: 0; }
.spacer { height: 0.75rem; }

/* --- Icônes (SVG au trait, injectées par common.js) -------------------------------- */
.i { display: inline-flex; width: 20px; height: 20px; flex: none; }
.i svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; }

/* --- Boutons --------------------------------------------------------------------- */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 44px; padding: 0 1.05rem; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--raised); color: var(--text);
  font-weight: 560; font-size: 0.95rem; line-height: 1.2; cursor: pointer; text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn .i { width: 18px; height: 18px; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #0a1624; font-weight: 650; }
.btn-gold:hover { background: var(--gold-hi); border-color: var(--gold-hi); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--raised); border-color: transparent; color: var(--text); }
.btn-danger { background: transparent; border-color: rgba(224, 138, 119, 0.35); color: var(--ruby); }
.btn-danger:hover { background: var(--ruby-wash); border-color: var(--ruby); }
.btn-small { min-height: 36px; padding: 0 0.8rem; font-size: 0.87rem; border-radius: 10px; }

.icon-btn {
  appearance: none; display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; border-radius: var(--r); border: 0; background: transparent;
  color: var(--text-soft); cursor: pointer; transition: background-color 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn[aria-pressed="true"] { color: var(--gold-hi); background: var(--gold-wash); }
.small-icon { width: 36px; height: 36px; border-radius: 10px; }
.small-icon .i { width: 18px; height: 18px; }
.link-btn {
  appearance: none; background: none; border: 0; padding: 0; color: var(--text); text-align: left;
  font-weight: 600; cursor: pointer; min-height: 32px; line-height: 1.35;
}
.link-btn:hover { color: var(--gold-hi); }
.link-btn.small { font-weight: 450; font-size: 0.84rem; color: var(--muted); }
.link-btn.danger { color: var(--ruby); }

/* --- Champs ------------------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; min-width: 0; }
.field label { font-size: 0.84rem; font-weight: 550; color: var(--text-soft); }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 0.65rem 0.85rem; border-radius: var(--r);
  background: var(--well); border: 1px solid var(--line-strong); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: #66778d; }
input:hover, select:hover, textarea:hover { border-color: #3a5574; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-wash); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--gold); flex: none; }
input[type="file"] { padding: 0.5rem; font-size: 0.9rem; color: var(--muted); }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 560; color: var(--text); background: var(--raised); border: 1px solid var(--line-strong);
  border-radius: 9px; padding: 0.4rem 0.8rem; margin-right: 0.8rem; cursor: pointer;
}
select {
  appearance: none; padding-right: 2.2rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.row > .field { flex: 1 1 180px; }
.check { display: flex; align-items: center; gap: 0.65rem; margin: 0.2rem 0 1rem; min-height: 40px; cursor: pointer; }

/* --- Pastilles ------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.74rem; font-weight: 600; line-height: 1;
  padding: 0.3rem 0.55rem; border-radius: 999px; white-space: nowrap;
  background: var(--gold-wash); color: var(--gold-hi); border: 1px solid var(--gold-edge);
}
.badge:empty { display: none; }
.badge .i { width: 13px; height: 13px; }
.badge.plain { background: transparent; color: var(--text-soft); border-color: var(--line-strong); }
.badge.ok { background: var(--sage-wash); color: var(--sage); border-color: rgba(140, 198, 164, 0.35); }
.badge.fail { background: var(--ruby-wash); color: var(--ruby); border-color: rgba(224, 138, 119, 0.35); }
.badge.ai { background: rgba(184, 180, 232, 0.1); color: var(--lilac); border-color: rgba(184, 180, 232, 0.35); }

/* --- Écran d'entrée ----------------------------------------------------------------- */
.gate {
  min-height: 100%; display: grid; place-items: center;
  padding: max(28px, env(safe-area-inset-top)) 16px calc(28px + var(--safe-bottom));
  background: radial-gradient(60% 45% at 50% 22%, rgba(201, 162, 74, 0.09), transparent 70%), var(--ink);
}
.gate-card { width: 100%; max-width: 360px; text-align: center; }
.emblem { display: block; width: auto; height: min(36vh, 300px); max-width: 76%; margin: 0 auto 1.4rem;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.55)); }
.wordmark { font-family: var(--display); font-size: 2.6rem; letter-spacing: 0.32em; margin: 0 0 0.2rem;
  padding-left: 0.32em; color: var(--text); line-height: 1.1; }
.gate .lede { margin: 0 0 1.6rem; color: var(--muted); }
.gate .lede span { display: block; font-size: 0.85rem; color: #6f8096; margin-top: 0.15rem; }
.code-input {
  text-align: center; font-size: 1.3rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
  font-variant-numeric: tabular-nums; min-height: 56px; border-radius: 14px; margin-bottom: 0.75rem;
}
.code-input::placeholder { letter-spacing: 0.2em; color: #3d5068; }
.gate-card > .btn-gold { width: 100%; min-height: 52px; border-radius: 14px; font-size: 1rem; }
.gate-card #password { min-height: 52px; border-radius: 14px; text-align: center; }
.gate-link { margin: 1.6rem 0 0; }
#open-offline { margin-top: 0.4rem; }
.mark { width: 30px; height: 30px; border-radius: 50%; display: block; flex: none; }
.gate h1:not(.wordmark) { font-size: 1.8rem; margin: 0 0 0.4rem; }

@media (prefers-reduced-motion: no-preference) {
  .gate:not([hidden]) .emblem { animation: rise 1.1s var(--ease) both; }
  .gate:not([hidden]) .gate-card > :not(.emblem) { animation: fade 0.7s var(--ease) 0.35s both; }
  .msg.bot { animation: fade 0.35s var(--ease) both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.97); filter: drop-shadow(0 0 0 transparent); } }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* --- Application membre ----------------------------------------------------------- */
.app { display: flex; flex-direction: column; height: 100%; height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 0.35rem;
  padding: max(8px, env(safe-area-inset-top)) 10px 8px; min-height: 60px;
  background: rgba(8, 19, 31, 0.86); backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.65rem; padding-left: 0.2rem; }
.topbar .who > div { min-width: 0; line-height: 1.25; }
.topbar .who strong { display: block; font-weight: 650; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grant-line { display: block; font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .btn-small { padding: 0 0.7rem; }

.thread {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 1.6rem;
  padding: 28px max(16px, calc((100% - 720px) / 2)) 32px;
}
.welcome { margin: auto 0; padding: 1.5rem 0 0.5rem; }
.welcome .mark { width: 52px; height: 52px; margin-bottom: 1.2rem; }
.welcome h2 { font-size: 2rem; margin: 0 0 0.6rem; }
.welcome p { margin: 0 0 0.3rem; max-width: 58ch; color: var(--muted); }
.welcome .kreyol { font-size: 0.88rem; color: #6f8096; }
.hints { display: flex; flex-direction: column; margin-top: 1.6rem; border-top: 1px solid var(--line); }
.hint {
  appearance: none; display: flex; align-items: center; gap: 0.8rem; width: 100%; text-align: left; cursor: pointer;
  background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--text-soft);
  padding: 0.9rem 0.2rem; min-height: 52px; font-size: 0.96rem; transition: color 0.15s, padding 0.2s var(--ease);
}
.hint::after { content: ""; margin-left: auto; width: 7px; height: 7px; flex: none; border-top: 1.6px solid var(--muted);
  border-right: 1.6px solid var(--muted); transform: rotate(45deg); }
.hint:hover { color: var(--text); padding-left: 0.5rem; }
.hint:hover::after { border-color: var(--gold); }

/* Messages */
.msg { max-width: 100%; min-width: 0; }
.msg.user {
  align-self: flex-end; max-width: min(86%, 560px); padding: 0.7rem 1rem; border-radius: 18px 18px 6px 18px;
  background: var(--raised); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.user .mode { display: block; font-size: 0.74rem; font-weight: 650; color: var(--gold); margin-bottom: 0.15rem; }
.bubble-photo { display: block; max-width: 200px; max-height: 200px; border-radius: 10px; margin: 0.15rem 0 0.5rem; }
.msg.bot { position: relative; padding-left: 0; }
.msg.bot::before {
  content: "VOID"; display: flex; align-items: center; gap: 0.55rem; height: 26px; margin-bottom: 0.6rem;
  font-family: var(--display); font-size: 0.86rem; letter-spacing: 0.24em; color: var(--muted);
  padding-left: 34px; background: url("/img/mark.webp") left center / 26px 26px no-repeat;
}
.msg.bot.refused { color: var(--muted); }
.msg.bot.refused .answer { color: var(--muted); }
.msg.bot.error { color: var(--ruby); }
.msg.bot.care { padding: 1rem 1.1rem; background: var(--sage-wash); border: 1px solid rgba(140, 198, 164, 0.25); border-radius: var(--r-lg); }
.msg.bot.thinking { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); flex-wrap: wrap; }
.msg.bot.thinking::before { flex-basis: 100%; margin-bottom: 0.1rem; }
.dots { display: inline-flex; gap: 5px; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); animation: pulse 1.2s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: 0.18s; }
.dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.2; transform: scale(0.85); } 40% { opacity: 1; transform: none; } }

.answer { font-size: 1.04rem; line-height: 1.72; color: var(--text); overflow-wrap: break-word; }
.answer > * { max-width: 68ch; }
.answer h2, .answer h3 { font-size: 1.32rem; color: var(--text); margin: 1.7rem 0 0.55rem; }
.answer h2:first-child, .answer h3:first-child { margin-top: 0; }
.answer p { margin: 0 0 0.95rem; }
.answer ul, .answer ol { margin: 0 0 1rem; padding-left: 1.35rem; }
.answer li { margin: 0.35rem 0; padding-left: 0.2rem; }
.answer li::marker { color: var(--gold); }
.answer ol li::marker { font-weight: 650; font-variant-numeric: tabular-nums; }
.answer strong { font-weight: 680; color: #fff7e6; }
.answer em { color: var(--text-soft); }
.cite {
  display: inline-block; font-size: 0.68rem; font-weight: 700; line-height: 1; vertical-align: 0.42em; margin-left: 2px;
  padding: 0.2rem 0.36rem; border-radius: 5px; background: var(--gold-wash); color: var(--gold-hi);
  font-variant-numeric: tabular-nums;
}

.msg-actions { display: flex; align-items: center; gap: 0.25rem; margin-top: 0.9rem; flex-wrap: wrap; }
.msg-actions .btn-small { min-height: 34px; padding: 0 0.65rem; font-weight: 540; }
.msg-actions .btn { background: transparent; border-color: var(--line); color: var(--text-soft); }
.msg-actions .btn:hover { background: var(--raised); color: var(--text); border-color: var(--line-strong); }
.msg-actions > .muted { margin-left: 0.4rem; }
.rating { display: inline-flex; gap: 0.1rem; margin-left: auto; }

.sources { margin-top: 1.1rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); max-width: 68ch; }
.sources summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.6rem; min-height: 44px;
  padding: 0 0.9rem; font-size: 0.88rem; font-weight: 600; color: var(--text-soft);
}
.sources summary::-webkit-details-marker { display: none; }
.sources summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted); transform: rotate(45deg) translate(-2px, -2px); transition: transform 0.2s var(--ease); }
.sources[open] summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.sources[open] summary { border-bottom: 1px solid var(--line); }
.source { padding: 0.85rem 0.9rem; border-bottom: 1px solid var(--line); }
.source:last-child { border-bottom: 0; }
.source-head { display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; line-height: 1.35; }
.source-head strong { font-weight: 650; }
.source-head .n { color: var(--gold); font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.source blockquote { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.6;
  border-left: 2px solid var(--gold-edge); padding-left: 0.75rem; }

/* Figures authentiques */
.figures { margin-top: 1.2rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.8rem; max-width: 68ch; }
.figures-title { grid-column: 1 / -1; margin: 0; font-size: 1.05rem; }
.figure { margin: 0; }
.figure-btn { display: block; width: 100%; padding: 10px; border: 1px solid var(--gold-edge); border-radius: var(--r);
  background: var(--papyrus); cursor: zoom-in; transition: transform 0.2s var(--ease), box-shadow 0.2s; }
.figure-btn:hover { box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7); transform: translateY(-1px); }
.figure-btn img { display: block; width: 100%; height: 150px; object-fit: contain; }
.figure figcaption { font-size: 0.8rem; color: var(--muted); margin-top: 0.45rem; line-height: 1.4; }
.lightbox { max-width: min(760px, calc(100vw - 24px)); padding: 1rem; text-align: center; }
.lightbox img { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto 0.8rem; background: var(--papyrus); border-radius: var(--r); padding: 10px; }
.lightbox p { color: var(--text-soft); }

/* Zone de saisie */
.composer {
  padding: 0.6rem max(12px, calc((100% - 744px) / 2)) calc(0.7rem + var(--safe-bottom));
  background: linear-gradient(to top, var(--ink) 70%, rgba(8, 19, 31, 0));
}
.modes { display: inline-flex; gap: 2px; padding: 3px; margin: 0 0 0.55rem 2px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); }
.mode-btn {
  appearance: none; border: 0; background: transparent; border-radius: 999px; padding: 0 0.9rem; min-height: 32px;
  cursor: pointer; color: var(--muted); font-size: 0.85rem; font-weight: 600; transition: background-color 0.15s, color 0.15s;
}
.mode-btn:hover { color: var(--text); }
.mode-btn[aria-pressed="true"] { background: var(--raised); color: var(--gold-hi); box-shadow: inset 0 0 0 1px var(--line-strong); }
.compose-row {
  display: flex; align-items: flex-end; gap: 0.15rem; padding: 6px; border-radius: 22px;
  background: var(--panel); border: 1px solid var(--line-strong); transition: border-color 0.15s, box-shadow 0.15s;
}
.compose-row:focus-within { border-color: var(--gold-edge); box-shadow: 0 0 0 4px rgba(201, 162, 74, 0.08); }
.compose-row textarea {
  flex: 1; min-height: 44px; max-height: 180px; padding: 0.62rem 0.4rem; resize: none;
  background: transparent; border: 0; box-shadow: none; border-radius: 0; font-size: 1rem;
}
.compose-row textarea:focus { box-shadow: none; }
.compose-row .icon-btn { width: 44px; height: 44px; border-radius: 16px; }
#send { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 16px; flex: none; }
#send .i { width: 20px; height: 20px; }
#send .i svg { stroke-width: 2.1; }
.quota { font-size: 0.76rem; color: #6f8096; margin: 0.45rem 6px 0; text-align: center; }
.photo-chip { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.5rem; padding: 0.4rem 0.4rem 0.4rem 0.45rem;
  border: 1px solid var(--gold-edge); background: var(--gold-wash); border-radius: 14px; }
.photo-chip img { width: 44px; height: 44px; object-fit: cover; border-radius: 9px; }
.photo-chip span { flex: 1; color: var(--text-soft); }

/* --- Boîtes de dialogue ------------------------------------------------------------- */
dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  padding: 1.4rem; max-width: min(440px, calc(100vw - 32px)); width: 100%; box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(3, 9, 16, 0.66); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: pop 0.22s var(--ease); }
  dialog.drawer[open] { animation: slide 0.28s var(--ease); }
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.985); } }
@keyframes slide { from { transform: translateX(-24px); opacity: 0; } }
.dialog-title { font-size: 1.4rem; margin: 0 0 0.6rem; }
dialog .row { margin-top: 1rem; justify-content: flex-end; }
dialog .row .btn { flex: 1 1 auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.4rem; }
.drawer-head .dialog-title { margin: 0; }
dialog.drawer {
  margin: 0 auto 0 0; height: 100%; max-height: 100%; width: min(380px, 88vw); max-width: none;
  border-radius: 0 var(--r-lg) var(--r-lg) 0; border-width: 0 1px 0 0; overflow-y: auto;
  padding: max(1.1rem, env(safe-area-inset-top)) 1.1rem calc(1.2rem + var(--safe-bottom));
}
.drawer-sub { font-size: 1.05rem; margin: 1.6rem 0 0.6rem; color: var(--text-soft); }
#history-list .item, #offline-mini .item { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0.7rem 0.1rem; }
#history-list .item-actions, #offline-mini .item-actions { margin-top: 0.35rem; }
#history-list .conv-row { display: flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0; }
.conv-open { appearance: none; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; padding: 0.55rem 0.1rem;
  background: none; border: 0; color: var(--text); text-align: left; cursor: pointer; }
.conv-title { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.conv-open:hover .conv-title { color: var(--gold-hi); }
.conv-open .item-meta { margin-top: 0; }
/* « ⋮ » visible par défaut (téléphone, écran tactile) ; avec une souris, il apparaît au survol ou au clavier. */
.row-more { transition: opacity 0.15s, background-color 0.15s, color 0.15s; }
@media (hover: hover) and (pointer: fine) {
  .row-more { opacity: 0; }
  .conv-row:hover .row-more, .conv-row:focus-within .row-more, .row-more[aria-expanded="true"] { opacity: 1; }
}

/* --- Menu d'actions (common.js : openMenu) --- */
.menu {
  position: fixed; inset: auto; margin: 0; z-index: 1000; min-width: 170px; padding: 6px; box-sizing: border-box;
  background: #11223a; color: var(--text); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 22px 50px -12px rgba(0, 4, 12, 0.8), 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.menu-item { appearance: none; display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 0.8rem;
  background: none; border: 0; border-radius: 8px; color: var(--text); font: inherit; font-size: 0.94rem; text-align: left; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--raised); outline: none; }
.menu-item.danger { color: var(--ruby); }
@media (prefers-reduced-motion: no-preference) { .menu:popover-open { animation: vs-in 0.14s var(--ease); } }
.levels { border: 1px solid var(--line); border-radius: var(--r); padding: 0.4rem 0.9rem 0.5rem; margin: 0.9rem 0 0.6rem; }
.levels legend { color: var(--muted); font-size: 0.82rem; font-weight: 600; padding: 0 0.35rem; }
.levels label { display: flex; gap: 0.7rem; align-items: center; min-height: 44px; cursor: pointer; }
#settings-grants > div { padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.45rem 0;
  border-bottom: 1px solid var(--line); }
#logout-others { margin-top: 0.7rem; }
.alerts, .devices { margin-top: 0.6rem; font-size: 0.86rem; }
.alerts { border-left: 2px solid var(--ruby); padding-left: 0.75rem; color: var(--text-soft); }
.alert-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.3rem 0.8rem; padding: 0.3rem 0; }
.devices .device-row:last-child { border-bottom: 0; }
#feedback textarea { margin-top: 0.4rem; }
.code-display {
  font-size: 1.55rem; font-weight: 650; letter-spacing: 0.16em; text-align: center; font-variant-numeric: tabular-nums;
  color: var(--gold-hi); background: var(--well); border: 1px dashed var(--gold-edge); border-radius: var(--r);
  padding: 1rem; margin: 0.9rem 0; user-select: all; overflow-wrap: anywhere;
}
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%); z-index: 50;
  width: max-content; max-width: calc(100vw - 32px); padding: 0.7rem 1.05rem; border-radius: var(--r);
  background: #1b2e45; border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  font-size: 0.9rem; font-weight: 550; text-align: center;
}
@media (prefers-reduced-motion: no-preference) { .toast { animation: toast 0.25s var(--ease); } }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 8px); } }

/* --- Listes, cartes (admin et historique) -------------------------------------------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.3rem; margin-bottom: 1.2rem; }
.card h2 { font-size: 1.3rem; margin: 0 0 1rem; }
.card > ol { margin: 0; padding-left: 1.2rem; }
.card > ol li { margin: 0.45rem 0; padding-left: 0.2rem; }
.card > ol li::marker { color: var(--gold); font-weight: 650; }
.list { display: flex; flex-direction: column; gap: 0.6rem; }
.item { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 0.95rem 1rem; min-width: 0; }
.card .item { background: var(--well); }
.item-head { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.item-head strong { flex: 1 1 180px; min-width: 0; font-weight: 650; overflow-wrap: anywhere; }
.item-meta { font-size: 0.82rem; color: var(--muted); margin-top: 0.3rem; overflow-wrap: anywhere; }
.item-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.75rem; align-items: center; }
.item-actions select { width: auto; max-width: 100%; min-height: 36px; padding-top: 0.25rem; padding-bottom: 0.25rem; font-size: 0.87rem; border-radius: 10px; }
.item.inactive { opacity: 0.55; }
.item.has-thumb { display: grid; grid-template-columns: 76px minmax(0, 1fr); column-gap: 0.95rem; }
.item.has-thumb > :not(.thumb) { grid-column: 2; }
.thumb { grid-row: 1 / span 3; width: 76px; height: 76px; object-fit: contain; background: var(--papyrus); border-radius: 10px; padding: 4px; }
.toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.9rem; }
.toolbar input, .toolbar select { flex: 1 1 170px; width: auto; }
.notice { border: 1px solid var(--gold-edge); background: var(--gold-wash); border-radius: var(--r); padding: 0.85rem 1rem;
  margin-bottom: 1.2rem; font-size: 0.92rem; color: var(--text-soft); line-height: 1.55; }
.notice strong { color: var(--text); }
.quote { margin: 0.6rem 0; color: var(--muted); font-size: 0.88rem; border-left: 2px solid var(--line-strong); padding-left: 0.7rem;
  white-space: pre-wrap; max-height: 9em; overflow: hidden; }
.log-line { font-size: 0.85rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; color: var(--text-soft); }
.log-line:last-child { border-bottom: 0; }
.log-line time { color: var(--muted); margin-right: 0.6rem; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.chip { display: inline-flex; align-items: center; gap: 0.15rem; padding: 0.15rem 0.2rem 0.15rem 0.7rem; border-radius: 999px;
  background: var(--gold-wash); color: var(--gold-hi); border: 1px solid var(--gold-edge); font-size: 0.84rem; font-weight: 560; }
.chip-x { appearance: none; border: 0; background: transparent; color: inherit; cursor: pointer; width: 26px; height: 26px;
  border-radius: 50%; font-size: 1rem; line-height: 1; }
.chip-x:hover { background: rgba(201, 162, 74, 0.2); }
.chip-x { display: inline-grid; place-items: center; padding: 0; }
.chip-x .i { width: 14px; height: 14px; }
.levels-list { margin: 0.6rem 0; padding-left: 1.3rem; }
.levels-list li { min-height: 36px; }
.levels-list li > * { vertical-align: middle; }
.levels-list li::marker { color: var(--gold); font-weight: 650; }
.levels-list li span { margin-right: 0.6rem; }
.more-fields { margin-bottom: 1rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.more-fields summary { cursor: pointer; color: var(--text-soft); font-weight: 560; font-size: 0.9rem; min-height: 44px; display: flex; align-items: center; }
.more-fields[open] summary { margin-bottom: 0.4rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1.2rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.05rem; min-width: 0; }
.stat .v { font-family: var(--display); font-size: 2rem; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.stat .l { font-size: 0.8rem; font-weight: 550; color: var(--muted); margin-bottom: 0.35rem; }
.stat .small { overflow-wrap: anywhere; color: var(--text-soft); }
.stat.warn { border-color: var(--gold-edge); background: linear-gradient(var(--gold-wash), var(--gold-wash)), var(--panel); }
.stat.warn .v { color: var(--gold-hi); }
textarea.tall { min-height: 220px; }
textarea.draft { min-height: 440px; font-size: 0.93rem; line-height: 1.65; }
textarea.notes { min-height: 72px; margin-top: 0.5rem; }
#a-rendered { margin-bottom: 1rem; padding: 1.2rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--ink); }
#a-rendered::before { display: none; }

/* --- Espace admin ------------------------------------------------------------------ */
.admin { min-height: 100%; }
/* --- Catalogue à valider ------------------------------------------------------------- */
dialog.wide-dialog { max-width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow-y: auto; }
.excerpt-text { white-space: pre-wrap; max-height: 60vh; overflow-y: auto; font-size: 0.88rem; line-height: 1.6;
  color: var(--text-soft); background: var(--well); border: 1px solid var(--line); border-radius: var(--r); padding: 0.9rem 1rem; }
.cat-meta { font-size: 0.82rem; color: var(--muted); margin-top: 0.3rem; overflow-wrap: anywhere; }
.cat-props { display: grid; gap: 0.8rem; margin-top: 0.8rem; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.cat-prop { min-width: 0; padding: 0.85rem 0.95rem; background: var(--well); border: 1px solid var(--line); border-radius: var(--r); }
.cat-prop-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem; }
.cat-access { font-weight: 650; margin: 0.55rem 0 0.4rem; color: var(--gold-hi); }
.cat-fields { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.2rem 0.75rem; margin: 0.5rem 0; font-size: 0.86rem; }
.cat-fields dt { color: var(--muted); }
.cat-fields dd { margin: 0; overflow-wrap: anywhere; }
.cat-fields .badge { margin-left: 0.4rem; }
.cat-note { font-size: 0.86rem; line-height: 1.5; color: var(--text-soft); margin: 0.4rem 0 0; }
.cat-warn { font-size: 0.86rem; line-height: 1.5; color: var(--ruby); margin: 0.4rem 0 0; }
.cat-pick { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; font-size: 0.88rem; cursor: pointer; }
.table-wrap { overflow-x: auto; }
.cat-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; margin-bottom: 0.6rem; }
.cat-table th, .cat-table td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cat-table th { color: var(--muted); font-weight: 600; }
.cat-top { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.8rem 0 0.4rem; }
.cat-top .btn .i { margin-right: 0.35rem; }
.cat-budget { font-size: 0.86rem; color: var(--text-soft); margin: 0.6rem 0 0.9rem; font-variant-numeric: tabular-nums; }
#cat-series:empty { display: none; }
#cat-series { margin-bottom: 1.2rem; }
.job { margin-top: 0.7rem; }
.job-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.7rem; font-size: 0.9rem; }
.job-line > span:first-child { flex: 1 1 220px; }
progress { width: 100%; height: 8px; margin-top: 0.45rem; border: 0; border-radius: 99px; overflow: hidden;
  background: var(--raised); appearance: none; -webkit-appearance: none; }
progress::-webkit-progress-bar { background: var(--raised); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--gold); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--gold); border-radius: 99px; }
.dropzone { margin: 0.9rem 0 0.4rem; padding: 1.2rem 1rem; text-align: center; border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg); background: var(--well); transition: border-color 0.15s, background-color 0.15s; }
.dropzone p { margin: 0 0 0.3rem; }
.dropzone .row { justify-content: center; margin-top: 0.7rem; }
.dropzone .row .btn { flex: 0 1 auto; }
.dropzone.over { border-color: var(--gold); background: var(--gold-wash); }
.imp-models { border: 1px solid var(--line); border-radius: var(--r); padding: 0.4rem 0.9rem 0.6rem; margin: 0.8rem 0 0.4rem; }
.imp-models legend { color: var(--muted); font-size: 0.82rem; font-weight: 600; padding: 0 0.35rem; }
.imp-models .check { display: flex; align-items: center; gap: 0.6rem; min-height: 40px; margin: 0; }
.imp-results { list-style: none; margin: 0.6rem 0 0; padding: 0; max-height: 220px; overflow-y: auto; font-size: 0.86rem; }
.imp-results li { padding: 0.3rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.imp-results li:last-child { border-bottom: 0; }
.imp-recap { margin: 0.6rem 0; padding-left: 1.2rem; line-height: 1.6; }
.guide-text .answer { max-width: 68ch; }

/* Pas de backdrop-filter ici : il ferait du tiroir (position: fixed, à l'intérieur) un prisonnier de la barre. */
.admin-side { position: sticky; top: 0; z-index: 6; background: var(--ink); border-bottom: 1px solid var(--line); }
.admin-brand, .admin-nav-head { display: flex; align-items: center; gap: 0.7rem; }
.admin-brand { min-height: 60px; padding: max(8px, env(safe-area-inset-top)) 10px 8px 8px; }
.admin-brand > div, .admin-nav-head > div { flex: 1; min-width: 0; line-height: 1.2; }
.admin-brand strong, .admin-nav-head strong { display: block; font-family: var(--display); font-weight: 400; font-size: 1.1rem;
  letter-spacing: 0.18em; }
.admin-brand span, .admin-nav-head span { display: block; font-size: 0.8rem; color: var(--muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.admin-brand .mark, .admin-nav-head .mark { width: 34px; height: 34px; }
.brand-sub { display: none !important; }
.brand-section { color: var(--text-soft) !important; }

/* Téléphone : les sections sont dans un tiroir latéral (bouton menu), comme dans une application. */
.admin-nav {
  position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(300px, 86vw); overflow-y: auto; overscroll-behavior: contain;
  padding: max(10px, env(safe-area-inset-top)) 0 calc(20px + env(safe-area-inset-bottom));
  background: var(--ink); border-right: 1px solid var(--line-strong); box-shadow: 24px 0 60px -20px rgba(0, 4, 12, 0.9);
  transform: translateX(-102%); visibility: hidden; transition: transform 0.24s var(--ease), visibility 0s linear 0.24s;
}
.admin.nav-open .admin-nav { transform: none; visibility: visible; transition: transform 0.24s var(--ease), visibility 0s; }
.admin-nav-head { padding: 0 8px 14px 16px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.nav-backdrop { position: fixed; inset: 0; z-index: 29; background: rgba(0, 4, 12, 0.6); }
@media (prefers-reduced-motion: reduce) { .admin-nav, .admin.nav-open .admin-nav { transition: none; } }

.tabs { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.tab {
  appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap;
  min-height: 46px; padding: 0 0.85rem; font-weight: 600; font-size: 0.95rem; text-align: left; border-radius: 10px;
  position: relative; transition: color 0.15s, background-color 0.15s;
}
.tab:hover { color: var(--text); background: var(--panel); }
.tab[aria-selected="true"] { color: var(--text); background: var(--raised); }
.tab[aria-selected="true"]::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--gold); }
.admin-main { padding: 22px 16px 64px; max-width: 960px; margin: 0 auto; }
.panel-title { font-size: 1.75rem; margin: 0 0 1.1rem; }

@media (min-width: 960px) {
  .admin { display: grid; grid-template-columns: 248px minmax(0, 1fr); }
  .admin-side {
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
    border-bottom: 0; border-right: 1px solid var(--line); background: var(--ink); backdrop-filter: none;
  }
  .admin-brand { padding: 22px 18px 22px 20px; }
  .nav-toggle, .admin-nav-head, .nav-backdrop, .brand-section { display: none !important; }
  .brand-sub { display: block !important; }
  .admin-nav { position: static; width: auto; padding: 0; overflow: visible; transform: none; visibility: visible;
    background: none; border: 0; box-shadow: none; transition: none; }
  .tab { min-height: 40px; font-size: 0.9rem; }
  .admin-main { padding: 40px 40px 80px; margin: 0; max-width: 1000px; width: 100%; }
}

/* --- Candidature publique ------------------------------------------------------- */
.candidature { max-width: 1080px; margin: 0 auto; padding: max(32px, env(safe-area-inset-top)) 16px calc(40px + var(--safe-bottom)); }
.cand-head { text-align: center; margin-bottom: 1.8rem; }
.cand-head .emblem { height: min(30vh, 240px); margin-bottom: 1.4rem; }
.cand-head h1 { font-size: clamp(1.9rem, 6vw, 2.8rem); margin: 0 0 0.8rem; }
.cand-head p { margin: 0 auto 0.5rem; max-width: 46ch; color: var(--text-soft); }
.cand-head .kreyol { color: var(--muted); font-size: 0.88rem; }
.cand-steps { list-style: none; padding: 0; margin: 1.6rem auto 0; max-width: 42ch; text-align: left; display: grid; gap: 0.7rem; counter-reset: step; }
.cand-steps li { display: grid; grid-template-columns: 30px 1fr; gap: 0.7rem; align-items: start; color: var(--text-soft); font-size: 0.92rem; line-height: 1.45; counter-increment: step; }
.cand-steps li::before { content: counter(step); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--gold-edge); color: var(--gold-hi); font-weight: 700; font-size: 0.82rem; }
.cand-steps strong { color: var(--text); font-weight: 650; display: block; }
.candidature .card { padding: 1.5rem; }
.cand-foot { text-align: center; margin-top: 1.4rem; }
.consent { align-items: flex-start; font-size: 0.88rem; color: var(--text-soft); line-height: 1.5; }
.consent input { margin-top: 0.15rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
#c-submit { width: 100%; min-height: 52px; border-radius: 14px; font-size: 1rem; }
#cand-done h2 { font-size: 1.6rem; }
@media (min-width: 900px) {
  .candidature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 56px; align-items: start; padding-top: 64px; }
  .cand-head { position: sticky; top: 48px; margin: 0; }
  .cand-foot { grid-column: 2; margin-top: -2rem; }
}

@media (max-width: 520px) {
  .item.has-thumb { display: block; }
  .item.has-thumb .thumb { display: block; width: 96px; height: 96px; margin-bottom: 0.7rem; }
  .welcome h2 { font-size: 1.75rem; }
  .answer { font-size: 1rem; }
  .card { padding: 1.1rem; }
  .msg-actions .label-opt { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .dots span { opacity: 0.7; }
}
.gate-card > .mark { width: 72px; height: 72px; margin: 0 auto 1.3rem; }

/* Ajustements après relecture visuelle */
h1, h2, h3 { text-wrap: balance; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
.stat .v { font-family: var(--sans); font-weight: 650; font-size: 1.85rem; letter-spacing: -0.01em; }
.msg-actions { max-width: 68ch; gap: 0.2rem; }
.msg-actions .btn-small { padding: 0 0.6rem; gap: 0.4rem; }
@media (max-width: 520px) {
  .msg-actions .btn-small:has(.label-opt) { width: 36px; padding: 0; }
}

/* --- Installation sur l'écran d'accueil ------------------------------------------- */
.install-card {
  display: flex; align-items: center; gap: 0.9rem; margin-top: 1.6rem; padding: 0.95rem 1rem;
  border: 1px solid var(--gold-edge); border-radius: 14px; background: var(--panel);
}
.install-card > div { flex: 1; min-width: 0; line-height: 1.35; }
.install-card strong { display: block; font-weight: 650; margin-bottom: 0.15rem; }
.install-card > div > span { font-size: 0.86rem; color: var(--muted); }
.install-close { flex: none; margin: -0.4rem -0.55rem -0.4rem -0.5rem; }
#gate-install { margin-top: 0.6rem; }

dialog.sheet { max-width: min(460px, calc(100vw - 24px)); padding: 0.9rem 1.3rem 1.3rem; }
.sheet-grip { width: 44px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 0 auto 1.1rem; }
.sheet-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.1rem; }
.sheet-head .dialog-title { margin: 0 0 0.15rem; }
.sheet-head p { margin: 0; }
.app-icon { width: 64px; height: 64px; border-radius: 16px; flex: none; box-shadow: 0 0 0 1px var(--line-strong); }
.perks { list-style: none; margin: 0 0 1.1rem; padding: 0; display: grid; gap: 0.65rem; }
.perks li { display: flex; align-items: center; gap: 0.75rem; color: var(--text-soft); font-size: 0.95rem; line-height: 1.35; }
.perks li::before {
  content: ""; flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--gold-wash);
  box-shadow: inset 0 0 0 1px var(--gold-edge);
}
.perks li { position: relative; }
.perks li::after {
  content: ""; position: absolute; left: 8px; top: 50%; width: 5px; height: 10px; margin-top: -6px;
  border-right: 2px solid var(--gold-hi); border-bottom: 2px solid var(--gold-hi); transform: rotate(45deg);
}
.install-steps { list-style: none; margin: 0 0 0.9rem; padding: 0.4rem 0.9rem; counter-reset: step;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--well); }
.install-steps li { display: grid; grid-template-columns: 28px 1fr; gap: 0.75rem; align-items: center; padding: 0.6rem 0;
  counter-increment: step; font-size: 0.92rem; line-height: 1.45; color: var(--text); }
.install-steps li + li { border-top: 1px solid var(--line); }
.install-steps li::before { content: counter(step); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line-strong); color: var(--text-soft); font-size: 0.8rem; font-weight: 700; }
.install-steps .i { width: 18px; height: 18px; vertical-align: -4px; color: var(--gold-hi); }
.install-note { font-size: 0.86rem; color: var(--gold-hi); background: var(--gold-wash); border-radius: 10px; padding: 0.6rem 0.8rem; margin: 0 0 0.9rem; }
.sheet .kreyol { color: var(--muted); margin: 0 0 1rem; }
.sheet-actions { display: grid; gap: 0.6rem; }
.sheet-actions .btn { width: 100%; min-height: 50px; border-radius: 14px; }
@media (max-width: 600px) {
  dialog.sheet { margin: auto 0 0; width: 100%; max-width: none; border-radius: 22px 22px 0 0; border-width: 1px 0 0;
    padding-bottom: calc(1.2rem + var(--safe-bottom)); }
  @media (prefers-reduced-motion: no-preference) {
    dialog.sheet[open] { animation: sheet-up 0.3s var(--ease); }
  }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 601px) { .sheet-grip { display: none; } dialog.sheet { padding-top: 1.4rem; } }

/* --- Listes déroulantes de l'app (common.js : enhanceSelect) ---------------------------- */
.vs { position: relative; display: block; width: 100%; min-width: 0; }
.vs > select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.vs-button {
  appearance: none; display: flex; align-items: center; gap: 0.65rem; width: 100%; min-height: 44px;
  padding: 0.5rem 0.85rem; border-radius: var(--r); background: var(--well); border: 1px solid var(--line-strong);
  color: var(--text); text-align: left; cursor: pointer; font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.vs-button:hover { border-color: #3a5574; }
.vs-button:focus-visible, .vs-button[aria-expanded="true"] { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-wash); }
.vs-button:disabled { opacity: 0.45; cursor: default; }
.vs-label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.55rem; white-space: nowrap; }
.vs-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.vs-chevron { width: 8px; height: 8px; flex: none; margin-left: 0.2rem; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted);
  transform: translateY(-2px) rotate(45deg); transition: transform 0.2s var(--ease), border-color 0.15s; }
.vs-button[aria-expanded="true"] .vs-chevron { transform: translateY(2px) rotate(225deg); border-color: var(--gold-hi); }
.vs-num { display: inline-grid; place-items: center; flex: none; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 7px;
  background: var(--raised); border: 1px solid var(--line-strong); color: var(--gold-hi); font-size: 0.76rem; font-weight: 700;
  font-variant-numeric: tabular-nums; }
.vs-list {
  position: fixed; inset: auto; margin: 0; z-index: 1000; box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain;
  padding: 6px; background: #11223a; color: var(--text); border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: 0 22px 50px -12px rgba(0, 4, 12, 0.8), 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.vs-option { display: flex; align-items: center; gap: 0.65rem; min-height: 42px; padding: 0.45rem 0.7rem; border-radius: 9px;
  cursor: pointer; font-size: 0.94rem; line-height: 1.3; color: var(--text-soft); }
.vs-option .vs-text { flex: 1; white-space: normal; }
.vs-option[data-active] { background: var(--raised); color: var(--text); }
.vs-option[aria-selected="true"] { color: var(--gold-hi); font-weight: 600; }
.vs-option[aria-selected="true"]::after { content: ""; flex: none; width: 5px; height: 10px; margin: 0 0.15rem 0 auto;
  border-right: 2px solid var(--gold-hi); border-bottom: 2px solid var(--gold-hi); transform: translateY(-2px) rotate(45deg); }
.vs-option[aria-selected="true"] .vs-num { border-color: var(--gold-edge); background: var(--gold-wash); }
.vs-option[aria-disabled="true"] { opacity: 0.4; cursor: default; }
@media (prefers-reduced-motion: no-preference) {
  .vs-list:popover-open { animation: vs-in 0.14s var(--ease); }
}
@keyframes vs-in { from { opacity: 0; transform: translateY(-4px); } }
.toolbar .vs { flex: 1 1 170px; width: auto; }
.item-actions .vs { width: auto; min-width: 150px; max-width: 100%; flex: 0 1 auto; }
.item-actions .vs-button { min-height: 36px; padding-top: 0.25rem; padding-bottom: 0.25rem; font-size: 0.87rem; border-radius: 10px; }

/* --- Fenêtres de confirmation et de saisie (common.js : ask) ----------------------------- */
dialog.ask { max-width: min(440px, calc(100vw - 32px)); }
.ask-message { white-space: pre-line; color: var(--text-soft); margin: 0 0 0.6rem; line-height: 1.55; }
.ask-input { margin: 0.4rem 0 0.2rem; }
.ask .row { margin-top: 1.1rem; }
.btn-danger-solid { background: var(--ruby); border-color: var(--ruby); color: #1d0b06; font-weight: 650; }
.btn-danger-solid:hover { background: #ea9d8c; border-color: #ea9d8c; }
