/* Sentinelle — 4/4 : thème « verre ». Chargé en DERNIER : surcharge les tokens d'app.css et habille
   les surfaces (translucides + floutées) posées sur un fond dégradé fixe. Le flou ne vise que les
   conteneurs (jamais les lignes de tableau) pour garder un défilement fluide. Sans backdrop-filter :
   surfaces opaques (bloc @supports en fin de fichier). */
:root {
    --bg: #edf1f8;
    --surface: rgba(255, 255, 255, .66); --surface-2: rgba(255, 255, 255, .5); --surface-3: rgba(15, 23, 42, .05);
    --surface-solid: #ffffff;
    --border: rgba(15, 23, 42, .08); --border-strong: rgba(15, 23, 42, .15);
    --sidebar-bg: rgba(255, 255, 255, .58);
    --glass-edge: rgba(255, 255, 255, .75);
    --glass-blur: saturate(160%) blur(18px);
    --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 0 0 1px rgba(15, 23, 42, .05), 0 12px 32px -14px rgba(15, 23, 42, .22);
    --blob-1: rgba(59, 130, 246, .5); --blob-2: rgba(14, 165, 233, .38); --blob-3: rgba(20, 184, 166, .3); --blob-4: rgba(129, 140, 248, .26);
    --r-lg: 16px;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #070a10;
        --surface: rgba(24, 29, 39, .56); --surface-2: rgba(255, 255, 255, .03); --surface-3: rgba(255, 255, 255, .07);
        --surface-solid: #151a23;
        --border: rgba(255, 255, 255, .08); --border-strong: rgba(255, 255, 255, .15);
        --sidebar-bg: rgba(16, 20, 28, .55);
        --glass-edge: rgba(255, 255, 255, .09);
        --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 0 0 1px rgba(0, 0, 0, .25), 0 16px 40px -14px rgba(0, 0, 0, .75);
        --blob-1: rgba(59, 130, 246, .34); --blob-2: rgba(14, 165, 233, .2); --blob-3: rgba(45, 212, 191, .15); --blob-4: rgba(99, 102, 241, .18);
    }
}
:root[data-theme="dark"] {
    --bg: #070a10;
    --surface: rgba(24, 29, 39, .56); --surface-2: rgba(255, 255, 255, .03); --surface-3: rgba(255, 255, 255, .07);
    --surface-solid: #151a23;
    --border: rgba(255, 255, 255, .08); --border-strong: rgba(255, 255, 255, .15);
    --sidebar-bg: rgba(16, 20, 28, .55);
    --glass-edge: rgba(255, 255, 255, .09);
    --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 0 0 1px rgba(0, 0, 0, .25), 0 16px 40px -14px rgba(0, 0, 0, .75);
    --blob-1: rgba(59, 130, 246, .34); --blob-2: rgba(14, 165, 233, .2); --blob-3: rgba(45, 212, 191, .15); --blob-4: rgba(99, 102, 241, .18);
}

/* ---- fond : dégradé fixe derrière tout le contenu ---- */
html { background: var(--bg); }
body { background: transparent; }
body::before {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(44rem 34rem at 0% 0%, var(--blob-1), transparent 65%),
        radial-gradient(40rem 32rem at 100% 12%, var(--blob-2), transparent 65%),
        radial-gradient(48rem 36rem at 45% 108%, var(--blob-3), transparent 65%),
        radial-gradient(30rem 26rem at 72% 55%, var(--blob-4), transparent 70%);
}

/* ---- surfaces en verre ---- */
.sidebar, .mobile-bar, .card, .panel, .table-wrap, .tile, .empty, .detail-state, .findings > li,
.history, .hist-list, dialog.modal, .auth-box {
    background-color: var(--surface);
    border-color: var(--glass-edge);
    box-shadow: var(--glass-shadow);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.flash, .notice-warn { -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
/* pas de verre dans le verre : le contenu d'un panneau reste transparent */
.panel > .table-wrap, .card .table-wrap, .auth-box .card {
    background: transparent; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none;
}
.card-head, .modal-head { border-bottom-color: var(--border); }
thead th { background: var(--surface-2); }
tbody tr:hover { background: var(--surface-3); }
pre.detail, .prompt-body pre, .mt-result, .modal-body textarea { background: var(--surface-2); }
.modal-foot { background: var(--surface-2); }
dialog.modal::backdrop { background: rgba(8, 11, 18, .38); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

/* ---- coque : barre latérale flottante ---- */
.sidebar { background-color: var(--sidebar-bg); }
.sidebar-foot { border-top-color: var(--border); }
.mobile-bar { background-color: var(--sidebar-bg); border-color: var(--glass-edge); box-shadow: 0 1px 0 var(--border); }
@media (min-width: 1101px) {
    .sidebar { top: 12px; height: calc(100vh - 24px); margin: 12px 0 12px 12px; border: 1px solid var(--glass-edge); border-radius: var(--r-lg); }
}
.nav a[aria-current="page"] {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.brand-mark { box-shadow: 0 6px 16px -6px rgba(37, 99, 235, .7); }

/* ---- boutons ---- */
button, .btn { background-color: var(--surface); }
.btn.ghost, button.link, .side-btn, .field-btn { background-color: transparent; }
.primary, .btn.primary, .primary:hover, .btn.primary:hover {
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, #fff), var(--accent));
    border-color: color-mix(in srgb, var(--accent) 75%, #000);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 8px 20px -8px color-mix(in srgb, var(--accent) 80%, transparent);
}
.primary:hover, .btn.primary:hover { filter: brightness(1.07); }
input, textarea, select { background-color: var(--surface); }
input[readonly] { background-color: var(--surface-2); }

/* ---- tuiles : halo de la couleur d'état ---- */
.tile { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.tile:hover { background-color: var(--surface); transform: translateY(-2px); box-shadow: var(--glass-shadow), 0 14px 28px -16px var(--c); }
.filter-tiles .tile[aria-pressed="true"] { box-shadow: 0 0 0 1px var(--c), 0 14px 30px -14px var(--c); }

/* ---- connexion : formulaire dans une carte en verre ---- */
.auth-box { padding: var(--s8); border: 1px solid var(--glass-edge); border-radius: 20px; }
.auth-aside { -webkit-backdrop-filter: none; backdrop-filter: none; }
@media (max-width: 480px) { .auth-box { padding: var(--s6) var(--s5); } }

/* ---- mobile : cartes de lignes plus opaques (pas de flou par ligne) ---- */
@media (max-width: 640px) {
    tbody tr { background: color-mix(in srgb, var(--surface-solid) 84%, transparent); border-color: var(--glass-edge); }
    tbody tr:hover { background: color-mix(in srgb, var(--surface-solid) 84%, transparent); }
    td.actions { background: var(--surface-3); }
}

/* ---- navigateurs sans flou : surfaces opaques ---- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .sidebar, .mobile-bar, .card, .panel, .table-wrap, .tile, .empty, .detail-state, .findings > li,
    .history, .hist-list, dialog.modal, .auth-box { background-color: var(--surface-solid); }
}
