/* ===================== SNAP AI — styles =====================
   Formes arrondies, surfaces translucides (verre dépoli), ombres douces.
   Les thèmes redéfinissent uniquement les variables ci-dessous. */
:root {
  --brand: #5b4cf5; --brand-2: #00b4d8; --on-brand: #fff;
  --bg1: #eef0ff; --bg2: #e3f6fb; --blob1: #b9b0ff; --blob2: #8fe3f3;
  --glass: rgba(255,255,255,.80); --glass-strong: rgba(255,255,255,.94); --glass-soft: rgba(255,255,255,.55);
  --text: #1c1d2b; --muted: #676a80; --border: rgba(30,32,60,.10);
  --brand-soft: rgba(91,76,245,.12); --tool: rgba(30,32,60,.05);
  --danger: #e5484d; --ok: #12a150; --warn: #f59e0b;
  --shadow: 0 10px 30px rgba(30,32,80,.10), 0 2px 6px rgba(30,32,80,.06);
  --shadow-lg: 0 24px 60px rgba(30,32,80,.18);
  --r: 18px; --r-sm: 12px; --r-pill: 999px;
  /* Le flou d'arrière-plan coûte cher : seulement sur les éléments temporaires (menus, fenêtres) */
  --blur: none; --blur-overlay: blur(12px) saturate(1.3);
  --shadow-sm: 0 1px 3px rgba(30,32,80,.08);
  color-scheme: light;
}
/* ---- Thèmes ---- */
[data-theme="clair"]    { --brand:#2563eb; --brand-2:#60a5fa; --bg1:#f5f6f8; --bg2:#eef1f6; --blob1:#dbe4ff; --blob2:#e6ecf5; --brand-soft:rgba(37,99,235,.10); }
[data-theme="ocean"]    { --brand:#0077b6; --brand-2:#00b4d8; --bg1:#e0f4fb; --bg2:#d3ecff; --blob1:#90e0ef; --blob2:#a9c8ff; --brand-soft:rgba(0,119,182,.12); }
[data-theme="foret"]    { --brand:#2d6a4f; --brand-2:#74c69d; --bg1:#eaf5ee; --bg2:#f3f7e9; --blob1:#b7e4c7; --blob2:#d8f3dc; --brand-soft:rgba(45,106,79,.12); }
[data-theme="coucher"]  { --brand:#e2552d; --brand-2:#f9a03f; --bg1:#fff1e8; --bg2:#ffe6ef; --blob1:#ffc4a3; --blob2:#ffb3c7; --brand-soft:rgba(226,85,45,.12); }
[data-theme="lavande"]  { --brand:#8b5cf6; --brand-2:#ec4899; --bg1:#f6f0ff; --bg2:#fdf0fa; --blob1:#ddd0ff; --blob2:#ffd0ec; --brand-soft:rgba(139,92,246,.12); }
[data-theme="sable"]    { --brand:#a0632b; --brand-2:#d4a373; --bg1:#faf5ec; --bg2:#f3ece0; --blob1:#ecd9bd; --blob2:#f5e6cc; --text:#2b2218; --muted:#7a6a58; --brand-soft:rgba(160,99,43,.12); }
[data-theme="sombre"], [data-theme="graphite"], [data-theme="neon"] {
  --glass: rgba(28,30,42,.86); --glass-strong: rgba(32,34,48,.96); --glass-soft: rgba(40,42,58,.6);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --text:#e9e9f1; --muted:#9b9db3; --border: rgba(255,255,255,.09); --tool: rgba(255,255,255,.05);
  --shadow: 0 10px 30px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.25); --shadow-lg: 0 24px 60px rgba(0,0,0,.5);
  color-scheme: dark;
}
[data-theme="sombre"]   { --brand:#7c6cff; --brand-2:#22d3ee; --bg1:#0f1020; --bg2:#121a2a; --blob1:#3a2f8f; --blob2:#0e4d5c; --brand-soft:rgba(124,108,255,.18); }
[data-theme="graphite"] { --brand:#a3a3b8; --brand-2:#6b7280; --on-brand:#111; --bg1:#141518; --bg2:#1b1c20; --blob1:#2b2d33; --blob2:#25272c; --brand-soft:rgba(255,255,255,.08); }
[data-theme="neon"]     { --brand:#00f5d4; --brand-2:#f15bb5; --on-brand:#071016; --bg1:#07070f; --bg2:#0d0718; --blob1:#00f5d433; --blob2:#f15bb540; --brand-soft:rgba(0,245,212,.12); }

/* ---- Base ---- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text);
  background: radial-gradient(900px 600px at 8% 0%, var(--blob1), transparent 60%),
              radial-gradient(800px 600px at 100% 100%, var(--blob2), transparent 60%),
              linear-gradient(135deg, var(--bg1), var(--bg2));
  overflow: hidden;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); min-height: 1em; margin: 4px 0 0; font-size: 14px; }
.ok { color: var(--ok); font-weight: 600; }
a { color: var(--brand); }
::selection { background: var(--brand-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }

.glass { background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--border); box-shadow: var(--shadow); }

button { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, var(--brand-2))); color: var(--on-brand); border: 0; border-radius: var(--r-pill);
  padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer; transition: transform .12s, box-shadow .12s, background .12s, opacity .12s; box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 30%, transparent); }
button:hover { transform: translateY(-1px); }
button:active { transform: none; }
button:disabled { opacity: .5; cursor: default; transform: none; }
button.ghost, button.soft { background: var(--glass-soft); color: var(--text); border: 1px solid var(--border); box-shadow: none; font-weight: 500; }
button.ghost:hover, button.soft:hover { background: var(--brand-soft); }
button.danger { background: var(--danger); box-shadow: none; }
button.small { padding: 5px 12px; font-size: 13px; }
.icon-btn { background: transparent; color: var(--text); border: 0; box-shadow: none; padding: 8px; border-radius: var(--r-pill); font-size: 16px; line-height: 1; font-weight: 400; }
.icon-btn:hover { background: var(--brand-soft); transform: none; }
.icon-btn.active { background: var(--brand-soft); color: var(--brand); }
input, textarea, select { font: inherit; color: var(--text); background: var(--glass-strong); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; width: 100%; outline: none; transition: border-color .12s, box-shadow .12s; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
textarea { resize: vertical; }
input:disabled, select:disabled, textarea:disabled { opacity: .5; cursor: not-allowed; background: var(--tool); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--brand); }
input[type="color"] { padding: 2px; height: 38px; }

/* ---- Connexion / installation ---- */
.auth { height: 100%; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.auth-card { width: min(400px, 100%); border-radius: 28px; padding: 36px 32px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.auth-card h1 { margin: 4px 0 0; font-size: 26px; }
.auth-card p { margin: 0; }
.auth-card label { text-align: left; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.logo-big { width: 72px; height: 72px; margin: 0 auto; filter: drop-shadow(0 8px 20px color-mix(in srgb, var(--brand) 35%, transparent)); }

/* ---- Mise en page ---- */
.app { height: 100%; display: flex; gap: 12px; padding: 12px; }
.sidebar { width: 290px; flex-shrink: 0; border-radius: 24px; display: flex; flex-direction: column; padding: 14px; gap: 10px; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; padding: 2px 4px; }
.brand strong { flex: 1; letter-spacing: .3px; }
.logo { width: 30px; height: 30px; }
.new-chat { width: 100%; padding: 11px; }
.side-tools { display: flex; gap: 6px; }
.side-tools .search { flex: 1; }
.search { padding: 8px 12px; border-radius: var(--r-pill); }
.conv-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -6px; padding: 0 6px; min-height: 0; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); padding: 12px 8px 4px; font-weight: 700; }
.group { border-radius: var(--r-sm); }
.group.drop, .ungrouped.drop { background: var(--brand-soft); outline: 2px dashed var(--brand); outline-offset: -2px; }
.group-head { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; font-weight: 600; }
.group-head:hover { background: var(--tool); }
.group-head .caret { width: 12px; color: var(--muted); font-size: 10px; transition: transform .15s; }
.group.collapsed .caret { transform: rotate(-90deg); }
.group.collapsed .group-body { display: none; }
.group-head .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-head .count { font-size: 11px; color: var(--muted); font-weight: 500; }
.group-body { padding-left: 10px; margin-left: 13px; border-left: 2px solid var(--border); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--muted); box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 0%, transparent); }
.conv { display: flex; align-items: center; gap: 8px; border-radius: var(--r-sm); padding: 7px 8px; cursor: pointer; font-size: 14px; position: relative; }
.conv:hover { background: var(--tool); }
.conv.active { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.conv .dot { width: 8px; height: 8px; }
.conv .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.conv .t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .t small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .more, .group-head .more { visibility: hidden; padding: 2px 6px; font-size: 14px; }
.conv:hover .more, .conv.active .more, .group-head:hover .more { visibility: visible; }
.conv.child { margin-left: 16px; }
.conv.child::before { content: ""; position: absolute; left: -9px; top: 50%; width: 8px; border-top: 2px solid var(--border); }
.conv.dragging { opacity: .4; }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 16px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--border); padding-top: 8px; }
.nav-btn { background: transparent; color: var(--text); text-align: left; padding: 9px 10px; border-radius: var(--r-sm); box-shadow: none; font-weight: 500; display: flex; gap: 10px; align-items: center; }
.nav-btn:hover { background: var(--tool); transform: none; }
.nav-btn.active { background: var(--brand-soft); color: var(--brand); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r); cursor: pointer; background: var(--glass-soft); border: 1px solid var(--border); color: var(--text); box-shadow: none; font-weight: 500; text-align: left; }
.user-card:hover { background: var(--brand-soft); transform: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; flex-shrink: 0; background: linear-gradient(135deg, var(--brand), var(--brand-2)); font-size: 14px; }
.user-card .who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.user-card .who small { color: var(--muted); font-size: 12px; }

.main { flex: 1; min-width: 0; display: flex; gap: 12px; }
.view { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; border-radius: 24px; overflow: hidden; position: relative; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; min-height: 60px; border-bottom: 1px solid var(--border); }
.topbar .title { flex: 1; margin: 0; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.topbar .title .dot { width: 12px; height: 12px; }
.menu-btn { display: none !important; }
.chip { background: var(--glass-soft); color: var(--text); border: 1px solid var(--border); padding: 5px 12px; font-size: 13px; border-radius: var(--r-pill); white-space: nowrap; box-shadow: none; font-weight: 500; }
.chip:hover { background: var(--brand-soft); transform: none; }
.chip.warn { border-color: var(--warn); color: var(--warn); }
.chip.on { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.model-select { width: auto; padding: 6px 30px 6px 12px; font-size: 13px; border-radius: var(--r-pill); }
.breadcrumb { font-size: 12px; color: var(--muted); padding: 6px 18px 0; }
.breadcrumb a { cursor: pointer; }

/* ---- Messages ---- */
.chat-body { flex: 1; min-height: 0; display: flex; }
.chat-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.messages { flex: 1; overflow-y: auto; padding: 24px clamp(14px, 2.5vw, 40px); display: flex; flex-direction: column; gap: 14px; }
.messages > * { width: 100%; max-width: none; }
/* Fichier partagé par l'agent */
.shared-file { display: flex; flex-direction: column; gap: 8px; background: var(--glass); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow-sm); }
.shared-file .sf-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.shared-file .sf-ico { font-size: 22px; }
.shared-file .sf-name { font-weight: 600; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.shared-file .sf-size { font-size: 12px; color: var(--muted); }
.shared-file .sf-actions { display: flex; gap: 6px; }
.shared-file .sf-actions a { font-size: 13px; padding: 5px 12px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--glass-strong); color: var(--text); text-decoration: none; }
.shared-file .sf-actions a:hover { border-color: var(--brand); color: var(--brand); }
.shared-file img { max-width: 100%; max-height: 420px; object-fit: contain; border-radius: var(--r-sm); align-self: flex-start; cursor: zoom-in; }
.shared-file iframe { width: 100%; height: 520px; border: 1px solid var(--border); border-radius: var(--r-sm); background: #fff; }
.welcome { text-align: center; margin-top: 8vh; }
.welcome h1 { font-size: 28px; margin: 14px 0 4px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.notice { background: var(--brand-soft); border-radius: var(--r); padding: 10px 14px; font-size: 14px; }
.suggestions { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; max-width: 680px; margin: 24px auto 0; }
.suggestions button { background: var(--glass); color: var(--text); border: 1px solid var(--border); text-align: left; padding: 14px; border-radius: var(--r); box-shadow: var(--shadow); font-weight: 500; backdrop-filter: var(--blur); }
.suggestions button:hover { border-color: var(--brand); }
.msg { line-height: 1.6; overflow-wrap: anywhere; }
.msg.user { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg.user .bubble { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 65%, var(--brand-2))); color: var(--on-brand); padding: 11px 16px; border-radius: 22px 22px 6px 22px; max-width: 80%; white-space: pre-wrap; box-shadow: var(--shadow-sm); }
.msg.assistant { position: relative; background: var(--glass); border: 1px solid var(--border); border-radius: 6px 22px 22px 22px; padding: 14px 18px; box-shadow: var(--shadow-sm); backdrop-filter: var(--blur); }
.msg.assistant .md > :first-child { margin-top: 0; }
.msg.assistant .md > :last-child { margin-bottom: 0; }
.msg.assistant pre { background: var(--tool); padding: 12px; border-radius: var(--r-sm); overflow-x: auto; position: relative; }
.msg.assistant code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }
.msg.assistant table { border-collapse: collapse; display: block; overflow-x: auto; }
.msg.assistant td, .msg.assistant th { border: 1px solid var(--border); padding: 5px 10px; }
.msg.assistant.streaming .md::after { content: "▍"; animation: blink 1s infinite; color: var(--brand); }
@keyframes blink { 50% { opacity: 0; } }
.files { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--glass-strong); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 5px 9px; font-size: 13px; color: var(--text); text-decoration: none; max-width: 240px; }
.file-chip img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip button { background: none; color: var(--muted); padding: 0 2px; box-shadow: none; }
.msg-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; margin-top: 6px; }
.msg:hover .msg-actions, .msg-actions:focus-within { opacity: 1; }
.msg-actions button { background: none; color: var(--muted); padding: 3px 8px; font-size: 13px; box-shadow: none; font-weight: 500; border-radius: var(--r-pill); }
.msg-actions button:hover { color: var(--brand); background: var(--brand-soft); transform: none; }
.code-copy { position: absolute; top: 8px; right: 8px; padding: 3px 10px !important; font-size: 12px; background: var(--glass-strong) !important; color: var(--text) !important; border: 1px solid var(--border) !important; box-shadow: none !important; }
.msg.flash .bubble { animation: flash 1.5s 2; }
@keyframes flash { 50% { box-shadow: 0 0 0 5px #facc15; } }
.meta { font-size: 12px; color: var(--muted); padding-left: 6px; }
.meta.err { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); padding: 8px 12px; border-radius: var(--r-sm); font-size: 13px; }
/* Pastille « étapes » dans la conversation */
.steps-pill { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; width: auto !important; margin-left: 0 !important; background: var(--glass-soft); border: 1px solid var(--border); color: var(--muted); padding: 5px 12px; border-radius: var(--r-pill); font-size: 13px; cursor: pointer; box-shadow: none; font-weight: 500; }
.steps-pill:hover { color: var(--brand); background: var(--brand-soft); transform: none; }
.steps-wrap { display: flex; }
.spinner { width: 12px; height: 12px; border: 2px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Volet « Étapes » ---- */
.steps-panel { width: 360px; flex-shrink: 0; border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--glass-soft); }
.steps-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.steps-head strong { flex: 1; }
.steps-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 14px; }
.turn { display: flex; flex-direction: column; gap: 6px; border-radius: var(--r); padding: 4px; transition: background .3s; }
.turn.flash { background: var(--brand-soft); }
.turn-title { font-size: 12px; color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
details.tool { background: var(--glass-strong); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 10px; font-size: 13px; }
details.tool summary { cursor: pointer; list-style: none; display: flex; gap: 6px; align-items: center; overflow: hidden; }
details.tool summary::-webkit-details-marker { display: none; }
details.tool .ico { width: 18px; text-align: center; }
details.tool .name { font-weight: 600; white-space: nowrap; }
details.tool .detail { color: var(--muted); font-family: ui-monospace, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
details.tool .state { font-size: 12px; }
details.tool pre { white-space: pre-wrap; max-height: 280px; overflow-y: auto; margin: 8px 0 0; font-size: 12px; background: var(--tool); padding: 8px; border-radius: 8px; }
details.tool.err { border-color: color-mix(in srgb, var(--danger) 60%, transparent); }
details.tool.err .state { color: var(--danger); }

/* ---- Zone de saisie ---- */
.composer { padding: 10px clamp(14px, 2.5vw, 40px) 14px; }
.composer-box { max-width: none; margin: 0; border-radius: 26px; padding: 8px 8px 8px 10px; background: var(--glass-strong); border: 1px solid var(--border); box-shadow: var(--shadow-lg); transition: box-shadow .15s, border-color .15s; }
.suggestion { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; box-shadow: none; color: var(--muted); font-weight: 500; font-size: 13px; padding: 4px 10px 6px; border-radius: var(--r-sm); }
.suggestion:hover { color: var(--brand); background: var(--brand-soft); transform: none; }
.suggestion kbd { font-family: inherit; font-size: 11px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; background: var(--glass-strong); color: var(--text); flex-shrink: 0; }
.suggestion span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-box:focus-within { border-color: color-mix(in srgb, var(--brand) 50%, transparent); }
.composer.drag .composer-box { outline: 2px dashed var(--brand); outline-offset: 4px; }
.attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 4px 8px; }
.attachments:empty { display: none; }
.composer-row { display: flex; gap: 4px; align-items: flex-end; }
.composer-row textarea { flex: 1; resize: none; max-height: 220px; border: 0; background: transparent; box-shadow: none; padding: 9px 6px; }
.composer-row textarea:focus { box-shadow: none; }
.send-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 18px; flex-shrink: 0; }
.icon-btn.recording { background: var(--danger); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.hint { text-align: center; margin: 8px auto 0; font-size: 12px; }

/* ---- Pages (tâches, administration, profil, activité) ---- */
.page { flex: 1; overflow-y: auto; padding: 22px 18px; display: flex; flex-direction: column; gap: 16px; }
.page > * { width: 100%; max-width: 900px; margin-left: auto; margin-right: auto; }
.card { background: var(--glass); backdrop-filter: var(--blur); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.card h3 { margin: 0; font-size: 16px; }
.card h4 { margin: 6px 0 0; font-size: 14px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row input { flex: 1; min-width: 180px; }
.check { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; cursor: pointer; }
.check.big { font-weight: 600; }
.steps { display: flex; flex-direction: column; gap: 8px; }
.steps p { margin: 0; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 10px; border-radius: var(--r-pill); background: var(--tool); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.badge.err { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.badge.brand { color: var(--brand); background: var(--brand-soft); border-color: transparent; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; border-radius: var(--r-pill); background: var(--glass-soft); border: 1px solid var(--border); width: fit-content !important; max-width: 100%; }
.tabs button { background: none; color: var(--muted); padding: 7px 14px; border-radius: var(--r-pill); box-shadow: none; font-weight: 500; }
.tabs button:hover { color: var(--text); transform: none; }
.tabs button.active { background: var(--glass-strong); color: var(--brand); font-weight: 600; box-shadow: var(--shadow); }
.admin-panel { display: flex; flex-direction: column; gap: 16px; }
.task-list, .item-list { display: flex; flex-direction: column; gap: 10px; }
.task { background: var(--glass); backdrop-filter: var(--blur); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.task.off { opacity: .6; }
.task { cursor: pointer; transition: border-color .15s; }
.task.selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow); opacity: 1; }
.page > .tasks-split { max-width: 1500px; }
.page:has(.tasks-split) > *:not(.tasks-split) { max-width: 1500px; }
.tasks-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
.tasks-split .task-section { font-size: 13px; color: var(--muted); font-weight: 600; margin: 6px 2px -2px; }
.task-runs { position: sticky; top: 0; background: var(--glass); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 150px); overflow-y: auto; }
.task-runs h3 { margin: 0; font-size: 15px; }
.run-row { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 9px 12px; background: var(--glass-soft); cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.run-row:hover { border-color: var(--brand); }
.run-row .run-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.run-row .run-head b { flex: 1; }
.run-row .run-prev { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-detail .md { line-height: 1.6; overflow-wrap: anywhere; }
.run-detail .run-q { background: var(--brand-soft); border-radius: var(--r-sm); padding: 8px 12px; white-space: pre-wrap; font-size: 14px; }
.run-detail pre { background: var(--tool); padding: 10px; border-radius: var(--r-sm); overflow-x: auto; }
@media (max-width: 1000px) { .tasks-split { grid-template-columns: 1fr; } .task-runs { position: static; max-height: none; } }
.task-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-head strong { flex: 1; }
.task-prompt { font-size: 14px; color: var(--muted); white-space: pre-wrap; max-height: 4.5em; overflow: hidden; }
.item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; flex-wrap: wrap; background: var(--glass-soft); }
.item strong { min-width: 100px; }
.item code { flex: 1; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.mcp-item .mcp-error { flex-basis: 100%; color: var(--danger); overflow-wrap: anywhere; }
button.danger:hover { color: var(--danger); }
.warn-box { background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; }

/* Utilisateurs */
.user-actions { margin-top: 4px; }
.user-row { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; padding: 12px; border-radius: var(--r); border: 1px solid var(--border); background: var(--glass-soft); }
.user-row.off { opacity: .55; }
.user-row .info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.user-row .info .row { gap: 6px; }
.mini-gauge { height: 6px; background: var(--tool); border-radius: 99px; overflow: hidden; width: 140px; display: inline-block; vertical-align: middle; }
.mini-gauge span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.mini-gauge span.hot { background: var(--danger); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }
.perm-box { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.perm-box h4 { margin: 0; font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
[hidden] { display: none !important; }
.tree { list-style: none; margin: 6px 0 0; padding-left: 16px; font-size: 13px; }
.tree .tree { margin-top: 2px; }
.tree li { padding: 2px 0; }
/* Éditeur de droits : onglets + tableaux filtrables */
.dialog.wide { width: min(980px, calc(100% - 32px)); }
.dialog.wide form { min-height: min(640px, 80vh); }
.dlg-tabs { margin: 4px 0 2px; }
.dlg-tabs button .cnt { font-size: 11px; opacity: .75; margin-left: 4px; }
.dlg-page { display: flex; flex-direction: column; gap: 10px; }
.dlg-page.hidden { display: none; }
.pt-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pt-tools input[type="search"] { flex: 1; min-width: 180px; }
.pt-tools .pt-count { font-size: 12px; color: var(--muted); margin-left: auto; }
.pt-scroll { max-height: 46vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-sm); }
.perm-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm-table th { position: sticky; top: 0; background: var(--glass-strong); text-align: left; padding: 8px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); z-index: 1; }
.perm-table td { padding: 7px 10px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); vertical-align: top; }
.perm-table td:first-child, .perm-table th:first-child { width: 34px; }
.perm-table tr { cursor: pointer; }
.perm-table tbody tr:hover { background: var(--brand-soft); }
.perm-table tr.on td:nth-child(2) { font-weight: 600; }
.perm-table td.desc { color: var(--muted); }
.perm-table td code { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.perm-table.all-on tbody { opacity: .6; }
.perm-table .pt-empty { padding: 14px; text-align: center; color: var(--muted); }

/* Thèmes */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.theme-card { border-radius: var(--r); padding: 0; overflow: hidden; border: 2px solid var(--border); background: none; color: var(--text); box-shadow: var(--shadow); text-align: left; font-weight: 600; }
.theme-card.active { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.theme-card .sw { height: 64px; display: flex; align-items: flex-end; gap: 6px; padding: 8px; }
.theme-card .sw i { width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.theme-card span { display: block; padding: 8px 10px; background: var(--glass-strong); font-size: 13px; }
.color-row { display: flex; flex-wrap: wrap; gap: 8px; }
.color-row button { width: 30px; height: 30px; border-radius: 50%; padding: 0; border: 3px solid transparent; box-shadow: var(--shadow); }
.color-row button.active { border-color: var(--text); }
.color-row button.none { background: var(--glass-strong); color: var(--muted); font-size: 14px; border: 1px dashed var(--muted); }

/* Contexte */
.ctx-panel { position: absolute; right: 16px; top: 64px; z-index: 15; width: min(390px, calc(100% - 32px)); background: var(--glass-strong); backdrop-filter: var(--blur-overlay); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 16px; font-size: 14px; max-height: 70vh; overflow-y: auto; }
.ctx-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.ctx-head strong { flex: 1; }
.ctx-bar { display: flex; height: 10px; background: var(--tool); border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.ctx-bar span { height: 100%; }
.ctx-row { display: grid; grid-template-columns: 12px 1fr auto 56px; gap: 8px; align-items: center; padding: 3px 0; }
.ctx-row i { width: 10px; height: 10px; border-radius: 3px; }
.ctx-row em { color: var(--muted); font-style: normal; text-align: right; }
.ctx-panel h4 { margin: 10px 0 4px; font-size: 13px; }
.ctx-panel ul { margin: 0; padding-left: 18px; color: var(--muted); }

/* Menus flottants */
.menu { position: fixed; z-index: 50; background: var(--glass-strong); backdrop-filter: var(--blur-overlay); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; min-width: 230px; display: flex; flex-direction: column; animation: pop .12s ease-out; }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(-4px); } }
.menu button, .menu label { background: none; color: var(--text); text-align: left; padding: 8px 12px; border-radius: 10px; font-size: 14px; display: flex; gap: 10px; align-items: center; cursor: pointer; box-shadow: none; font-weight: 500; }
.menu button:hover, .menu label:hover { background: var(--brand-soft); transform: none; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 6px; width: auto; }
.menu .color-row { padding: 6px 12px; }
.menu .color-row button { width: 22px; height: 22px; padding: 0; border-width: 2px; }
.danger-text { color: var(--danger) !important; }

/* Consommation */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--glass); backdrop-filter: var(--blur); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.stat b { font-size: 26px; }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; }
.chart .bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.chart .bar span { width: 100%; background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-radius: 6px 6px 2px 2px; min-height: 1px; }
.chart .bar small { font-size: 9px; color: var(--muted); }
.gauge-head { display: flex; justify-content: space-between; font-size: 14px; }
.gauge-bar { height: 10px; background: var(--tool); border-radius: 99px; overflow: hidden; margin: 5px 0; }
.gauge-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), color-mix(in srgb, var(--ok) 60%, var(--brand-2))); border-radius: 99px; }
.gauge-bar span.hot { background: var(--danger); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.cat-item { background: var(--glass-soft); color: var(--text); border: 1px solid var(--border); text-align: left; display: grid; grid-template-columns: 28px 1fr; gap: 2px 8px; padding: 12px; border-radius: var(--r); box-shadow: none; font-weight: 500; }
.cat-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.cat-item span { grid-row: span 2; font-size: 22px; }
.cat-item small { color: var(--muted); font-size: 12px; font-weight: 400; }

/* Activité */
.activity-list { display: flex; flex-direction: column; gap: 8px; }
.act-row { display: flex; gap: 6px; align-items: center; background: var(--glass); backdrop-filter: var(--blur); border: 1px solid var(--border); border-radius: var(--r); padding: 10px 14px; box-shadow: var(--shadow-sm); }
.act-row.err { border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.act-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.act-main span, .act-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Boîte de dialogue */
.dialog { border: 1px solid var(--border); border-radius: 24px; padding: 0; width: min(620px, calc(100% - 32px)); background: var(--glass-strong); backdrop-filter: var(--blur-overlay); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(10,10,30,.4); }
.dialog form { padding: 22px; max-height: 86vh; overflow-y: auto; }
.dialog h3 { margin: 0; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--glass-strong); backdrop-filter: var(--blur-overlay); border: 1px solid var(--border); padding: 10px 18px; border-radius: var(--r-pill); box-shadow: var(--shadow-lg); font-size: 14px; animation: pop .15s; }

/* ---- Mobile ---- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 9; }
@media (max-width: 1100px) {
  .steps-panel { position: absolute; right: 0; top: 60px; bottom: 0; z-index: 12; box-shadow: var(--shadow-lg); background: var(--glass-strong); backdrop-filter: var(--blur); width: min(360px, 100%); }
}
@media (max-width: 800px) {
  .app { padding: 0; gap: 0; }
  .view { border-radius: 0; border: 0; }
  .sidebar { position: fixed; z-index: 10; inset: 8px auto 8px 8px; transform: translateX(-110%); transition: transform .2s; background: var(--glass-strong); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-block !important; }
  .model-select { max-width: 104px; padding-right: 22px; }
  .topbar .lbl { display: none; }
  .topbar .chip { padding: 5px 9px; }
  .topbar .title { font-size: 15px; }
  .topbar { padding: 8px 10px; gap: 4px; }
  .messages { padding: 16px 12px; }
  .composer { padding: 8px 10px 10px; }
  .hint { display: none; }
  .msg.user .bubble { max-width: 92%; }
}

/* Accès distant : liste de contrôle du domaine */
.dsteps { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.dsteps .dstep { border: 1px solid var(--border, #e5e5ef); border-radius: var(--r, 10px); padding: 10px 14px; font-size: 14px; }
.dsteps .dstep b { display: block; margin-bottom: 2px; }
.dsteps .dstep.ok { border-color: rgba(34,160,90,.35); background: rgba(34,160,90,.08); }
.dsteps .dstep.ko { border-color: rgba(220,60,60,.35); background: rgba(220,60,60,.07); }
.dsteps .dstep code { user-select: all; }
