/* Console d'administration — style Windows 11 (MMC) */
:root {
  --window: #ffffff; --chrome: #f3f3f3; --pane: #ffffff; --surface: #f9f9f9; --panel-head: #f3f3f3; --section: #eef0f3;
  --text: #1a1a1a; --muted: #5c5c5c; --icon: #3b3b3b; --border: #e1e1e1; --border-strong: #c4c4c4; --guide: #e3e3e3;
  --accent: #005fb8; --accent-hover: #1a6fc2; --accent-text: #fff; --link: #005fb8;
  --hover: #f0f5fb; --select: #d6e7f7; --pressed: #dbe8f5; --pressed-border: #b7d1ec;
  --ok: #0f7b0f; --warn: #9d5d00; --danger: #c42b1c; --gauge: #0f7b0f;
  --info-bg: #eef5fc; --info-border: #b7d1ec; --danger-bg: #fdf0f0; --danger-border: #f0b8b8;
  --input: #fff; --input-border: #d1d1d1; --input-under: #8a8a8a; --btn: #fdfdfd; --btn-hover: #f5f5f5;
  --shadow: 0 8px 24px rgba(0, 0, 0, .16);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --window: #202020; --chrome: #2b2b2b; --pane: #252525; --surface: #1c1c1c; --panel-head: #2d2d2d; --section: #2f3236;
    --text: #f2f2f2; --muted: #ababab; --icon: #d4d4d4; --border: #383838; --border-strong: #555; --guide: #3a3a3a;
    --accent: #4cc2ff; --accent-hover: #74d0ff; --accent-text: #00131f; --link: #78c8ff;
    --hover: #2e3338; --select: #1e3a55; --pressed: #23384c; --pressed-border: #33587d;
    --ok: #6ccb5f; --warn: #fcb045; --danger: #ff8a80; --gauge: #6ccb5f;
    --info-bg: #1b2b3b; --info-border: #2f5579; --danger-bg: #3a2020; --danger-border: #713535;
    --input: #1e1e1e; --input-border: #474747; --input-under: #9a9a9a; --btn: #2d2d2d; --btn-hover: #363636;
    --shadow: 0 8px 24px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --window: #202020; --chrome: #2b2b2b; --pane: #252525; --surface: #1c1c1c; --panel-head: #2d2d2d; --section: #2f3236;
  --text: #f2f2f2; --muted: #ababab; --icon: #d4d4d4; --border: #383838; --border-strong: #555; --guide: #3a3a3a;
  --accent: #4cc2ff; --accent-hover: #74d0ff; --accent-text: #00131f; --link: #78c8ff;
  --hover: #2e3338; --select: #1e3a55; --pressed: #23384c; --pressed-border: #33587d;
  --ok: #6ccb5f; --warn: #fcb045; --danger: #ff8a80; --gauge: #6ccb5f;
  --info-bg: #1b2b3b; --info-border: #2f5579; --danger-bg: #3a2020; --danger-border: #713535;
  --input: #1e1e1e; --input-border: #474747; --input-under: #9a9a9a; --btn: #2d2d2d; --btn-hover: #363636;
  --shadow: 0 8px 24px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 12.5px/1.45 "Segoe UI", "Segoe UI Variable Text", Tahoma, system-ui, sans-serif; background: var(--window); color: var(--text); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { margin: 0; padding: 0; }
.ico { width: 16px; height: 16px; flex: none; color: var(--icon); vertical-align: -3px; }
.ico.big { width: 40px; height: 40px; }
.ico-gauge { color: var(--gauge); }
.caret { width: 12px; height: 12px; flex: none; color: var(--muted); transform: rotate(90deg); transition: transform .12s; }
.collapsed > .ap-head .caret, .collapsed > .row .twisty svg { transform: rotate(0deg); }

/* ---- Cadre ------------------------------------------------------------------ */
body.console { display: grid; grid-template-rows: 30px 26px 36px minmax(0, 1fr) 22px; height: 100vh; overflow: hidden; }
.titlebar { display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--window); border-bottom: 1px solid var(--border); font-size: 12px; white-space: nowrap; overflow: hidden; }
.menubar { display: flex; align-items: stretch; padding: 0 4px; background: var(--window); }
.menu { position: relative; }
.menu > button { height: 100%; padding: 0 9px; border: 0; border-radius: 4px; background: none; color: var(--text); font: inherit; min-width: 0; min-height: 0; }
.menu > button:hover, .menu.open > button { background: var(--hover); }
.dropdown { display: none; position: absolute; top: 100%; left: 0; z-index: 50; min-width: 250px; padding: 4px; background: var(--pane);
  border: 1px solid var(--border-strong); border-radius: 6px; box-shadow: var(--shadow); }
.menu.open .dropdown { display: block; }
.dropdown a, .dropdown button { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; padding: 5px 24px 5px 8px; border: 0; border-radius: 4px;
  background: none; color: var(--text); font: inherit; text-align: left; min-width: 0; min-height: 0; cursor: default; }
.dropdown a:hover, .dropdown button:hover { background: var(--hover); text-decoration: none; }
.dropdown form { margin: 0; }
.dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.dropdown .kbd { margin-left: auto; color: var(--muted); }

.toolbar { display: flex; align-items: center; gap: 2px; padding: 0 8px; background: var(--chrome); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.tool { display: grid; place-items: center; width: 30px; height: 28px; padding: 0; border: 1px solid transparent; border-radius: 4px; background: none; min-width: 0; min-height: 0; cursor: default; }
.tool:hover { background: var(--hover); text-decoration: none; }
.tool.pressed { background: var(--pressed); border-color: var(--pressed-border); }
.tool.disabled .ico { opacity: .35; }
.toolbar .sep { width: 1px; height: 20px; margin: 0 5px; background: var(--border-strong); }

.panes { display: grid; grid-template-columns: 255px minmax(0, 1fr) 235px; min-height: 0; }
.panes.no-tree { grid-template-columns: minmax(0, 1fr) 235px; }
.panes.no-actions { grid-template-columns: 255px minmax(0, 1fr); }
.panes.no-tree.no-actions { grid-template-columns: minmax(0, 1fr); }
.panes.no-tree .tree, .panes.no-actions .actions-pane { display: none; }

/* ---- Arborescence -------------------------------------------------------------- */
.tree { overflow: auto; padding: 4px 0 12px; background: var(--pane); border-right: 1px solid var(--border); user-select: none; }
.tree li { list-style: none; }
.tree li.collapsed > ul { display: none; }
.tree ul ul { position: relative; }
.tree ul ul::before { content: ""; position: absolute; top: 0; bottom: 4px; left: calc(var(--d) * 18px + 16px); border-left: 1px solid var(--guide); }
.row { display: flex; align-items: center; height: 24px; padding-left: calc(var(--depth) * 18px + 4px); margin: 0 4px; border-radius: 3px; }
.row:hover { background: var(--hover); }
.row.selected { background: var(--select); }
.row a { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; height: 100%; color: var(--text); white-space: nowrap; }
.row a span:first-of-type { overflow: hidden; text-overflow: ellipsis; }
.row a:hover { text-decoration: none; }
.twisty { display: grid; place-items: center; width: 16px; height: 16px; flex: none; padding: 0; margin-right: 2px; border: 0; background: none; min-width: 0; min-height: 0; color: var(--muted); }
.twisty svg { width: 12px; height: 12px; transform: rotate(90deg); transition: transform .12s; }
.twisty svg use, .caret use { stroke: currentColor; }
.row .count { margin-left: auto; }

/* ---- Volet de résultats ---------------------------------------------------------- */
.results { overflow: auto; padding: 20px; background: var(--surface); min-width: 0; }
.panel { background: var(--pane); border: 1px solid var(--border); border-radius: 4px; padding: 0 16px 16px; }
.panel > h1:first-child { position: sticky; top: -20px; z-index: 5; margin: 0 -16px 14px; padding: 8px 12px; font-size: 12.5px; font-weight: 600;
  background: var(--panel-head); border-bottom: 1px solid var(--border); border-radius: 4px 4px 0 0; }
.panel.flush { padding: 0; }
.panel.flush > h1:first-child { margin: 0; }
.panel.flush .table-wrap { border: 0; }
.panel-foot { padding: 6px 12px; font-size: 11.5px; color: var(--muted); background: var(--panel-head); border-top: 1px solid var(--border); border-radius: 0 0 4px 4px; }
h1 { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
h2 { font-size: 12.5px; font-weight: 600; margin: 22px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--border); }
h3 { font-size: 12.5px; font-weight: 600; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }

.card { background: var(--pane); border: 1px solid var(--border); border-radius: 4px; padding: 12px 14px; margin-bottom: 12px; }
.card > h3:first-child, .card > h2:first-child { margin-top: 0; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

.stats { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stat { background: var(--pane); border: 1px solid var(--border); border-radius: 4px; padding: 9px 12px; }
.stat .v { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 11.5px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.badge.ok::before { background: var(--ok); } .badge.warn::before { background: var(--warn); } .badge.danger::before { background: var(--danger); }
.count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--accent); color: var(--accent-text); font-size: 10.5px; line-height: 16px; text-align: center; }

/* Vue en liste */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 4px; background: var(--pane); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 4px 12px; vertical-align: top; }
th { position: sticky; top: 0; z-index: 1; font-weight: 400; color: var(--muted); white-space: nowrap; background: var(--pane); border-bottom: 1px solid var(--border); }
th + th { border-left: 1px solid var(--border); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td, table tr:hover td { background: var(--hover); }
tr.selected td { background: var(--select) !important; }
tr[data-href] { cursor: default; }
tr[data-href]:focus { outline: 1px dotted var(--accent); outline-offset: -1px; }
.list-view td { padding-top: 3px; padding-bottom: 3px; white-space: nowrap; }
.list-view td:last-child { white-space: normal; }
.cell-link { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.cell-link:hover { text-decoration: none; }
form.inline { display: inline; }

/* Champs */
label { display: block; font-size: 12px; margin: 9px 0 3px; }
label.check { display: flex; gap: 7px; align-items: center; }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=number], input[type=time], input[type=search], input[type=datetime-local], input[type=date], select, textarea {
  width: 100%; min-height: 30px; padding: 4px 9px; border: 1px solid var(--input-border); border-bottom-color: var(--input-under); border-radius: 4px;
  background: var(--input); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-bottom: 2px solid var(--accent); padding-bottom: 3px; }
input[type=checkbox], input[type=radio] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
input[type=file] { font: inherit; }
textarea { min-height: 90px; resize: vertical; }
textarea.tall { min-height: 220px; }
.help { color: var(--muted); font-size: 11.5px; margin-top: 3px; }

/* Boutons */
.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 84px; min-height: 30px; padding: 4px 14px;
  border: 1px solid var(--input-border); border-bottom-color: var(--border-strong); border-radius: 4px; background: var(--btn); color: var(--text); font: inherit; cursor: default; }
.btn:hover, button:hover { background: var(--btn-hover); text-decoration: none; }
.btn:active, button:active { background: var(--chrome); }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover, button.primary:hover { background: var(--accent-hover); }
button.danger { color: var(--danger); }
button:disabled { opacity: .5; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.fields { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.fields .wide { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }

.alert { display: flex; gap: 8px; padding: 7px 12px; margin-bottom: 12px; background: var(--info-bg); border: 1px solid var(--info-border); border-radius: 4px; }
.alert::before { content: "i"; flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font: 700 11px/16px Georgia, serif; text-align: center; }
.alert.danger { background: var(--danger-bg); border-color: var(--danger-border); }
.alert.danger::before { content: "!"; background: var(--danger); color: #fff; font-family: inherit; }
.checklist { padding: 0; margin: 0; }
.checklist li { list-style: none; display: flex; align-items: center; gap: 7px; margin: 3px 0; }
.checklist input:disabled { opacity: 1; }
pre.text { white-space: pre-wrap; font: inherit; margin: 0; }

/* Mini-histogramme (tableau de bord du site) */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: 16px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar-fill { width: 100%; max-width: 22px; min-height: 2px; background: var(--accent); border-radius: 3px 3px 0 0; }
.bar-v { font-size: 10.5px; color: var(--muted); line-height: 14px; }
.bar-l { font-size: 10.5px; color: var(--muted); margin-top: 3px; }

/* Onglets (feuille de propriétés Windows) */
.tabs { display: flex; flex-wrap: wrap; gap: 2px 0; padding-left: 4px; border-bottom: 1px solid var(--border-strong); }
.tab { min-width: 0; min-height: 28px; margin-bottom: -1px; padding: 4px 11px; border: 1px solid transparent; border-bottom: 0;
  border-radius: 4px 4px 0 0; background: none; color: var(--text); font-size: 12px; white-space: nowrap; }
.tab:hover { background: var(--hover); }
.tab[aria-selected="true"] { background: var(--pane); border-color: var(--border-strong); position: relative; z-index: 1;
  box-shadow: inset 0 2px 0 var(--accent); font-weight: 600; }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.tab-panel { border: 1px solid var(--border-strong); border-top: 0; border-radius: 0 0 4px 4px; background: var(--pane); }
.tab-panel[hidden] { display: none; }
.tab-body { padding: 14px 16px 16px; margin: 0; }
.tab-body > h2:first-of-type { border-bottom: 0; padding-bottom: 0; }
.settings-nav { display: flex; flex-wrap: wrap; margin: 0 0 12px; border-bottom: 1px solid var(--border); }
.settings-nav a { padding: 5px 10px; color: var(--text); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.settings-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); text-decoration: none; }

/* ---- Volet Actions ------------------------------------------------------------------ */
.actions-pane { overflow: auto; background: var(--pane); border-left: 1px solid var(--border); }
.ap-title { padding: 8px 10px 6px; font-weight: 600; }
.ap-head { display: flex; align-items: center; justify-content: flex-start; gap: 6px; width: 100%; min-height: 26px; padding: 3px 10px; border: 0; border-radius: 0;
  background: var(--section); color: var(--text); font-weight: 600; text-align: left; }
.ap-head:hover { background: var(--section); filter: brightness(.98); }
.ap-section.collapsed .ap-list { display: none; }
.ap-list { padding: 4px 0 10px; }
.ap-list a, .ap-list button, .ap-info { display: flex; align-items: center; justify-content: flex-start; gap: 9px; width: 100%; min-height: 24px; padding: 2px 10px 2px 14px;
  border: 0; border-radius: 0; background: none; color: var(--text); font: inherit; text-align: left; min-width: 0; cursor: default; }
.ap-list a:hover, .ap-list button:hover { background: var(--hover); text-decoration: none; }
.ap-list form { margin: 0; }
.ap-info { color: var(--muted); }

/* ---- Barre d'état ------------------------------------------------------------------------ */
.statusbar { display: flex; align-items: center; padding: 0 4px; background: var(--chrome); border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.statusbar span { padding: 0 10px; border-right: 1px solid var(--border-strong); line-height: 12px; }
.statusbar span:last-child, .statusbar .grow { border-right: 0; }
.statusbar .grow { flex: 1; }

/* ---- Boîtes de dialogue ---------------------------------------------------------------- */
.win-dialog { width: min(420px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--pane); color: var(--text); box-shadow: var(--shadow); }
.win-dialog::backdrop { background: rgba(0, 0, 0, .2); }
.dlg-title { display: flex; align-items: center; justify-content: space-between; height: 32px; padding-left: 12px; font-size: 12px; border-bottom: 1px solid var(--border); }
.dlg-close { min-width: 46px; min-height: 32px; height: 32px; border: 0; border-radius: 0 8px 0 0; background: none; }
.dlg-close:hover { background: #c42b1c; color: #fff; }
.dlg-body { display: flex; gap: 14px; padding: 18px 16px; }
.dlg-buttons { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; background: var(--chrome); border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; }

/* Pages hors session : fenêtre de dialogue centrée */
body.plain { background: var(--surface); }
.plain-main { padding: 16px; }
.login { max-width: 400px; margin: 10vh auto; padding: 0 18px 18px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--pane); box-shadow: var(--shadow); overflow: hidden; }
.login > h1:first-child { margin: 0 -18px 16px; padding: 9px 12px; font-size: 12px; font-weight: 400; background: var(--window); border-bottom: 1px solid var(--border); }

/* ---- Flux des agents (façon n8n) ------------------------------------------------ */
:root { --grid-dot: #d4d4d4; --edge: #9aa3ad; --wf-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --grid-dot: #3a3a3a; --edge: #6d7680; --wf-shadow: 0 1px 3px rgba(0, 0, 0, .5); } }
:root[data-theme="dark"] { --grid-dot: #3a3a3a; --edge: #6d7680; --wf-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.wf-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 4px; background-color: var(--surface);
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px); background-size: 20px 20px; }
.wf-canvas { position: relative; width: 1410px; height: 520px; }
.wf-edges { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.wf-edge { fill: none; stroke: var(--edge); stroke-width: 1.6; }
.wf-edge.dashed { stroke-dasharray: 5 4; }
.wf-edge.off { opacity: .35; }
.wf-arrow { fill: var(--edge); }
.wf-label { font-size: 10.5px; fill: var(--muted); }
.wf-label-bg { fill: var(--surface); stroke: var(--border); }
.wf-node { position: absolute; display: flex; align-items: center; gap: 10px; width: 200px; height: 64px; padding: 0 12px 0 10px;
  background: var(--pane); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: var(--wf-shadow);
  cursor: pointer; user-select: none; touch-action: none; }
.wf-node:hover { border-color: var(--accent); }
.wf-node:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wf-node.dragging { cursor: grabbing; box-shadow: var(--shadow); z-index: 2; }
.wf-node.off { opacity: .6; border-style: dashed; }
.wf-node.kind-sub { border-radius: 32px; }
.wf-tile { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 6px; background: #0067c0; }
.wf-node.kind-sub .wf-tile { border-radius: 50%; }
.wf-tile .ico { width: 22px; height: 22px; color: #fff; }
.kind-trigger .wf-tile { background: #e8590c; }
.kind-agent .wf-tile { background: #6741d9; }
.kind-sub .wf-tile { background: #9c36b5; }
.kind-human .wf-tile { background: #2b8a3e; }
.kind-data .wf-tile { background: #b7791f; }
.kind-output .wf-tile { background: #1971c2; }
.wf-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.wf-text strong { font-size: 12px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wf-text span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-port { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--pane); border: 1.5px solid var(--edge); }
.wf-port.in { left: -6px; top: 26px; } .wf-port.out { right: -6px; top: 26px; }
.wf-port.top { top: -6px; left: 94px; } .wf-port.bottom { bottom: -6px; left: 94px; }
.wf-state { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; }
.wf-state.ok { background: var(--ok); } .wf-state.err { background: var(--danger); }
.wf-state.run { background: var(--warn); animation: wf-pulse 1s ease-in-out infinite; }
@keyframes wf-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .wf-state.run { animation: none; } }
.wf-off { position: absolute; bottom: -19px; left: 0; font-size: 10.5px; color: var(--warn); }
.wf-dialog { width: min(880px, calc(100vw - 32px)); }
.wf-dlg-body { max-height: min(72vh, 720px); overflow: auto; padding: 14px 16px; }
.wf-dlg-body .card { background: var(--surface); }

/* ---- Écrans étroits ------------------------------------------------------------------ */
@media (max-width: 1100px) {
  .panes, .panes.no-actions { grid-template-columns: 230px minmax(0, 1fr); }
  .panes.no-tree { grid-template-columns: minmax(0, 1fr); }
  .actions-pane { display: none; }
}
@media (max-width: 700px) {
  body.console { grid-template-rows: 30px 26px 36px minmax(0, 1fr) 22px; }
  .panes, .panes.no-actions, .panes.no-tree { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 38%) minmax(0, 1fr); }
  .panes.no-tree { grid-template-rows: minmax(0, 1fr); }
  .tree { border-right: 0; border-bottom: 1px solid var(--border); }
  .results { padding: 12px 16px; }
  .panel > h1:first-child { top: -12px; }
  .statusbar span:not(:first-child):not(.grow) { display: none; }
}

/* Champ image (logos des références) */
.img-field { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.img-preview { width: 160px; height: 80px; object-fit: contain; padding: 8px; border: 1px solid var(--border); border-radius: 4px; background: #fff; }
.img-preview.empty { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
/* Planning des rendez-vous (vue semaine) */
.cal-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.cal-nav .btn { min-width: 0; }
.cal-nav strong { margin-left: 6px; }
.cal-legend { margin-left: auto; display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.cal-legend .lg { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 2px; vertical-align: -1px; border: 1px solid var(--border-strong); }
.lg.open { background: var(--pane); } .lg.ok { background: var(--select); border-color: var(--accent); }
.lg.warn { background: var(--surface); border-color: var(--warn); } .lg.block { background: var(--section); }
.cal-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
.cal { display: grid; grid-template-columns: 52px repeat(7, minmax(96px, 1fr)); min-width: 740px; }
.cal-head { position: sticky; top: 0; z-index: 2; padding: 6px 8px; font-size: 11.5px; color: var(--muted); background: var(--panel-head);
  border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal-head.cal-corner { border-left: 0; }
.cal-head strong { color: var(--text); font-size: 13px; }
.cal-head.today strong { color: var(--accent); }
.cal-hours > div { height: var(--hour); padding: 0 6px; font-size: 10.5px; color: var(--muted); text-align: right; transform: translateY(-7px); }
.cal-hours > div:first-child { transform: none; }
.cal-day { position: relative; height: calc(var(--hour) * var(--rows)); border-left: 1px solid var(--border);
  background-image: linear-gradient(var(--guide) 1px, transparent 1px); background-size: 100% var(--hour); }
.cal-day.today { background-color: color-mix(in srgb, var(--select) 25%, transparent); }
.cal-open { position: absolute; left: 0; right: 0; background: var(--pane); border-top: 1px solid var(--guide); border-bottom: 1px solid var(--guide); }
.cal-block { position: absolute; left: 0; right: 0; overflow: hidden; padding: 2px 6px; font-size: 10.5px; color: var(--muted);
  background: repeating-linear-gradient(135deg, var(--section) 0 6px, transparent 6px 12px); border-left: 3px solid var(--border-strong); }
.cal-event { position: absolute; left: 3px; right: 3px; z-index: 1; overflow: hidden; padding: 2px 6px; border-radius: 3px; font-size: 11px; line-height: 1.3;
  color: var(--text); text-decoration: none; background: var(--select); border-left: 3px solid var(--accent); }
.cal-event:hover { text-decoration: none; filter: brightness(1.06); }
.cal-event span { display: block; color: var(--muted); }
.cal-event.st-propose { background: var(--surface); border: 1px dashed var(--warn); border-left: 3px solid var(--warn); }
.cal-event.st-annule { opacity: .55; text-decoration: line-through; background: var(--surface); border-left-color: var(--border-strong); }
.cal-event.st-realise, .cal-event.st-converti { border-left-color: var(--ok); }
.cal-now { position: absolute; left: 0; right: 0; z-index: 3; height: 2px; background: var(--danger); pointer-events: none; }
.booking-link input[readonly] { font-family: Consolas, "Cascadia Mono", monospace; }
