/* ============================================================
   JARVIS WORKSPACE - charge en dernier, surcharge ciblee.
   Tokens existants uniquement (--ink, --line, --accent...).
   ============================================================ */

/* ---------- sidebar repliable ---------- */
.rail { position: relative; transition: width .24s cubic-bezier(.2,.8,.2,1), padding .24s cubic-bezier(.2,.8,.2,1); }
.rail-toggle {
  position: absolute; top: 14px; right: 12px; z-index: 2;
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text-faint); cursor: pointer;
}
.rail-toggle svg { width: 18px; height: 18px; }
.rail-toggle:hover { color: var(--text); border-color: var(--line-soft); background: var(--ink-raised); }
.rail-link { position: relative; white-space: nowrap; }
.rail-label { overflow: hidden; text-overflow: ellipsis; }

@media (min-width: 821px) {
  html[data-rail="collapsed"] { --rail: 72px; }
  html[data-rail="collapsed"] body .rail { padding: 58px 10px 16px; overflow-x: hidden; }
  html[data-rail="collapsed"] body .rail-toggle { right: 50%; transform: translateX(50%); }
  html[data-rail="collapsed"] body .rail-mark { margin-bottom: 26px; }
  html[data-rail="collapsed"] body .rail-mark > span:not(.brand-orb),
  html[data-rail="collapsed"] body .rail-mark small,
  html[data-rail="collapsed"] body .rail-label,
  html[data-rail="collapsed"] body .who-name,
  html[data-rail="collapsed"] body .rail-foot { display: none; }
  html[data-rail="collapsed"] body .brand-orb { width: 48px; height: 48px; margin: 0; }
  html[data-rail="collapsed"] body .rail-link { justify-content: center; padding: 13px 0; gap: 0; }
  html[data-rail="collapsed"] body .rail-badge { position: absolute; top: 5px; right: 7px; min-width: 16px; height: 16px; font-size: 9px; }
  html[data-rail="collapsed"] body .rail .who { flex-direction: column; align-items: center; }
  html[data-rail="collapsed"] body .who-btn { padding: 4px; justify-content: center; }
}

/* ---------- Command Center (desktop) ---------- */
.ws { display: none; }

@media (min-width: 901px) {
  body[data-view="chat"] { --thread-w: clamp(340px, 28vw, 440px); }
  html[data-thread="hidden"] body[data-view="chat"] { --thread-w: 0px; }

  body[data-view="chat"] .ws {
    display: block; position: absolute; top: 86px; left: 0; right: var(--thread-w); bottom: 0;
    transition: right .24s cubic-bezier(.2,.8,.2,1);
  }
  body[data-view="chat"] .scroll {
    position: absolute; top: 86px; right: 0; bottom: 0; width: var(--thread-w);
    padding: 22px 20px 28px; border-left: 1px solid var(--line-soft); background: var(--ink);
  }
  html[data-thread="hidden"] body[data-view="chat"] .scroll { display: none; }
  body[data-view="chat"] .thread { max-width: none; gap: 20px; }
  body[data-view="chat"] .turn-you, body[data-view="chat"] .turn-jarvis { max-width: 100%; font-size: 13.5px; }
  body[data-view="chat"] .dock {
    left: var(--rail); right: var(--thread-w); background: none; padding: 8px 28px 20px;
    transition: right .24s cubic-bezier(.2,.8,.2,1);
  }
  body[data-view="chat"] .dock-inner { max-width: 680px; }

  .ws-canvas { position: absolute; inset: 0 0 88px 0; }
  .ws-core {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -52%);
    display: flex; flex-direction: column; align-items: center; gap: 12px; z-index: 1;
    max-width: min(460px, 80%); text-align: center; pointer-events: none;
  }
  .ws-core .orb-host { pointer-events: auto; }
  .ws-core .orb { width: clamp(180px, 27vmin, 300px); height: clamp(180px, 27vmin, 300px); cursor: pointer; }
  .ws-core.has-windows .orb { width: clamp(140px, 18vmin, 200px); height: clamp(140px, 18vmin, 200px); }
  .ws-windows { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
  .ws-win { pointer-events: auto; }
  .ws-tray { position: absolute; left: 20px; right: 20px; bottom: 6px; z-index: 3; }
}

/* ---------- noyau: orbe, etat, activite ---------- */
.ws-core .orb-host { position: relative; border-radius: 50%; }
.ws-core .orb-host::before {
  content: ""; position: absolute; inset: 6%; border-radius: 50%;
  border: 1px solid transparent; opacity: 0; pointer-events: none;
  transition: opacity .4s ease;
}
.ws-core.is-working .orb-host::before {
  opacity: 1;
  border-top-color: var(--accent); border-right-color: color-mix(in srgb, var(--accent) 35%, transparent);
  animation: ws-orbit 2.8s linear infinite;
}
@keyframes ws-orbit { to { transform: rotate(360deg); } }
.ws-status { font-size: 13px; color: var(--text-dim); letter-spacing: -.005em; min-height: 18px; }
.ws-reply { width: min(460px, 100%); pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ws-reply[hidden], body.voice-on .ws-reply { display: none; }
.ws-reply-text {
  max-height: 22vh; overflow: auto; font-size: 14px; line-height: 1.55; color: var(--text); text-align: center;
  scrollbar-width: none; mask-image: linear-gradient(to bottom, transparent 0, #000 18px);
}
.ws-reply-text::-webkit-scrollbar { display: none; }
.ws-reply-text p { margin: 0 0 6px; }
.ws-reply-open { font: inherit; font-size: 11.5px; color: var(--text-faint); background: none; border: 0; padding: 4px 8px; border-radius: 7px; cursor: pointer; }
.ws-reply-open:hover { color: var(--text); background: var(--ink-raised); }
body.voice-on .ws-status { display: none; }
.ws-core .stage-state, .ws-core .stage-tools, .ws-core .stage-text { display: none; }
body.voice-on .ws-core .stage-state, body.voice-on .ws-core .stage-text { display: block; }
body.voice-on .ws-core .stage-tools.is-on, body.voice-on .ws-core .stage-tools.is-off { display: inline-flex; }
.ws-core .stage-text { font-size: 15px; max-height: 14vh; }

/* La scene vocale devient un bandeau quand l'orbe vit dans le workspace. */
body[data-view="chat"] .stage {
  top: auto; left: var(--rail); right: var(--thread-w, 0px); bottom: 0; height: auto;
  background: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  pointer-events: none; grid-template-rows: auto; padding: 0 20px 18px; z-index: 60;
}
body[data-view="chat"] .stage .stage-core { display: none; }
body[data-view="chat"] .stage .stage-foot { pointer-events: auto; padding-top: 0; }
body[data-view="chat"] .stage .stage-log { max-height: 6vh; font-size: 11px; }

/* ---------- fenetres ---------- */
.ws-win {
  position: absolute; width: var(--ws-w, 260px); max-height: calc(100% - 16px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--ink-raised); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .34), 0 2px 8px rgba(0, 0, 0, .18);
}
/* Largeur fixee a la creation (--ws-w): une fenetre ne grandit pas vers l'orbe en changeant d'etat. */
.ws-win.is-big { width: min(560px, calc(100% - 32px)); }
.ws-win.is-focused { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.ws-win.is-dragging { box-shadow: 0 30px 80px rgba(0, 0, 0, .45); user-select: none; }
.ws-win[hidden] { display: none; }

.ws-win-bar {
  display: flex; align-items: center; gap: 8px; padding: 9px 8px 9px 12px;
  border-bottom: 1px solid var(--line-soft); cursor: grab; touch-action: none; user-select: none;
}
.ws-win.is-dragging .ws-win-bar { cursor: grabbing; }
.ws-win-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ws-win-title small { display: flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--text-faint); min-width: 0; }
.ws-kicker { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-win-title b { font-size: 12.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-state { font-size: 9px; letter-spacing: .06em; color: var(--text-faint); padding: 2px 6px; border-radius: 5px; background: var(--ink-high); flex: none; }
.ws-btn {
  width: 26px; height: 26px; display: grid; place-items: center; flex: none;
  border: 0; border-radius: 7px; background: transparent; color: var(--text-faint); cursor: pointer;
}
.ws-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ws-btn:hover { background: var(--ink-high); color: var(--text); }

.ws-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex: none; }
[data-status="RUNNING"] .ws-dot, [data-status="RUNNING"].ws-dot, .ws-chip[data-status="RUNNING"] .ws-dot { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
[data-status="DONE"] .ws-dot { background: var(--ok); }
[data-status="FAILED"] .ws-dot, [data-status="INTERRUPTED"] .ws-dot { background: var(--bad); }
[data-status="WAITING"] .ws-dot, [data-status="QUEUED"] .ws-dot { background: var(--warn); }
.ws-win[data-status="RUNNING"] .ws-state { color: var(--accent); }
.ws-win[data-status="DONE"] .ws-state, .ws-state[data-s="DONE"] { color: var(--ok); }
.ws-win[data-status="FAILED"] .ws-state, .ws-win[data-status="INTERRUPTED"] .ws-state, .ws-state[data-s="FAILED"], .ws-state[data-s="INTERRUPTED"] { color: var(--bad); }
.ws-win[data-status="WAITING"] .ws-state { color: var(--warn); }

.ws-progress { height: 2px; background: transparent; flex: none; overflow: hidden; }
.ws-win[data-status="RUNNING"] .ws-progress {
  background: linear-gradient(90deg, transparent 0%, var(--accent) 45%, transparent 90%);
  background-size: 40% 100%; background-repeat: no-repeat;
  animation: ws-sweep 1.6s ease-in-out infinite;
}
@keyframes ws-sweep { from { background-position: -40% 0; } to { background-position: 140% 0; } }

.ws-win-body { overflow: auto; min-height: 0; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ws-figure { margin: 0; border-radius: 10px; overflow: hidden; background: var(--ink-high); }
.ws-figure img { display: block; width: 100%; height: auto; max-height: 60vh; object-fit: contain; }
.ws-win.is-big .ws-figure img { max-height: calc(100vh - 300px); }
.ws-figure.is-preview img { filter: blur(6px) saturate(.9); transform: scale(1.03); }
.ws-placeholder { aspect-ratio: 2 / 3; border-radius: 10px; background: var(--ink-high); }
.ws-win[data-status="RUNNING"] .ws-placeholder { animation: ws-breathe 2.2s ease-in-out infinite; }
@keyframes ws-breathe { 50% { opacity: .55; } }
.ws-wait { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin: 0; }
.ws-text { font-size: 13px; line-height: 1.6; color: var(--text); max-height: 46vh; overflow: auto; }
.ws-text p { margin: 0 0 10px; }
.ws-error p { margin: 0 0 10px; font-size: 12.5px; line-height: 1.55; color: var(--text); }
.ws-note { margin: 0; font-size: 11px; color: var(--text-faint); line-height: 1.5; overflow-wrap: anywhere; }
.ws-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ws-link-btn {
  font: inherit; font-size: 11.5px; color: var(--text-dim); text-decoration: none;
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-soft); background: transparent; cursor: pointer;
}
.ws-link-btn:hover { color: var(--text); border-color: var(--line); background: var(--ink-high); }
.ws-link-btn.is-primary { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
.ws-meta { margin-left: auto; font-size: 10.5px; color: var(--text-faint); }
.ws-win.is-active-artifact .ws-figure { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: -2px; }

/* ---------- barre du bas: missions, fil, fenetres reduites ---------- */
.ws-tray { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.ws-tray > * { pointer-events: auto; }
.ws-tray-btn, .ws-chip {
  font: inherit; font-size: 11.5px; color: var(--text-dim); display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px; border-radius: 9px; border: 1px solid var(--line-soft); background: var(--ink-raised); cursor: pointer;
}
.ws-tray-btn:hover, .ws-chip:hover { color: var(--text); border-color: var(--line); }
.ws-thread-btn { margin-left: auto; order: 3; }
.ws-tray-wins { display: flex; gap: 6px; flex-wrap: wrap; order: 2; }
.ws-chip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-count { min-width: 17px; height: 17px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 10px; display: inline-grid; place-items: center; padding: 0 4px; }
.ws-count[hidden] { display: none; }
.ws-list {
  position: absolute; left: 0; bottom: 44px; width: min(360px, 100%); max-height: 50vh; overflow: auto;
  padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--ink-raised);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35); z-index: 5;
}
.ws-list[hidden] { display: none; }
.ws-list-mission { padding: 8px 6px; border-bottom: 1px solid var(--line-soft); }
.ws-list-mission:last-child { border-bottom: 0; }
.ws-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.ws-list-head b { font-size: 12.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-list-task {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; font: inherit; font-size: 12px;
  color: var(--text-dim); padding: 7px 6px; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
}
.ws-list-task:hover { background: var(--ink-high); color: var(--text); }
.ws-list-task small { margin-left: auto; font-size: 10.5px; color: var(--text-faint); }
.ws-empty { font-size: 12px; color: var(--text-faint); margin: 6px; }
.tool.ws-link { cursor: pointer; border: 0; font: inherit; }

/* ---------- mobile et tablette: bandeau au-dessus du fil ---------- */
@media (max-width: 900px) {
  body[data-view="chat"] .ws {
    display: block; position: relative; flex: 0 0 auto; max-height: 64dvh; overflow-y: auto;
    padding: 8px 14px 6px; border-bottom: 1px solid var(--line-soft);
  }
  .ws-canvas { display: flex; flex-direction: column; align-items: center; gap: 8px; }
  .ws-core { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
  .ws-core .orb { width: 112px; height: 112px; cursor: pointer; }
  .ws-windows { width: 100%; display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 0 6px; }
  .ws-windows:empty { display: none; }
  .ws-win { position: relative; flex: 0 0 min(86vw, 340px); width: auto; max-height: 56dvh; scroll-snap-align: start; box-shadow: none; }
  .ws-win[data-kind] { width: auto; }
  .ws-win.is-big { flex-basis: 92vw; }
  .ws-win-bar { cursor: default; }
  .ws-tray { width: 100%; position: relative; }
  .ws-thread-btn { display: none; }
  body[data-view="chat"] .stage { left: 0; right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ws-core.is-working .orb-host::before, .ws-win[data-status="RUNNING"] .ws-progress, .ws-win[data-status="RUNNING"] .ws-placeholder { animation: none !important; }
  .ws-win[data-status="RUNNING"] .ws-progress { background: var(--accent); opacity: .5; }
}

/* ---------- logo: petite orbe animee, bouton retour a JARVIS ---------- */
.rail-mark { cursor: pointer; border-radius: 12px; }
.rail-mark:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.brand-orb { display: block; width: 76px; height: 76px; flex: none; margin: -8px 0 -6px; border-radius: 50%; transition: transform .2s ease; }
.brand-orb canvas { display: block; width: 100%; height: 100%; }
.rail-mark:hover .brand-orb { transform: scale(1.06); }
/* Pendant la voix, la scene ne recouvre jamais la navigation: le logo reste
   le retour vers JARVIS, sans couper la session. */
@media (min-width: 821px) { body.voice-on .stage { left: var(--rail); } }

/* ---------- horloges Paris / Miami ---------- */
.clocks { display: inline-flex; align-items: center; gap: 12px; font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock b { font-weight: 600; color: var(--text); margin-left: 4px; }
@media (max-width: 540px) { .clocks { gap: 8px; font-size: 10px; } }

/* ---------- AI Spend ---------- */
.spend { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.spend-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.spend-head h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.spend-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.spend-card { padding: 16px 18px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--ink-raised); display: flex; flex-direction: column; gap: 4px; }
.spend-card small { font-size: 11px; color: var(--text-faint); }
.spend-card b { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.spend-card span { font-size: 11px; color: var(--text-faint); }
.spend-block h3 { margin: 0 0 10px; font-size: 12px; font-weight: 600; color: var(--text-dim); letter-spacing: .02em; }
.spend-row { display: grid; grid-template-columns: minmax(120px, 1.2fr) 3fr minmax(90px, auto); align-items: center; gap: 12px; padding: 7px 0; font-size: 13px; }
.spend-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spend-bar { height: 6px; border-radius: 3px; background: var(--ink-high); overflow: hidden; }
.spend-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.spend-row-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.spend-row-val em, .spend-cost em { font-style: normal; font-size: 10.5px; color: var(--text-faint); }
.spend-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.spend-table td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft); color: var(--text-dim); }
.spend-table td:first-child { color: var(--text-faint); white-space: nowrap; }
.spend-cost { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.spend-note { font-size: 12px; color: var(--text-dim); margin: 0; line-height: 1.55; }
.spend-source { font-size: 11px; color: var(--text-faint); margin: 0; line-height: 1.5; }

/* Drive dans la fenetre d'artefact */
.ws-drive { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-faint); }
.ws-drive[data-drive="DONE"] { color: var(--ok); }
.ws-drive[data-drive="FAILED"], .ws-drive[data-drive="SCOPE"] { color: var(--warn); }
.ws-drive a { color: inherit; }
.conn-again { margin-left: 10px; font-size: 10.5px; opacity: .75; }
.conn-again:hover { opacity: 1; }

/* ---------- panneau du fil: bascule dans la barre du haut ---------- */
.panel-toggle {
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text-faint); cursor: pointer;
}
.panel-toggle svg { width: 18px; height: 18px; }
.panel-toggle:hover { color: var(--text); border-color: var(--line-soft); background: var(--ink-raised); }
.panel-toggle[aria-pressed="true"] { color: var(--accent); }
body:not([data-view="chat"]) .panel-toggle { display: none; }
@media (max-width: 900px) { .panel-toggle { display: none; } }

/* ---------- connexions: lisible, action au survol ---------- */
.rail-foot { display: flex; flex-direction: column; gap: 2px; }
.conn-title { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); margin: 0 6px 6px; }
.conn {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 9px; font-size: 12px; color: var(--text-dim);
}
.conn:hover { background: var(--ink-raised); }
.conn-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); flex: none; }
.conn[data-on="1"] .conn-dot { background: var(--ok); }
.conn-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 12px; }
.conn-state { font-size: 10.5px; color: var(--text-faint); letter-spacing: -.005em; }
.conn-state.on { color: var(--ok); }
.conn .conn-link { font-size: 10.5px; font-weight: 500; }
.conn-again {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px;
  color: var(--text-faint); background: var(--ink-high); opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.conn-again svg { width: 14px; height: 14px; }
.conn:hover .conn-again, .conn-again:focus-visible { opacity: 1; pointer-events: auto; }
.conn:has(.conn-again):hover .conn-state.on { opacity: 0; }
.conn-again:hover { color: var(--text); }
html[data-rail="collapsed"] body .conn-title { display: none; }

/* ---------- recherche web et video ---------- */
.ws-video { width: 100%; border-radius: 10px; background: #000; display: block; max-height: 60vh; }
.ws-cards { display: flex; flex-direction: column; gap: 10px; }
.ws-card { padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 11px; background: var(--ink); }
.ws-card h4 { margin: 0 0 4px; font-size: 13px; font-weight: 550; line-height: 1.35; }
.ws-card h4 a { color: var(--text); text-decoration: none; }
.ws-card h4 a:hover { text-decoration: underline; }
.ws-card p { margin: 0 0 6px; font-size: 12px; line-height: 1.5; color: var(--text-dim); }
.ws-card-meta { color: var(--text-faint) !important; font-size: 11px !important; }
.ws-card-src { font-size: 11px; color: var(--accent); text-decoration: none; }
.ws-card-src.is-off { color: var(--text-faint); }
.ws-sources { font-size: 11.5px; color: var(--text-dim); }
.ws-sources summary { cursor: pointer; color: var(--text-faint); }
.ws-sources a { display: block; padding: 4px 0; color: var(--text-dim); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-sources a:hover { color: var(--text); }
.ws-card-img { display: block; width: 100%; height: 118px; object-fit: cover; border-radius: 8px; margin-bottom: 8px; background: var(--ink-high); }

/* ---------- connexion: qui se connecte ---------- */
.gate-who { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.gate-who-btn { font: inherit; font-size: 13px; color: var(--text-dim); padding: 8px 18px; border-radius: 10px; border: 1px solid var(--line-soft); background: transparent; cursor: pointer; }
.gate-who-btn.is-me { color: var(--text); border-color: var(--accent); background: var(--ink-raised); }
.spend-bar.is-high i { background: var(--warn); }

/* ---------- studio video Higgsfield ---------- */
.video-studio { position: absolute; left: 0; bottom: 44px; z-index: 6; width: min(560px, calc(100vw - 60px)); }
.video-studio[hidden] { display: none; }
.vs-panel {
  max-height: min(70vh, 640px); overflow: auto; padding: 16px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--ink-raised);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45); display: flex; flex-direction: column; gap: 14px;
}
.vs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.vs-head h3 { margin: 2px 0 0; font-size: 16px; font-weight: 600; }
.vs-warn { margin: 0; font-size: 11.5px; color: var(--warn); }
.vs-tree { display: flex; flex-direction: column; gap: 10px; }
.vs-family b { font-size: 11px; color: var(--text-dim); font-weight: 550; }
.vs-family > div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.vs-mode {
  font: inherit; font-size: 11.5px; color: var(--text-dim); cursor: pointer;
  padding: 7px 11px; border-radius: 9px; border: 1px solid var(--line-soft); background: transparent;
}
.vs-mode:hover { color: var(--text); border-color: var(--line); }
.vs-mode.is-on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.vs-model { margin: 0; font-size: 10.5px; color: var(--text-faint); }
.vs-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.vs-field { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--text-dim); min-width: 0; }
.vs-field.vs-wide { grid-column: 1 / -1; }
.vs-field small { color: var(--text-faint); }
.vs-field input[type="number"], .vs-field select, .vs-field textarea {
  font: inherit; font-size: 12.5px; color: var(--text); background: var(--ink);
  border: 1px solid var(--line-soft); border-radius: 9px; padding: 8px 10px; width: 100%; box-sizing: border-box;
}
.vs-field textarea { resize: vertical; min-height: 62px; }
.vs-check { flex-direction: row; align-items: center; gap: 8px; }
.vs-check input { width: 16px; height: 16px; }
.vs-media { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; }
.vs-thumb {
  flex: 0 0 76px; padding: 0; border: 1px solid var(--line-soft); border-radius: 9px; overflow: hidden;
  background: var(--ink); cursor: pointer; display: flex; flex-direction: column; gap: 0;
}
.vs-thumb img, .vs-thumb video { width: 100%; height: 76px; object-fit: cover; display: block; }
.vs-thumb small { font-size: 9px; color: var(--text-faint); padding: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-thumb.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.vs-empty { margin: 0; font-size: 11.5px; color: var(--text-faint); }
.vs-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vs-note { font-size: 10.5px; color: var(--text-faint); }
@media (max-width: 900px) {
  .video-studio { position: fixed; left: 10px; right: 10px; bottom: 84px; width: auto; }
  .vs-form { grid-template-columns: 1fr; }
}
.ws-prompt {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 12.5px; line-height: 1.5;
  color: var(--text); background: var(--ink); border: 1px solid var(--line-soft); border-radius: 9px; padding: 9px; resize: vertical;
}
.ws-win[data-kind="prompt"] { --ws-w: 380px; }

/* ---------- Connexions ---------- */
.cx { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; position: relative; }
.cx-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.cx-head h1 { margin: 6px 0 4px; font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.cx-head p { margin: 0; font-size: 13px; color: var(--text-dim); }
.cx-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.cx-filters button {
  font: inherit; font-size: 12px; color: var(--text-dim); cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line-soft); background: transparent;
}
.cx-filters button span { font-size: 10.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.cx-filters button:hover { color: var(--text); border-color: var(--line); }
.cx-filters button.is-on { color: var(--text); border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.cx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.cx-card {
  display: flex; align-items: flex-start; gap: 12px; text-align: left; width: 100%;
  font: inherit; color: var(--text); cursor: pointer;
  padding: 14px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--ink-raised);
}
.cx-card:hover { border-color: var(--line); }
.cx-card.is-open { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.cx-logo {
  width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--ink-high);
  display: grid; place-items: center; font-size: 13px; color: var(--text-dim); overflow: hidden;
}
.cx-logo img { width: 100%; height: 100%; object-fit: contain; padding: 5px; box-sizing: border-box; }
.cx-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cx-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cx-top b { font-size: 13.5px; font-weight: 550; }
.cx-state { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.cx-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.cx-dot[data-p="ok"] { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.cx-dot[data-p="warn"] { background: var(--warn); }
.cx-dot[data-p="bad"] { background: var(--bad); }
.cx-meta { font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; }
.cx-err { font-size: 11px; color: var(--warn); line-height: 1.45; }
.cx-note { font-size: 11.5px; color: var(--text-faint); line-height: 1.5; margin: 0; }
.cx-cat { font-size: 9px; letter-spacing: .08em; color: var(--text-faint); align-self: flex-start; }
.cx-detail {
  border: 1px solid var(--line); border-radius: 16px; background: var(--ink-raised); padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.cx-detail header { display: flex; align-items: center; gap: 12px; }
.cx-detail header h3 { margin: 0 0 3px; font-size: 17px; font-weight: 600; }
.cx-detail header > div { flex: 1; }
.cx-detail dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 18px; margin: 0; }
.cx-detail dt { font-size: 10.5px; color: var(--text-faint); margin-bottom: 2px; }
.cx-detail dd { margin: 0; font-size: 12.5px; color: var(--text); overflow-wrap: anywhere; }
.cx-detail section ul { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--text-dim); line-height: 1.6; }
.cx-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cx-result { margin: 0; font-size: 12px; color: var(--text-dim); }
.cx-result[hidden] { display: none; }
.cx-empty { font-size: 12.5px; color: var(--text-faint); }
.conn[data-conn-id] { cursor: pointer; }
