/* =====================================================================================================
   DEETO · design v22 — encre profonde, texte os, un seul accent citron. Instrument Serif pour les moments
   humains, Geist pour le reste. Chargé en dernier : il unifie TOUS les écrans (accueil, conversation,
   Atelier, réglages, admin, connexion, installation, partage, voix) en clair comme en sombre.
   ===================================================================================================== */
@font-face { font-family: "Geist"; src: url("/fonts/geist-latin.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif-latin.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif-italic-latin.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --font: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --lime: #CBFF4D; --ink: #0A0A0C; --coral: #FF7A59; --sky: #7AA7FF;
  --ease: cubic-bezier(.2,.9,.2,1);
  /* clair : papier chaud, encre, vert profond (texte) + citron (remplissages) */
  --bg: #F6F5F0; --panel: #EFEEE8; --surface: #FFFFFF; --elev: #FFFFFF;
  --fill: rgba(18,18,20,.07); --fill-2: rgba(18,18,20,.04);
  --text: #121214; --text-2: #46464e; --muted: #5f5f69;
  --border: rgba(18,18,20,.10); --sep: rgba(18,18,20,.07);
  --accent: #3E7A00; --on-accent: #FFFFFF; --accent-soft: rgba(62,122,0,.10);
  --user-bubble: #E7E6DE; --user-text: #121214; --code-bg: #F0EFE9; --link: #2F5FD0;
  --danger: #C8341F; --ok: #3E7A00; --warn: #B8750A;
  --c-blue: #3E7A00; --c-teal: #3E7A00; --c-green: #3E7A00; --c-amber: #B8750A; --c-pink: #C2457F; --c-orange: #D4502A;
  --pill-fill: #C4F23C; --pill-ink: #121214;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0A0C; --panel: #0D0D10; --surface: #121216; --elev: #1A1A20;
    --fill: rgba(255,255,255,.08); --fill-2: rgba(255,255,255,.045);
    --text: #F3F1EA; --text-2: #C9C8C2; --muted: #8E8E98;
    --border: rgba(255,255,255,.10); --sep: rgba(255,255,255,.07);
    --accent: #CBFF4D; --on-accent: #0A0A0C; --accent-soft: rgba(203,255,77,.12);
    --user-bubble: #1F1F26; --user-text: #F3F1EA; --code-bg: #0F0F13; --link: #7AA7FF;
    --danger: #FF5D4D; --ok: #CBFF4D; --warn: #FFC857;
    --c-blue: #CBFF4D; --c-teal: #CBFF4D; --c-green: #CBFF4D; --c-amber: #FFC857; --c-pink: #F29EC0; --c-orange: #FF7A59;
    --pill-fill: #CBFF4D; --pill-ink: #0A0A0C;
  }
}
:root[data-theme="dark"] {
  --bg: #0A0A0C; --panel: #0D0D10; --surface: #121216; --elev: #1A1A20;
  --fill: rgba(255,255,255,.08); --fill-2: rgba(255,255,255,.045);
  --text: #F3F1EA; --text-2: #C9C8C2; --muted: #8E8E98;
  --border: rgba(255,255,255,.10); --sep: rgba(255,255,255,.07);
  --accent: #CBFF4D; --on-accent: #0A0A0C; --accent-soft: rgba(203,255,77,.12);
  --user-bubble: #1F1F26; --user-text: #F3F1EA; --code-bg: #0F0F13; --link: #7AA7FF;
  --danger: #FF5D4D; --ok: #CBFF4D; --warn: #FFC857;
  --c-blue: #CBFF4D; --c-teal: #CBFF4D; --c-green: #CBFF4D; --c-amber: #FFC857; --c-pink: #F29EC0; --c-orange: #FF7A59;
  --pill-fill: #CBFF4D; --pill-ink: #0A0A0C;
}

html body { font-family: var(--font); font-feature-settings: "ss01", "cv11"; letter-spacing: -.01em; background: var(--bg); color: var(--text); }
body ::selection { background: color-mix(in srgb, var(--pill-fill) 45%, transparent); color: var(--text); }
body :focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 80%, transparent); outline-offset: 2px; }
body a, body .content a { color: var(--link); }
body .content a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent); text-underline-offset: 3px; }

/* ---------- Boutons : l'action principale est citron, encre dessus ---------- */
body .btn-primary, body .send-btn, body .send-btn.stop, body .send-btn.talk, body .file-btn.primary, body .ws-key.on, body .pill-see, body #install-gate .ig-btn:not(.ig-alt) {
  background: var(--pill-fill) !important; color: var(--pill-ink) !important; border-color: transparent !important; box-shadow: none;
}
body .send-btn.queue { background: var(--fill) !important; color: var(--text) !important; }
body .send-btn.stop { background: var(--text) !important; color: var(--bg) !important; }
body .btn-primary:disabled { cursor: default; filter: grayscale(.4); }
body .btn-primary { border-radius: 999px; height: 50px; font-weight: 650; letter-spacing: -.01em; transition: transform .18s var(--ease), filter .18s; }
body .btn-primary:hover, body .send-btn:not(:disabled):hover { filter: brightness(1.05); }
body .btn-primary:active { transform: scale(.98); }
body .send-btn { transition: transform .18s var(--ease), opacity .2s, filter .18s, background .15s, color .15s; }
body .send-btn:not(:disabled):active { transform: scale(.9); }
body .send-btn:disabled { background: var(--fill) !important; color: var(--muted) !important; opacity: 1; }
body .send-btn.talk { background: var(--pill-fill) !important; }
body .switch:checked { background: var(--pill-fill); }
body .switch:checked::after { background: var(--pill-ink); transform: translateX(20px); }
body .link-btn, body .sheet-item, body .sheet-item svg, body .icon-btn, body .icon-btn.tint, body .row-t.tint, body .expand-btn { color: var(--accent); }
body .seg button.on { background: var(--pill-fill); color: var(--pill-ink); box-shadow: none; font-weight: 650; }
body .day-picker .day.on { background: var(--pill-fill); color: var(--pill-ink); }
body .qbar i { background: var(--pill-fill); }
body .qbar.warn i { background: var(--warn); } body .qbar.full i { background: var(--danger); }
body .row-t.danger, body .link-btn.danger { color: var(--danger); }

/* ---------- Marque : le D (couleur du texte) avec le point citron ---------- */
body .logo::after, body .logo.big::after, body .empty .logo.big::after, body .login-card .logo::after { background: var(--pill-fill); box-shadow: 0 0 0 calc(var(--ls) * .04) color-mix(in srgb, var(--pill-fill) 25%, transparent); }
body .sidebar-title h1::after { font-family: var(--font); font-weight: 700; letter-spacing: .16em; font-size: 15px; }
.sp-dot { fill: var(--pill-fill); }
.sp-word { font-family: var(--serif); font-weight: 400; letter-spacing: .02em; font-size: 28px; }
#install-gate .ig-mark::after { background: var(--pill-fill); }

/* ---------- Accueil : grand serif sur deux lignes, tuiles douces ---------- */
body .empty h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 7vw, 64px); line-height: 1.02; letter-spacing: -.02em; margin: 4px auto 10px; text-wrap: balance; }
body .empty h2 em { font-style: italic; color: var(--accent); }
body .greeting-sub { font-size: 15px; color: var(--muted); }
body .suggestion { background: var(--surface); border-radius: 22px; transition: transform .2s var(--ease), border-color .2s, background .2s; }
body .suggestion:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: var(--elev); }
body .suggestion svg { stroke: var(--c, var(--accent)); }
.recent-h { letter-spacing: .12em; }
.recent-go { color: var(--accent); }
body .recent-row.recent-first { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; }
@media (prefers-reduced-motion: no-preference) {
  body .empty > * { animation: v22-rise .6s var(--ease) both; }
  body .empty > *:nth-child(2) { animation-delay: .06s; } body .empty > *:nth-child(3) { animation-delay: .12s; }
  body .empty > *:nth-child(4) { animation-delay: .18s; } body .empty > *:nth-child(n+5) { animation-delay: .24s; }
}
@keyframes v22-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Barre latérale ---------- */
body .sidebar { background: var(--panel); border-right: 1px solid var(--border); }
body .sidebar .new-chat-btn#new-chat { background: var(--pill-fill); color: var(--pill-ink); border: 0; font-weight: 650; border-radius: 16px; transition: transform .18s var(--ease), filter .18s, background .15s; }
body .sidebar .new-chat-btn#new-chat:hover { background: var(--pill-fill); filter: brightness(1.06); }
body .sidebar .new-chat-btn kbd { color: color-mix(in srgb, var(--pill-ink) 65%, transparent); border-color: color-mix(in srgb, var(--pill-ink) 25%, transparent); }
body .sidebar .search { background: var(--surface); }
body .sidebar .search:focus-within, body .sn-search:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: 0 0 0 3px var(--accent-soft); }
body .sidebar .proj-chip.on { background: var(--pill-fill); color: var(--pill-ink); }
body .sidebar .conv-item.active .slide { background: var(--elev); }
body .sidebar .conv-item.active .slide::before { background: var(--pill-fill); }
body .sidebar .conv-item .run-dot { background: var(--pill-fill); box-shadow: 0 0 8px var(--pill-fill); }
body .sidebar .conv-item .pin, body .sidebar .conv-item .qpin.on { color: var(--accent); }
.me-avatar { background: var(--pill-fill) !important; color: var(--pill-ink) !important; }
body .sidebar .settings-row .gear { background: var(--surface); }

/* ---------- Barre du haut, conversation ---------- */
body .topbar { background: linear-gradient(var(--bg) 62%, transparent); }
body .msg.user .bubble { background: var(--user-bubble); color: var(--user-text); border-radius: 22px 22px 6px 22px; }
body .msg.assistant .content h1, body .msg.assistant .content h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; }
body .msg.assistant .content h1 { font-size: 1.7em; } body .msg.assistant .content h2 { font-size: 1.4em; } body .msg.assistant .content h3 { font-size: 1.06em; font-weight: 650; }
body .msg.assistant .content blockquote { border-left: 2px solid var(--pill-fill); }
body .msg.assistant .content :not(pre) > code { background: var(--fill); color: var(--text); }
body .cursor > :last-child::after, body .typing i, body .act-orb.run, body .pill-orb { background: var(--pill-fill); }
body .act-row { background: var(--surface); border-radius: 16px; }
body .act-row:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
body .act-row.live { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
body .st.run { border-color: var(--pill-fill); border-right-color: transparent; }
body .file-card, body .quote-block { border-radius: 18px; }
body .quote-block { border-left-color: var(--pill-fill); }

/* ---------- Saisie ---------- */
body .composer { background: linear-gradient(to top, var(--bg) 60%, transparent); }
body .composer-box { background: var(--surface); border-radius: 28px; border: 1px solid var(--border); }
body .composer-box:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
body .round-btn, body .model-pill { background: var(--elev); }
body .model-pill b { color: var(--text); }
body .ctx-ring .ring-arc, body .ring-arc { stroke: var(--accent); }

/* ---------- Atelier (panneau, onglets, pages) ---------- */
body .ws-tab.on, body .ws-tab.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--pill-fill); }
body .ws-live, body .ws-live.on { color: var(--accent); }
body .ws-live.on::before, body .ws-step.running .ws-console::after, body .ws-agent.live .ws-agent-state::before, body.streaming .ws-btn::after { background: var(--pill-fill); color: var(--pill-fill); }
body .ws-step.running { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: 0 0 0 3px var(--accent-soft); }
body .ws-empty-ico { background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 85%, #000); }
body .ws-fico.dir { background: var(--accent); }
body .ask-opt:hover { border-color: var(--accent); background: var(--accent-soft); }
body .ask-head { color: var(--accent); }

/* ---------- Réglages, admin ---------- */
body .group { background: var(--surface); border-radius: 22px; }
body .group-head { color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
body .sn-tile { background: color-mix(in srgb, var(--tc, var(--accent)) 16%, transparent); }
body .sn-item.on { background: var(--elev); box-shadow: inset 3px 0 0 var(--pill-fill); }
body .settings .nav h2, body .settings-body h2, body .settings-body h3.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; }
body .settings .nav h2 { font-size: 28px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 820px) { body .settings .nav h2 { font-size: 22px; padding: 0 44px; } }
body .usage-grid div { background: var(--elev); }
body .usage-grid b { font-family: var(--serif); font-weight: 400; font-size: 30px; }
body .field:focus-within, body .ask-form input:focus, body .ask-form textarea:focus { border-color: color-mix(in srgb, var(--accent) 60%, var(--sep)); }
body input:focus, body textarea:focus, body select:focus { caret-color: var(--accent); }
body .user-acts .link-btn { background: var(--elev); color: var(--text); }
body .settings-shell { background: var(--panel); }

body .group > .row.sub { padding: 12px 16px; min-height: 44px; }
body .user-acts .link-btn.danger { margin-top: 0; }
body .row-select { max-width: 55%; text-overflow: ellipsis; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) body .switch:not(:checked) { background: rgba(18,18,20,.18); } }
:root[data-theme="light"] body .switch:not(:checked) { background: rgba(18,18,20,.18); }
:root[data-theme="light"] body .ws-tab.on, :root[data-theme="light"] body .ws-tab.active { box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------- Connexion ---------- */
body .login { background: radial-gradient(80% 50% at 50% 0%, color-mix(in srgb, var(--pill-fill) 14%, transparent), transparent 70%), var(--bg); }
body .login-card h1 { font-family: var(--serif); font-weight: 400; font-size: 40px; letter-spacing: -.02em; }
body .login-card input { border-radius: 16px; height: 52px; background: var(--surface); }
body .login-card input:focus { border-color: color-mix(in srgb, var(--accent) 65%, transparent); box-shadow: 0 0 0 4px var(--accent-soft); }
.pk-btn { background: var(--surface); border-radius: 20px; }
.pk-btn .pk-ring, .pk-offer-ic, .login-card.pk-ok .pk-ring { background: var(--pill-fill); color: var(--pill-ink); }
.has-passkey .pk-btn { border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: 0 8px 28px -12px color-mix(in srgb, var(--pill-fill) 55%, transparent); }
.pk-btn .pk-ring::before { border-color: color-mix(in srgb, var(--pill-fill) 45%, transparent); }
.pk-offer h2 { font-family: var(--serif); font-weight: 400; font-size: 30px; }
.pk-offer-card { border-radius: 30px; background: var(--elev); }
.bk-key { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.bk-ok input { accent-color: var(--pill-fill); }

/* ---------- Installation ---------- */
#install-gate { background: radial-gradient(70% 38% at 50% 0%, color-mix(in srgb, var(--pill-fill) 14%, transparent), transparent 70%), var(--bg); }
#install-gate h1 { font-family: var(--serif); font-weight: 400; font-size: 38px; letter-spacing: -.02em; }
#install-gate .ig-steps li.ig-on { border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: 0 0 0 4px var(--accent-soft); }
#install-gate .ig-steps li.ig-on .ig-n, #install-gate .ig-prog i.on, #install-gate .ig-done { background: var(--pill-fill); color: var(--pill-ink); }
#install-gate .ig-ic { color: var(--accent); }
#install-gate .ig-btn { border-radius: 999px; }

/* ---------- Feuilles, menus, dialogues ---------- */
body .sheet { background: var(--elev); border-radius: 28px 28px 0 0; }
body .sheet-cancel { background: var(--surface); }
body dialog, body .dlg { border-radius: 24px; }
body .slash-menu, body .menu { background: var(--elev); border-radius: 20px; }
body .to-bottom, body .live-pill { background: var(--elev); }
body .live-pill { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
body .banner { background: var(--surface); }

/* ---------- Voix : mêmes couleurs, fond d'encre ---------- */
.voice { --mood: #CBFF4D; background: #0A0A0C; color: #F3F1EA; }
.voice-status { min-height: 1.25em; font-family: var(--serif); font-weight: 400; font-size: 34px; letter-spacing: -.01em; }
.vm-dot { background: var(--mood); box-shadow: 0 0 10px var(--mood); }
.voice-engine::before { background: var(--pill-fill, #CBFF4D); }

/* ---------- Mouvement : réduit si demandé ---------- */
@media (prefers-reduced-motion: reduce) { body .empty > * { animation: none !important; } }
