/* =========================================================
   FlexCortex — styles de la console
   ========================================================= */
:root {
    --fc-navy: #14213d;
    --fc-blue: #1f4e8c;
    --fc-accent: #2a9d8f;
    --fc-bg: #f4f6fa;
    --fc-muted: #6c7f99;
}

body {
    background: var(--fc-bg);
    font-family: "Segoe UI", system-ui, sans-serif;
}

/* ---------- Menu latéral ---------- */
.fc-sidebar {
    width: 240px;
    height: 100vh;
    background: var(--fc-navy);
    color: #cfd8e3;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1020;
}

.fc-sidebar .fc-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .25) transparent;
}

.fc-sidebar .fc-nav::-webkit-scrollbar { width: 8px; }
.fc-sidebar .fc-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .2); border-radius: 4px; }
.fc-sidebar .fc-nav::-webkit-scrollbar-track { background: transparent; }

.fc-brand {
    padding: 1.2rem 1.25rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.fc-brand i { color: var(--fc-accent); }

.fc-brand small {
    display: block;
    font-size: .7rem;
    font-weight: 400;
    color: #8fa3bf;
    letter-spacing: .05em;
}

.fc-nav a,
.fc-nav span.disabled {
    display: flex;
    gap: .75rem;
    align-items: center;
    padding: .7rem 1.25rem;
    color: #cfd8e3;
    text-decoration: none;
}

.fc-nav a:hover { background: rgba(255, 255, 255, .05); }

.fc-nav a.active {
    background: var(--fc-blue);
    color: #fff;
    border-left: 4px solid var(--fc-accent);
}

.fc-nav span.disabled {
    color: #5d6f88;
    cursor: default;
}

.fc-nav .section {
    padding: 1rem 1.25rem .3rem;
    font-size: .7rem;
    text-transform: uppercase;
    color: var(--fc-muted);
    letter-spacing: .08em;
}

/* Groupes repliables du menu */
.fc-nav details.fc-group > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.fc-nav details.fc-group > summary::-webkit-details-marker { display: none; }
.fc-nav details.fc-group > summary:hover { color: #cfd8e3; }
.fc-nav details.fc-group > summary:focus-visible { outline: 1px solid var(--fc-accent); outline-offset: -2px; }

.fc-nav details.fc-group > summary .fc-chevron {
    font-size: .65rem;
    transition: transform .15s ease;
}

.fc-nav details.fc-group[open] > summary .fc-chevron { transform: rotate(90deg); }

.fc-nav details.fc-group > summary .fc-dot {
    display: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--fc-accent);
    margin-left: auto;
    margin-right: .6rem;
}

.fc-nav details.fc-group.has-active:not([open]) > summary .fc-dot { display: inline-block; }

/* ---------- Zone principale ---------- */
.fc-main {
    margin-left: 240px;
    padding: 1.5rem 2rem;
}

.fc-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.fc-card {
    background: #fff;
    border: 0;
    border-radius: .6rem;
    box-shadow: 0 1px 3px rgba(20, 33, 61, .08);
}

.kpi .val {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--fc-navy);
}

.kpi .val.small-val { font-size: 1.1rem; }

.kpi .lbl {
    font-size: .8rem;
    color: var(--fc-muted);
}

.kpi i.kpi-icon {
    font-size: 1.4rem;
    color: var(--fc-blue);
}

.badge-sov {
    background: #e6f4f1;
    color: #1d6f65;
    font-weight: 500;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dot.ok { background: #2a9d8f; }
.dot.ko { background: #e63946; }
.dot.wait { background: #f4a261; }
.dot.off { background: #adb5bd; }

code.key {
    background: #eef2f7;
    padding: .15rem .4rem;
    border-radius: .3rem;
    color: var(--fc-navy);
}

.progress { height: 8px; }

.table td, .table th { vertical-align: middle; }

/* ---------- Clé API affichée une seule fois ---------- */
.fc-newkey {
    font-family: Consolas, monospace;
    font-size: .95rem;
    word-break: break-all;
}

/* ---------- Banc d'essai ---------- */
.fc-answer {
    min-height: 160px;
    white-space: pre-wrap;
    font-size: .92rem;
}

.fc-answer.waiting::after {
    content: "▍";
    animation: fc-blink 1s steps(1) infinite;
}

@keyframes fc-blink {
    50% { opacity: 0; }
}

/* ---------- Détail d'un appel ---------- */
.fc-pre {
    background: #f6f8fb;
    border-radius: .4rem;
    padding: .75rem;
    max-height: 280px;
    overflow: auto;
    white-space: pre-wrap;
    font-size: .8rem;
}

/* ---------- Pages d'authentification ---------- */
body.fc-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--fc-navy), var(--fc-blue));
}

.fc-auth-box {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.fc-auth-brand {
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.25rem;
}

.fc-auth-brand i { color: var(--fc-accent); }

.fc-auth-brand small {
    display: block;
    font-size: .72rem;
    font-weight: 400;
    color: #b9c7dc;
    letter-spacing: .06em;
}

/* ---------- Assistant d'installation ---------- */
.fc-setup-box {
    width: 100%;
    max-width: 860px;
    padding: 1.5rem 1rem;
}

.fc-steps {
    display: flex;
    justify-content: space-between;
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    counter-reset: none;
}

.fc-steps li {
    flex: 1;
    text-align: center;
    color: #b9c7dc;
    font-size: .8rem;
    position: relative;
}

.fc-steps li:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 18px;
    left: calc(50% + 22px);
    width: calc(100% - 44px);
    height: 2px;
    background: rgba(255, 255, 255, .25);
}

.fc-steps li.done:not(:last-child)::after {
    background: var(--fc-accent);
}

.fc-step-icon {
    display: inline-flex;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    margin-bottom: .35rem;
}

.fc-steps li.done .fc-step-icon { background: var(--fc-accent); }

.fc-steps li.current .fc-step-icon {
    background: #fff;
    color: var(--fc-blue);
    box-shadow: 0 0 0 4px rgba(42, 157, 143, .5);
}

.fc-steps li.current { color: #fff; font-weight: 600; }

.fc-step-label { display: block; }

.fc-check-list li { margin-bottom: .35rem; }

/* ---------- RAG : bases et documents ---------- */
.fc-base-card { border-left: 4px solid var(--fc-accent); }

.fc-dropzone {
    display: block;
    border: 2px dashed #b9c7dc;
    border-radius: .6rem;
    padding: 1.4rem;
    text-align: center;
    color: var(--fc-muted);
    background: #fafbfd;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.fc-dropzone i { font-size: 1.8rem; color: var(--fc-blue); }
.fc-dropzone.over { background: #eaf1fb; border-color: var(--fc-blue); }
.fc-dropzone.busy { opacity: .6; pointer-events: none; }

/* ---------- Garde-fous (lot 6) ---------- */
.guard-act { font-size: .7rem; border-radius: .3rem; padding: .1rem .4rem; font-weight: 600; white-space: nowrap; }
.guard-act.a-block { background: #fde2e4; color: #9b1c2b; }
.guard-act.a-mask { background: #e8eefc; color: #3949ab; }
.guard-act.a-warn { background: #fff1d6; color: #8a5a00; }
.guard-act.a-log { background: #eef1f5; color: #374151; }
.guard-dir { font-size: .7rem; background: #eef1f5; border-radius: .3rem; padding: .05rem .35rem; margin-right: .15rem; }
.guard-note { border-radius: .4rem; padding: .45rem .65rem; font-size: .8rem; }
.guard-note.g-block { background: #fde2e4; color: #7a1522; border: 1px solid #f5b7bf; }
.guard-note.g-mask { background: #eef2ff; color: #2f3a8f; border: 1px solid #c7d2fe; }
.guard-note.g-warn { background: #fff7e6; color: #7a5200; border: 1px solid #f3d49b; }
.guard-note.g-log { background: #f3f4f6; color: #374151; border: 1px solid #e5e7eb; }
.guard-note.g-ok { background: #ecfdf3; color: #14532d; border: 1px solid #bbf7d0; }
.guard-highlight, .guard-sent { white-space: pre-wrap; word-break: break-word; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: .4rem; padding: .5rem .6rem; max-height: 260px; overflow: auto; }
.guard-highlight mark { padding: 0 .15rem; border-radius: .2rem; }
.guard-highlight mark.g-pii { background: #ffe08a; }
.guard-highlight mark.g-sec { background: #ffc2c8; }
.guard-highlight mark.g-inj { background: #d9c8ff; }
.guard-highlight mark.g-net { background: #c7ecff; }
.guard-highlight mark.g-term { background: #d1fae5; }
.guard-token { background: #e8eefc; color: #3949ab; border-radius: .25rem; padding: 0 .25rem; font-family: var(--bs-font-monospace); font-size: .8em; }
.guard-excerpt { max-width: 420px; word-break: break-word; }
.embed-banner { border-radius: .5rem; font-size: .85rem; }

/* ---------- Mots-clés détectés (lot 9) ---------- */
.kw { display: inline-flex; align-items: center; gap: .25rem; font-size: .7rem; line-height: 1.3; border-radius: 1rem; padding: .05rem .5rem; margin: .1rem .15rem .1rem 0; border: 1px solid; white-space: nowrap; font-weight: 500; }
.kw-cve   { background: #fdecec; color: #b42318; border-color: #f5c2c0; }
.kw-cvss  { background: #fff1e6; color: #b54708; border-color: #f9d3b4; }
.kw-avis  { background: #eef4ff; color: #1f4e8c; border-color: #c9daf3; }
.kw-norme { background: #e9f7f5; color: #1d6f65; border-color: #b8e3dc; }
.kw-prod  { background: #f3effc; color: #5b3fa0; border-color: #d9cdf3; }
.kw-perso { background: #fefce8; color: #854d0e; border-color: #f3e3a0; }
.kw-date  { background: #f1f5f9; color: #475569; border-color: #d9dee5; }
.kw-list { margin-top: .15rem; }

/* ---------- Profils d'un utilisateur (lot 10) ---------- */
.fc-prof-opt { border: 1px solid #e5e7eb; border-radius: .5rem; padding: .45rem .7rem; display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; margin: 0; }
.fc-prof-opt.on { border-color: #1f4e8c; background: #f3f7fd; }
.fc-prof-opt .badge { font-weight: 500; }
.fc-profile-check { display: flex; align-items: center; gap: .5rem; padding: .2rem 0; cursor: pointer; }
.fc-prof-opt.fc-prof-admin { border-color: #f5c2c0; background: #fff8f8; }
.fc-prof-opt.fc-prof-admin.on { border-color: #dc3545; background: #fff0f0; }
