/* =========================================================
   PAGE PROMPT : registre des outils (aperçu + éditeur JSON)
========================================================= */
.prompt-page {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 24px;
    background: rgba(5, 8, 15, 0.72);
    backdrop-filter: blur(4px);
    box-sizing: border-box;
}

.prompt-page[hidden] {
    display: none;
}

.prompt-page-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1500px;
    min-height: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.prompt-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    background: #252526;
    border-bottom: 1px solid #111111;
}

.prompt-title-block h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.prompt-sub {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.prompt-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}

.prompt-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.prompt-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    flex: 1 1 0;
    min-height: 0;
}

.prompt-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: #1e1e1e;
}

.prompt-col+.prompt-col {
    border-left: 1px solid var(--border-subtle);
}

.prompt-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 16px;
    font-family: 'Cairo', 'Cairo Play', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: #cbd5e1;
    background: #181818;
    border-bottom: 1px solid var(--border-subtle);
}

.prompt-col-meta {
    font-weight: 500;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prompt-col-meta[data-tone="ok"] {
    color: #34d399;
}

.prompt-col-meta[data-tone="dirty"] {
    color: #fbbf24;
}

.prompt-col-meta[data-tone="error"] {
    color: #f87171;
}

/* ---------- Colonne gauche : cartes d'outils ---------- */
.prompt-tools-list {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: 'Cairo', 'Cairo Play', sans-serif;
    scrollbar-width: thin;
    scrollbar-color: #475569 transparent;
}

.tool-card {
    background: #111827;
    border: 1px solid var(--border-subtle);
    border-left: 3px solid #38bdf8;
    border-radius: 8px;
    flex-shrink: 0;
}

.tool-card[open] {
    border-color: var(--border-color);
    border-left-color: #38bdf8;
}

.tool-card.inactive {
    border-left-color: #475569;
    opacity: 0.6;
}

.tool-card.just-updated {
    animation: tool-updated 1.6s ease-out;
}

@keyframes tool-updated {
    0% {
        box-shadow: 0 0 0 2px #34d399;
        background: rgba(52, 211, 153, 0.12);
    }

    100% {
        box-shadow: 0 0 0 0 transparent;
        background: #111827;
    }
}

.tool-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    font-size: 0.76rem;
}

.tool-summary::-webkit-details-marker {
    display: none;
}

.tool-summary::marker {
    display: none;
}

.tool-summary::after {
    content: "▸";
    margin-left: 4px;
    color: var(--text-muted);
    font-size: 0.65rem;
    transition: transform 0.15s;
}

.tool-card[open]>.tool-summary::after {
    transform: rotate(90deg);
}

.tool-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34d399;
    flex-shrink: 0;
}

.tool-card.inactive .tool-status-dot {
    background: #64748b;
}

.tool-name {
    color: var(--text-primary);
    font-weight: 700;
}

.tool-tier {
    font-size: 0.6rem;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    color: #c084fc;
    border: 1px solid rgba(192, 132, 252, 0.35);
    background: rgba(192, 132, 252, 0.1);
}

.tool-counts {
    margin-left: auto;
    font-size: 0.66rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.tool-body {
    padding: 4px 12px 12px;
    border-top: 1px solid var(--border-subtle);
}

.tool-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 4px;
}

.tool-flag {
    font-size: 0.64rem;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid;
}

.tool-flag.on {
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(52, 211, 153, 0.08);
}

.tool-flag.off {
    color: var(--text-muted);
    border-color: var(--border-subtle);
}

.tool-section-title {
    margin: 10px 0 5px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.tool-reqs,
.tool-extras {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    overflow: hidden;
}

.tool-req,
.tool-extra {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    font-size: 0.7rem;
    background: #0b1120;
}

.tool-extra {
    grid-template-columns: auto minmax(0, 1fr);
}

.tool-req+.tool-req,
.tool-extra+.tool-extra {
    border-top: 1px solid var(--border-subtle);
}

.tool-req-field,
.tool-extra-key {
    color: #38bdf8;
    font-weight: 600;
}

.tool-req-type {
    color: #c084fc;
    font-size: 0.64rem;
}

.tool-extra-val {
    color: #cbd5e1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tool-req-pill {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid;
}

.tool-req-pill.required {
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.1);
}

.tool-req-pill.optional {
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.tool-empty {
    padding: 8px 10px;
    font-size: 0.68rem;
    font-style: italic;
    color: #6a9955;
}

/* ---------- Colonne droite : éditeur JSON ---------- */
.prompt-editor {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 14px 16px;
    resize: none;
    border: none;
    outline: none;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Cairo', 'Cairo Play', sans-serif;
    font-size: 0.74rem;
    line-height: 1.55;
    tab-size: 2;
    white-space: pre;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #475569 transparent;
}

.prompt-editor:focus {
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.prompt-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #181818;
    border-top: 1px solid var(--border-subtle);
}

.prompt-save-message {
    margin-right: auto;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.prompt-save-message[data-tone="ok"] {
    color: #34d399;
}

.prompt-save-message[data-tone="error"] {
    color: #f87171;
}

.prompt-btn {
    padding: 7px 14px;
    border-radius: 7px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: #cbd5e1;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.prompt-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.prompt-btn.primary {
    background: #0ea5e9;
    border-color: #0ea5e9;
    color: #0b1120;
}

.prompt-btn.primary:hover:not(:disabled) {
    background: #38bdf8;
    color: #0b1120;
}

.prompt-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 900px) {
    .prompt-page {
        padding: 0;
    }

    .prompt-page-inner {
        border-radius: 0;
    }

    .prompt-columns {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    }

    .prompt-col+.prompt-col {
        border-left: none;
        border-top: 1px solid var(--border-subtle);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tool-card.just-updated {
        animation: none;
    }
}

/* ---------- Onglets ---------- */
.prompt-tabs {
    display: flex;
    gap: 4px;
    margin-left: auto;
    padding: 3px;
    border-radius: 8px;
    background: #1a1a1a;
    border: 1px solid var(--border-subtle);
}

.prompt-tab {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
}

.prompt-tab:hover {
    color: var(--text-primary);
}

.prompt-tab.active {
    background: #0ea5e9;
    color: #0b1120;
}

.prompt-columns[hidden] {
    display: none;
}

/* ---------- Prompt système ---------- */
.prompt-section {
    border-left-color: #c084fc;
}

.prompt-section[open] {
    border-left-color: #c084fc;
}

.prompt-section .tool-status-dot {
    background: #c084fc;
}

.prompt-section-preview {
    margin: 8px 0 0;
    padding: 10px 12px;
    border-radius: 6px;
    background: #0b1120;
    border: 1px solid var(--border-subtle);
    color: #cbd5e1;
    font-family: 'Cairo', 'Cairo Play', sans-serif;
    font-size: 0.7rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.prompt-var {
    padding: 0 3px;
    border-radius: 3px;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
}

.prompt-var.tools {
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
}

.prompt-var.unknown {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
}

.prompt-placeholders {
    padding: 6px 16px;
    font-size: 0.66rem;
    color: var(--text-muted);
    background: #181818;
    border-bottom: 1px solid var(--border-subtle);
}

.prompt-placeholders code {
    color: #38bdf8;
    font-family: 'Cairo', 'Cairo Play', sans-serif;
}

.prompt-editor.wrap {
    white-space: pre-wrap;
}

/* Onglet Components : aperçu des secure blocks */
.component-card {
    border-left-color: #10b981;
}

.component-card[open] {
    border-left-color: #10b981;
}

.component-icon {
    font-size: 0.9rem;
}

.component-preview {
    max-width: 330px;
    display: flex;
    flex-direction: column;
}

/* Groupes d'outils : IA / internes */
.tool-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
}

.tool-group+.tool-group {
    margin-top: 6px;
}

.tool-group.ai {
    background: rgba(56, 189, 248, 0.04);
    border-color: rgba(56, 189, 248, 0.25);
}

.tool-group.internal {
    background: rgba(16, 185, 129, 0.04);
    border-color: rgba(16, 185, 129, 0.3);
}

.tool-group.internal .tool-card {
    border-left-color: #10b981;
}

.tool-group-head {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 2px 2px;
}

.tool-group-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
}

.tool-group.ai .tool-group-title {
    color: #7dd3fc;
}

.tool-group.internal .tool-group-title {
    color: #6ee7b7;
}

.tool-group-meta {
    font-size: 0.64rem;
    color: var(--text-secondary);
}

/* Onglet Components : 3 colonnes */
.prompt-columns.three {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
}

.prompt-columns.three .prompt-col+.prompt-col {
    border-left: 1px solid var(--border-subtle);
}

@media (max-width: 1200px) {
    .prompt-columns.three {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .prompt-columns.three .prompt-col:last-child {
        grid-column: 1 / -1;
        border-left: none;
        border-top: 1px solid var(--border-subtle);
    }
}

.anatomy-flow {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.anatomy-pill {
    padding: 5px 9px;
    border-radius: 8px;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    border: 1px solid;
}

.anatomy-pill small {
    font-weight: 500;
    opacity: 0.8;
}

.anatomy-pill.registry {
    color: #c084fc;
    border-color: rgba(192, 132, 252, 0.45);
    background: rgba(192, 132, 252, 0.08);
}

.anatomy-pill.bank {
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.45);
    background: rgba(56, 189, 248, 0.08);
}

.anatomy-pill.out {
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.45);
    background: rgba(52, 211, 153, 0.08);
}

.anatomy-plus {
    color: var(--text-muted);
    font-weight: 700;
}

.anatomy-preview {
    max-width: 340px;
    display: flex;
    flex-direction: column;
    margin: 4px 0;
}

/* Chaque zone du squelette est repérée et nommée */
.secure-block.anatomy [data-slot] {
    position: relative;
    outline: 1px dashed rgba(148, 163, 184, 0.35);
    outline-offset: -2px;
}

.secure-block.anatomy [data-slot]::before {
    content: attr(data-slot);
    position: absolute;
    top: 1px;
    inset-inline-end: 3px;
    z-index: 1;
    padding: 0 4px;
    border-radius: 3px;
    font-size: 0.55rem;
    font-weight: 700;
    color: #0b1120;
    background: #94a3b8;
}

.secure-block.anatomy .slot-used {
    outline-color: #34d399;
}

.secure-block.anatomy .slot-used::before {
    background: #34d399;
}

.secure-block.anatomy .slot-unused {
    opacity: 0.3;
}

.anatomy-def {
    display: block;
    padding: 7px 9px;
    border-radius: 6px;
    background: #0b1120;
    border: 1px solid var(--border-subtle);
    color: #c084fc;
    font-size: 0.66rem;
    overflow-wrap: anywhere;
}

.anatomy-table {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    overflow: hidden;
}

.anatomy-row {
    display: grid;
    grid-template-columns: 62px 104px minmax(0, 1fr);
    grid-template-areas: "slot source shape" "slot source note";
    column-gap: 8px;
    padding: 6px 9px;
    font-size: 0.66rem;
    background: #0b1120;
}

.anatomy-row+.anatomy-row {
    border-top: 1px solid var(--border-subtle);
}

.anatomy-row.slot-used {
    background: rgba(52, 211, 153, 0.07);
}

.anatomy-row.slot-unused {
    opacity: 0.45;
}

.anatomy-slot {
    grid-area: slot;
    color: #f1f5f9;
    font-weight: 700;
}

.anatomy-row.slot-used .anatomy-slot {
    color: #34d399;
}

.anatomy-source {
    grid-area: source;
    align-self: start;
    font-size: 0.6rem;
    font-weight: 700;
}

.anatomy-source.bank {
    color: #38bdf8;
}

.anatomy-source.registry {
    color: #c084fc;
}

.anatomy-shape {
    grid-area: shape;
    color: #cbd5e1;
    overflow-wrap: anywhere;
}

.anatomy-note {
    grid-area: note;
    color: var(--text-muted);
}

/* Icônes des composants */
.component-icon {
    display: inline-flex;
    color: #34d399;
}

.component-icon .sb-svg {
    width: 16px;
    height: 16px;
}

.tool-flag .sb-svg {
    width: 11px;
    height: 11px;
    vertical-align: -1px;
}

.anatomy-icons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 6px;
}

.anatomy-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 4px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: #0b1120;
    color: #cbd5e1;
}

.anatomy-icon .sb-svg {
    width: 18px;
    height: 18px;
}

.anatomy-icon small {
    font-size: 0.58rem;
    color: var(--text-muted);
}

/* =========================================================
   ANATOMY : schéma fil de fer du secure block
========================================================= */
.anatomy-col {
    --wf-registry: #c084fc;
    --wf-bank: #38bdf8;
    --wf-shape: #334155;
}

.wf-sources {
    display: flex;
    gap: 14px;
    font-size: 0.66rem;
    color: var(--text-secondary);
}

.wf-source {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.wf-source i {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.wf-source.registry i {
    background: var(--wf-registry);
}

.wf-source.bank i {
    background: var(--wf-bank);
}

.wf-frame {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 360px;
    padding: 10px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: #0b1120;
}

.wf-zone {
    --wf-color: var(--wf-bank);
    display: grid;
    grid-template-columns: 20px 62px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--wf-color) 35%, transparent);
    border-inline-start: 3px solid var(--wf-color);
    background: color-mix(in srgb, var(--wf-color) 6%, transparent);
    transition: opacity 0.15s, background 0.15s, border-color 0.15s;
}

.wf-zone.registry {
    --wf-color: var(--wf-registry);
}

.wf-zone.unused {
    opacity: 0.28;
    border-style: dashed;
    border-inline-start-style: solid;
}

.wf-zone.used {
    background: color-mix(in srgb, var(--wf-color) 14%, transparent);
}

.wf-zone.hover,
.wf-legend-row.hover {
    background: color-mix(in srgb, var(--wf-color) 22%, transparent);
    opacity: 1;
}

.wf-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 800;
    color: #0b1120;
    background: var(--wf-color, var(--wf-bank));
}

.wf-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-primary);
}

.wf-shape {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

/* Formes neutres */
.wf-shape i {
    display: block;
    flex-shrink: 0;
    background: var(--wf-shape);
}

.wf-bar {
    height: 7px;
    border-radius: 4px;
}

.wf-bar.thin {
    height: 5px;
}

.wf-bar.thick {
    height: 11px;
}

.wf-bar.w20 {
    width: 20%;
    margin-inline-start: auto;
}

.wf-bar.w30 {
    width: 30%;
}

.wf-bar.w40 {
    width: 40%;
}

.wf-bar.w50 {
    width: 50%;
}

.wf-bar.w60 {
    width: 60%;
}

.wf-bar.w70 {
    width: 70%;
}

.wf-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.wf-dot.lg {
    width: 18px;
    height: 18px;
    border-radius: 6px;
}

.wf-sq {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.wf-sq.lg {
    width: 18px;
    height: 18px;
    border-radius: 5px;
}

.wf-sq.sm {
    width: 8px;
    height: 8px;
}

.wf-pill {
    width: 34px;
    height: 12px;
    border-radius: 9999px;
    margin-inline-start: auto;
}

.wf-btn {
    flex: 1 !important;
    height: 14px;
    border-radius: 6px;
    background: transparent !important;
    border: 1.5px solid var(--wf-shape);
}

.wf-btn.filled {
    background: var(--wf-shape) !important;
}

.wf-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.wf-line {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.wf-line.boxed {
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid var(--wf-shape);
}

.wf-stack .wf-line .wf-bar.w40 {
    flex: 1;
    width: auto;
}

/* Légende numérotée */
.wf-legend {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
}

.wf-legend-row {
    --wf-color: var(--wf-bank);
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 7px 10px;
    background: #0b1120;
    transition: opacity 0.15s, background 0.15s;
}

.wf-legend-row.registry {
    --wf-color: var(--wf-registry);
}

.wf-legend-row+.wf-legend-row {
    border-top: 1px solid var(--border-subtle);
}

.wf-legend-row.unused {
    opacity: 0.35;
}

.wf-legend-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.wf-legend-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-primary);
}

.wf-legend-title em {
    font-style: normal;
    font-weight: 500;
    color: var(--text-muted);
    margin-inline-start: 4px;
}

.wf-legend-text code {
    font-size: 0.64rem;
    color: var(--wf-color);
    overflow-wrap: anywhere;
}

/* Anatomy : infos techniques dans chaque zone */
.wf-zone {
    grid-template-columns: 20px 62px minmax(0, 1fr);
    grid-template-areas:
        "num name shape"
        ".   tech tech";
    row-gap: 7px;
}

.wf-zone>.wf-num {
    grid-area: num;
}

.wf-zone>.wf-name {
    grid-area: name;
}

.wf-zone>.wf-shape {
    grid-area: shape;
}

.wf-tech {
    grid-area: tech;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-top: 6px;
    border-top: 1px dashed color-mix(in srgb, var(--wf-color) 30%, transparent);
    min-width: 0;
}

.wf-tech-head {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.wf-tag {
    padding: 0 6px;
    border-radius: 4px;
    font-size: 0.56rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #0b1120;
    background: var(--wf-color);
}

.wf-path {
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--wf-color);
}

.wf-type {
    font-size: 0.64rem;
    color: #cbd5e1;
    overflow-wrap: anywhere;
}

.wf-note {
    font-size: 0.6rem;
    color: var(--text-muted);
}

.wf-zone.unused .wf-tech {
    display: none;
}

.wf-hint {
    font-size: 0.62rem;
    color: var(--text-muted);
}

.wf-frame {
    max-width: 420px;
}

/* =========================================================
   ANATOMY v2 : modes Functional / Technical
========================================================= */
.anatomy-col {
    gap: 10px;
}

.an-toolbar {
    position: sticky;
    top: -12px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin: -12px -12px 0;
    padding: 10px 12px;
    background: #1e1e1e;
    border-bottom: 1px solid var(--border-subtle);
}

.an-sheet {
    margin-right: auto;
}

.an-lang-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0 10px;
}

.an-lang-count {
    margin-right: auto;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.an-lang-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--text-primary);
    cursor: pointer;
}

.an-lang-status {
    margin-bottom: 10px;
    font-size: 0.72rem;
    color: #38bdf8;
}

.an-lang-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.an-lang-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 9px;
    background: #111827;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
}

.an-lang-row.disabled {
    cursor: default;
    opacity: 0.6;
}

.an-lang-name {
    margin-right: auto;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.an-lang-name small {
    margin-left: 8px;
    font-size: 0.66rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.an-lang-badge {
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.62rem;
    font-weight: 700;
}

.an-lang-badge.builtin { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.an-lang-badge.done { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.an-lang-comps {
    font-size: 0.66rem;
    color: var(--text-secondary);
}

.an-lang-badge.partial { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.an-lang-badge.missing { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.an-switch {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: 9px;
    background: #111827;
    border: 1px solid var(--border-subtle);
}

.an-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
}

.an-switch-btn .sb-svg {
    width: 12px;
    height: 12px;
}

.an-switch-btn:hover {
    color: var(--text-primary);
}

.an-switch-btn.active {
    background: #0ea5e9;
    color: #0b1120;
}

.an-legend {
    display: flex;
    gap: 12px;
    font-size: 0.64rem;
    color: var(--text-secondary);
}

.an-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.an-legend-item i {
    width: 9px;
    height: 9px;
    border-radius: 3px;
}

.an-legend-item.registry i {
    background: #c084fc;
}

.an-legend-item.bank i {
    background: #38bdf8;
}

/* ---------- Functional ---------- */
.an-intro {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.07);
    border: 1px solid rgba(16, 185, 129, 0.25);
    font-size: 0.72rem;
    line-height: 1.45;
    color: #cbd5e1;
}

.an-intro .sb-svg {
    color: #34d399;
    margin-top: 1px;
}

.an-intro strong {
    color: #f8fafc;
}

.an-zones {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.an-zone {
    --an-color: #38bdf8;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 96px;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background: #111827;
    transition: opacity 0.15s, border-color 0.15s;
}

.an-zone.registry {
    --an-color: #c084fc;
}

.an-zone.used {
    border-color: color-mix(in srgb, var(--an-color) 55%, transparent);
    background: color-mix(in srgb, var(--an-color) 7%, #111827);
}

.an-zone.unused {
    opacity: 0.35;
}

.an-zone-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    color: var(--an-color);
    background: color-mix(in srgb, var(--an-color) 14%, transparent);
}

.an-zone-icon .sb-svg {
    width: 18px;
    height: 18px;
}

.an-zone-icon b {
    position: absolute;
    top: -5px;
    inset-inline-end: -5px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    border-radius: 9999px;
    font-size: 0.56rem;
    line-height: 16px;
    text-align: center;
    color: #0b1120;
    background: var(--an-color);
    box-shadow: 0 0 0 2px #111827;
}

.an-zone-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.an-zone-title {
    display: flex;
    align-items: baseline;
    gap: 7px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
}

.an-zone-title small {
    font-size: 0.56rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--an-color);
}

.an-zone-desc {
    font-size: 0.68rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

.an-zone-example {
    align-self: flex-start;
    max-width: 100%;
    margin-top: 2px;
    padding: 1px 7px;
    border-radius: 5px;
    font-size: 0.64rem;
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.an-zone-wire {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: #0b1120;
    --wf-shape: #334155;
}

.an-zone-wire i {
    display: block;
    flex-shrink: 0;
    background: var(--wf-shape);
}

.an-zone.used .an-zone-wire {
    --wf-shape: color-mix(in srgb, var(--an-color) 45%, #334155);
}

/* ---------- Technical ---------- */
.an-map {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.an-map-item {
    --an-color: #38bdf8;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px 2px 3px;
    border-radius: 9999px;
    border: 1px solid color-mix(in srgb, var(--an-color) 40%, transparent);
    font-size: 0.64rem;
    font-weight: 700;
    color: var(--text-primary);
}

.an-map-item.registry {
    --an-color: #c084fc;
}

.an-map-item.unused {
    opacity: 0.3;
}

.an-map-item b,
.an-code-zone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    border-radius: 9999px;
    font-size: 0.56rem;
    color: #0b1120;
    background: var(--an-color);
}

.an-code {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: #0b1120;
    overflow-x: auto;
    scrollbar-width: thin;
}

.an-code-line {
    --an-color: transparent;
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    align-items: center;
    padding: 1px 10px 1px 4px;
    border-inline-start: 2px solid transparent;
}

.an-code-line.zoned {
    --an-color: #38bdf8;
    border-inline-start-color: color-mix(in srgb, var(--an-color) 50%, transparent);
}

.an-code-line.zoned.registry {
    --an-color: #c084fc;
}

.an-code-line.used {
    background: color-mix(in srgb, var(--an-color) 9%, transparent);
    border-inline-start-color: var(--an-color);
}

.an-code-line.unused {
    opacity: 0.38;
}

.an-code-line:not(.zoned) .an-code-zone {
    background: transparent;
}

.an-code-line code {
    font-size: 0.68rem;
    line-height: 1.55;
    color: #d4d4d4;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.an-code-line.sig code {
    color: #fbbf24;
    font-weight: 700;
}

.tk-kw {
    color: #c586c0;
}

.tk-key {
    color: #9cdcfe;
}

.tk-type {
    color: #4ec9b0;
}

.tk-str {
    color: #ce9178;
}

.tk-ref {
    color: #dcdcaa;
}

.tk-comment {
    color: #6a9955;
}

.an-rules {
    margin: 0;
    padding-inline-start: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.68rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.an-rules code,
.an-json {
    font-size: 0.66rem;
}

.an-rules code {
    color: #9cdcfe;
}

.an-json {
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: #0b1120;
    color: #d4d4d4;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.5;
}

/* Type d'outil : informationnel / transactionnel / sécurité */
.tool-tier.tier-info {
    color: #7dd3fc;
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(56, 189, 248, 0.1);
}

.tool-tier.tier-tx {
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.12);
}

.tool-tier.tier-sec {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(239, 68, 68, 0.1);
}

/* =========================================================
   ANATOMY v3 : un seul bloc, structure fixe, contenu Functional / Technical
========================================================= */
.an-block {
    display: flex;
    flex-direction: column;
    max-width: 440px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: #0d1422;
    overflow: hidden;
}

.an-sec {
    --an-color: #38bdf8;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 8px 12px;
    transition: opacity 0.15s, background 0.15s;
}

.an-sec+.an-sec {
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.an-sec.registry {
    --an-color: #c084fc;
}

.an-sec.used {
    background: color-mix(in srgb, var(--an-color) 8%, transparent);
}

.an-sec.unused {
    opacity: 0.3;
}

.an-sec[data-zone="head"] {
    background-color: rgba(148, 163, 184, 0.04);
}

.an-sec[data-zone="foot"] {
    background-color: rgba(2, 6, 23, 0.4);
}

.an-sec-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 800;
    color: #0b1120;
    background: var(--an-color);
}

.an-sec-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.an-sec-main {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    min-height: 20px;
    font-size: 0.74rem;
    color: #e2e8f0;
    overflow: hidden;
    white-space: nowrap;
}

.an-sec-main>span,
.an-sec-main>b {
    overflow: hidden;
    text-overflow: ellipsis;
}

.an-sec-main b {
    color: #f8fafc;
}

.an-sec-main .an-big {
    margin-inline-start: auto;
    font-size: 0.9rem;
}

.an-sec-main b.neg {
    margin-inline-start: auto;
    color: #f87171;
}

.an-sec[data-zone="summary"] .an-sec-main b {
    margin-inline-start: auto;
}

.an-ico {
    width: 15px;
    height: 15px;
    color: var(--an-color);
}

.an-ico.neg {
    color: #f87171;
}

.an-sec-sub {
    font-size: 0.62rem;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.an-sec-name {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: color-mix(in srgb, var(--an-color) 70%, #64748b);
}

/* Éléments d'exemple (mode Functional) */
.an-chip,
.an-btn,
.an-otp {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.64rem;
    font-weight: 700;
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #cbd5e1;
}

.an-chip.danger,
.an-btn.danger {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
}

.an-btn.primary {
    color: #0b1120;
    background: var(--an-color);
    border-color: var(--an-color);
}

.an-otp {
    letter-spacing: 0.15em;
    flex: 1;
    text-align: center;
}

/* Mode Technical : même structure, contenu en code */
.an-block.tech .an-sec-main {
    font-size: 0.7rem;
}

.an-block.tech .an-sec-main code {
    color: var(--an-color);
    font-weight: 700;
}

.an-block.tech .an-sec-sub {
    font-family: inherit;
    color: #9cdcfe;
    font-size: 0.64rem;
}

/* Encadré de fonctionnement : 3 étapes, même structure dans les deux modes */
.an-flow {
    display: flex;
    flex-direction: column;
    max-width: 440px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background: #111827;
    overflow: hidden;
}

.an-step {
    --an-color: #34d399;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 10px;
    padding: 9px 12px;
}

.an-step+.an-step {
    border-top: 1px solid var(--border-subtle);
}

.an-step.registry {
    --an-color: #c084fc;
}

.an-step.bank {
    --an-color: #38bdf8;
}

.an-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--an-color);
    background: color-mix(in srgb, var(--an-color) 15%, transparent);
}

.an-step-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.an-step-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-primary);
}

.an-step-title code {
    color: var(--an-color);
}

.an-step-text {
    font-size: 0.64rem;
    line-height: 1.4;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.an-flow.tech .an-step-text {
    color: #9cdcfe;
}

/* Aperçus des composants sur fond clair, comme dans l app */
.component-preview {
    padding: 12px;
    border-radius: 14px;
    background: #f3f5f9;
}

/* Icône utilisée par le composant ouvert */
.anatomy-icon.current {
    border-color: #34d399;
    color: #34d399;
    background: rgba(52, 211, 153, 0.08);
}

.anatomy-icon.current small {
    color: #34d399;
}

/* Anatomy : les sections gardent leur hauteur naturelle, la colonne défile */
.anatomy-col>* {
    flex-shrink: 0;
}

.anatomy-col {
    overflow-y: auto;
    overscroll-behavior: contain;
}

.an-block,
.an-flow {
    width: 100%;
}

.an-step-text {
    white-space: normal;
}

/* Switch actif / inactif dans l'en-tête des outils */
.tool-toggle {
    position: relative;
    flex-shrink: 0;
    width: 30px;
    height: 17px;
    padding: 0;
    border: none;
    border-radius: 9999px;
    background: #334155;
    cursor: pointer;
    transition: background 0.2s;
}

.tool-toggle span {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: transform 0.2s;
}

.tool-toggle.on {
    background: #10b981;
}

.tool-toggle.on span {
    transform: translateX(13px);
}

.tool-toggle:hover {
    filter: brightness(1.15);
}

.tool-toggle:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
}

.tool-toggle.saving {
    opacity: 0.6;
    cursor: progress;
}

.tool-card .tool-summary .tool-toggle+* {
    margin-left: 0;
}

/* Tag (type d outil / layout) placé juste à gauche du compteur de paramètres */
.tool-summary .tool-tier {
    margin-inline-start: auto;
}

.tool-summary .tool-tier+.tool-counts {
    margin-inline-start: 0;
}

/* Onglet Seeder */
.seeder-card {
    border-left-color: #f59e0b;
}

.seeder-card[open] {
    border-left-color: #f59e0b;
}

.seeder-card .tool-status-dot {
    background: #f59e0b;
}

.seeder-muted {
    font-size: 0.62rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.seeder-amount {
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
}

.seeder-amount.neg {
    color: #f87171;
}

.seeder-amount.pos {
    color: #34d399;
}

.seeder-tx {
    max-height: 360px;
    overflow-y: auto;
}

.seeder-card .tool-req {
    grid-template-columns: minmax(0, 1fr) auto auto;
}

/* Seeder : lignes éditables (repeater) */
.seeder-rows {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.seeder-row {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
}

.seeder-row.custom {
    grid-template-columns: 90px minmax(0, 1fr) 24px;
}

.seeder-cols-ben {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 1.3fr) 24px;
}

.seeder-cols-op {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1.2fr) 24px;
}

.seeder-cols-card {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.8fr) 58px 104px 82px 24px;
}

.seeder-status.pos {
    color: #34d399;
}

.seeder-status.neg {
    color: #f87171;
}

.seeder-cols-tx {
    grid-template-columns: 118px minmax(0, 1.4fr) 96px minmax(0, 0.8fr) 24px;
}

.seeder-cols-st {
    grid-template-columns: 90px 80px minmax(0, 1fr) minmax(0, 1fr);
}

.seeder-row.static {
    padding: 5px 8px;
    border-radius: 6px;
    background: #0b1120;
    font-size: 0.7rem;
    color: #cbd5e1;
}

.seeder-key {
    font-size: 0.7rem;
    font-weight: 600;
    color: #38bdf8;
}

.seeder-input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    background: #0b1120;
    color: #e2e8f0;
    font: inherit;
    font-size: 0.7rem;
    color-scheme: dark;
}

.seeder-input:focus {
    outline: none;
    border-color: #38bdf8;
}

.seeder-input.neg {
    color: #f87171;
}

.seeder-input.pos {
    color: #34d399;
}

.seeder-grid-head {
    display: grid;
    gap: 6px;
    margin: 6px 0 4px;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.seeder-remove {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
}

.seeder-remove:hover {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.08);
}

.seeder-add {
    margin-top: 8px;
    padding: 6px 10px;
    border: 1px dashed rgba(245, 158, 11, 0.5);
    border-radius: 7px;
    background: rgba(245, 158, 11, 0.06);
    color: #fbbf24;
    font: inherit;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
}

.seeder-add:hover {
    background: rgba(245, 158, 11, 0.14);
}

.seeder-note {
    margin-top: 8px;
    font-size: 0.64rem;
    color: var(--text-muted);
}

.seeder-note .seeder-add {
    margin: 0 0 0 6px;
    padding: 3px 8px;
}

.seeder-tx {
    max-height: 380px;
    overflow-y: auto;
    padding-right: 2px;
}

/* Switch Multi-requests : dans la barre de la page Prompt, juste à gauche des onglets */
.prompt-topbar .prompt-multi-switch {
    margin-left: auto;
}

.prompt-topbar .prompt-multi-switch+.prompt-tabs {
    margin-left: 10px;
}

/* Onglets Guidelines / Guardrails */
.gov-group.scope,
.gov-group.input {
    background: rgba(56, 189, 248, 0.04);
    border-color: rgba(56, 189, 248, 0.25);
}

.gov-group.business,
.gov-group.output {
    background: rgba(245, 158, 11, 0.04);
    border-color: rgba(245, 158, 11, 0.28);
}

.gov-group.editorial {
    background: rgba(192, 132, 252, 0.04);
    border-color: rgba(192, 132, 252, 0.28);
}

.gov-group.core {
    background: rgba(16, 185, 129, 0.04);
    border-color: rgba(16, 185, 129, 0.3);
}

.gov-rule {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #0b1120;
    border: 1px solid var(--border-subtle);
    font-size: 0.72rem;
    line-height: 1.5;
    color: #cbd5e1;
}

.gov-params {
    margin: 0;
    padding: 8px 10px;
    border-radius: 6px;
    background: #0b1120;
    border: 1px solid var(--border-subtle);
    font-size: 0.66rem;
    color: #9cdcfe;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.gov-lock {
    display: inline-flex;
    color: #34d399;
}

.gov-lock .sb-svg {
    width: 13px;
    height: 13px;
}

.prompt-tab-sep {
    width: 1px;
    align-self: stretch;
    margin: 6px 4px;
    background: var(--border-subtle, rgba(148, 163, 184, 0.25));
}

.tool-req-options {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 2px 0 4px 8px;
}

.tool-req-desc {
    margin: 0 0 6px 8px;
    font-size: 0.64rem;
    line-height: 1.4;
    color: #94a3b8;
}