/* Teeya — l'assistante de Yorix Groupe. Monde Yorix : le BAT — papier, encre noire, rouge correcteur, cible de repérage. */

@font-face {
  font-family: "Schibsted";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/assets/fonts/schibsted-latin.woff2") format("woff2");
}

:root {
  --ground: #f7f7f4;
  --paper: #ffffff;
  --paper-2: #ecece6;
  --line: rgba(18, 18, 18, 0.12);
  --line-strong: rgba(18, 18, 18, 0.3);
  --ink: #121212;
  --ink-2: #55575e;
  --ink-3: #66686f;
  --pill: #121212;
  --pill-ink: #f7f7f4;
  --pill-ink-2: #c9c9c3;
  --pill-line: rgba(247, 247, 244, 0.16);
  --user: #121212;
  --user-ink: #f7f7f4;
  --accent: #d7141c;
  --accent-ink: #ffffff;
  --accent-text: #b8111a;
  --accent-soft: rgba(215, 20, 28, 0.12);
  --cyan: #00a0e3;
  --violet: #e4007c;
  --code-bg: #121212;
  --code-ink: #ecece6;
  --danger: #b8111a;
  --ok: #087a3e;
  --shadow-pill: 0 18px 40px -14px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.12);
  --shadow-sheet: 0 -18px 50px rgba(0, 0, 0, 0.16);
  --shadow-card: 0 1px 0 rgba(0, 0, 0, 0.04), 0 18px 30px -22px rgba(0, 0, 0, 0.4);
  --radius: 0;
  --col: 720px;
  --dock-h: 128px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ground: #121212;
  --paper: #1c1c1c;
  --paper-2: #262626;
  --line: rgba(247, 247, 244, 0.1);
  --line-strong: rgba(247, 247, 244, 0.22);
  --ink: #f7f7f4;
  --ink-2: #c9c9c3;
  --ink-3: #a3a39d;
  --pill: #000000;
  --pill-line: rgba(247, 247, 244, 0.14);
  --user: #2c2c2c;
  --user-ink: #f7f7f4;
  --accent-text: #ff6b70;
  --accent-soft: rgba(215, 20, 28, 0.2);
  --danger: #ff8a7f;
  --code-bg: #000000;
  --shadow-pill: 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(247, 247, 244, 0.1);
  --shadow-sheet: 0 -18px 50px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 10px 28px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(247, 247, 244, 0.08);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #121212;
    --paper: #1c1c1c;
    --paper-2: #262626;
    --line: rgba(247, 247, 244, 0.1);
    --line-strong: rgba(247, 247, 244, 0.22);
    --ink: #f7f7f4;
    --ink-2: #c9c9c3;
    --ink-3: #a3a39d;
    --pill: #000000;
    --pill-line: rgba(247, 247, 244, 0.14);
    --user: #2c2c2c;
    --user-ink: #f7f7f4;
    --accent-text: #ff6b70;
    --accent-soft: rgba(215, 20, 28, 0.2);
    --danger: #ff8a7f;
    --code-bg: #000000;
    --shadow-pill: 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(247, 247, 244, 0.1);
    --shadow-sheet: 0 -18px 50px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 10px 28px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(247, 247, 244, 0.08);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font: 400 16.5px/1.62 "Schibsted", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  caret-color: var(--accent);
}
::selection { background: #ffe100; color: #121212; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 5px #ffe100; border-radius: 0; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
[hidden] { display: none !important; }
.sprite { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--pill); color: var(--pill-ink); padding: 10px 14px; border-radius: 0; text-decoration: none; }
.skip:focus { top: 12px; }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 16px; height: 16px; }

/* ---------- La goutte de Teeya : une goutte de teinture qui s'étale en cercles ---------- */
.orb {
  --s: 28px;
  position: relative;
  display: inline-block;
  width: var(--s);
  height: var(--s);
  flex: none;
  border-radius: 50%;
  background:
    radial-gradient(circle at 52% 52%, #e4007c 0 15%, transparent 16%),
    radial-gradient(circle, transparent 0 28%, #121212 29% 37%, transparent 38% 55%, #00a0e3 56% 64%, transparent 65% 84%, #121212 85% 95%, transparent 96%),
    #ffffff;
}
.orb-xs { --s: 18px; }
.orb-sm { --s: 30px; }
.orb-lg { --s: 64px; }
.orb::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid #e4007c;
  opacity: 0;
}
.is-thinking .orb::after, .orb.is-thinking::after { animation: goutte 1.5s var(--ease) infinite; }
@keyframes goutte { 0% { transform: scale(0.7); opacity: 0.9; } 100% { transform: scale(1.45); opacity: 0; } }

/* ---------- Barre du haut ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 0 max(14px, env(safe-area-inset-left)) 0 max(14px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--ground) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.bar.is-scrolled { border-bottom-color: var(--line); }
.bar-back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px 0 8px;
  border-radius: 0;
  background: var(--pill);
  color: var(--pill-ink);
  font-size: 0.82rem;
  font-weight: 650;
  text-decoration: none;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 20px rgba(5, 5, 5, 0.14);
}
.bar-back .ic { width: 16px; height: 16px; }
.brand-mark { width: 12px; height: 16px; flex: none; }
.bar-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar-id-text { display: grid; line-height: 1.15; min-width: 0; }
.bar-id-text strong { font-size: 0.98rem; font-weight: 750; letter-spacing: -0.02em; }
.bar-status { font-size: 0.76rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.bar-status::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #22c55e; vertical-align: 1px; }
.bar-status[data-state="busy"]::before { background: var(--accent); animation: blink 1s infinite; }
.bar-status[data-state="off"]::before { background: var(--ink-3); }
@keyframes blink { 50% { opacity: 0.35; } }
.bar-actions { justify-self: end; display: flex; gap: 6px; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--line); }

/* ---------- Scène ---------- */
.stage {
  width: 100%;
  max-width: calc(var(--col) + 32px);
  margin: 0 auto;
  padding: 8px 16px calc(var(--dock-h) + 40px);
}
.welcome {
  display: grid;
  justify-items: start;
  gap: 18px;
  padding: clamp(28px, 9vh, 96px) 0 24px;
  animation: rise 0.6s var(--ease) both;
}
.welcome h1 {
  margin: 6px 0 0;
  font-size: clamp(2.05rem, 6.2vw, 2.6rem);
  line-height: 1.02;
  font-weight: 860;
  letter-spacing: -0.04em;
  text-wrap: balance;
  max-width: 15ch;
}
.welcome-lead { margin: 0; max-width: 54ch; color: var(--ink-2); font-size: 1.02rem; }
.starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; margin-top: 10px; }
.starter {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  text-align: left;
  transition: transform 0.18s var(--ease), border-color 0.18s, box-shadow 0.18s;
}
.starter:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-card); }
.starter .ic { margin-top: 2px; color: var(--ink); }
.starter strong { display: block; font-size: 0.95rem; font-weight: 680; letter-spacing: -0.015em; }
.starter small { display: block; margin-top: 2px; color: var(--ink-2); font-size: 0.83rem; line-height: 1.35; }
.welcome-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--ink-2); font-size: 0.88rem; font-weight: 560; text-decoration: none; border-bottom: 1px solid var(--line-strong); padding-bottom: 2px; }
.welcome-link .ic { width: 15px; height: 15px; }
.welcome-link:hover { color: var(--ink); border-color: var(--ink); }
.has-thread .welcome { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Fil de discussion ---------- */
.thread { list-style: none; margin: 0; padding: 18px 0 0; display: grid; gap: 26px; }
.msg { position: relative; animation: rise 0.28s var(--ease) both; }
.msg-user { display: grid; justify-items: end; }
.msg-user .bubble {
  max-width: min(84%, 620px);
  padding: 11px 16px;
  border-radius: 0;
  background: var(--user);
  color: var(--user-ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.msg-user .msg-files { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-bottom: 6px; }
.msg-user .msg-tools { opacity: 0; display: flex; gap: 2px; margin-top: 4px; transition: opacity 0.15s; }
.msg-user:hover .msg-tools, .msg-user:focus-within .msg-tools { opacity: 1; }
.msg-edit { width: min(100%, 620px); display: grid; gap: 8px; }
.msg-edit textarea { width: 100%; min-height: 90px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 0; background: var(--paper); resize: vertical; }
.msg-edit div { display: flex; gap: 8px; justify-content: flex-end; }

.msg-ai { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; }
.msg-ai .orb { margin-top: 2px; }
.msg-ai.is-followup .orb { visibility: hidden; }
.msg-body { min-width: 0; }
.steps { display: flex; align-items: center; gap: 8px; min-height: 30px; color: var(--ink-2); font-size: 0.9rem; }
.steps-text { color: var(--ink-2); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
@keyframes sheen { from { background-position: 100% 0; } to { background-position: -150% 0; } }

.sources { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; margin-bottom: 4px; scrollbar-width: none; }
.sources::-webkit-scrollbar { display: none; }
.source {
  flex: none;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 8px;
  width: 196px;
  padding: 9px 11px;
  border-radius: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s var(--ease);
}
.source:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.source img { grid-row: 1 / span 2; width: 16px; height: 16px; margin-top: 2px; border-radius: 0; }
.source b { font-size: 0.78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source span { font-size: 0.72rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source em { font-style: normal; color: var(--accent-text); font-weight: 700; margin-right: 4px; }

/* ---------- Texte riche ---------- */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 0.85em; max-width: 34em; text-wrap: pretty; }
.md h2, .md h3, .md h4 { margin: 1.35em 0 0.45em; line-height: 1.2; letter-spacing: -0.025em; font-weight: 720; }
.md h1 { font-size: 1.45rem; margin: 1.2em 0 0.5em; letter-spacing: -0.03em; line-height: 1.15; }
.md h2 { font-size: 1.2rem; }
.md h3 { font-size: 1.05rem; }
.md h4 { font-size: 0.98rem; }
.md ul, .md ol { margin: 0 0 0.9em; padding-left: 1.35em; max-width: 34em; }
.md li { text-wrap: pretty; }
.md li { margin: 0.28em 0; padding-left: 0.2em; }
.md li::marker { color: var(--ink-3); }
.md ol > li::marker { font-weight: 650; font-variant-numeric: tabular-nums; }
.md li.task { list-style: none; margin-left: -1.35em; display: flex; gap: 8px; }
.md strong { font-weight: 680; }
.md a { color: var(--ink); text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; }
.md a:hover { color: var(--accent-text); }
.md blockquote { margin: 0 0 0.9em; padding: 2px 0 2px 14px; border-left: 1px solid var(--line-strong); color: var(--ink-2); }
.md hr { border: 0; height: 1px; background: var(--line); margin: 1.4em 0; }
.md code { font: 0.86em/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; padding: 0.12em 0.38em; border-radius: 0; background: var(--paper-2); border: 1px solid var(--line); }
.md sup.cite a {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  margin-left: 2px;
  border-radius: 0;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.68rem;
  font-weight: 750;
  text-decoration: none;
  vertical-align: 0.12em;
  font-variant-numeric: tabular-nums;
}
.md sup.cite { line-height: 0; }
.md .table-wrap { overflow-x: auto; margin: 0 0 1em; border: 1px solid var(--line); border-radius: 0; background: var(--paper); }
.md table { border-collapse: collapse; width: 100%; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.md th, .md td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.md th { font-weight: 680; background: var(--paper-2); white-space: nowrap; }
.md tr:last-child td { border-bottom: 0; }
.code {
  margin: 0 0 1em;
  border-radius: 0;
  overflow: hidden;
  background: var(--code-bg);
  color: var(--code-ink);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 14px; font-size: 0.75rem; color: rgba(232, 235, 242, 0.62); border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.code-head button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 0; border-radius: 0; background: transparent; color: inherit; font-size: 0.75rem; }
.code-head button:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.code-head .ic { width: 15px; height: 15px; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 0.84rem/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; tab-size: 2; }
.code code { background: none; border: 0; padding: 0; font: inherit; }
.tok-k { color: #ff9e64; }
.tok-s { color: #9ece6a; }
.tok-c { color: #6b7389; font-style: italic; }
.tok-n { color: #73efff; }
.tok-t { color: #bb9af7; }

.gen-img { margin: 0 0 1em; max-width: 520px; }
.gen-img-frame { position: relative; aspect-ratio: 1; border-radius: 0; overflow: hidden; background: var(--paper-2); border: 1px solid var(--line); }
.gen-img-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(115, 239, 255, 0.18) 45%, rgba(138, 92, 255, 0.18) 55%, transparent 70%);
  background-size: 220% 100%;
  animation: sheen 1.6s linear infinite;
}
.gen-img-frame.is-ready::before { display: none; }
.gen-img img { position: relative; display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.5s; }
.gen-img-frame.is-ready img { opacity: 1; }
.gen-img-wait { position: absolute; inset: auto 0 14px; text-align: center; font-size: 0.82rem; color: var(--ink-2); }
.gen-img-frame.is-ready .gen-img-wait { display: none; }
.gen-img figcaption { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; font-size: 0.82rem; color: var(--ink-2); }
.gen-img figcaption a { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; color: var(--ink); font-weight: 600; }
.md img.inline-img { max-width: 100%; border-radius: 0; }

/* ---------- Actions sous une réponse ---------- */
.msg-tools { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 8px; margin-left: -8px; }
.tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.8rem;
  font-weight: 560;
}
.tool .ic { width: 17px; height: 17px; }
.tool:hover { background: var(--line); color: var(--ink); }
.tool.is-on { color: var(--accent-text); }
.msg-meta { margin-left: auto; align-self: center; font-size: 0.72rem; color: var(--ink-3); padding-right: 4px; }
.msg-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 0;
  background: color-mix(in srgb, var(--danger) 9%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
  color: var(--ink);
  font-size: 0.92rem;
}
.followups { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.followup {
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 560;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.15s var(--ease);
}
.followup:hover { background: var(--paper); border-color: var(--ink); transform: translateY(-1px); }
.caret { display: inline-block; width: 8px; height: 1.05em; margin-left: 2px; vertical-align: -0.15em; border-radius: 0; background: var(--accent); animation: blink 0.9s infinite; }

/* Pièces jointes */
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  height: 44px;
  padding: 4px 10px 4px 4px;
  border-radius: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.8rem;
}
.file-chip .thumb { width: 36px; height: 36px; flex: none; border-radius: 0; object-fit: cover; background: var(--paper-2); display: grid; place-items: center; }
.file-chip .thumb .ic { width: 18px; height: 18px; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip small { display: block; color: var(--ink-3); font-size: 0.7rem; }
.file-chip button { display: grid; place-items: center; width: 26px; height: 26px; margin-left: 2px; border: 0; border-radius: 50%; background: var(--line); color: var(--ink); }
.file-chip button .ic { width: 14px; height: 14px; }

/* Brief */
.brief { margin: 4px 0 1em; padding: 16px; border-radius: 0; background: var(--paper); border: 1px solid var(--line-strong); box-shadow: var(--shadow-card); }
.brief-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.brief-head strong { font-size: 1rem; letter-spacing: -0.02em; }
.brief-fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0 0 14px; font-size: 0.92rem; }
.brief-fields dt { color: var(--ink-2); font-weight: 560; }
.brief-fields dd { margin: 0; }
.brief-inputs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.brief-inputs input { width: 100%; height: 44px; padding: 0 12px; border-radius: 0; border: 1px solid var(--line-strong); background: var(--ground); }
.brief-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.brief-msg { margin: 8px 0 0; font-size: 0.85rem; color: var(--ink-2); }
.brief-msg.is-ok { color: var(--ok); }
.brief-msg.is-err { color: var(--danger); }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 0; border: 1px solid transparent; font-weight: 650; font-size: 0.9rem; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-dark { background: var(--pill); color: var(--pill-ink); }
.btn[disabled] { opacity: 0.55; cursor: default; }

/* ---------- La pilule (barre de saisie) ---------- */
.dock {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  padding: 18px 16px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--ground) 62%, color-mix(in srgb, var(--ground) 0%, transparent));
  pointer-events: none;
}
.dock > * { pointer-events: auto; }
.dock-note { max-width: var(--col); margin: 0 auto 8px; text-align: center; font-size: 0.82rem; color: var(--ink-2); }
.pill {
  position: relative;
  max-width: var(--col);
  margin: 0 auto;
  padding: 9px;
  border-radius: 0;
  background: var(--pill);
  color: var(--pill-ink);
  box-shadow: var(--shadow-pill);
  transition: border-radius 0.3s var(--ease), box-shadow 0.3s;
}
.pill.is-tall { border-radius: 0; }
.pill-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 4px 8px; }
.pill-files .file-chip { background: #16181d; border-color: var(--pill-line); color: var(--pill-ink); }
.pill-files .file-chip small { color: var(--pill-ink-2); }
.pill-files .file-chip button { background: rgba(255, 255, 255, 0.1); color: var(--pill-ink); }
.pill-files .file-chip .thumb { background: #22252c; }
.pill-row { display: flex; align-items: flex-end; gap: 4px; }
.pill-btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--pill-ink);
  transition: background 0.15s, color 0.15s, transform 0.2s var(--ease);
}
.pill-btn:hover { background: rgba(255, 255, 255, 0.09); }
.pill-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.12); }
.pill-btn[aria-expanded="true"] .ic { transform: rotate(45deg); }
.pill-btn .ic { transition: transform 0.2s var(--ease); }
#mic[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.pill-field { position: relative; flex: 1; min-width: 0; align-self: center; }
.pill textarea {
  display: block;
  width: 100%;
  max-height: 40vh;
  min-height: 46px;
  padding: 12px 6px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--pill-ink);
  font-size: 1rem;
  line-height: 1.4;
  caret-color: var(--accent);
}
.pill textarea::placeholder { color: var(--pill-ink-2); }
.pill textarea:focus-visible { outline: 0; box-shadow: none; }
.pill:has(textarea:focus-visible) { box-shadow: var(--shadow-pill), 0 0 0 2px var(--accent); }
.pill-send {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  transition: transform 0.2s var(--ease), background 0.2s, opacity 0.2s;
}
.pill-send .ic { stroke-width: 2.2; }
.pill-send:hover:not([disabled]) { transform: scale(1.06); }
.pill-send[disabled] { background: rgba(247, 247, 244, 0.14); color: rgba(247, 247, 244, 0.55); cursor: default; }
.pill-think, .pill-wave { position: absolute; inset: 0; display: none; align-items: center; gap: 10px; padding: 0 6px; pointer-events: none; }
.pill-wave { width: 100%; height: 100%; }
.pill-think-text { font-size: 0.95rem; color: var(--pill-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* États de la pilule : idle → listening → thinking → streaming */
.pill[data-state="thinking"] textarea, .pill[data-state="streaming"] textarea { opacity: 0; }
.pill[data-state="thinking"] .pill-think, .pill[data-state="streaming"] .pill-think { display: flex; animation: slideIn 0.35s var(--ease) both; }
.pill[data-state="thinking"] .pill-think .orb::after, .pill[data-state="streaming"] .pill-think .orb::after { opacity: 1; animation: spin 1.1s linear infinite; }
.pill[data-state="streaming"] .pill-think-text { color: var(--pill-ink-2); }
.pill[data-state="thinking"] .pill-send, .pill[data-state="streaming"] .pill-send { background: var(--pill-ink); color: var(--pill); }
.pill[data-state="listening"] { box-shadow: var(--shadow-pill), 0 0 0 2px var(--accent); }
.pill[data-state="listening"] .pill-wave { display: block; }
.pill[data-state="listening"] textarea { color: transparent; }
.pill[data-state="listening"] textarea::placeholder { color: transparent; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }

.dock-meta { display: flex; align-items: center; gap: 10px; max-width: var(--col); margin: 8px auto 0; padding: 0 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
}
.chip .ic { width: 15px; height: 15px; }
.chip:hover { background: var(--paper); }
.dock-hint { font-size: 0.74rem; color: var(--ink-3); line-height: 1.3; }

.attach-menu {
  position: absolute;
  bottom: calc(100% - 10px);
  left: max(16px, calc(50% - var(--col) / 2));
  display: grid;
  min-width: 250px;
  padding: 6px;
  border-radius: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card), 0 20px 50px rgba(18, 24, 37, 0.14);
  animation: rise 0.2s var(--ease) both;
}
.attach-menu button { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border: 0; border-radius: 0; background: transparent; text-align: left; font-size: 0.92rem; font-weight: 560; }
.attach-menu button:hover, .attach-menu button:focus-visible { background: var(--paper-2); }

.drop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: color-mix(in srgb, var(--ground) 70%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.drop-card { display: grid; justify-items: center; gap: 6px; padding: 40px 56px; border: 2px dashed var(--accent); border-radius: 0; background: var(--paper); text-align: center; }
.drop-card .ic { width: 34px; height: 34px; }
.drop-card strong { font-size: 1.3rem; letter-spacing: -0.03em; }
.drop-card span { color: var(--ink-2); font-size: 0.9rem; }

/* ---------- Tiroirs ---------- */
.sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 600px;
  max-height: min(86dvh, 760px);
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-sheet);
  overflow: hidden;
  display: none;
  flex-direction: column;
}
.sheet[open] { display: flex; animation: sheetUp 0.38s var(--ease) both; }
.sheet.is-closing { animation: sheetDown 0.22s ease-in both; }
.sheet::backdrop { background: rgba(5, 5, 5, 0.38); animation: fade 0.3s both; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetDown { to { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 720px) {
  .sheet { inset: auto 0 24px 0; border-radius: 0; }
}
.sheet-grip { width: 40px; height: 5px; margin: 10px auto 0; border-radius: 99px; background: var(--line-strong); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 6px 22px; }
.sheet-head h2 { margin: 0; font-size: 1.25rem; font-weight: 740; letter-spacing: -0.03em; }
.sheet-search { display: flex; align-items: center; gap: 10px; margin: 6px 16px 8px; padding: 0 14px; border-radius: 0; background: var(--ground); }
.sheet-search .ic { color: var(--ink-2); }
.sheet-search input { flex: 1; height: 46px; border: 0; outline: 0; background: transparent; }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 16px 16px; overscroll-behavior: contain; }
.sheet-foot { display: grid; gap: 2px; padding: 8px 10px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.row-btn { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border: 0; border-radius: 0; background: transparent; text-align: left; font-weight: 560; }
.row-btn:hover { background: var(--paper-2); }
.row-btn-danger { color: var(--danger); }
.history-group { margin: 14px 6px 6px; font-size: 0.74rem; font-weight: 650; letter-spacing: 0.02em; color: var(--ink-3); }
.history-item { display: flex; align-items: center; gap: 4px; border-radius: 0; }
.history-item:hover, .history-item.is-active { background: var(--paper-2); }
.history-open { flex: 1; min-width: 0; display: grid; gap: 1px; padding: 10px 12px; border: 0; background: transparent; text-align: left; }
.history-open b { font-weight: 600; font-size: 0.94rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-open small { color: var(--ink-3); font-size: 0.76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item .icon-btn { width: 38px; height: 38px; opacity: 0; color: var(--ink-2); }
.history-item:hover .icon-btn, .history-item:focus-within .icon-btn, .history-item.is-active .icon-btn { opacity: 1; }
.history-empty { padding: 30px 10px; text-align: center; color: var(--ink-2); }

.field { display: grid; gap: 8px; margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
.field legend, .field-label { padding: 0; margin-bottom: 2px; font-weight: 650; font-size: 0.92rem; }
.field input[type="text"], .field textarea { width: 100%; padding: 12px 14px; border-radius: 0; border: 1px solid var(--line-strong); background: var(--ground); resize: vertical; }
.field-help { margin: 0; font-size: 0.8rem; color: var(--ink-2); }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border-radius: 0; background: var(--ground); }
.field-row small, .choice small { display: block; color: var(--ink-2); font-size: 0.8rem; font-weight: 400; }
.choices { display: grid; gap: 6px; }
.choice { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 0; background: var(--ground); border: 1px solid transparent; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--ink); }
.choice.is-off { opacity: 0.45; pointer-events: none; }
.choice input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: 0; background: var(--ground); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: grid; place-items: center; min-height: 40px; padding: 0 8px; border-radius: 0; font-size: 0.86rem; font-weight: 600; color: var(--ink-2); text-align: center; transition: background 0.15s, color 0.15s; }
.segmented input:checked + span { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(18, 24, 37, 0.12); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.switch { appearance: none; -webkit-appearance: none; position: relative; width: 50px; height: 30px; flex: none; margin: 0; border-radius: 99px; background: var(--line-strong); cursor: pointer; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s var(--ease); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-h) + 12px);
  z-index: 70;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 0;
  background: var(--pill);
  color: var(--pill-ink);
  font-size: 0.86rem;
  font-weight: 560;
  box-shadow: var(--shadow-pill);
  animation: rise 0.25s var(--ease) both;
}

/* ---------- Intégration (widget, iframe) ---------- */
.is-embed .bar-back { display: none; }
.is-embed .bar { grid-template-columns: auto 1fr auto; height: 58px; padding-right: 104px; }
.is-embed .bar-id { justify-self: start; }
.is-embed .welcome { padding-top: 22px; }
.is-embed .welcome h1 { font-size: 1.9rem; }
.is-embed .starters { grid-template-columns: 1fr; }
.is-embed .welcome-link { display: none; }
.is-embed .dock-hint { display: none; }

/* ---------- Petits écrans ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .bar { grid-template-columns: auto 1fr auto; }
  .bar-back { padding: 0 10px 0 6px; }
  .bar-back-label { display: none; }
  .bar-id { justify-self: start; }
  .starters { grid-template-columns: 1fr; }
  .starter { min-height: 64px; padding: 12px 14px; }
  .dock { padding-left: 10px; padding-right: 10px; }
  .dock-hint { display: none; }
  .msg-ai { grid-template-columns: minmax(0, 1fr); }
  .msg-ai > .orb { display: none; }
  .msg-user .bubble { max-width: 88%; }
  .brief-inputs { grid-template-columns: 1fr; }
  .brief-fields { grid-template-columns: 1fr; gap: 0 0; }
  .brief-fields dd { margin-bottom: 8px; }
  .msg-user .msg-tools { opacity: 1; }
  .msg-user:not(:nth-last-child(-n+2)) .msg-tools { display: none; }
  .hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .steps-text { opacity: 1; }
}
@media print {
  .bar, .dock, .msg-tools, .followups { display: none !important; }
  .stage { padding-bottom: 0; }
}

/* Cartes projet citées par Teeya */
.projs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 4px 0 1em; }
.proj { display: grid; grid-template-rows: auto 1fr; overflow: hidden; border-radius: 0; background: var(--paper); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: transform 0.18s var(--ease), border-color 0.18s; }
.proj:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.proj img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; background: var(--paper-2); }
.proj span { display: grid; gap: 2px; padding: 10px 12px 12px; }
.proj b { font-size: 0.95rem; font-weight: 700; letter-spacing: -0.015em; }
.proj small { color: var(--ink-2); font-size: 0.8rem; line-height: 1.4; }
.proj em { display: inline-flex; align-items: center; gap: 5px; font-style: normal; color: var(--accent-text); font-size: 0.78rem; font-weight: 700; margin-top: 4px; }
.proj em .ic { width: 14px; height: 14px; }
.md li.task .ic { width: 16px; height: 16px; margin-top: 4px; color: var(--ink-2); }

/* 4. Cibles tactiles confortables */
@media (pointer: coarse) {
  .tool, .chip, .followup, .code-head button { min-height: 44px; }
  .history-item .icon-btn, .file-chip button { min-width: 44px; min-height: 44px; }
}
