/* ==========================================================================
   Template V6 ter : espace de travail à panneaux ancrables (layouts/v6c-dockspace.js)
     ┌ bandes des panneaux masqués (haut) ────────────────────────────┐
     │ bande │  groupes d'onglets ancrés, séparés par des poignées     │ bande │
     │ gauche│  (le volet d'un panneau masqué s'ouvre par-dessus)      │ droite│
     └ bandes des panneaux masqués (bas) ─────────────────────────────┘
   Fenêtres flottantes, guides d'ancrage et menus vivent au-dessus de la page.
   ========================================================================== */

.ds-ws {
  flex: 1; min-height: 0; position: relative; display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: ". top ." "left main right" ". bottom .";
  background: var(--surface-3); border-top: 1px solid var(--border);
}
.ds-mainwrap { grid-area: main; position: relative; min-width: 0; min-height: 0; }
.ds-main { position: absolute; inset: 0; display: flex; }
.ds-main > * { flex: 1 1 0; }
.ds-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.625rem; text-align: center; color: var(--text-faint); border: 0.125rem dashed var(--border-strong); border-radius: var(--radius-lg); padding: 1.875rem; }

/* ---------- Partages et poignées (filet d'1 px, la zone de saisie déborde de part et d'autre) ---------- */
.ds-split { display: flex; min-width: 0; min-height: 0; }
.ds-split.ds-row { flex-direction: row; }
.ds-split.ds-col { flex-direction: column; }
.ds-split > :not(.ds-bar) { min-width: 0; min-height: 0; }
.ds-bar { flex: 0 0 1px; position: relative; z-index: 5; background: var(--border); cursor: col-resize; touch-action: none; }
.ds-split.ds-col > .ds-bar { cursor: row-resize; }
/* Zone sensible (::after) de taille fixe, trait visible (::before) à part : au survol, seule la couleur du trait change.
   Si la zone sensible rétrécissait au survol, la souris en sortait et le trait clignotait. */
.ds-bar::after { content: ""; position: absolute; inset: 0 -3px; }
.ds-split.ds-col > .ds-bar::after { inset: -3px 0; }
.ds-bar::before { content: ""; position: absolute; inset: 0 -1px; background: transparent; pointer-events: none; transition: background .12s; }
.ds-split.ds-col > .ds-bar::before { inset: -1px 0; }
.ds-bar:hover::before, .ds-bar.on::before { background: var(--accent); }

/* ---------- Panneau principal : fixe, ni déplaçable ni regroupable ; son bandeau est celui de la page ---------- */
.ds-group.ds-mainp { background: var(--bg); }
.ds-mainp > .ds-gb { background: var(--bg); }

/* ---------- Groupe d'onglets (panneaux latéraux) ----------
   En-tête à deux lignes, même hauteur que le bandeau du panneau principal (--band-h) :
   titre (contexte) + actions, puis onglets à icônes (styles .dk-head de v6b-nav.css).
   Fond en retrait (--dk-band) : les panneaux latéraux se lisent comme des outils autour du principal. */
.ds-group { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); overflow: hidden; }
.ds-main.has-max .ds-group.ds-max { position: absolute; inset: 0; z-index: 15; box-shadow: var(--shadow-lg); }
.ds-gh.dk-head { height: var(--band-h, 3.75rem); touch-action: none; user-select: none; cursor: grab; }
/* Panneau actif signalé seulement pendant la navigation au clavier (Alt+P, Alt+C…) : au clic, rien ne bouge */
.ds-kbd .ds-focus > .ds-gh { box-shadow: inset 0 0.125rem 0 var(--accent); }
.ds-gh .dk-ctx { cursor: grab; }
.ds-gh .dk-ctx b { color: var(--text-muted); font-weight: 600; }
.ds-tab { touch-action: none; max-width: 13.75rem; }
.ds-tab .dk-tl { overflow: hidden; text-overflow: ellipsis; }
.ds-btn { display: grid; place-items: center; }
.ds-unpinned svg { transform: rotate(90deg); }
.ds-gb { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; background: var(--bg); }
.ds-pane { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; container-type: inline-size; }
.ds-pane[hidden] { display: none; }

/* ---------- Bandes des panneaux masqués automatiquement ---------- */
.ds-strip { display: flex; gap: 0.75rem; padding: 0.25rem; background: var(--surface-2); }
.ds-strip[hidden] { display: none; }
.ds-strip.left { grid-area: left; flex-direction: column; border-right: 1px solid var(--border); }
.ds-strip.right { grid-area: right; flex-direction: column; border-left: 1px solid var(--border); }
.ds-strip.top { grid-area: top; border-bottom: 1px solid var(--border); }
.ds-strip.bottom { grid-area: bottom; border-top: 1px solid var(--border); }
.ds-sgrp { display: flex; gap: 0.125rem; }
.ds-strip.left .ds-sgrp, .ds-strip.right .ds-sgrp { flex-direction: column; }
.ds-stab {
  position: relative; display: flex; align-items: center; gap: 0.375rem; padding: 0.3125rem 0.5625rem; border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--text-muted); font: inherit; font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; cursor: pointer;
}
.ds-strip.left .ds-stab, .ds-strip.right .ds-stab { writing-mode: vertical-rl; padding: 0.5625rem 0.3125rem; }
.ds-strip.left .ds-stab { transform: rotate(180deg); }
.ds-stab::after { content: ""; position: absolute; background: var(--border-strong); border-radius: 0.125rem; }
.ds-strip.left .ds-stab::after { right: 0; top: 0.25rem; bottom: 0.25rem; width: 0.125rem; }
.ds-strip.right .ds-stab::after { right: 0; top: 0.25rem; bottom: 0.25rem; width: 0.125rem; }
.ds-strip.top .ds-stab::after { left: 0.25rem; right: 0.25rem; bottom: 0; height: 0.125rem; }
.ds-strip.bottom .ds-stab::after { left: 0.25rem; right: 0.25rem; top: 0; height: 0.125rem; }
.ds-stab:hover { background: var(--surface-3); color: var(--text); }
.ds-stab.on { background: var(--accent-soft); color: var(--accent); }
.ds-stab.on::after { background: var(--accent); }

/* Volet ouvert depuis une bande */
.ds-fly { position: absolute; z-index: 40; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); animation: ds-in .14s ease-out; }
.ds-fly.left { left: 0; top: 0; bottom: 0; } .ds-fly.right { right: 0; top: 0; bottom: 0; }
.ds-fly.top { top: 0; left: 0; right: 0; } .ds-fly.bottom { bottom: 0; left: 0; right: 0; }
@keyframes ds-in { from { opacity: 0; } }
.ds-fh { cursor: default; }
.ds-fh .dk-tab { cursor: default; }
.ds-flygrip { position: absolute; z-index: 2; touch-action: none; }
.ds-fly.left > .ds-flygrip { right: -4px; top: 0; bottom: 0; width: 0.5rem; cursor: col-resize; }
.ds-fly.right > .ds-flygrip { left: -4px; top: 0; bottom: 0; width: 0.5rem; cursor: col-resize; }
.ds-fly.top > .ds-flygrip { bottom: -4px; left: 0; right: 0; height: 0.5rem; cursor: row-resize; }
.ds-fly.bottom > .ds-flygrip { top: -4px; left: 0; right: 0; height: 0.5rem; cursor: row-resize; }

/* ---------- Fenêtres flottantes ---------- */
.ds-floats { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.ds-float { position: absolute; pointer-events: auto; display: flex; flex-direction: column; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.ds-float.ds-dragging { opacity: .78; pointer-events: none; }
.ds-ftitle { display: flex; align-items: center; gap: 0.25rem; height: 1.625rem; flex-shrink: 0; padding: 0 0.25rem 0 0.75rem; font-size: var(--fs-xs); color: var(--text-muted); cursor: move; touch-action: none; user-select: none; }
.ds-ftitle > span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ds-ftitle .ds-btn { width: 1.375rem; height: 1.375rem; }
.ds-fbody { flex: 1; min-height: 0; display: flex; padding: 0 0.1875rem 0.1875rem; }
.ds-fbody > * { flex: 1 1 0; }
.ds-rs { position: absolute; z-index: 2; touch-action: none; }
.ds-rs.n { top: -4px; left: 0.625rem; right: 0.625rem; height: 0.5rem; cursor: ns-resize; }
.ds-rs.s { bottom: -4px; left: 0.625rem; right: 0.625rem; height: 0.5rem; cursor: ns-resize; }
.ds-rs.e { right: -4px; top: 0.625rem; bottom: 0.625rem; width: 0.5rem; cursor: ew-resize; }
.ds-rs.w { left: -4px; top: 0.625rem; bottom: 0.625rem; width: 0.5rem; cursor: ew-resize; }
.ds-rs.ne, .ds-rs.nw, .ds-rs.se, .ds-rs.sw { width: 0.875rem; height: 0.875rem; }
.ds-rs.ne { top: -5px; right: -5px; cursor: nesw-resize; } .ds-rs.sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.ds-rs.nw { top: -5px; left: -5px; cursor: nwse-resize; } .ds-rs.se { bottom: -5px; right: -5px; cursor: nwse-resize; }

/* ---------- Guides d'ancrage (croix sur le groupe survolé + 4 guides de bord) ---------- */
.ds-guides { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.ds-guides[hidden], .ds-guides [hidden] { display: none; }
.ds-prev { position: absolute; border: 0.125rem solid var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 20%, transparent); transition: left .08s, top .08s, width .08s, height .08s; }
.ds-prev.tab { background: color-mix(in srgb, var(--accent) 12%, transparent); border-style: dashed; }
.ds-plate { position: absolute; width: 7.5rem; height: 7.5rem; }
.ds-plate::before, .ds-plate::after { content: ""; position: absolute; background: color-mix(in srgb, var(--surface-2) 88%, transparent); border: 1px solid var(--border-strong); border-radius: 0.625rem; box-shadow: var(--shadow); }
.ds-plate::before { left: 0; right: 0; top: 2.3125rem; height: 2.875rem; }
.ds-plate::after { top: 0; bottom: 0; left: 2.3125rem; width: 2.875rem; }
.ds-gd { position: absolute; width: 2.125rem; height: 2.125rem; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 0.375rem; color: var(--text-muted); box-shadow: var(--shadow-sm); }
.ds-gd.outer { box-shadow: var(--shadow); }
.ds-gd svg .fr { fill: var(--surface); stroke: currentColor; stroke-width: 1.4; }
.ds-gd svg .fi { fill: var(--accent); opacity: .45; }
.ds-gd svg .ar { fill: currentColor; }
.ds-gd.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.ds-gd.on svg .fi { opacity: 1; }

/* ---------- Menus et barre d'outils ---------- */
.ds-menu { position: fixed; z-index: 400; min-width: 15.625rem; max-width: 23.75rem; padding: 0.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); font-size: var(--fs-sm); }
.ds-menu button { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.375rem 0.625rem; border: 0; border-radius: var(--radius); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.ds-menu button:hover:not(:disabled) { background: var(--surface-2); }
.ds-menu button:disabled { color: var(--text-faint); cursor: default; }
.ds-menu .ck { width: 0.875rem; flex-shrink: 0; display: grid; place-items: center; color: var(--accent); }
.ds-menu .mt { flex: 1; min-width: 0; }
.ds-menu .d { display: block; font-size: var(--fs-xs); color: var(--text-faint); }
.ds-menu small { margin-left: 0.75rem; color: var(--text-faint); font-size: var(--fs-xs); white-space: nowrap; }
.ds-menu hr { border: 0; border-top: 1px solid var(--border); margin: 0.25rem 0; }
.ds-menu h5 { padding: 0.375rem 0.625rem 0.1875rem; font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.ds-tb { display: flex; align-items: center; gap: 0.125rem; }
.ds-tb .btn { gap: 0.375rem; }
.ds-tb .ds-mod { display: none; width: 0.4375rem; height: 0.4375rem; border-radius: 50%; background: var(--accent); margin-left: -2px; }
.ds-tb .mod .ds-mod { display: inline-block; }
@media (max-width: 1280px) { .ds-tbt, .ds-tbl { display: none; } }

/* ---------- Glisser en cours ---------- */
.ds-dragmode, .ds-dragmode * { cursor: grabbing !important; user-select: none !important; }
.ds-rs-col, .ds-rs-col * { cursor: col-resize !important; user-select: none !important; }
.ds-rs-row, .ds-rs-row * { cursor: row-resize !important; user-select: none !important; }
.ds-dragmode revo-grid, .ds-rs-col revo-grid, .ds-rs-row revo-grid { pointer-events: none; }

/* ---------- Écran tactile : cibles plus grandes ---------- */
.h6.nb.ds-touch, .ds-touch { --band-h: 4.5rem; }
.ds-touch .ds-gh.dk-head { grid-template-rows: 1.75rem minmax(0, 1fr); }
.ds-touch .ds-tab { padding: 0 1rem; font-size: var(--fs-base); gap: 0.5rem; }
.ds-touch .ds-btn { width: 2rem; height: 1.75rem; }
.ds-touch .ds-bar::after { inset: 0 -8px; }
.ds-touch .ds-split.ds-col > .ds-bar::after { inset: -8px 0; }
.ds-touch .ds-stab { padding: 0.75rem 0.875rem; font-size: var(--fs-sm); }
.ds-touch .ds-strip.left .ds-stab, .ds-touch .ds-strip.right .ds-stab { padding: 0.875rem 0.625rem; }
.ds-touch .ds-ftitle { height: 2.375rem; }

/* ---------- Focus clavier (Alt+C, Alt+P, Alt+O) ---------- */
.ds-gb:focus { outline: none; }
.ds-group.ds-flash::after { content: ""; position: absolute; inset: 0; z-index: 20; pointer-events: none; box-shadow: inset 0 0 0 0.125rem var(--accent); border-radius: 0.125rem; animation: ds-flash .7s ease-out forwards; }
@keyframes ds-flash { to { box-shadow: inset 0 0 0 0.125rem transparent; } }
