/* =====================================================================================================
   DEETO · refonte v21 — le style des maquettes : sombre profond, surfaces douces, pastilles, orbe vivant.
   Chargé après design.css : il a le dernier mot. Clair et sombre sont gérés ; le sombre est la référence.
   ===================================================================================================== */

:root {
  --c-blue: #2f6fe0; --c-teal: #0f8f7a; --c-amber: #b8750a; --c-pink: #c2457f; --c-orange: #d4502a; --c-green: #1e9d5a;
  --pill: 999px; --r-card: 20px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0e; --panel: #101014; --surface: #141418; --elev: #1c1c22;
    --fill: rgba(255,255,255,.085); --fill-2: rgba(255,255,255,.05);
    --text: #f4f4f6; --text-2: #cfcfd8; --muted: #a0a0ac;
    --border: rgba(255,255,255,.09); --sep: rgba(255,255,255,.07);
    --user-bubble: #1f1f27; --code-bg: #101014; --link: #8fb8ff;
    --c-blue: #8fb8ff; --c-teal: #7ed6c4; --c-amber: #ffc857; --c-pink: #f29ec0; --c-orange: #ff8a5b; --c-green: #7ed6c4;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b0e; --panel: #101014; --surface: #141418; --elev: #1c1c22;
  --fill: rgba(255,255,255,.085); --fill-2: rgba(255,255,255,.05);
  --text: #f4f4f6; --text-2: #cfcfd8; --muted: #a0a0ac;
  --border: rgba(255,255,255,.09); --sep: rgba(255,255,255,.07);
  --user-bubble: #1f1f27; --code-bg: #101014; --link: #8fb8ff;
  --c-blue: #8fb8ff; --c-teal: #7ed6c4; --c-amber: #ffc857; --c-pink: #f29ec0; --c-orange: #ff8a5b; --c-green: #7ed6c4;
}

/* ---------- Orbe de marque ---------- */
body .logo.big, body .empty .logo.big { width: 52px; height: 52px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0%, #c9ccf5 58%, #8e92e0 100%); box-shadow: 0 0 40px rgba(160,166,255,.5); animation: orb-breathe 5s ease-in-out infinite; }
body .logo.big::after, body .empty .logo.big::after { display: none; }
@keyframes orb-breathe { 50% { transform: scale(1.06); box-shadow: 0 0 54px rgba(160,166,255,.65); } }

/* ---------- Accueil ---------- */
body .empty { justify-content: flex-start; align-items: stretch; text-align: left; padding: 11vh 22px 150px; gap: 0; overflow-y: auto; }
body .empty > * { width: min(560px, 100%); margin-left: auto; margin-right: auto; }
body .empty .logo.big { margin: 0 0 18px; margin-left: max(0px, calc(50% - 280px)); }
body .empty h2 { font-size: 31px; line-height: 1.14; font-weight: 700; letter-spacing: -.03em; margin: 0 auto 6px; }
.greeting-sub { margin: 0 auto 22px; font-size: 15px; color: var(--muted); }
body .suggestions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: min(560px, 100%); }
body .suggestion { display: flex; flex-direction: column; gap: 12px; min-height: 96px; padding: 15px; border-radius: var(--r-card); border: 1px solid var(--border); background: var(--surface); text-align: left; transition: transform .15s, border-color .2s, background .2s; }
body .suggestion:hover { border-color: color-mix(in srgb, var(--text) 22%, transparent); background: var(--elev); }
body .suggestion:active { transform: scale(.97); }
body .suggestion svg { width: 22px; height: 22px; fill: none; stroke: var(--c); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body .suggestion b { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
body .suggestion span { display: none; }
body .suggestion:nth-child(n+4) { display: flex; }
.recent { margin-top: 26px; display: flex; flex-direction: column; gap: 2px; }
.recent[hidden] { display: none; }
.recent-h { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 2px 8px; }
.recent-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 10px 2px; border: 0; border-bottom: 1px solid var(--sep); background: none; color: var(--text); text-align: left; font-size: 15px; }
.recent-row:active { opacity: .6; }
.recent-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.recent-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-d { font-size: 12px; color: var(--muted); flex-shrink: 0; }
@media (max-width: 380px) { body .suggestions { gap: 8px; } body .suggestion { padding: 12px; min-height: 88px; } }

/* ---------- Barre de saisie ---------- */
body .composer-box { border-radius: 26px; background: var(--surface); border-color: color-mix(in srgb, var(--text) 13%, transparent); padding: 10px 10px 10px 12px; }
body .round-btn { width: 40px; height: 40px; background: var(--elev); border: 1px solid var(--border); }
body .round-btn:hover { background: var(--fill); }
body .model-pill { height: 34px; padding: 0 13px; background: var(--elev); border-radius: var(--pill); }
body .send-btn { width: 44px; height: 44px; }
body .send-btn.talk { background: var(--text); color: var(--bg); }
body .send-btn.talk svg { stroke-width: 2.2; }

/* ---------- Réponses : tableaux lisibles sur mobile, première colonne figée ---------- */
body .content table { display: block; width: max-content; max-width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); border-collapse: separate; border-spacing: 0; }
body .content th, body .content td { min-width: 6.5em; vertical-align: top; word-break: normal; overflow-wrap: normal; hyphens: none; padding: 11px 13px; border: 0; border-bottom: 1px solid var(--sep); text-align: left; }
body .content td { min-width: 8em; line-height: 1.42; }
body .content th { white-space: nowrap; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--elev); }
body .content tr:last-child td { border-bottom: 0; }
body .content th:first-child, body .content td:first-child { position: sticky; left: 0; z-index: 1; font-weight: 600; background: var(--surface); box-shadow: 1px 0 0 var(--sep); }
body .content th:first-child { background: var(--elev); }

/* ---------- Mode vocal : humeur de DEETO ---------- */
.voice { --mood: #e6e8ff; }
.voice-bg { background: radial-gradient(60% 40% at 50% 38%, color-mix(in srgb, var(--mood) 34%, transparent), transparent 70%), radial-gradient(60% 50% at 50% 112%, color-mix(in srgb, var(--mood) 14%, transparent), transparent 70%); transition: background .9s ease; }
.voice-mood { position: relative; display: inline-flex; align-items: center; gap: 8px; margin: 10px auto 0; padding: 8px 14px; border-radius: var(--pill); background: rgba(255,255,255,.07); border: 1px solid color-mix(in srgb, var(--mood) 38%, transparent); font: 600 13px var(--font); color: #fff; transition: border-color .9s; }
.vm-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mood); box-shadow: 0 0 10px var(--mood); transition: background .9s, box-shadow .9s; }
.voice-status { font-size: 22px; }
.vbtn.big { width: 76px; }
.vbtn.big svg { padding: 22px; }
.voice-engine { font-size: 12px; color: rgba(255,255,255,.5); }
.voice-engine::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: #7ed6c4; vertical-align: middle; }
.vc-chip { background: rgba(255,255,255,.08); border-radius: var(--pill); }

/* ---------- Réglages et listes : cartes arrondies ---------- */
body .group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); }
body .group-head { font-size: 12px; font-weight: 600; letter-spacing: .08em; }
body .switch { width: 52px; height: 32px; border-radius: 16px; background: var(--fill); }
body .switch::after { width: 26px; height: 26px; top: 3px; left: 3px; }
body .switch:checked { background: var(--c-green); }
body .switch:checked::after { transform: translateX(20px); background: #0b0b0e; }
body .seg { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 4px; }
body .seg button { border-radius: 10px; padding: 8px 12px; }
body .seg button.on { background: var(--elev); color: var(--text); box-shadow: 0 0 0 1px var(--border); }

/* ---------- Admin : usage et quotas ---------- */
body .qbar { height: 8px; border-radius: 4px; background: var(--fill); margin-top: 10px; }
body .qbar i { border-radius: 4px; background: var(--c-blue); }
body .qbar.warn i { background: #ffbf47; }
body .qbar.full i { background: #ff6b63; }
body .usage-grid { border-top: 0; gap: 10px; background: none; padding: 4px 14px 14px; }
body .usage-grid div { background: var(--elev); border-radius: 16px; padding: 12px 14px; }
body .usage-grid b { font-size: 24px; letter-spacing: -.02em; }
body .user-row { align-items: flex-start; }
body .user-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
body .user-acts .link-btn { height: 36px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--pill); background: var(--elev); color: var(--text); font-size: 13px; font-weight: 600; }
body .user-acts .link-btn.danger, body .user-acts .link-btn.bad { color: var(--danger); }

/* ---------- Installation guidée ---------- */
#install-gate { background: radial-gradient(70% 38% at 50% 0%, rgba(150,156,255,.16), transparent 70%), var(--bg); }
#install-gate h1 { font-size: 29px; letter-spacing: -.03em; }
#install-gate .ig-intro { font-size: 16px; color: var(--muted); }
#install-gate .ig-steps li { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 14px; align-items: center; }
#install-gate .ig-steps li.ig-on { border-color: color-mix(in srgb, var(--c-blue) 55%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-blue) 10%, transparent); background: var(--elev); }
#install-gate .ig-n { background: var(--fill); color: var(--text); font-size: 15px; }
#install-gate .ig-steps li.ig-on .ig-n { background: var(--c-blue); color: #0b0b0e; }
#install-gate .ig-t { font-size: 16px; }
#install-gate .ig-ic { width: 34px; height: 34px; border-radius: 11px; background: var(--fill); color: var(--c-blue); }
#install-gate .ig-btn { border-radius: var(--pill); font-size: 16px; padding: 16px; }
#install-gate .ig-alt { background: transparent; color: var(--muted); font-weight: 500; }
#install-gate .ig-note { font-size: 14px; background: var(--surface); border: 1px dashed color-mix(in srgb, var(--text) 18%, transparent); border-radius: 18px; padding: 14px; }

/* =====================================================================================================
   Barre latérale (maquettes 7 et 8) : marque, grand bouton « Nouvelle conversation », recherche avec raccourci,
   pastilles de projets, conversations à deux lignes avec repère d'état, compte en bas, réduction sur PC.
   ===================================================================================================== */
body .sidebar { background: var(--panel); }
body .sidebar-head { padding: max(14px, env(safe-area-inset-top)) 16px 4px; gap: 10px; display: flex; flex-direction: column; }
body .sidebar-title { display: flex; align-items: center; gap: 12px; margin: 0 0 4px; }
body .sidebar-title h1 { flex: 1; display: flex; align-items: center; gap: 12px; font-size: 0; }
body .sidebar-title h1::before { width: 34px; height: 34px; border-radius: 11px; background: var(--text); box-shadow: none; background-image: radial-gradient(circle, var(--bg) 0 5px, transparent 5.5px); }
body .sidebar-title h1::after { content: "DEETO"; font-size: 17px; font-weight: 700; letter-spacing: .12em; }
.sb-collapse { width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: none; place-items: center; cursor: pointer; }
.sb-collapse:hover { background: var(--fill-2); color: var(--text); }
.sb-collapse svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 821px) { .sb-collapse { display: grid; } }

body .sidebar .new-chat-btn#new-chat { width: 100%; height: 46px; padding: 0 14px; display: flex; flex-direction: row; align-items: center; gap: 10px; border-radius: 14px; background: var(--elev); border: 1px solid var(--border); color: var(--text); font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, transform .1s; }
body .sidebar .new-chat-btn#new-chat::after { content: none; }
body .sidebar .new-chat-btn kbd { display: none; }
body .sidebar .new-chat-btn#new-chat:hover { background: var(--fill); }
body .sidebar .new-chat-btn#new-chat:active { transform: scale(.985); }
.new-chat-btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.new-chat-btn .ncb-t { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar kbd { font: inherit; font-size: 11.5px; font-weight: 500; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; flex: none; }
@media (hover: none) { .sidebar kbd { display: none; } }

body .sidebar .search { height: 42px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); padding: 0 12px; }
body .sidebar .search:focus-within { border-color: rgba(143,184,255,.55); box-shadow: 0 0 0 3px rgba(143,184,255,.1); }
body .sidebar .search input { font-size: 16px; }
body .sidebar .search input::-webkit-search-cancel-button { display: none; }

body .sidebar .proj-strip { padding: 6px 16px 8px; gap: 8px; }
body .sidebar .proj-chip { height: 34px; padding: 0 14px; border-radius: 17px; font-size: 13px; font-weight: 500; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
body .sidebar .proj-chip.on { background: var(--text); color: var(--bg); border-color: transparent; font-weight: 600; }
body .sidebar .proj-chip.add { background: transparent; border-style: dashed; color: var(--muted); }
body .sidebar .proj-dot { width: 8px; height: 8px; }

body .sidebar .conv-list { padding: 0 10px 12px; }
body .sidebar .conv-group { padding: 16px 14px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); opacity: .85; }
body .sidebar .conv-item { margin: 1px 0; border-radius: 14px; min-height: 0; padding: 0; }
body .sidebar .conv-item .slide { position: relative; border-radius: 14px; background: transparent; }
body .sidebar .conv-item:hover .slide { background: var(--fill-2); }
body .sidebar .conv-item.active .slide { background: var(--user-bubble, var(--fill)); }
body .sidebar .conv-item.active .slide::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; background: var(--c-blue); }
body .sidebar .conv-item .open { padding: 11px 14px; gap: 2px; font-size: 15px; font-weight: 500; color: var(--text-2); min-width: 0; }
body .sidebar .conv-item.active .open { color: var(--text); font-weight: 600; }
body .sidebar .conv-item .snip { font-size: 12px; color: var(--muted); }
body .sidebar .conv-item .t { display: block; }
body .sidebar .conv-item .pin { color: var(--c-amber); font-size: 8px; vertical-align: middle; }
body .sidebar .conv-item .run-dot { background: var(--c-teal); box-shadow: 0 0 8px var(--c-teal); }
body .sidebar .conv-item .qpin { padding: 6px; margin-right: 0; }
body .sidebar .conv-item .qpin svg, body .sidebar .conv-item .more svg { width: 16px; height: 16px; }
body .sidebar .conv-item .qpin.on { color: var(--c-amber); }
@media (hover: hover) { body .sidebar .conv-item:hover .more { opacity: 1; } }

body .sidebar-foot { padding: 12px 12px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
body .sidebar .settings-row { height: 56px; padding: 0 10px 0 8px; gap: 12px; border-radius: 14px; background: transparent; }
body .sidebar .settings-row:hover { background: var(--fill-2); }
.me-avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #0b0b0e; background: linear-gradient(135deg, #8fb8ff, #b79cff); }
body .sidebar .settings-row-t { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; gap: 1px; }
body .sidebar .settings-row-t b { font-size: 14.5px; font-weight: 600; }
body .sidebar .settings-row-t small { font-size: 12px; color: var(--muted); font-weight: 400; }
body .sidebar .settings-row .gear { width: 36px; height: 36px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; color: var(--text-2); }
body .sidebar .settings-row .gear svg { width: 18px; height: 18px; }

/* Mobile : tiroir arrondi avec ombre. */
@media (max-width: 820px) {
  body .sidebar { border-radius: 0 28px 28px 0; box-shadow: none; }
  body .sidebar.open { box-shadow: 14px 0 44px rgba(0,0,0,.45); }
}
/* PC : barre réductible. */
@media (min-width: 821px) {
  #app.sb-collapsed .sidebar { display: none; }
  #app.sb-collapsed #menu-btn { display: grid !important; }
}

/* =====================================================================================================
   Réglages par catégories (maquettes 9, 10, 11) : mobile = accueil puis catégorie ; PC = fenêtre centrée
   avec navigation à gauche. Tous les réglages existants restent dans le même DOM, seule la mise en page change.
   ===================================================================================================== */
.sx-off { display: none !important; }
.settings-shell { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; }
.settings-split { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.settings-nav { display: flex; flex-direction: column; gap: 14px; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; width: min(680px, 100%); margin: 0 auto; box-sizing: border-box; }
.settings-body { flex: 1; min-height: 0; width: min(680px, 100%); box-sizing: border-box; }
.nav-back { font-weight: 500; white-space: nowrap; }

.settings[data-view="detail"] .settings-nav { display: none; }
.settings-body.sx-empty::after { content: "Aucun réglage ne correspond."; display: block; text-align: center; color: var(--muted); padding: 40px 16px; font-size: 15px; }
.settings[data-view="home"] .settings-body { display: none; }

.sn-search { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); flex: none; }
.sn-search:focus-within { border-color: rgba(143,184,255,.55); box-shadow: 0 0 0 3px rgba(143,184,255,.1); }
.sn-search svg { width: 18px; height: 18px; flex: none; }
.sn-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; color: var(--text); padding: 0; }
.sn-search input::-webkit-search-cancel-button { display: none; }
.sn-me { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); flex: none; }
.sn-me .me-avatar { width: 52px; height: 52px; font-size: 20px; }
.sn-me-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sn-me-t b { font-size: 17px; font-weight: 600; }
.sn-me-t small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-list { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; flex: none; }
.sn-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; border-bottom: 1px solid var(--sep); }
.sn-item:last-of-type, .sn-item:last-child { border-bottom: 0; }
.sn-item[hidden] { display: none; }
.sn-item:active { background: var(--fill-2); }
.sn-tile { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; color: var(--tc); background: color-mix(in srgb, var(--tc) 14%, transparent); }
.sn-tile svg { width: 19px; height: 19px; }
.sn-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sn-name { font-size: 15.5px; font-weight: 500; }
.sn-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-chev { color: var(--muted); display: flex; opacity: .7; }
.sn-chev svg { width: 18px; height: 18px; }

/* PC : fenêtre centrée (comme Claude / ChatGPT), navigation à gauche, contenu à droite. */
@media (min-width: 821px) {
  body .settings { inset: 0; width: auto; background: rgba(0,0,0,.55); box-shadow: none; padding: 0; display: flex; align-items: center; justify-content: center; flex-direction: row; transform: none; opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s .2s; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
  body .settings.open { opacity: 1; visibility: visible; transition: opacity .2s; }
  body .settings.open .settings-shell { transform: none; opacity: 1; }
  .settings-shell { width: min(960px, calc(100vw - 48px)); height: min(680px, calc(100dvh - 48px)); flex: none; border-radius: 24px; overflow: hidden; background: var(--panel); border: 1px solid var(--border); box-shadow: 0 30px 80px rgba(0,0,0,.45); transform: translateY(8px) scale(.98); opacity: 0; transition: transform .3s var(--spring), opacity .2s; position: relative; }
  .settings .nav { position: absolute; top: 0; right: 0; left: 268px; z-index: 2; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; border: 0; height: 60px; padding: 0 20px 0 36px; display: flex; align-items: center; }
  .settings .nav h2 { flex: 1; text-align: left; font-size: 24px; letter-spacing: -.01em; }
  .settings .nav .nav-back { display: none; }
  .settings-split { flex-direction: row; }
  .settings-nav { width: 268px; flex: none; margin: 0; padding: 18px 14px; gap: 10px; background: var(--surface); border-right: 1px solid var(--border); }
  .settings-nav .sn-me { order: 9; margin-top: auto; padding: 10px 8px; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: none; gap: 10px; }
  .settings-nav .sn-me .me-avatar { width: 34px; height: 34px; font-size: 14px; }
  .settings-nav .sn-me-t b { font-size: 14px; }
  .sn-search { height: 38px; border-radius: 12px; }
  .sn-list { border: 0; background: none; border-radius: 0; display: flex; flex-direction: column; gap: 2px; }
  .sn-item { border: 0; border-radius: 12px; padding: 8px 10px; gap: 12px; }
  .sn-item:hover { background: var(--fill-2); }
  .sn-item.on { background: var(--user-bubble, var(--fill)); }
  .sn-item.on .sn-name { font-weight: 600; }
  .sn-name { font-size: 14.5px; }
  .sn-sub, .sn-chev { display: none; }
  .settings[data-view] .settings-body { display: block; }
  .settings-body { flex: 1; width: auto; margin: 0; padding: 64px 36px 32px; max-width: none; }
  .settings-body > * { max-width: 640px; }
  .settings-nav { display: flex !important; }
}
.settings .nav .nav-side { flex: 0 0 84px; }
.settings .nav .nav-back { text-align: left; padding-left: 4px; }
.settings .nav #settings-done { text-align: right; }
@media (min-width: 821px) { .settings .nav .nav-side { flex: 0 0 auto; } }
.settings .nav .nav-back { font-size: 30px; line-height: 1; font-weight: 400; padding: 0 0 4px 4px; }
@media (max-width: 820px) { .settings .nav { position: relative; } .settings .nav .nav-back { position: absolute; left: 14px; top: 50%; transform: translateY(-52%); } }

/* =====================================================================================================
   Logo DEETO : un « D » en trait fin dont le creux contient un point qui regarde autour de lui.
   Monochrome (suit le thème clair / sombre), sans dégradé ni halo. Le point cligne et suit le regard.
   ===================================================================================================== */
body .logo, body .logo.big, body .empty .logo.big, body .login-card .logo {
  --ls: 44px; position: relative; width: var(--ls); height: var(--ls); border-radius: 0; background: none; box-shadow: none; animation: none; color: var(--text); overflow: visible;
}
body .logo.big, body .empty .logo.big { --ls: 56px; flex: none; min-height: var(--ls); }
body .login-card .logo { --ls: 76px; margin-bottom: 16px; }
body .logo::before, body .logo.big::before, body .empty .logo.big::before, body .login-card .logo::before {
  content: ""; display: block; position: absolute; left: calc(var(--ls) * .27); top: calc(var(--ls) * .19); box-sizing: border-box;
  width: calc(var(--ls) * .5); height: calc(var(--ls) * .62); border: calc(var(--ls) * .1) solid currentColor; border-radius: calc(var(--ls) * .05) calc(var(--ls) * .31) calc(var(--ls) * .31) calc(var(--ls) * .05);
  background: none; opacity: 1; transform-origin: 30% 50%; animation: dm-in .8s cubic-bezier(.2,.9,.2,1) both;
}
body .logo::after, body .logo.big::after, body .empty .logo.big::after, body .login-card .logo::after {
  content: ""; display: block; position: absolute; left: calc(var(--ls) * .52); top: 50%; width: calc(var(--ls) * .13); height: calc(var(--ls) * .13); margin: calc(var(--ls) * -.065) 0 0 calc(var(--ls) * -.065);
  border-radius: 50%; background: currentColor; box-shadow: none; font-size: 0;
  animation: dm-pop .5s cubic-bezier(.2,1.6,.4,1) .45s both, dm-look 9s ease-in-out 1.2s infinite;
}
@keyframes dm-in { from { opacity: 0; transform: translateX(-12%) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes dm-pop { from { transform: scale(0); } to { transform: scale(1); } }
/* le point regarde à droite, à gauche, puis cligne */
@keyframes dm-look {
  0%, 18% { transform: translateX(0) scale(1, 1); }
  24%, 40% { transform: translateX(calc(var(--ls) * .06)) scale(1, 1); }
  46%, 60% { transform: translateX(calc(var(--ls) * -.05)) scale(1, 1); }
  66%, 100% { transform: translateX(0) scale(1, 1); }
  80% { transform: translateX(0) scale(1, 1); }
  82% { transform: translateX(0) scale(1.15, .1); }
  84% { transform: translateX(0) scale(1, 1); }
}
/* Marque dans la barre latérale (fixe, en masque : suit la couleur du texte) */
body .sidebar-title h1::before {
  width: 30px; height: 30px; border-radius: 0; box-shadow: none; background: var(--text); background-image: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M32 24H46A26 26 0 0 1 46 76H32Z' fill='none' stroke='%23000' stroke-width='10' stroke-linejoin='round'/%3E%3Ccircle cx='52' cy='50' r='6.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M32 24H46A26 26 0 0 1 46 76H32Z' fill='none' stroke='%23000' stroke-width='10' stroke-linejoin='round'/%3E%3Ccircle cx='52' cy='50' r='6.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Écran de démarrage : le D se trace, puis le point apparaît et regarde autour pendant le chargement. */
.sp-stage { width: 132px; height: 132px; }
.sp-mark { width: 104px; height: 104px; overflow: visible; color: var(--text); }
.sp-d { fill: none; stroke: currentColor; stroke-width: 10; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: sp-draw .9s cubic-bezier(.5,0,.2,1) .1s forwards; }
.sp-dot { fill: currentColor; transform-box: fill-box; transform-origin: center; transform: scale(0); animation: dm-pop .5s cubic-bezier(.2,1.6,.4,1) .85s forwards, sp-look 3.2s ease-in-out 1.4s infinite; }
@keyframes sp-draw { to { stroke-dashoffset: 0; } }
@keyframes sp-look { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(6px); } 60% { transform: translateX(-5px); } 88% { transform: translateX(0) scale(1, 1); } 92% { transform: translateX(0) scale(1.15, .1); } 96% { transform: translateX(0) scale(1, 1); } }
.sp-word { font-weight: 700; letter-spacing: .16em; font-size: 22px; margin-top: 18px; }
@media (prefers-reduced-motion: reduce) {
  .sp-d, .sp-dot, body .logo::before, body .logo::after { animation: none !important; stroke-dashoffset: 0; transform: none; opacity: 1; }
}

/* =====================================================================================================
   Transitions de page : chaque changement de vue (réglages, conversation, accueil, boîtes de dialogue) s'anime.
   ===================================================================================================== */
@media (prefers-reduced-motion: no-preference) {
  /* Réglages : la catégorie entre par la droite, le retour ramène la liste par la gauche ; les blocs arrivent en cascade. */
  .settings-body > :not(.sx-off) { animation: set-rise .42s cubic-bezier(.2,.9,.2,1) both; animation-delay: calc(min(var(--i, 0), 8) * 34ms); }
  .settings[data-dir="fwd"] .settings-body > :not(.sx-off) { animation-name: set-fwd; }
  .settings[data-dir="back"] .settings-nav > * { animation: set-back .42s cubic-bezier(.2,.9,.2,1) both; }
  .settings[data-dir="back"] .settings-nav .sn-list { animation-delay: .06s; }
  .settings:not([data-dir="back"]) .sn-item { animation: set-rise .4s cubic-bezier(.2,.9,.2,1) both; animation-delay: calc(min(var(--i, 0), 9) * 28ms + 120ms); }
  .settings .nav h2 { animation: tswap-in .3s ease both; }
  @keyframes set-fwd { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
  @keyframes set-back { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
  @keyframes set-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  @keyframes tswap-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

  /* Conversation / accueil : le titre se fond, le contenu monte (animation « swap » déjà en place). */
  .conv-title.tswap { animation: tswap-in .32s ease both; }

  /* Boîtes de dialogue : arrivée en douceur, fond qui s'assombrit. */
  dialog[open] { animation: dlg-in .3s cubic-bezier(.2,.9,.2,1); }
  dialog[open]::backdrop { animation: dlg-fade .25s ease; }
  @keyframes dlg-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
  @keyframes dlg-fade { from { opacity: 0; } to { opacity: 1; } }

  /* Retours tactiles : les lignes et boutons s'enfoncent légèrement. */
  .sn-item:active, .row.action:active, .conv-item:active { transform: scale(.992); transition: transform .08s; }
}

/* Jauge de quota sous le nom (barre latérale) et carte de dépense (réglages > Consommation) */
.me-bar { display: block; height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; margin-top: 5px; }
.me-bar[hidden] { display: none; }
.me-bar b { display: block; height: 100%; width: 0; background: var(--c-blue); border-radius: 2px; transition: width .6s cubic-bezier(.2,.9,.2,1); }
.me-bar.warn b { background: var(--c-amber); }
.me-bar.full b { background: #ff6b5e; }
.spend-card { margin: 0 0 10px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); color: var(--c-blue); display: flex; flex-direction: column; gap: 8px; }
.spend-card[hidden] { display: none; }
.sp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sp-l { font-size: 13px; color: var(--muted); }
.sp-d { font-size: 12px; font-weight: 600; color: var(--c-teal); }
.sp-d.up { color: var(--c-amber); }
.spend-card svg { display: block; width: 100%; height: 70px; }
.sp-n { font-size: 32px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }

/* Accueil : la dernière conversation devient une carte « Reprendre » en un geste */
.recent-row.recent-first { min-height: 62px; padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: 0 1px 0 rgba(255,255,255,.03) inset; transition: background .15s, transform .1s; }
.recent-row.recent-first:hover { background: var(--elev); }
.recent-row.recent-first:active { transform: scale(.992); opacity: 1; }
.recent-row.recent-first .recent-t { font-weight: 600; font-size: 16px; }
.recent-go { font-size: 13px; font-weight: 600; color: var(--c-blue); white-space: nowrap; }

/* Installation : le D animé, une progression et des étapes qui s'allument l'une après l'autre */
#install-gate .ig-mark { --ls: 96px !important; margin: 0 auto 4px; }
#install-gate .ig-prog { display: flex; gap: 6px; justify-content: center; }
#install-gate .ig-prog i { width: 28px; height: 4px; border-radius: 2px; background: var(--fill); transition: background .4s; }
#install-gate .ig-prog i.on { background: var(--text); }
#install-gate .ig-steps li { transition: border-color .35s, box-shadow .35s, transform .35s, opacity .35s; opacity: .62; }
#install-gate .ig-steps li.ig-on { opacity: 1; transform: scale(1.012); }
@media (prefers-reduced-motion: no-preference) { #install-gate .ig-card > * { animation: set-rise .55s cubic-bezier(.2,.9,.2,1) both; } #install-gate .ig-card > *:nth-child(2) { animation-delay: .08s; } #install-gate .ig-card > *:nth-child(3) { animation-delay: .14s; } #install-gate .ig-card > *:nth-child(n+4) { animation-delay: .2s; } }
