/* Identité HINFINI (hinfini.fr) : bleu nuit, dégradé cyan → bleu → violet, Space Grotesk / Inter. */
:root {
  --bg: #f5f7fd; --side: #eaeefa; --surface: #ffffff; --line: rgba(40, 60, 130, .14); --line-strong: rgba(40, 60, 130, .3);
  --text: #101530; --muted: #545d85; --code: #eef1fb; --bubble: #e3e9fb;
  --cyan: #0e93ac; --blue: #2563eb; --violet: #7c3aed; --ok: #15803d; --bad: #b91c1c;
  --grad: linear-gradient(100deg, #22d3ee 0%, #3b82f6 48%, #8b5cf6 100%);
  --display: "Space Grotesk", "Segoe UI", system-ui, sans-serif; --body: Inter, "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Code", Consolas, monospace;
}
:root[data-theme="dark"] {
  --bg: #060914; --side: #0a1022; --surface: #0f1630; --line: rgba(140, 160, 255, .14); --line-strong: rgba(140, 160, 255, .3);
  --text: #eef2ff; --muted: #a3acd0; --code: #080d1d; --bubble: #1a2450;
  --cyan: #22d3ee; --blue: #60a5fa; --violet: #a78bfa; --ok: #4ade80; --bad: #f87171;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { display: flex; background: var(--bg); color: var(--text); font: 15px/1.55 var(--body); overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; border-radius: 10px; }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
input, textarea, select { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; min-width: 0; }
h1, h2, h3 { font-family: var(--display); line-height: 1.25; }
a { color: var(--blue); }
.grow { flex: 1; }
.muted { color: var(--muted); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.row.center { justify-content: center; } .row.end { justify-content: flex-end; }
.icon { width: 34px; height: 34px; flex: none; color: var(--muted); }
.icon:hover { background: var(--bubble); color: var(--text); }
.btn { padding: 8px 16px; border: 1px solid var(--line-strong); font-family: var(--display); font-weight: 600; }
.btn:hover:not(:disabled) { border-color: var(--cyan); }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn.primary { background: var(--grad); border-color: transparent; color: #05081a; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }

#sidebar { width: 272px; flex: none; display: flex; flex-direction: column; gap: 8px; padding: 14px 12px; background: var(--side); border-right: 1px solid var(--line); min-height: 0; }
body.collapsed #sidebar { display: none; }
body:not(.collapsed) #open-side { display: none; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 36px; height: 36px; }
.brand span { flex: 1; font: 700 20px/1 var(--display); letter-spacing: .08em; }
.brand small { display: block; font-size: 10px; letter-spacing: .34em; color: var(--muted); }
.btn.voice { border-color: var(--cyan); color: var(--cyan); }
#nav { display: flex; flex-direction: column; }
#nav button { text-align: left; padding: 6px 10px; color: var(--muted); font-weight: 500; }
#nav button:hover, #nav button.active { background: var(--bubble); color: var(--text); }
#sessions { flex: 1; overflow-y: auto; min-height: 0; }
.session { display: flex; align-items: center; border-radius: 10px; }
.session:hover, .session.active { background: var(--bubble); }
.session .open { flex: 1; min-width: 0; text-align: left; padding: 6px 10px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session .del { opacity: 0; width: 28px; height: 28px; }
.session:hover .del, .session .del:focus-visible { opacity: 1; }
.session .del:hover { color: var(--bad); }
.side-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; font-size: 13px; }
.side-foot #status { flex: 1; }
#dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
#dot.ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); } #dot.bad { background: var(--bad); }

main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; min-height: 56px; }
#title { font: 600 16px var(--display); padding: 4px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#gate-badge { display: inline-block; width: 9px; height: 9px; margin-left: 6px; border-radius: 50%; background: var(--bad); }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.page { overflow-y: auto; padding: 0 max(20px, calc((100% - 940px) / 2)) 40px; display: block; }
.page h2 { font-size: 28px; margin: 12px 0 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.grid .card h4 { margin: 0 0 4px; font: 600 16px var(--display); overflow-wrap: anywhere; }
.grid .card p { margin: 4px 0; font-size: 14px; }
.card.selected { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan); }
.grid input { width: 100%; }

#scroll { flex: 1; overflow-y: auto; padding: 0 20px; }
#messages, #dock { width: 100%; max-width: 820px; margin: 0 auto; }
#dock { padding: 0 20px 8px; max-width: 860px; }
#messages { padding-bottom: 24px; }
#view-chat.empty #scroll { flex: 0; margin-top: auto; overflow: visible; }
#view-chat.empty #dock { margin-bottom: auto; }
#view-chat:not(.empty) #welcome, #view-chat:not(.empty) #suggestions { display: none; }
#view-chat.empty .note { visibility: hidden; }
#welcome { text-align: center; padding-bottom: 18px; }
#welcome img { width: 72px; height: 72px; filter: drop-shadow(0 0 22px rgba(59, 130, 246, .65)); }
#welcome h1 { margin: 8px 0 0; font-size: clamp(26px, 4vw, 40px); }
#welcome em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
#welcome p { margin: 4px 0 0; color: var(--muted); }
#composer { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 20px; padding: 12px; box-shadow: 0 20px 50px -30px rgba(30, 60, 180, .6); }
#composer.drop { border-color: var(--cyan); }
#input { width: 100%; max-height: 220px; resize: none; border: 0; background: transparent; font-size: 16px; padding: 2px 4px; outline: 0; }
#composer .bar { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
#model { max-width: 210px; font-size: 13px; padding: 4px 8px; }
.folder { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.folder input { flex: 1; border-color: transparent; background: transparent; font-size: 12px; padding: 3px 6px; }
#context { font-size: 12px; color: var(--muted); white-space: nowrap; }
#send { width: 38px; height: 38px; flex: none; background: var(--grad); color: #05081a; font-size: 18px; font-weight: 700; }
#send.stop { background: var(--text); color: var(--bg); font-size: 13px; }
#attachments { display: flex; flex-wrap: wrap; gap: 6px; }
#attachments button { font-size: 12px; background: var(--bubble); padding: 3px 9px; margin-bottom: 6px; }
#suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding-top: 14px; }
#suggestions button { border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px; font-size: 13px; color: var(--muted); }
#suggestions button:hover { color: var(--text); border-color: var(--cyan); }
.note { text-align: center; font-size: 12px; color: var(--muted); margin: 8px 0 0; }
#activity { display: flex; align-items: center; gap: 8px; padding: 0 6px 8px; font-size: 13px; color: var(--muted); }
.spinner { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--cyan); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#todos { margin: 0 0 8px; padding: 8px 12px 8px 32px; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; max-height: 22vh; overflow: auto; }
#todos li.completed { color: var(--muted); text-decoration: line-through; }
#todos li.in_progress { color: var(--cyan); font-weight: 600; }

.msg { margin: 18px 0; overflow-wrap: anywhere; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user > div { max-width: 82%; background: var(--bubble); border-radius: 18px 18px 4px 18px; padding: 10px 16px; white-space: pre-wrap; }
.msg.assistant { font-size: 15.5px; line-height: 1.7; }
.msg.assistant .body > :first-child { margin-top: 0; }
.msg .tools-line { display: flex; gap: 4px; opacity: 0; }
.msg:hover .tools-line, .msg .tools-line:focus-within { opacity: 1; }
.tools-line button { font-size: 12px; color: var(--muted); padding: 2px 8px; }
.msg code { font: 13px var(--mono); background: var(--code); border-radius: 5px; padding: 1px 5px; }
.msg table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 14px; }
.msg th, .msg td { border: 1px solid var(--line-strong); padding: 5px 10px; text-align: left; }
.msg blockquote { margin: .6em 0; padding-left: 12px; border-left: 3px solid var(--violet); color: var(--muted); }
.msg.error { color: var(--bad); border: 1px solid var(--bad); border-radius: 12px; padding: 10px 14px; font-size: 14px; white-space: pre-wrap; }
.msg.info { color: var(--muted); font-size: 13px; }
.codeblock { margin: .8em 0; border: 1px solid var(--line); border-radius: 12px; background: var(--code); overflow: hidden; }
.codeblock .head { display: flex; gap: 6px; padding: 4px 8px 0 14px; font-size: 12px; color: var(--muted); }
.codeblock .head span { flex: 1; }
.codeblock .head button { padding: 2px 8px; }
.codeblock pre { margin: 0; padding: 8px 14px 14px; overflow-x: auto; }
.codeblock code { background: none; padding: 0; }
details.tool { margin: 8px 0; border: 1px solid var(--line); border-left: 3px solid var(--cyan); border-radius: 10px; font-size: 13px; }
details.tool summary { display: flex; gap: 8px; align-items: center; padding: 7px 12px; cursor: pointer; color: var(--muted); list-style: none; }
details.tool b { color: var(--text); white-space: nowrap; }
details.tool .ctx { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: 12px var(--mono); }
details.tool pre { margin: 0; max-height: 320px; overflow: auto; padding: 10px 12px; background: var(--code); border-top: 1px solid var(--line); font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

.request { background: var(--surface); border: 1px solid var(--violet); border-radius: 16px; padding: 14px 16px; margin-bottom: 10px; max-height: 42vh; overflow: auto; text-align: left; }
.request h3 { margin: 0 0 4px; font-size: 15px; }
.request pre { background: var(--code); border-radius: 8px; padding: 10px; font: 12px var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.request input { flex: 1; }

#panel { width: min(46vw, 720px); flex: none; display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--side); }
.tabs { display: flex; align-items: center; gap: 2px; padding: 10px 10px 6px; }
.tabs > button:not(.icon) { padding: 5px 12px; font-size: 13px; color: var(--muted); }
.tabs > button.active { background: var(--bubble); color: var(--text) !important; }
.pane { flex: 1; min-height: 0; overflow: auto; padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; }
#url-form { display: flex; gap: 6px; } #url-form .mic-wrap { flex: 1; } #url { width: 100%; }
#screen { position: relative; aspect-ratio: 1280 / 800; width: 100%; flex: none; background: var(--code); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; }
#screen:focus { border-color: var(--cyan); }
#frame { display: block; width: 100%; height: 100%; }
#frame:not([src]) { visibility: hidden; }
#screen-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 20px; text-align: center; color: var(--muted); }
#type-form .mic-wrap { flex: 1; }
#type-form input, #type-form { width: 100%; }
#artifact { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.field .line { display: flex; gap: 6px; align-items: center; } .field .mic-wrap, .field select, .field input:not([type=checkbox]) { flex: 1; }
#history { margin: 0; padding-left: 20px; font-size: 13px; } #history li { margin-bottom: 8px; overflow-wrap: anywhere; }
#gates { padding: 0 10px; max-height: 45%; overflow: auto; }

#jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 14px; }
#jobs img, #jobs video { width: 100%; border-radius: 12px; display: block; }
#jobs .card { padding: 10px; font-size: 13px; }

.mic-wrap { position: relative; display: flex; min-width: 0; }
.mic-wrap > input, .mic-wrap > textarea { width: 100%; padding-right: 38px; }
.mic { position: absolute; right: 4px; top: 50%; translate: 0 -50%; width: 30px; height: 30px; border-radius: 50%; color: var(--muted); display: grid; place-items: center; }
textarea + .mic { top: 18px; }
.mic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.mic:hover { background: var(--bubble); color: var(--cyan); }
.mic.recording { background: var(--bad); color: #fff; animation: pulse 1.2s infinite; }
.mic.working { color: var(--cyan); animation: pulse .7s infinite; }
@keyframes pulse { 50% { opacity: .45; } }

#voice { position: fixed; inset: 0; z-index: 20; background: radial-gradient(circle at 50% 42%, #0d1a3d 0%, #040713 70%); color: #eef2ff; --surface: #0f1630; --text: #eef2ff; --muted: #a3acd0; --code: #080d1d; --line: rgba(140, 160, 255, .2); --line-strong: rgba(140, 160, 255, .35); --bubble: #1a2450; }
#orb { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.voice-top { position: relative; display: flex; align-items: center; gap: 12px; padding: 16px 20px; font: 600 13px var(--display); letter-spacing: .28em; }
.voice-top span { flex: 1; }
.voice-top select { letter-spacing: 0; max-width: 240px; font-size: 12px; }
.voice-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 20px 24px; max-width: 760px; margin: 0 auto; text-align: center; pointer-events: none; }
.voice-bottom > * { pointer-events: auto; }
#voice-state { font: 600 13px var(--display); letter-spacing: .3em; text-transform: uppercase; color: #67e8f9; }
#voice-heard { color: var(--muted); margin: 6px 0; min-height: 1.5em; }
#voice-said { margin: 6px 0 12px; max-height: 4.8em; overflow: hidden; }

dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 16px; width: min(440px, 92vw); }
dialog::backdrop { background: rgba(3, 6, 18, .65); }
dialog .mic-wrap input { width: 100%; }
#toast { position: fixed; left: 50%; bottom: 18px; translate: -50% 0; z-index: 30; max-width: 90vw; background: var(--text); color: var(--bg); border-radius: 12px; padding: 9px 16px; font-size: 14px; }

@media (max-width: 1100px) { #panel { position: fixed; inset: 0 0 0 auto; width: min(100vw, 720px); z-index: 8; box-shadow: -20px 0 50px rgba(0, 0, 0, .4); } }
@media (max-width: 760px) {
  #sidebar { position: fixed; inset: 0 auto 0 0; z-index: 9; box-shadow: 20px 0 50px rgba(0, 0, 0, .4); }
  #scroll, #dock { padding-left: 14px; padding-right: 14px; }
  .folder, #context { display: none; } #model { flex: 1; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .spinner, .mic { animation: none !important; } }

body.login { display: grid; place-items: center; overflow: auto; padding: 20px; background: radial-gradient(circle at 50% 30%, #0d1a3d 0%, var(--bg) 65%); }
#login { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; text-align: center; }
#login img { width: 64px; height: 64px; margin: 0 auto; }
#login h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: .08em; }
#login h1 small { display: block; font-size: 11px; letter-spacing: .34em; color: var(--muted); }
#login label { display: flex; flex-direction: column; gap: 4px; text-align: left; font-size: 13px; color: var(--muted); }
#login input { color: var(--text); }
#login p { margin: 0; font-size: 13px; }
#error { color: var(--bad); }
