/* Devo Studio — cadre teinté, feuille blanche.
   La barre latérale vit sur le fond teinté ; le travail sur une feuille blanche posée à 8 px des bords,
   sans ombre. La couleur de marque se limite au logo, au soulignement d'onglet et aux données d'état. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400 600; font-display: swap;
  src: url(fonts/IBMPlexSans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400 600; font-display: swap;
  src: url(fonts/IBMPlexSans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap;
  src: url(fonts/IBMPlexMono-400-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap;
  src: url(fonts/IBMPlexMono-400-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap;
  src: url(fonts/IBMPlexMono-500-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap;
  src: url(fonts/IBMPlexMono-500-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F; }

:root {
  --ground: #f3f6f7;      /* le cadre : un pas gris-bleu tiré de l'accent */
  --surface: #ffffff;     /* la feuille */
  --raised: #f4f6f8;
  --active: #e6eaec;
  --border: #e8eaec;
  --rule: #f0f1f2;
  --control: #cdced1;
  --text: #131416;
  --muted: #5d5f60;
  --accent: #1b6c80;
  --primary: #131416;
  --primary-ink: #ffffff;
  --positive: #1e7b4f;
  --negative: #c4242a;
  --warning: #92400e;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb; --pill-warning-ink: #92400e; --notice-border: #fde68a;
  --pane-running-bg: #f59e0b; --pane-running-ink: #3b1702;  /* affichages : discussion en cours */
  --pill-neutral-bg: #ebedee; --pill-neutral-ink: #353736;
  --pill-accent-bg: #e3f0f3; --pill-accent-ink: #134e5c;
  --alert-bg: #b4232a;
  --seg-1: #1b6c80; --seg-2: #6d4fb3; --seg-3: #c2771a; --seg-4: #b8a15a; --seg-5: #1e7b4f; --seg-6: #8b8f93;
  --backdrop: rgba(12, 16, 18, .42);
  --float-shadow: 0 12px 40px rgba(12, 16, 18, .18);

  --radius-card: 8px;
  --radius-control: 6px;
  --radius-chip: 4px;
  --radius-sheet: 16px;
  --sheet-inset: 8px;
  --sidebar-width: 248px;
  --gap: 24px;
  --pad: 24px;
  --control-h: 36px;

  --font: "IBM Plex Sans", Inter, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --fs-title: 22px; --fs-section: 16px; --fs-body: 14px; --fs-small: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0b0c0d; --surface: #141516; --raised: #1c1d1f; --active: #26282a;
    --border: #26282a; --rule: #1f2022; --control: #3d4043;
    --text: #f2f3f3; --muted: #a9adb0; --accent: #5fb3c7;
    --primary: #f2f3f3; --primary-ink: #111213;
    --positive: #4cc38a; --negative: #ef6b70; --warning: #e8b04a;
    --pill-positive-bg: #15291e; --pill-positive-ink: #5fd39a;
    --pill-negative-bg: #2e1a1c; --pill-negative-ink: #f2878b;
    --pill-warning-bg: #2b2213; --pill-warning-ink: #e8b04a; --notice-border: #5a4419;
    --pane-running-bg: #c2610c; --pane-running-ink: #fff7ed;
    --pill-neutral-bg: #26282a; --pill-neutral-ink: #c9cccf;
    --pill-accent-bg: #15282d; --pill-accent-ink: #7cc4d6;
    --seg-1: #5fb3c7; --seg-2: #a78bdf; --seg-3: #e39a45; --seg-4: #d6c27e; --seg-5: #4cc38a; --seg-6: #6c7074;
    --backdrop: rgba(0, 0, 0, .6);
    --float-shadow: 0 12px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font: 400 var(--fs-body)/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; }
.spacer { flex: 1; }
code { font-family: var(--mono); font-size: .88em; background: var(--raised); padding: 1px 5px; border-radius: var(--radius-chip); }
a { color: var(--accent); text-underline-offset: 2px; }
a.btn { text-decoration: none; display: inline-flex; }
button.badge { border: 0; font-family: inherit; line-height: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--control-h); padding: 0 14px;
  border: 1px solid var(--control); background: var(--surface); color: var(--text);
  border-radius: var(--radius-control); font: 500 14px/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: background-color .12s, border-color .12s, color .12s, transform .08s;
}
.btn:hover { background: var(--raised); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 86%, var(--surface)); }
.btn.danger { color: var(--negative); border-color: color-mix(in srgb, var(--negative) 35%, var(--control)); }
.btn.danger:hover { background: var(--pill-negative-bg); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--raised); }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; gap: 6px; }
.btn.icon-btn { padding: 0; width: 30px; min-height: 30px; }
.btn[aria-busy="true"] { cursor: progress; opacity: 1; }
.spinner { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; opacity: .8; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formulaires ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; margin-bottom: 16px; }
input, textarea, select {
  font: inherit; font-weight: 400; color: var(--text); background: var(--surface);
  border: 1px solid var(--control); border-radius: var(--radius-control); padding: 7px 11px; width: 100%;
}
input:not([type=checkbox]):not([type=radio]):not([type=file]), select { min-height: var(--control-h); }
input::placeholder, textarea::placeholder { color: #6b6d70; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0; flex: none; accent-color: var(--text); }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 0; border-color: var(--accent); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 12px 16px 4px; margin: 0 0 16px; }
legend { font-size: 13px; font-weight: 600; padding: 0 6px; }
.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }
.options label { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; margin-bottom: 8px; }
.options input { width: auto; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.choice {
  position: relative; display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-card); cursor: pointer; font-weight: 400;
}
.choice:hover { border-color: var(--control); }
.choice:has(input:checked) { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-title { font-weight: 600; font-size: 14px; }
.choice-hint { color: var(--muted); font-size: 13px; }
@media (max-width: 480px) { .choices { grid-template-columns: 1fr; } }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-radius: var(--radius-control) 0 0 var(--radius-control); }
.suffix {
  display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--control); border-left: 0;
  border-radius: 0 var(--radius-control) var(--radius-control) 0; background: var(--raised); color: var(--muted); font-size: 13px; white-space: nowrap;
}
.error { color: var(--negative); font-size: 13px; margin: 0 0 12px; }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px; }
.card h3 { margin: 0 0 12px; font-size: var(--fs-section); font-weight: 600; line-height: 1.3; }

/* ---------- Marque ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: -.005em; }
.logo { width: 24px; height: 24px; flex: none; display: block; }
/* Signature « par devoto » : le logo texte prend la couleur du texte (lisible en thème sombre). */
.by-devoto { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 16px 0 0; font-size: 12px; color: var(--muted); }
.wordmark { display: inline-block; width: 64px; height: 14px; background: currentColor;
  -webkit-mask: url(/static/devoto-logo-text.svg) no-repeat center / contain; mask: url(/static/devoto-logo-text.svg) no-repeat center / contain; }
.sidebar-foot .by-devoto { justify-content: flex-start; margin: 6px 8px 0; font-size: 11px; }
.sidebar-foot .by-devoto .wordmark { width: 52px; height: 11px; }

/* ---------- Connexion ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; padding: 28px; }
.login-card .brand { margin-bottom: 24px; }
.login-title { margin: 0 0 4px; font-size: var(--fs-title); font-weight: 600; letter-spacing: -.01em; }
.login-card > p.muted { margin: 0 0 24px; }
.login-card .btn { width: 100%; }
.login-card .btn + .btn { margin-top: 8px; }
.qr-login-sep { display: flex; align-items: center; gap: 10px; margin: 20px 0 8px; color: var(--muted); font-size: 12px; }
.qr-login-sep::before, .qr-login-sep::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.qr-login-sep span { flex: none; }
/* Autres connexions : clé d'accès et QR code côte à côte (le QR code s'ouvre à la demande). */
.login-alt { display: flex; gap: 8px; }
.login-card .login-alt .btn { flex: 1 1 0; min-width: 0; margin-top: 0; }
.login-alt .btn[aria-expanded="true"] { background: var(--active); }
.qr-login { margin-top: 16px; }
.qr-login > p.small-text { margin: 0 0 12px; text-align: center; }
.qr-login-box { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr-login-img { width: 184px; height: 184px; padding: 10px; background: #fff; border-radius: 10px; border: 1px solid var(--border); }
.qr-login-img svg { display: block; width: 100%; height: 100%; }
.qr-login-img.stale { opacity: .25; }
.qr-login-code { font-family: var(--mono); font-size: 26px; font-weight: 500; letter-spacing: .18em; padding-left: .18em; }
.qr-login-code.stale { opacity: .35; text-decoration: line-through; }
.qr-login-timer { width: 184px; height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.qr-login-timer > div { height: 100%; width: 100%; background: var(--accent); transform-origin: left; }
.qr-login-box > p { margin: 0; text-align: center; }
#qr-approve-code { font-family: var(--mono); font-size: 20px; letter-spacing: .2em; text-align: center; }

/* ---------- Cadre ---------- */
.layout { display: flex; height: calc(100vh - var(--disk-alert-h, 0px) - var(--imp-h, 0px)); height: calc(100dvh - var(--disk-alert-h, 0px) - var(--imp-h, 0px)); }
.sidebar { width: var(--sidebar-width); flex: none; background: var(--ground); display: flex; flex-direction: column; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 12px 12px 16px; }
.sidebar-tools { display: flex; gap: 6px; padding: 0 12px 8px; }
.sidebar-tools input { flex: 1; min-width: 0; min-height: 32px; padding: 5px 10px; font-size: 13px; background: var(--surface); border-color: var(--border); }
.sidebar-tools .btn { border-color: transparent; color: var(--muted); }
.sidebar-tools .btn:hover { color: var(--text); background: var(--active); }
.sidebar-head .btn { background: var(--surface); border-color: var(--border); }
.sidebar-head-actions { display: flex; gap: 6px; }
.sidebar-head #btn-collapse-sidebar { background: none; border-color: transparent; color: var(--muted); }
.sidebar-head #btn-collapse-sidebar:hover { color: var(--text); background: var(--active); }

.project-list { list-style: none; margin: 0; padding: 4px 8px 12px; overflow-y: auto; flex: 1; }
.project-list li {
  padding: 6px 10px; border-radius: var(--radius-control); cursor: pointer; display: flex; flex-direction: column; gap: 0;
}
.project-list li + li { margin-top: 2px; }
.project-list li:hover { background: var(--active); }
.project-list li.active { background: var(--active); }
.project-list li.active .p-name { font-weight: 600; }
.project-list .p-row { display: flex; align-items: center; gap: 8px; }
.project-list .p-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; line-height: 20px; }
.project-list .p-dom { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 16px; line-height: 18px; }
.project-list .empty-list { color: var(--muted); font-size: 13px; cursor: default; }
.project-list .empty-list:hover { background: none; }
.project-list.drop-root { outline: 1px dashed var(--accent); outline-offset: -4px; border-radius: var(--radius-card); }
.project-list li.in-folder { margin-left: 8px; }
/* Projet enfant : pas de retrait ; une étiquette nomme son parent. */
.p-parent { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-width: 0; height: 20px; padding: 0 7px 0 5px; border: 0; border-radius: var(--radius-chip);
  background: var(--pill-accent-bg); color: var(--pill-accent-ink); font: 400 12px/1 var(--font); white-space: nowrap; }
.p-parent > span { overflow: hidden; text-overflow: ellipsis; }
.p-parent strong { font-weight: 600; }
.p-parent .icon { width: 13px; height: 13px; stroke-width: 1.8; flex: none; }
.project-list .p-parent { align-self: flex-start; margin: 3px 0 2px 16px; max-width: calc(100% - 16px); }
.p-parent-slot:empty { display: none; }
button.p-parent { cursor: pointer; }
button.p-parent:hover { background: color-mix(in srgb, var(--pill-accent-bg) 80%, var(--accent)); }
/* Projet système : l'orchestrateur lui-même, épinglé et distinct des projets utilisateur. */
.project-list li.system { background: var(--pill-accent-bg); box-shadow: inset 3px 0 0 var(--accent); }
.project-list li.system:hover, .project-list li.system.active { background: color-mix(in srgb, var(--pill-accent-bg) 80%, var(--accent)); }
.project-list .p-system { display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 6px 0 4px; border-radius: var(--radius-chip); background: var(--accent); color: var(--ground); font: 600 11px/1 var(--font); text-transform: uppercase; letter-spacing: .03em; flex: none; }
.project-list .p-system .icon { width: 12px; height: 12px; stroke-width: 2; }
/* Mêmes couleurs que les affichages : traitement en cours en orange franc, réponse à lire en vert. */
.project-list li.is-running, .project-list li.is-running:hover { background: var(--pane-running-bg); color: var(--pane-running-ink); box-shadow: none; }
.project-list li.is-running .dot { background: var(--pane-running-ink); box-shadow: none; }
.project-list li.is-unread, .project-list li.is-unread:hover { background: var(--pill-positive-bg); color: var(--pill-positive-ink); box-shadow: inset 3px 0 0 var(--positive); }
.project-list li.is-running .p-dom, .project-list li.is-unread .p-dom { color: inherit; opacity: .75; }
.project-list li.sys-sep { height: 1px; padding: 0; margin: 8px 4px; background: var(--border, var(--active)); pointer-events: none; }
.project-list li.sys-sep:hover { background: var(--border, var(--active)); }
.project-list li.drag { opacity: .5; }
.project-list li.folder { flex-direction: row; align-items: center; gap: 6px; padding: 4px 6px 4px 8px; margin-top: 12px; font-size: 12px; font-weight: 500; color: var(--muted); }
.project-list li.folder:first-child { margin-top: 0; }
.project-list li.folder:hover { background: none; color: var(--text); }
.project-list li.folder.drop-target { background: var(--active); outline: 1px dashed var(--accent); }
.project-list .f-toggle { width: 12px; flex: none; text-align: center; font-size: 10px; }
.project-list .f-name { flex: 1; display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; }
.project-list .f-name .icon { width: 14px; height: 14px; }
/* Dossier où un projet est en cours d'exécution : pastille pulsante à la couleur d'accent. */
.project-list li.folder.has-running .f-name { color: var(--text); }
.f-running { display: inline-flex; align-items: center; gap: 5px; flex: none; height: 18px; padding: 0 7px 0 6px; border-radius: 9px; background: var(--pill-accent-bg); color: var(--pill-accent-ink); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.f-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }
/* Actions du dossier : posées sur la fin de la ligne au survol, sans y réserver de place. */
.project-list li.folder { position: relative; }
.project-list .f-act { position: absolute; top: 50%; transform: translateY(-50%); display: inline-grid; place-items: center; border: 0; background: var(--ground); color: var(--muted); cursor: pointer; width: 22px; height: 22px; border-radius: var(--radius-chip); visibility: hidden; }
.project-list .f-act:last-child { right: 4px; }
.project-list .f-act:nth-last-child(2) { right: 28px; }
.project-list .f-act .icon { width: 13px; height: 13px; }
.project-list li.folder:hover .f-act, .project-list li.folder:focus-within .f-act { visibility: visible; }
.project-list .f-act:hover { color: var(--text); background: var(--active); }
#dlg-move select { width: 100%; }

/* Pastille d'état d'un projet : la seule couleur de la liste. */
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--control); }
.dot.running { background: var(--positive); }
.dot.provisioning, .dot.deleting { background: var(--warning); animation: pulse 1.2s infinite; }
.dot.error { background: var(--negative); }
/* Discussion en cours : le point pulse et un anneau d'accent s'élargit en boucle. */
.dot.busy { background: var(--pane-running-bg); box-shadow: 0 0 0 2px var(--ground), 0 0 0 3.5px var(--pane-running-bg); animation: dot-busy 1.1s ease-in-out infinite; }
@keyframes dot-busy {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 2px var(--ground), 0 0 0 3.5px var(--accent); }
  50% { transform: scale(1.25); box-shadow: 0 0 0 2px var(--ground), 0 0 0 6px color-mix(in srgb, var(--accent) 35%, transparent); }
}
@keyframes pulse { 50% { opacity: .35; } }
.unread { width: 7px; height: 7px; border-radius: 50%; background: var(--positive); flex: none; }

/* Navigation secondaire et pied : des lignes, pas des boutons encadrés. */
/* Pied de la barre latérale : l'utilisateur, puis une rangée d'outils en icônes. */
.sidebar-foot { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px 10px; border-top: 1px solid var(--border); }
.sidebar-foot .muted { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 8px; font-size: 12px; }
.sidebar-bar { display: flex; align-items: center; gap: 2px; }
.sidebar-bar .btn { position: relative; width: 34px; min-height: 34px; padding: 0; border: 0; background: none; color: var(--muted); }
.sidebar-bar .btn:hover { background: var(--active); color: var(--text); }
.sidebar-bar .btn.active { background: var(--active); color: var(--text); }
.sidebar-bar .count { position: absolute; top: 0; right: -2px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; pointer-events: none; }

/* ---------- La feuille ---------- */
.main {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  margin: var(--sheet-inset) var(--sheet-inset) var(--sheet-inset) 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); overflow: hidden;
}
/* Accueil : indicateurs puis cartes des projets. */
.home { flex: 1; min-height: 0; overflow-y: auto; padding: 0 var(--pad) var(--pad); }
.home-head { display: flex; align-items: center; gap: 16px; padding: 20px 0 16px; }
.home-title { flex: 1; min-width: 0; }
.home-title h1 { margin: 0 0 2px; font-size: var(--fs-title); font-weight: 600; letter-spacing: -.01em; }
.home-title p { margin: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 28px; }
.home-tile, .home-card { display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 14px 16px; cursor: pointer; min-width: 0; }
.home-tile:hover, .home-card:hover { background: var(--raised); }
.home-tile:focus-visible, .home-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.home-tile-label { font-size: var(--fs-small); color: var(--muted); }
.home-tile-value { font-size: 22px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.home-tile-sub { font-size: var(--fs-small); }
.home-tile.warn { border-color: var(--notice-border); }
.home-tile.warn .home-tile-value { color: var(--warning); }
.home-tile.alert { border-color: var(--negative); }
.home-tile.alert .home-tile-value { color: var(--negative); }
.home-res { display: block; width: 100%; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 14px 16px 0; margin-bottom: 28px; cursor: pointer; }
.home-res:hover { background: var(--raised); }
.home-res:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.home-res .disk-legend { margin-bottom: 12px; }
.home-card-res:empty { display: none; }
.home-card-res { font-size: var(--fs-small); padding-left: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-h { font-size: var(--fs-section); font-weight: 600; margin: 0 0 12px; }
.home-h .muted { font-weight: 400; font-size: 13px; }
.home-projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.home-card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.home-card-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.home-card-dom, .home-card-foot { font-size: var(--fs-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 16px; }
.home-busy { color: var(--accent); }
.home-empty { grid-column: 1 / -1; text-align: center; padding: 32px 16px; }
.home-empty p { max-width: 420px; margin: 0 auto 16px; }
a.brand-home { color: inherit; text-decoration: none; border-radius: var(--radius-control); }
a.brand-home:hover span { text-decoration: underline; text-underline-offset: 3px; }
.menu-toggle { display: none; }
/* Ordinateur : la barre latérale réduite disparaît, le bouton « menu » des en-têtes la rouvre. */
@media (min-width: 761px) {
  .layout.sidebar-collapsed .sidebar { display: none; }
  .layout.sidebar-collapsed .menu-toggle { display: inline-flex; }
}

.project { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.project-head { display: flex; align-items: center; gap: 16px; padding: 20px var(--pad) 16px; }
.project-title { flex: 1; min-width: 0; }
.project-title h1 { margin: 0 0 4px; font-size: var(--fs-title); font-weight: 600; letter-spacing: -.01em; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.project-meta a { color: var(--muted); text-decoration: none; }
.project-meta a:hover { color: var(--text); text-decoration: underline; }
.project-actions { display: flex; gap: 8px; }

/* Pastilles : teinte pâle et encre de la même teinte. */
.badge, .pill {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--radius-chip);
  font-size: 12px; font-weight: 500; white-space: nowrap; flex: none;
  background: var(--pill-neutral-bg); color: var(--pill-neutral-ink);
}
.badge.running, .pill.ok, .badge.upd-ok { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.badge.provisioning, .badge.deleting, .pill.warn, .badge.upd-warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.badge.error, .pill.bad { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.badge.asleep { background: var(--control); color: var(--muted); }
.dot.running.asleep { background: var(--muted); }
.badge.requested { background: var(--pill-accent-bg); color: var(--pill-accent-ink); }
.badge.upd-ok, .badge.upd-warn { cursor: pointer; }

.tabs { display: flex; gap: 20px; padding: 0 var(--pad); box-shadow: inset 0 -1px 0 var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; flex: none; }
.tab { border: 0; background: none; font: 400 14px/1 var(--font); color: var(--muted); padding: 12px 0 13px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 500; }
.tab-panel { flex: 1; min-height: 0; }
.count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--pill-neutral-bg); color: var(--text); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tab .count, .sidebar-bar .count { background: var(--text); color: var(--surface); }
.tab .count.alert { background: var(--negative); }

/* ---------- Discussion ---------- */
.chat { display: flex; flex-direction: column; }
.banner { margin: 16px var(--pad) 0; padding: 10px 14px; border-radius: var(--radius-control); background: var(--pill-warning-bg); border: 1px solid var(--notice-border); color: var(--pill-warning-ink); font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
/* Fil de messagerie : vos messages à droite, ceux de Claude à gauche, chacun dans sa bulle. */
.messages { flex: 1; overflow-y: auto; padding: 24px var(--pad); display: flex; flex-direction: column; gap: 14px; }
.msg { width: 100%; }
.msg.user, .msg.assistant { width: fit-content; padding: 10px 14px 12px; }
.msg.user { align-self: flex-end; max-width: min(72%, 760px); background: var(--pill-accent-bg); border-radius: 14px 14px 4px 14px; }
.msg.assistant { align-self: flex-start; max-width: min(86%, 1040px); min-width: min(420px, 100%); background: var(--raised); border-radius: 14px 14px 14px 4px; }
.msg .who { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.msg.user .who { justify-content: flex-end; color: var(--pill-accent-ink); }
.msg .who .when { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.msg.user .bubble { white-space: pre-wrap; word-wrap: break-word; }
.msg.assistant .bubble { padding: 0; word-wrap: break-word; line-height: 1.6; }
/* Dans une bulle grise, le code et les outils reprennent le blanc de la feuille. */
.msg.assistant code, .msg.assistant .bubble pre { background: var(--surface); }
.msg.assistant .bubble pre { border: 1px solid var(--border); }
.msg.user code { background: color-mix(in srgb, var(--pill-accent-ink) 10%, transparent); }
.msg.user + .msg.assistant, .msg.assistant + .msg.user { margin-top: 6px; }
.bubble p { margin: 0 0 .75em; }
.bubble p:last-child { margin-bottom: 0; }
.bubble h1, .bubble h2, .bubble h3, .bubble h4 { margin: 1.2em 0 .4em; font-size: 15px; font-weight: 600; }
.bubble ul, .bubble ol { margin: 0 0 .75em; padding-left: 1.3em; }
.bubble li + li { margin-top: 2px; }
.bubble pre { background: var(--raised); padding: 12px 14px; border-radius: var(--radius-card); overflow-x: auto; font: 13px/1.5 var(--mono); }
.bubble pre code { background: none; padding: 0; }
.bubble table { border-collapse: collapse; font-size: 13px; margin: 0 0 .75em; }
.bubble th, .bubble td { text-align: left; padding: 6px 12px 6px 0; border-bottom: 1px solid var(--rule); }
.bubble th { color: var(--muted); font-weight: 400; border-bottom-color: var(--border); }
.msg .meta { font-size: 12px; color: var(--muted); margin-top: 10px; font-variant-numeric: tabular-nums; }
.msg .err { color: var(--negative); font-size: 13px; margin-top: 8px; white-space: pre-wrap; }
.status-line { color: var(--muted); font-size: 13px; margin-top: 6px; }
.live-line { display: flex; align-items: center; gap: 8px; }
.live-line .live-time { font-variant-numeric: tabular-nums; opacity: .7; }
.cursor::after { content: "▍"; animation: pulse 1s infinite; color: var(--accent); }

/* Trace des outils : un registre compact, une ligne par appel. */
.tools { display: flex; flex-direction: column; margin: 0 0 12px; border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.tools:empty { display: none; }
.bubble .tools { margin: 10px 0 12px; }
.tool { font: 12.5px/1.4 var(--mono); background: var(--surface); }
.tool + .tool { border-top: 1px solid var(--rule); }
.tool summary { padding: 7px 12px; cursor: pointer; display: flex; gap: 10px; align-items: center; list-style: none; }
.tool summary:hover { background: var(--raised); }
.tool summary::-webkit-details-marker { display: none; }
.tool .t-name { font-weight: 500; color: var(--text); flex: none; min-width: 44px; }
.tool .t-sum { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool .t-state { margin-left: auto; flex: none; display: inline-flex; color: var(--muted); }
.tool .t-state .icon { width: 14px; height: 14px; stroke-width: 2; }
.tool.ok .t-state { color: var(--positive); }
.tool.fail .t-state { color: var(--negative); }
.tool.fail .t-name { color: var(--negative); }
.tool pre { margin: 0; padding: 10px 12px; border-top: 1px solid var(--rule); background: var(--raised); max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

.composer { padding: 12px var(--pad) 20px; flex: none; }
.composer textarea { resize: vertical; min-height: 72px; max-height: 40vh; display: block; padding: 12px 14px; border-color: var(--control); border-radius: var(--radius-card); line-height: 1.5; }
.composer-actions { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; }
.composer-actions .file-btn { width: 30px; padding: 0; }
/* Dictée en cours : le bouton passe au rouge et pulse. */
#btn-dictate.listening { color: #fff; background: var(--negative); border-color: var(--negative); animation: pulse 1.4s infinite; }
/* Lecture d'une réponse : petite icône au bout de la ligne « Claude ». */
/* Sous la ligne d'état : un agent au travail par ligne, chacun avec son indicateur. */
.live-agents { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 6px 0 0 20px; }
.agent-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 2px 10px 2px 8px; border-radius: 999px; background: var(--pane-running-bg); color: var(--pane-running-ink); font-size: 12px; font-weight: 600; }
.agent-chip .spinner { width: 11px; height: 11px; border-width: 1.5px; opacity: 1; }
.agent-chip .agent-detail { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.agent-chip .agent-detail::before { content: "— "; }
.project-list .p-agent { flex: none; max-width: 96px; padding: 0 6px; border-radius: 999px; font-size: 11px; line-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: color-mix(in srgb, currentColor 16%, transparent); }
.msg-edit { display: inline-grid; place-items: center; width: 24px; height: 24px; margin: -4px auto -4px -6px; padding: 0; border: 0; border-radius: var(--radius-control); background: none; color: var(--pill-accent-ink); cursor: pointer; opacity: 0; }
.msg.user:hover .msg-edit, .msg-edit:focus-visible { opacity: .7; }
.msg-edit:hover { opacity: 1; background: color-mix(in srgb, var(--pill-accent-ink) 10%, transparent); }
.msg-edit .icon { width: 14px; height: 14px; }
@media (hover: none) { .msg-edit { opacity: .6; } }
.msg-edit-form { display: flex; flex-direction: column; gap: 8px; min-width: min(560px, 70vw); }
.msg-edit-form textarea { width: 100%; resize: vertical; font: inherit; }
.msg-edit-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.msg-read { display: inline-grid; place-items: center; width: 26px; height: 26px; margin: -4px -6px -4px auto; padding: 0; border: 0; border-radius: var(--radius-control); background: none; color: var(--muted); cursor: pointer; }
.msg-read:hover { background: var(--active); color: var(--text); }
.msg-read .icon { width: 15px; height: 15px; }
.msg-read.speaking { color: var(--accent); }

/* File d'attente : au-dessus du champ, dans la même colonne. */
.queue { padding: 12px var(--pad) 0; max-height: 32vh; overflow-y: auto; flex: none; box-shadow: inset 0 1px 0 var(--rule); }
.queue h4 { margin: 0 0 8px; font-size: 12px; font-weight: 500; color: var(--muted); }
.qitem { display: flex; align-items: center; gap: 10px; padding: 0 10px; min-height: 36px; border: 1px solid var(--border); border-radius: var(--radius-control); margin-bottom: 6px; background: var(--surface); }
.qitem.running { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.qitem .qforce, .qitem .qhold { flex: none; }
.qitem.held { border-style: dashed; }
.qitem.held .qtext { color: var(--muted); }
.qitem .grip { cursor: grab; color: var(--muted); flex: none; display: inline-flex; }
.qitem .grip .icon { stroke-width: 2.6; }
.qitem.running .grip { cursor: default; visibility: hidden; }
.qitem .qtext { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.qitem .qrole { flex: none; font-size: 12px; height: 20px; display: inline-flex; align-items: center; padding: 0 7px; border-radius: var(--radius-chip); background: var(--pill-accent-bg); color: var(--pill-accent-ink); }
.qitem .qstate { flex: none; font-size: 12px; color: var(--muted); }
.qitem.running .qstate { color: var(--accent); font-weight: 500; }
.qitem.drag { opacity: .4; }
.chip .x, .qitem .x { display: inline-grid; place-items: center; flex: none; border: 0; background: none; color: var(--muted); cursor: pointer; width: 22px; height: 22px; padding: 0; border-radius: var(--radius-chip); }
.chip .x .icon, .qitem .x .icon { width: 13px; height: 13px; }
.chip .x:hover, .qitem .x:hover { color: var(--negative); background: var(--pill-negative-bg); }

.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 9px; font-size: 13px;
  background: var(--raised); border-radius: var(--radius-control); max-width: 100%; }
.chip > .icon { width: 14px; height: 14px; color: var(--muted); }
.chip-thumb { width: 22px; height: 22px; margin-left: -5px; border-radius: 4px; object-fit: cover; flex: none; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* Dépôt de fichiers sur la discussion : un voile qui dit ce qui va se passer. */
.chat { position: relative; }
.chat.dropping::after { content: "Déposez les fichiers pour les joindre au message"; position: absolute; inset: 8px; z-index: 5; display: grid; place-items: center;
  border: 2px dashed var(--accent); border-radius: var(--radius-card); background: color-mix(in srgb, var(--surface) 88%, var(--accent)); color: var(--pill-accent-ink); font-size: 15px; font-weight: 500; pointer-events: none; }
.msg .role-tag { font-size: 12px; font-weight: 500; height: 20px; display: inline-flex; align-items: center; padding: 0 7px; border-radius: var(--radius-chip); background: var(--pill-accent-bg); color: var(--pill-accent-ink); }

/* Pièces jointes d'un message : miniatures carrées, pastilles pour les autres fichiers. */
.msg-attachments { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin: 2px 0 6px; }
.thumbs { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.thumb { display: block; width: 132px; height: 132px; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--surface); cursor: zoom-in; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.thumb:hover img { transform: scale(1.04); }
.thumb:focus-visible { outline-offset: 2px; }
.thumbs:has(.thumb:only-child) .thumb { width: auto; max-width: min(320px, 100%); height: auto; max-height: 240px; }
.thumbs:has(.thumb:only-child) .thumb img { width: auto; max-width: 100%; height: auto; max-height: 240px; object-fit: contain; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 30px; padding: 0 10px; border-radius: var(--radius-control); background: var(--surface); color: var(--text); font-size: 13px; text-decoration: none; }
.file-chip:hover { background: color-mix(in srgb, var(--surface) 85%, var(--text)); }
.file-chip > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .icon { width: 14px; height: 14px; color: var(--muted); }
@media (max-width: 760px) { .thumb { width: 96px; height: 96px; } }

/* Visionneuse : l'image en grand sur fond sombre. */
.lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0b0d0f; color: #f2f3f3; }
.lightbox::backdrop { background: rgba(8, 10, 12, .6); }
.lightbox[open] { display: flex; flex-direction: column; }
.lightbox-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.lightbox-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-count { color: #a9adb0; font-variant-numeric: tabular-nums; }
.lightbox .btn.ghost { color: #f2f3f3; border-color: rgba(255, 255, 255, .25); background: none; }
.lightbox .btn.ghost:hover { background: rgba(255, 255, 255, .1); }
.lightbox .btn.icon-btn { border-color: transparent; }
.lightbox-stage:focus { outline: none; }
.lightbox-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 64px 24px; }
.lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #f2f3f3; cursor: pointer; }
.lightbox-nav:hover { background: rgba(255, 255, 255, .2); }
.lightbox-nav .icon { width: 22px; height: 22px; }
.lightbox-nav.prev { left: 12px; }
.lightbox-nav.next { right: 12px; }
@media (max-width: 760px) {
  .lightbox-stage { padding: 8px 8px 72px; }
  .lightbox-nav { top: auto; bottom: 14px; transform: none; }
  .lightbox-nav.prev { left: calc(50% - 56px); }
  .lightbox-nav.next { right: calc(50% - 56px); }
}

/* ---------- Panneaux de travail (infra, git, fichiers…) ---------- */
.infra { overflow-y: auto; padding: var(--pad); display: flex; flex-direction: column; gap: var(--gap); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--gap); align-items: start; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0 0 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table th { color: var(--muted); font-weight: 400; font-size: 12px; padding-top: 4px; padding-bottom: 8px; border-bottom-color: var(--border); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td code { font-size: 13px; background: none; padding: 0; white-space: nowrap; }
.state-running { color: var(--positive); }
.state-exited, .state-dead { color: var(--negative); }
.log { margin: 0; font: 12.5px/1.6 var(--mono); max-height: 360px; overflow: auto; white-space: pre-wrap; background: var(--raised); padding: 12px 14px; border-radius: var(--radius-card); }

/* ---------- Journaux : barre de recherche, copie, plein écran ---------- */
.logbox { display: flex; flex-direction: column; min-width: 0; }
.logbox > pre { margin-top: 0; }
.log-tools { display: flex; align-items: center; gap: 2px; margin-bottom: 6px; }
.log-search { flex: 0 1 320px; display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 0 4px 0 0; height: 30px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); font-weight: 400; color: var(--muted); }
.log-search:focus-within { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.log-search .icon { width: 14px; height: 14px; }
.log-search input { flex: 1; min-width: 0; min-height: 0 !important; height: 28px; padding: 0; border: 0; background: none; font-size: 13px; }
.log-search input:focus { outline: none; }
.log-count { flex: none; font-size: 12px; font-variant-numeric: tabular-nums; }
.log-tools .icon-btn { width: 28px; min-height: 28px; border-color: transparent; color: var(--muted); }
.log-tools .icon-btn:hover:not(:disabled) { color: var(--text); background: var(--raised); }
.log-tools .icon-btn:disabled { opacity: .35; }
::highlight(log-hit) { background-color: #fde68a; color: #131416; }
::highlight(log-current) { background-color: #f59e0b; color: #131416; }
/* Agrandi : le journal occupe l'écran, la page reste devinée derrière. */
.logbox.is-full { position: fixed; inset: 16px; z-index: 200; padding: 12px 14px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--float-shadow), 0 0 0 100vmax var(--backdrop); }
.logbox.is-full > pre { flex: 1; min-height: 0; max-height: none !important; }
.visually-hidden { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }
@media (max-width: 640px) {
  .log-search { flex: 1 1 auto; }
  .logbox.is-full { inset: 0; border-radius: 0; border: 0; }
}

/* ---------- Fenêtres ---------- */
.dialog { border: 1px solid var(--border); border-radius: 12px; padding: 24px; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--float-shadow);
  max-height: calc(100dvh - 32px); overflow: auto; }
/* Fenêtre plus haute que l'écran : ses boutons restent visibles en bas. */
.dialog .dialog-actions { position: sticky; bottom: -24px; background: var(--surface); padding: 12px 0 4px; margin-bottom: -4px; }
.dialog::backdrop { background: var(--backdrop); }
.dialog h2 { margin: 0 0 20px; font-size: 18px; font-weight: 600; letter-spacing: -.005em; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: var(--radius-control); font-size: 14px; z-index: 100; max-width: calc(100vw - 32px); box-shadow: var(--float-shadow); }
.toast.error { background: var(--negative); color: #fff; }
.toast.success { background: var(--positive); color: #fff; }

/* ---------- Contrôle des conteneurs ---------- */
.ctl { display: flex; gap: 2px; justify-content: flex-end; white-space: nowrap; }
/* Actions de ligne : du texte, un fond au survol ; le rouge seulement sur ce qui détruit. */
.table td .btn { min-height: 28px; padding: 0 8px; font-size: 13px; font-weight: 500; border-color: transparent; background: none; color: var(--text); }
.table td .btn:hover { background: var(--raised); }
.table td .btn.danger { color: var(--negative); }
.table td .btn.danger:hover { background: var(--pill-negative-bg); }
.table td .btn.primary { color: var(--primary-ink); background: var(--primary); }
.dialog.wide { width: min(1000px, calc(100vw - 32px)); }
.log.tall { max-height: 65vh; min-height: 200px; }
#server .table td { vertical-align: middle; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.toolbar > h3, .toolbar > h2 { margin: 0; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 14px; }
.crumbs button { border: 0; background: none; color: var(--text); cursor: pointer; font: inherit; padding: 2px 4px; border-radius: var(--radius-chip); }
.crumbs button:hover { background: var(--raised); }
.crumbs .sep { color: var(--muted); }
.file-btn { position: relative; overflow: hidden; flex-direction: row; margin: 0; font-weight: 500; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.table .num, .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table.files td { vertical-align: middle; padding-top: 8px; padding-bottom: 8px; }
.table.files .fname { display: flex; align-items: center; gap: 10px; word-break: break-all; }
.table.files .fname button, .table.files .fname a { border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; padding: 0; text-align: left; text-decoration: none; }
.table.files .fname button:hover, .table.files .fname a:hover { color: var(--accent); text-decoration: underline; }
.table.files tr:hover td { background: var(--raised); }
.update-banner { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 1000; display: flex; align-items: center;
  gap: 12px; max-width: calc(100vw - 32px); padding: 10px 14px; border-radius: 10px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--float-shadow); font-size: 13px; }
.seg-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: var(--raised); }
.seg-toggle button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.seg-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.size-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin: 4px 0 12px; }
.size-summary strong { font-size: 20px; font-weight: 600; }
.table.files.sizes td.bar-cell { width: 34%; min-width: 120px; }
.size-bar { display: flex; align-items: center; gap: 8px; }
.size-bar .track { flex: 1; height: 8px; border-radius: 4px; background: var(--raised); overflow: hidden; }
.size-bar .fill { height: 100%; background: var(--accent); border-radius: 4px; min-width: 1px; }
.size-bar .pct { width: 44px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.size-view h4 { margin: 20px 0 8px; font-size: 14px; font-weight: 600; }
.ficon { display: inline-flex; color: var(--muted); flex: none; }
.files-card.dragover { outline: 1px dashed var(--accent); outline-offset: -6px; background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.drop-hint { text-align: center; margin: 16px 0 0; }
.progress { position: relative; height: 24px; background: var(--raised); border-radius: var(--radius-control); overflow: hidden; margin-bottom: 12px; }
.progress .bar { position: absolute; inset: 0 auto 0 0; width: 0; background: color-mix(in srgb, var(--accent) 30%, transparent); transition: width .2s; }
.progress span { position: relative; font-size: 12px; padding: 0 8px; line-height: 24px; font-variant-numeric: tabular-nums; }
.attach-progress { display: flex; align-items: center; margin-bottom: 8px; }
.attach-progress span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-progress .btn { position: relative; height: 22px; margin-right: 2px; }
.attach-progress.hidden { display: none; }
.row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.row > label { flex: 1 1 200px; margin-bottom: 0; }
.row > .btn { flex: none; }
.row + .row { margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.git-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.git-head .branch { display: inline-flex; align-items: center; gap: 6px; font: 500 15px var(--mono); }
.git-head .branch .icon { color: var(--muted); }
.changes { margin: 0; padding: 0; list-style: none; font: 12.5px/1.7 var(--mono); max-height: 220px; overflow: auto; }
.changes .st { display: inline-block; width: 2.5em; color: var(--warning); font-weight: 500; }
.commits { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.commits li { padding: 8px 0; border-bottom: 1px solid var(--rule); display: flex; gap: 12px; }
.commits li:last-child { border-bottom: 0; }
.commits code { flex: none; background: none; padding: 0; color: var(--muted); }
.commits .who { color: var(--muted); flex: none; margin-left: auto; white-space: nowrap; }
.out { margin: 12px 0 0; font: 12px/1.5 var(--mono); white-space: pre-wrap; background: var(--raised); padding: 10px 12px; border-radius: var(--radius-control); max-height: 200px; overflow: auto; }
.out.tall { max-height: 420px; }
.env-table input { font-family: var(--mono); font-size: 13px; padding: 6px 8px; }
.env-table td { vertical-align: middle; }
.env-table .key { font: 500 13px var(--mono); word-break: break-all; }
.env-table .hint { display: block; color: var(--muted); font: 12px var(--font); }
.secret-cell { display: flex; gap: 4px; align-items: stretch; }
.secret-cell .btn { min-height: var(--control-h); min-width: var(--control-h); padding: 0; }
.env-file h3 { display: flex; gap: 8px; align-items: center; font: 500 14px var(--mono); color: var(--text); }
.env-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; align-items: center; }

/* ---------- Contexte, doc, sauvegardes, équipe, pile ---------- */
#context-text, #docs-edit, #md-edit { font: 13px/1.6 var(--mono); width: 100%; resize: vertical; }
.docs-view { max-width: 760px; }
.docs-view:empty::before { content: "Aucune documentation. Cliquez « Générer avec Devo Studio » ou « Modifier »."; color: var(--muted); }
/* label est en colonne par défaut : un interrupteur repasse en ligne (case puis texte). */
.switch { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; font-weight: 400; margin: 0; }
.switch.static { cursor: default; white-space: nowrap; }
.switch input { width: auto; }
.site-auth { padding-bottom: 12px; }
.site-auth-fields { margin-top: 12px; }
.site-auth-fields > p { margin: 0 0 12px; }
.git-autopush { margin-top: 12px; font-size: 13px; }
.git-clone-alt { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--rule); }
.git-clone-alt summary { cursor: pointer; color: var(--muted); }
.import-block { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 10px 14px; margin-bottom: 16px; }
.import-block summary { cursor: pointer; font-weight: 500; font-size: 13px; }
.import-block label { margin-top: 12px; }
.agent-select { width: auto; max-width: 200px; min-height: 30px !important; padding: 4px 8px; font-size: 13px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; height: 22px; display: inline-flex; align-items: center; padding: 0 8px; border-radius: var(--radius-chip); background: var(--raised); color: var(--text); }
.tag.svc { background: var(--pill-accent-bg); color: var(--pill-accent-ink); }
.stack-grid { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; font-size: 14px; align-items: baseline; margin: 0; }
.stack-grid dt { color: var(--muted); }
.stack-grid dd { margin: 0; }
.team-agent { display: flex; gap: 12px; align-items: flex-start; }
.team-agent .aname { flex: none; width: 160px; }
.team-agent .arole { flex: 1; }
.team-agent textarea { width: 100%; resize: vertical; font-size: 13px; }

/* ---------- Réglages ----------
   Une rubrique à la fois : navigation à gauche, contenu à droite. Chaque section suit le même
   schéma — titre et explication, l'action d'ajout en bouton à droite, le panneau de saisie,
   puis la liste. */
.dialog.settings { width: min(980px, calc(100vw - 32px)); height: min(680px, calc(100dvh - 32px)); padding: 0; overflow: hidden; }
.settings-shell { display: grid; grid-template-columns: 220px 1fr; height: 100%; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; padding: 20px 12px 16px; background: var(--ground); border-right: 1px solid var(--border); }
.settings-nav h2 { margin: 0 0 14px 10px; font-size: 18px; }
.settings-tab { display: flex; align-items: center; min-height: 34px; padding: 0 10px; border: 0; border-radius: var(--radius-control); background: none; color: var(--muted); font: 400 14px var(--font); text-align: left; cursor: pointer; }
.settings-tab:hover { background: var(--active); color: var(--text); }
.settings-tab.active { background: var(--active); color: var(--text); font-weight: 500; }
.settings-close { align-self: flex-start; margin-left: 2px; }
.settings-body { overflow-y: auto; padding: 28px 32px 32px; }
.set-group { display: flex; flex-direction: column; }
.set-section { padding: 0 0 28px; }
.set-section + .set-section { border-top: 1px solid var(--border); padding-top: 28px; }
.set-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.set-head h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.set-head p { margin: 0; font-size: 13px; max-width: 62ch; }
.set-head > .btn { flex: none; }
.set-panel { max-width: 640px; }
.set-panel > .row + p, .set-panel > p { margin: 10px 0 0; }
.set-panel #ghapp-install { margin-top: 14px; }
.set-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.set-actions > .muted { margin-right: auto; }
.set-field { max-width: 260px; margin: 0; }
.row > label.narrow { flex: 0 1 110px; }
/* Panneau de saisie d'un ajout : un pas de ton, pas de bordure. */
.form-panel { background: var(--raised); border-radius: var(--radius-card); padding: 18px 20px; margin-bottom: 20px; }
.form-panel h4 { margin: 0 0 14px; font-size: 14px; font-weight: 600; }
.form-panel label:last-child { margin-bottom: 0; }
.form-panel .set-actions { margin-top: 18px; }
/* Message à lire une fois (clé publique, jeton créé). */
.notice { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 20px; padding: 14px 16px; border-radius: var(--radius-card); background: var(--pill-warning-bg); border: 1px solid var(--notice-border); color: var(--text); font-size: 13px; }
.notice p, .notice .out { margin: 0; align-self: stretch; }
.set-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; font-size: 14px; }
.settings .table td:last-child { text-align: right; white-space: nowrap; }
.settings-body:focus { outline: none; }
.settings .table td:first-child { white-space: nowrap; }
.settings .table td code { white-space: normal; word-break: break-all; }
/* Skills : la description (souvent longue) passe à la ligne, limitée à deux lignes. */
.settings .table.skills td:first-child { white-space: normal; }
.settings .table.skills td:first-child code { word-break: normal; overflow-wrap: anywhere; }
@media (min-width: 641px) { .settings .table.skills td:first-child { width: 50%; } }
@media (max-width: 640px) { .settings .table.skills td:first-child { grid-column: 1 / -1; } }
.skill-projects span { white-space: nowrap; }
.skill-summary { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; font-size: 13px; font-weight: 500; }
.skill-summary textarea { font-weight: 400; resize: vertical; }
.skill-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; margin-top: 2px; }
.settings .table td .ctl { justify-content: flex-end; }
.set-row { align-items: center; }
.token-value { display: block; margin: 0; padding: 8px 10px; word-break: break-all; background: var(--surface); align-self: stretch; }
#updates-body .set-row code { background: var(--raised); }
@media (max-width: 760px) {
  .dialog.settings { height: calc(100dvh - 32px); }
  .settings-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .settings-nav { flex-direction: row; align-items: center; overflow-x: auto; padding: 12px; border-right: 0; border-bottom: 1px solid var(--border); scrollbar-width: none; scroll-padding-inline: 12px; }
  .settings-nav h2 { display: none; }
  .settings-tab { flex: none; white-space: nowrap; }
  .settings-nav .spacer { display: none; }
  .settings-close { order: -1; margin: 0 6px 0 0; flex: none; }
  .settings-body { padding: 20px 16px 24px; }
  .set-head { flex-direction: column; gap: 12px; }
}
/* Téléphone : chaque ligne devient une fiche — nom et type, puis le détail, puis les actions. */
@media (max-width: 640px) {
  .settings .table thead { display: none; }
  .settings .table tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
  .settings .table tr:last-child { border-bottom: 0; }
  .settings .table td { padding: 0; border: 0; }
  .settings .table td:nth-child(3) { grid-column: 1 / -1; }
  .settings .table td:last-child { grid-column: 1 / -1; text-align: left; }
  .settings .table td:last-child .ctl { justify-content: flex-start; margin-left: -8px; }
  .settings .table td:last-child > .btn { margin-left: -8px; }
  .settings .table td[colspan] { grid-column: 1 / -1; }
}

/* ---------- Audit de sécurité ---------- */
.sec-roles { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 4px 0 12px; }
.sec-role { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.sec-role .sec-mark { width: 16px; display: inline-flex; justify-content: center; }
.sec-role .sec-mark .icon { width: 14px; height: 14px; stroke-width: 2; }
.sec-role.running { color: var(--accent); } .sec-role.done { color: var(--text); } .sec-role.done .sec-mark { color: var(--positive); }
.sec-role.error { color: var(--negative); } .sec-role.pending { color: var(--muted); }
.sec-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sev { display: inline-flex; align-items: center; justify-content: center; height: 20px; font-size: 12px; font-weight: 500; padding: 0 8px; border-radius: var(--radius-chip); white-space: nowrap; flex: none; min-width: 72px; }
.sev-critical { color: #fff; background: var(--negative); }
.sev-high { color: var(--pill-negative-ink); background: var(--pill-negative-bg); }
.sev-medium { color: var(--pill-warning-ink); background: var(--pill-warning-bg); }
.sev-low, .sev-info { color: var(--pill-neutral-ink); background: var(--pill-neutral-bg); }
.finding summary { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.finding .f-title { font-weight: 500; }
.sec-audience { margin-top: 8px; }
.sec-audience > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0 10px; cursor: pointer; list-style: none; }
.sec-audience > summary::-webkit-details-marker { display: none; }
.sec-audience > summary::before { content: ""; width: 0; height: 0; border-left: 6px solid var(--muted);
  border-top: 5px solid transparent; border-bottom: 5px solid transparent; transition: transform .15s; }
.sec-audience[open] > summary::before { transform: rotate(90deg); }
.sec-audience > summary h3 { margin: 0; font-size: var(--fs-section); font-weight: 600; }
.sec-audience > summary p { margin: 0; flex-basis: 100%; padding-left: 20px; }
.sec-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 4px 0 8px; }
.sec-filters select, .sec-filters input[type=search] { width: auto; min-width: 180px; }
.sec-filters input[type=search] { flex: 1; }
#dlg-report fieldset { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; }
#dlg-report .switch { align-items: flex-start; }
.sev-filter { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.sev-filter button { border: 1px solid transparent; font: inherit; cursor: pointer; }
.sev-filter button[aria-pressed="false"] { opacity: .35; filter: grayscale(.6); }
.finding .f-status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
#dlg-finding .finding-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
#dlg-finding h2 { margin-bottom: 12px; }
#dlg-finding [data-details]:empty { display: none; }
#dlg-finding .dialog-actions .spacer { flex: 1; }
.finding .f-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.finding .f-details { margin-top: 12px; padding: 12px 16px; border-radius: var(--radius-card); background: var(--raised); }
.finding .f-details > :first-child { margin-top: 0; }
.finding .f-details h2 { font-size: 15px; margin: 16px 0 6px; }
.f-details pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 10px 12px; overflow-x: auto; font-size: 13px; }
.f-details pre code { background: none; padding: 0; }
.f-details li > p { margin: 6px 0; }
.finding.sev-border-critical { box-shadow: inset 3px 0 0 var(--negative); }
.finding.sev-border-high { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--negative) 55%, var(--surface)); }
.finding.sev-border-medium { box-shadow: inset 3px 0 0 var(--notice-border); }

/* ---------- Modales génériques ---------- */
.modal-message { white-space: pre-line; margin: 0 0 16px; }
#dlg-prompt input[data-input] { width: 100%; margin: 0 0 16px; }

/* ---------- Mises à jour, activité ---------- */
/* Écran Mises à jour : deux listes à quatre colonnes — nom, détail, état, actions. */
#updates .project-meta { flex-direction: column; align-items: flex-start; gap: 0; }
#updates .project-head { flex-wrap: wrap; }
@media (min-width: 761px) { #updates .project-title { flex: 1 1 320px; } }
.inline-select { flex-direction: row; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.inline-select select { width: auto; min-height: 30px !important; padding: 2px 8px; font-size: 13px; }
.project-actions { align-items: center; }
.upd-section { display: flex; flex-direction: column; gap: 10px; }
.upd-title { display: flex; align-items: baseline; gap: 8px; margin: 0; font-size: 16px; font-weight: 600; }
.upd-title .muted { font-size: 13px; font-weight: 400; font-variant-numeric: tabular-nums; }
.card.upd-list { padding: 0; overflow: hidden; }
.upd-row { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(0, 2.6fr) 140px 210px; gap: 8px 20px; align-items: start; padding: 14px 20px; }
.upd-row + .upd-row { border-top: 1px solid var(--rule); }
.upd-row.todo { box-shadow: inset 3px 0 0 #e8a33d; }
.upd-label { font-weight: 500; line-height: 22px; }
.upd-detail { display: flex; flex-direction: column; min-width: 0; }
.upd-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; min-width: 0; font-size: 13px; line-height: 22px; }
.upd-line code { flex: 0 1 auto; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; padding: 0; font-size: 12.5px; }
.upd-line > span { min-width: 0; }
.upd-line .icon { width: 14px; height: 14px; color: var(--muted); }
.upd-new { color: var(--warning); font-weight: 500; }
.upd-state { padding-top: 1px; }
.upd-act { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.upd-act .icon-btn { width: 30px; color: var(--muted); border-color: transparent; }
.upd-act .icon-btn:hover { color: var(--text); background: var(--raised); }
.upd-empty { display: flex; flex-direction: column; gap: 6px; }
.upd-run { display: flex; flex-direction: column; gap: 12px; }
.upd-run.failed { border-color: color-mix(in srgb, var(--negative) 35%, var(--border)); }
.upd-run-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.upd-run-title { font-size: 14px; }
.upd-run .update-cause { margin: 0; }
.upd-log .logbox { margin-top: 2px; }
@media (max-width: 900px) {
  .upd-row { grid-template-columns: minmax(0, 1fr) auto; padding: 14px 16px; }
  .upd-detail, .upd-act { grid-column: 1 / -1; }
  .upd-act { justify-content: flex-start; }
  .upd-state { grid-column: 2; grid-row: 1; }
}
@media (max-width: 760px) {
  #updates .project-actions { flex-wrap: nowrap; }
}
.spin { color: var(--accent); }
.log .log-problem { color: var(--negative); font-weight: 500; }
.log .log-success { color: var(--positive); }
.updates-group { margin: 20px 0 8px; font-size: 14px; font-weight: 500; color: var(--muted); }
.updates-group:first-child { margin-top: 0; }
.card-failed { border-color: color-mix(in srgb, var(--negative) 45%, var(--border)); }
.update-cause { margin: 8px 0 0; padding: 10px 12px; border-radius: var(--radius-control); font-size: 13px; color: var(--pill-negative-ink); background: var(--pill-negative-bg); }
.update-cause div { margin-top: 4px; color: var(--text); }
.m-0 { margin: 0; }
.my-8 { margin: 8px 0; }
/* Tableaux : un identifiant (conteneur…) ne se coupe pas ; une image trop longue est rognée. */
.table td.cell-clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Un tableau plus large que sa carte (écran étroit) défile dans la carte au lieu d'être rogné. */
.card:has(table.table) { overflow-x: auto; }

/* Planification des sauvegardes : champs alignés sur une ligne, repliés sur mobile. */
.backup-schedule { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 12px; }
.backup-schedule > label { gap: 6px; font-size: 13px; color: var(--muted); margin: 0; }
.backup-schedule select, .backup-schedule input[type=time] { min-width: 120px; }
.backup-contents { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 6px 12px 8px; }
.backup-contents legend { font-size: 13px; font-weight: 400; color: var(--muted); }
.backup-contents label { flex-direction: row; align-items: center; gap: 6px; font-size: 14px; font-weight: 400; margin: 0; color: var(--text); }
.backup-contents label.unavailable { color: var(--muted); }
.backup-contents input { width: auto; }
.backup-plan { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 14px 16px 10px; margin-bottom: 12px; }
.backup-plan .backup-schedule { margin-bottom: 10px; }
.backup-plan.view { padding: 14px 16px; }
.backup-plan-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.backup-plan-head h4 { margin: 0; font-size: 15px; font-weight: 600; }
.backup-plan-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 10px; font-size: 14px; }
.backup-plan-facts dt { color: var(--muted); }
.backup-plan-facts dd { margin: 0; }
.backup-plan-facts .pill { margin-right: 4px; }
.backup-plan-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.backup-plan-foot > p { margin: 0; }
.input-unit { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.input-unit input { width: 80px; }
.text-ok { color: var(--positive); }
.text-bad { color: var(--negative); }

/* ---------- Téléphone et tablette ---------- */
@media (max-width: 760px) {
  /* Le cadre disparaît : la feuille devient l'écran, la liste des projets un panneau. */
  .main { margin: 0; border: 0; border-radius: 0; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; width: min(300px, 85vw); }
  .sidebar.open { transform: none; box-shadow: var(--float-shadow); }
  .menu-toggle { display: inline-flex; }
  #btn-collapse-sidebar { display: none; }
  :root { --pad: 16px; }
  .project-head { padding-top: 12px; padding-bottom: 12px; gap: 10px; }
  .project-head .menu-toggle { width: 36px; min-height: 36px; padding: 0; }
  .project-title h1 { font-size: 20px; }
  .messages { padding-top: 16px; gap: 12px; }
  .msg.user { max-width: 88%; }
  .msg.assistant { max-width: 96%; min-width: 0; }
  .infra { padding: 16px; gap: 16px; }
  .card { padding: 16px; }
  .banner { margin: 12px 16px 0; }
  /* En-tête du projet sur deux lignes : nom et état, puis les actions — côte à côte, le nom
     était réduit à trois lettres et l'adresse passait sous les boutons. */
  .project-head { flex-wrap: wrap; }
  .project-title { flex: 1 1 calc(100% - 56px); }
  .project-meta a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .project-actions { flex: 1 1 100%; flex-wrap: wrap; }
  .composer { padding-bottom: 12px; }
  .composer-actions { flex-wrap: wrap; }
  .btn, .btn.small { min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .spinner { animation-duration: 1.6s !important; }
  .dot.busy { animation: none !important; }
}

/* Réglages › Stockage : barre empilée du disque et légende. */
.storage-total { margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.disk-bar { display: flex; height: 14px; background: var(--raised); border-radius: var(--radius-chip); overflow: hidden; }
.disk-bar .seg { height: 100%; min-width: 0; }
.disk-bar .seg + .seg { box-shadow: -1px 0 0 var(--surface); }
.s1 { background: var(--seg-1); } .s2 { background: var(--seg-2); } .s3 { background: var(--seg-3); }
.s4 { background: var(--seg-4); } .s5 { background: var(--seg-5); } .s6 { background: var(--seg-6); }
.disk-legend { list-style: none; margin: 10px 0 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 20px; font-size: var(--fs-small); }
.disk-legend li { display: flex; align-items: center; gap: 8px; }
.disk-legend i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.disk-legend i.free { background: var(--raised); box-shadow: inset 0 0 0 1px var(--control); }
.disk-legend b { margin-left: auto; font-weight: 500; }
.disk-bar .seg.sys, .disk-legend i.sys { background: var(--control); }
.res-meter { height: 4px; margin-top: 4px; margin-left: auto; width: 100%; max-width: 120px; background: var(--raised); border-radius: 2px; overflow: hidden; }
.res-meter span { display: block; height: 100%; background: var(--accent); }
.res-meter.warn span { background: var(--seg-3); }
.res-meter.alert span { background: var(--alert-bg); }
.table-scroll { overflow-x: auto; }
.table.storage td { vertical-align: top; }

/* Bandeau d'alerte d'espace disque, au-dessus de toute l'application. */
.disk-alert { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px; padding: 8px 16px; background: var(--alert-bg); color: #fff; font-size: 13px; text-align: center; }
.disk-alert .btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .7); }
.disk-alert .btn:hover { background: rgba(255, 255, 255, .15); }

/* Recherche de skills dans l'annuaire */
.row-actions { display: flex; gap: 8px; flex: none; }
#skill-need { width: 100%; resize: vertical; }
.skill-hit { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--active); }
.skill-hit:first-child { margin-top: 10px; }
.skill-hit > div { min-width: 0; }
.skill-hit .btn { flex: none; }

/* Visualisation d'un fichier (onglet Fichiers) */
.file-viewer { flex: none; height: var(--fv-h, 70vh); min-height: 240px; display: flex; flex-direction: column; }
.file-viewer .fv-name { word-break: break-all; }
.fv-body { padding: 4px 0 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.fv-body img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; object-fit: contain; }
.file-viewer.fv-full { position: fixed; inset: 0; z-index: 60; margin: 0; border-radius: 0; min-height: 0; height: auto; }
body.fv-lock { overflow: hidden; }
.fv-note { margin: 6px 0 0; }
/* Éditeur de code (editor.js) */
.ce { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); overflow: hidden; }
.ce-main { flex: 1; min-height: 0; display: flex; position: relative; }
.ce-gutter { flex: none; overflow: hidden; background: var(--raised); border-right: 1px solid var(--border); color: var(--muted); text-align: right; user-select: none; }
.ce-gutter-in, .ce-hl, .ce-ta { font: 13px/20px var(--mono); tab-size: 2; letter-spacing: 0; }
.ce-gutter-in { padding: 8px 8px 8px 0; white-space: pre; }
.ce-code { flex: 1; position: relative; min-width: 0; }
.ce-hl { position: absolute; inset: 0; margin: 0; overflow: hidden; padding: 0; pointer-events: none; color: var(--text); white-space: pre; }
.ce-hl-in { display: block; padding: 8px; font: inherit; white-space: pre; width: max-content; min-width: 100%; }
.ce-ta { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 8px; border: 0; outline: 0; resize: none; overflow: auto; background: transparent; color: transparent; -webkit-text-fill-color: transparent; caret-color: var(--text); white-space: pre; box-sizing: border-box; }
.ce-ta::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.ce-probe { position: absolute; visibility: hidden; font: 13px/20px var(--mono); white-space: pre; }
.tk-c { color: var(--muted); font-style: italic; }
.tk-s { color: var(--positive); }
.tk-n { color: var(--warning); }
.tk-k { color: var(--accent); font-weight: 600; }
.tk-p { color: var(--text); font-weight: 600; }
.tk-t { color: var(--accent); }
.tk-a { color: var(--warning); }
.tk-v { color: var(--negative); }
.tk-f { color: var(--accent); text-decoration: underline; }
.ce-hl mark { color: inherit; border-radius: 2px; background: color-mix(in srgb, var(--warning) 30%, transparent); }
.ce-hl mark.cur { background: color-mix(in srgb, var(--warning) 65%, transparent); outline: 1px solid var(--warning); }
.ce-bar { padding: 6px 8px; border-bottom: 1px solid var(--border); background: var(--raised); display: flex; flex-direction: column; gap: 6px; }
.ce-bar-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ce-bar-row.hidden { display: none; }
.ce-q { flex: 1 1 180px; max-width: 320px; height: 28px; padding: 0 8px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); color: var(--text); font: 13px var(--font); }
.ce-opt.on { background: var(--active); outline: 1px solid var(--accent); }
.ce-count { min-width: 70px; }
.table.files tr.viewing td { background: var(--active); }

/* Écran d'attente du déploiement */
.deploy-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: color-mix(in srgb, var(--ground) 82%, transparent); backdrop-filter: blur(3px); }
.deploy-box { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 420px; padding: 28px 32px; text-align: center; background: var(--surface); border-radius: var(--radius-card); box-shadow: 0 8px 32px rgba(0, 0, 0, .25); }
.deploy-box h3 { margin: 6px 0 0; }
.deploy-box p { margin: 0; }
.spinner.big { width: 36px; height: 36px; border-width: 3px; color: var(--accent); opacity: 1; }

#messages .older { display: block; margin: 4px auto 12px; }

/* Historique des conversations */
.history-body { max-height: 65vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.hist-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: var(--radius-control); background: var(--raised); color: var(--text); font: inherit; cursor: pointer; }
.hist-item:hover { background: var(--active); }
.hist-item strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.hist-messages { overflow: visible; }

.activity-filters { margin-bottom: 12px; align-items: center; }

.project-list .p-todo { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.project-list .p-pill { height: 16px; padding: 0 6px; border-radius: var(--radius-chip); font: 600 10px/16px var(--font); background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.project-list .p-pill.warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.project-list .p-pill.bad { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.project-list .p-pill.accent { background: var(--pill-accent-bg); color: var(--pill-accent-ink); }
.project-list li.folder .p-todo { margin: 0; flex: none; flex-wrap: nowrap; }

/* Affichages : liste dans la barre latérale */
.layout-nav { padding: 0 8px 4px; }
.layout-nav-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 0 10px; font-size: 12px; font-weight: 500; color: var(--muted); }
.layout-nav-head .btn { width: 26px; min-height: 26px; padding: 0; border-color: transparent; color: var(--muted); }
.layout-nav-head .btn:hover { color: var(--text); background: var(--active); }
.layout-list { list-style: none; margin: 0; padding: 0; }
.layout-list li { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: var(--radius-control); cursor: pointer; font-size: 13px; }
.layout-list li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layout-list li .icon { width: 14px; height: 14px; flex: none; color: var(--accent); }
.layout-list li:hover, .layout-list li.active { background: var(--active); }
.layout-list li.active { font-weight: 600; }

/* Affichages : discussions placées librement, positions en % de la zone */
.lay-canvas { position: relative; flex: 1; min-height: 0; margin: 0 var(--pad) var(--pad); }
.lay-empty { padding: 32px 0; text-align: center; }
.lay-pane { position: absolute; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-control); overflow: hidden; }
.lay-bar { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-bottom: 1px solid var(--border); background: var(--ground); cursor: grab; user-select: none; touch-action: none; }
.lay-bar .lay-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lay-bar .btn { width: 26px; min-height: 26px; padding: 0; border-color: transparent; background: none; color: var(--muted); }
.lay-bar .btn:hover { color: var(--text); background: var(--active); }
.lay-state { font-size: 12px; font-weight: 500; white-space: nowrap; }
.lay-spin { display: none; width: 12px; height: 12px; }
/* Rien à faire : barre neutre. En cours : orange franc, en aplat. À lire : vert. */
.lay-pane.is-running { border: 2px solid var(--pane-running-bg); }
.lay-pane.is-running .lay-bar { background: var(--pane-running-bg); color: var(--pane-running-ink); border-bottom-color: var(--pane-running-bg); }
.lay-pane.is-running .lay-spin { display: inline-block; }
.lay-pane.is-unread { border-color: var(--positive); }
.lay-pane.is-unread .lay-bar { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.lay-pane.is-running .lay-bar .btn, .lay-pane.is-unread .lay-bar .btn { color: inherit; }
.lay-pane iframe { flex: 1; min-height: 0; width: 100%; border: 0; background: var(--surface); }
.lay-pane > .muted { padding: 16px; }
.lay-resize { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 50%, var(--border) 50%, var(--border) 60%, transparent 60%, transparent 75%, var(--border) 75%, var(--border) 85%, transparent 85%); }
/* Pendant un déplacement, les cadres ne doivent pas capter la souris. */
.lay-canvas.lay-moving iframe { pointer-events: none; }
.lay-canvas.lay-moving .lay-bar { cursor: grabbing; }
@media (max-width: 760px) {
  .lay-canvas { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; margin: 0; padding: 12px; }
  .lay-pane { position: static; width: auto !important; height: 75vh !important; flex: none; }
  .lay-resize { display: none; }
}

/* Discussion seule, intégrée dans un affichage */
body.embed .sidebar, body.embed .project-head, body.embed .tabs, body.embed #disk-alert { display: none; }
body.embed .main { margin: 0; border: 0; border-radius: 0; }

/* Déploiement */
.choices.two { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 480px) { .choices.two { grid-template-columns: 1fr; } }
.card h4 { margin: 16px 0 8px; font-size: 14px; font-weight: 600; }
.deploy-steps { margin: 0 0 12px; padding-left: 20px; line-height: 1.6; }
#form-deploy-docker input[name=app_dir], #deploy-remote { min-width: 260px; }
#deploy-git-warn { margin: 0 0 12px; }

/* Onglet Fichiers : recherche, séparateur liste / contenu */
.file-search { margin: 0; }
.file-search input { width: 240px; max-width: 100%; height: 30px; min-height: 0; padding: 0 10px; font-size: 13px; }
#tab-files.viewing .files-scroll { max-height: var(--files-h, 35vh); min-height: 80px; overflow: auto; }
.fv-split { flex: none; height: var(--gap); margin: calc(-1 * var(--gap)) 0; position: relative; cursor: row-resize; touch-action: none; }
.fv-split::after { content: ""; position: absolute; left: 50%; top: 50%; width: 56px; height: 4px; transform: translate(-50%, -50%); border-radius: 2px; background: var(--border); }
.fv-split:hover::after, .fv-split:focus-visible::after, .fv-split.dragging::after { background: var(--accent); }
.fv-split:focus-visible { outline: none; }
body.fv-resizing { cursor: row-resize; user-select: none; }
.file-results { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.file-results .fr-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.file-results .fr-file { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.file-results button.fr-link { border: 0; background: none; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-align: left; word-break: break-all; }
.file-results button.fr-line { display: flex; gap: 10px; width: 100%; border: 0; background: none; color: var(--text); cursor: pointer; padding: 3px 6px; text-align: left; border-radius: var(--radius-chip); font: 12.5px/1.5 var(--mono); }
.file-results button.fr-line:hover, .file-results button.fr-link:hover { background: var(--raised); }
.file-results .fr-no { flex: none; min-width: 4ch; text-align: right; color: var(--muted); }
.file-results .fr-text { white-space: pre; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.file-results mark { color: inherit; border-radius: 2px; background: color-mix(in srgb, var(--warning) 35%, transparent); }
@media (max-width: 640px) { .file-search input { width: 100%; } .file-search { flex: 1 1 100%; } }

/* Envoi forcé (en parallèle, lecture seule) : étiquette distincte des rôles du mode équipe. */
.msg .role-tag.side-tag { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
/* Dictée en direct : le champ se remplit tout seul (lecture seule le temps de la dictée). */
#prompt.dictating { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

/* Services externes d'un projet (onglet Secrets) */
.ext-service + .ext-service { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.ext-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.env-actions select { width: auto; max-width: 100%; }

/* Rôles : ce qu'un rôle ne peut pas faire n'est pas proposé (le serveur le refuse de toute façon). */
body:not([data-role="admin"]) .admin-only, body[data-role="viewer"] .dev-only,
body[data-role="client"] .no-client { display: none !important; }
.role-chip { margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--control); color: var(--muted); font-size: 11px; }
.badge.role-admin { background: var(--pill-accent-bg); color: var(--pill-accent-ink); }
.badge.role-viewer { background: var(--control); color: var(--muted); }
td .badge + .badge, td div + .badge { margin-left: 0; margin-top: 4px; }

/* Emprunt de profil : bandeau permanent tant que l'admin agit en tant qu'un autre */
body.impersonating { --imp-h: 44px; }
.imp-banner { display: flex; align-items: center; justify-content: center; gap: 6px 14px; height: 44px; padding: 0 16px;
  background: var(--pill-warning-bg); color: var(--pill-warning-ink); font-size: 13px; overflow: hidden; }
.imp-banner .btn { flex: none; }
@media (max-width: 640px) { .imp-banner { font-size: 12px; } .imp-banner > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }

/* Auteur d'un message envoyé par quelqu'un d'autre (multi-utilisateur) */
.msg.user .who .author { font-weight: 600; color: var(--text); }
.msg.user .who .via { font-weight: 400; color: var(--muted); }
.qauthor { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); }

/* Blocs de code : bouton « Copier » en haut à droite, visible au survol (toujours sur écran tactile). */
.code-block { position: relative; margin: 0 0 .75em; }
.code-block > pre { margin: 0; }
.tool .code-block { margin: 0; }
.code-block .code-copy { position: absolute; top: 6px; right: 6px; background: var(--surface); border: 1px solid var(--border); opacity: 0; transition: opacity .15s; }
.code-block:hover .code-copy, .code-block .code-copy:focus-visible { opacity: 1; }
@media (hover: none) { .code-block .code-copy { opacity: 1; } }

/* Consommation de l'IA */
.usage-section { margin-top: 20px; overflow-x: auto; }
.usage-section h4 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.usage-totals { margin-bottom: 0; }
.usage-table td:first-child { white-space: nowrap; }

/* Historique des conversations : suppression (admin) */
.hist-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.hist-tools > .muted { flex: 1; }
.hist-row { display: flex; align-items: center; gap: 6px; }
.hist-row .hist-item { flex: 1; min-width: 0; }
