/* Feuille de style de l'interface : tokens, composants partagés, puis page de gestion. */

/* ══════════════════════════ Police ══════════════════════════ */
/* Mulish, la police de coreupdate.com, servie localement (la CSP n'autorise que 'self').
   Fichiers variables (graisses 200 à 1000), licence OFL : voir fonts/OFL.txt. Le numéro de
   version est dans le nom de fichier : ces URL-là ne portent pas l'empreinte de static_url. */
@font-face {
    font-family: "Mulish";
    font-style: normal;
    font-weight: 200 1000;
    font-display: swap;
    src: url("../fonts/mulish-v18-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
        U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Mulish";
    font-style: normal;
    font-weight: 200 1000;
    font-display: swap;
    src: url("../fonts/mulish-v18-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
        U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ══════════════════════════ Tokens ══════════════════════════ */
/* Charte de coreupdate.com : fond gris froid, cartes à peine plus claires et bordées, texte
   presque noir, bleu marine de la marque pour les actions et la navigation. */
:root {
    --brand: #00223e;
    --brand-hover: #0b3a63;
    --on-brand: #f2f3f5;
    --bg: #e8eaed;
    --surface: #f7f8f9;
    --surface-2: #eef0f2;
    --surface-3: #e2e5e9;
    --field: #ffffff;
    --border: #d9dde2;
    --border-strong: #bfc5cc;
    --text: #1e1e1e;
    --text-2: #474c54;
    --text-3: #5f656e;
    --accent: #00223e;
    --accent-soft: #dde4ec;
    --accent-text: #00315a;
    --on-accent: #ffffff;
    --accent-solid: #00223e;
    --accent-solid-hover: #0b3a63;
    --teal: #82c0c7;
    --success-solid: #1d7f45;
    --danger-solid: #c02626;
    --danger-solid-hover: #a51d1d;
    --success: #1d7f45;
    --success-soft: #e3f3e9;
    --warning: #a4520b;
    --warning-soft: #fcefdc;
    --danger: #bb2424;
    --danger-soft: #fbe6e6;
    --info: #0f6874;
    --info-soft: #dcf0f2;
    --scrim: rgba(0, 20, 38, 0.5);
    --shadow-sm: 0 1px 2px rgba(0, 34, 62, 0.05);
    --shadow-md: 0 6px 16px rgba(0, 34, 62, 0.1), 0 1px 3px rgba(0, 34, 62, 0.06);
    --shadow-lg: 0 24px 56px rgba(0, 34, 62, 0.22), 0 4px 12px rgba(0, 34, 62, 0.08);
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 10px;
    --font: "Mulish", Helvetica, Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    color-scheme: light;
}
/* Le mode clair est celui par défaut ; le sombre se choisit (bouton de la barre latérale) et
   ne suit pas le réglage du système. Le marine de la marque y sert de fond, la sarcelle du
   site prend le rôle d'accent. */
:root[data-theme="dark"] {
    --brand: #061a2d;
    --brand-hover: #0d2944;
    --on-brand: #e8eaed;
    --bg: #0a1520;
    --surface: #101e2c;
    --surface-2: #152638;
    --surface-3: #1c3047;
    --field: #0c1824;
    --border: #213449;
    --border-strong: #33485f;
    --text: #e8eaed;
    --text-2: #b6c0cb;
    --text-3: #8d99a6;
    --accent: #82c0c7;
    --accent-soft: rgba(130, 192, 199, 0.14);
    --accent-text: #9fd2d8;
    --on-accent: #ffffff;
    --accent-solid: #1f5a88;
    --accent-solid-hover: #2a6a9c;
    --success-solid: #22804a;
    --danger-solid: #c93c37;
    --danger-solid-hover: #d9534e;
    --success: #5cc885;
    --success-soft: rgba(92, 200, 133, 0.13);
    --warning: #e8ab4a;
    --warning-soft: rgba(232, 171, 74, 0.13);
    --danger: #f2716a;
    --danger-soft: rgba(242, 113, 106, 0.13);
    --info: #82c0c7;
    --info-soft: rgba(130, 192, 199, 0.13);
    --scrim: rgba(0, 6, 12, 0.65);
    --shadow-sm: none;
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
}

/* ══════════════════════════ Base ══════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font: 400 0.9rem/1.55 var(--font);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
/* Comme sur coreupdate.com : titres en graisse moyenne, resserrés d'autant plus qu'ils sont grands. */
h1, h2, h3, h4 { margin: 0; color: var(--text); font-weight: 650; }
h1 { font-size: 1.625rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 1.125rem; line-height: 1.3; letter-spacing: -0.01em; }
h3 { font-size: 0.975rem; line-height: 1.35; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code {
    font-family: var(--mono);
    font-size: 0.8125em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.05em 0.35em;
    overflow-wrap: anywhere;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.muted { color: var(--text-3); }
.text-danger { color: var(--danger); }
.small { font-size: 0.8125rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.icon {
    width: 1rem; height: 1rem; flex: none;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ══════════════════════════ Boutons ══════════════════════════ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    height: 2.125rem; padding: 0 0.85rem;
    font: 600 0.8125rem/1 var(--font);
    white-space: nowrap;
    color: var(--text);
    background: var(--field);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms var(--ease-out);
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.55; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.btn-primary { background: var(--accent-solid); border-color: var(--accent-solid); color: var(--on-accent); }
.btn-danger { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn-success { background: var(--success-solid); border-color: var(--success-solid); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-danger-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--danger); }
.btn-sm { height: 1.875rem; padding: 0 0.65rem; }
.btn-xs { height: 1.5rem; padding: 0 0.4rem; font-size: 0.75rem; }
.btn-icon { padding: 0; width: 2.125rem; }
.btn-icon.btn-sm { width: 1.875rem; }
.btn-icon.btn-xs { width: 1.5rem; }
.btn-block { width: 100%; height: 2.5rem; font-size: 0.875rem; }
@media (hover: hover) and (pointer: fine) {
    .btn:hover:not(:disabled) { background: var(--surface-2); }
    .btn-primary:hover:not(:disabled) { background: var(--accent-solid-hover); border-color: var(--accent-solid-hover); }
    .btn-danger:hover:not(:disabled) { background: var(--danger-solid-hover); border-color: var(--danger-solid-hover); }
    .btn-success:hover:not(:disabled) { background: var(--success-solid); filter: brightness(1.1); }
    .btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
    .btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); }
}

/* ══════════════════════════ Formulaires ══════════════════════════ */
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.field label, .label { font-weight: 500; font-size: 0.8125rem; color: var(--text); }
.field .hint { font-size: 0.75rem; color: var(--text-3); }
.input, .select {
    width: 100%;
    height: 2.25rem;
    padding: 0 0.75rem;
    font: inherit;
    font-size: 0.875rem;
    color: var(--text);
    background: var(--field);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.select { width: auto; padding-right: 0.5rem; }
.field .select { width: 100%; }
.input::placeholder { color: var(--text-3); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-group { position: relative; flex: 1 1 18rem; min-width: 12rem; }
.input-group > .icon { position: absolute; left: 0.7rem; top: 50%; translate: 0 -50%; color: var(--text-3); pointer-events: none; }
.input-group > .input { padding-left: 2.1rem; }

/* ══════════════════════════ Surfaces ══════════════════════════ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    height: 1.375rem; padding: 0 0.55rem;
    font-size: 0.75rem; font-weight: 600; line-height: 1;
    white-space: nowrap;
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.badge .icon { width: 0.8rem; height: 0.8rem; }
.badge-success { color: var(--success); background: var(--success-soft); border-color: transparent; }
.badge-warning { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.badge-danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge-info { color: var(--info); background: var(--info-soft); border-color: transparent; }
.badge-accent { color: var(--accent-text); background: var(--accent-soft); border-color: transparent; }
.badge-dot::before { content: ""; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: currentColor; }

.callout {
    display: flex; gap: 0.6rem; align-items: flex-start;
    padding: 0.65rem 0.8rem;
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 0.8125rem;
}
.callout > .icon { margin-top: 0.15rem; }
.callout-success { background: var(--success-soft); color: var(--success); }
.callout-warning { background: var(--warning-soft); color: var(--warning); }
.callout-danger { background: var(--danger-soft); color: var(--danger); }
.callout-info { background: var(--info-soft); color: var(--info); }
.callout strong { font-weight: 600; }

/* ══════════════════════════ Tableaux ══════════════════════════ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.table th {
    text-align: left; font-weight: 600; font-size: 0.75rem;
    color: var(--text-3);
    background: var(--surface-2);
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child > td { border-bottom: none; }
.table .col-actions { text-align: right; width: 1%; white-space: nowrap; }
.table .actions { display: inline-flex; gap: 0.35rem; justify-content: flex-end; align-items: center; }
@media (hover: hover) { .table tbody tr:hover > td { background: var(--surface-2); } }
.table .empty-row td { text-align: center; color: var(--text-3); padding: 2rem 1rem; }

.empty {
    display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
    padding: 2.5rem 1rem;
    text-align: center; color: var(--text-3);
}
.empty .icon { width: 1.75rem; height: 1.75rem; margin-bottom: 0.3rem; color: var(--border-strong); }
.empty strong { color: var(--text-2); font-weight: 600; }

/* ══════════════════════════ Dialogues ══════════════════════════ */
dialog.modal {
    width: min(28rem, calc(100vw - 2rem));
    max-height: calc(100vh - 3rem);
    padding: 0;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 1;
    transform: scale(1);
    transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out), overlay 180ms allow-discrete, display 180ms allow-discrete;
}
dialog.modal-wide { width: min(36rem, calc(100vw - 2rem)); }
@starting-style { dialog.modal[open] { opacity: 0; transform: scale(0.96); } }
dialog.modal:not([open]) { opacity: 0; transform: scale(0.98); transition-duration: 120ms; }
dialog.modal::backdrop {
    background: var(--scrim);
    opacity: 1;
    transition: opacity 180ms ease, overlay 180ms allow-discrete, display 180ms allow-discrete;
}
@starting-style { dialog.modal[open]::backdrop { opacity: 0; } }
dialog.modal:not([open])::backdrop { opacity: 0; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem 0; }
.modal-body { padding: 0.75rem 1.25rem 0; color: var(--text-2); }
.modal-body .message { white-space: pre-line; }
.modal-body .intro { margin-bottom: 1rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 1.25rem; }

/* ══════════════════════════ Toasts ══════════════════════════ */
.toaster {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 1000;
    display: flex; flex-direction: column; gap: 0.5rem;
    width: min(24rem, calc(100vw - 2rem));
    pointer-events: none;
}
.toast {
    display: flex; gap: 0.6rem; align-items: flex-start;
    padding: 0.75rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}
@starting-style { .toast { opacity: 0; transform: translateY(0.75rem); } }
.toast.is-leaving { opacity: 0; transform: translateY(0.5rem); transition-duration: 150ms; }
.toast > .icon { margin-top: 0.1rem; }
.toast-success > .icon { color: var(--success); }
.toast-error > .icon { color: var(--danger); }
.toast-info > .icon { color: var(--accent); }
.toast .toast-text { flex: 1; white-space: pre-line; }

.spinner {
    width: 0.9rem; height: 0.9rem; flex: none;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
    animation: spin 600ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════ Pages d'authentification ══════════════════════════ */
.auth {
    min-height: 100vh; min-height: 100dvh;
    display: grid; place-items: center;
    padding: 1.5rem 1rem;
}
.auth-card { width: min(24rem, 100%); padding: 2rem 1.75rem; }
.auth-brand { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.5rem; }
.auth-card h1 { margin-bottom: 0.4rem; }
.auth-card .lead { color: var(--text-2); margin-bottom: 1.5rem; }
.auth-footer { margin-top: 1.25rem; text-align: center; font-size: 0.8125rem; }
.form-error { margin-bottom: 1rem; }

/* Le logo associe une silhouette blanche et une orbite marine : sur la pastille sarcelle de la
   charte, les deux se lisent, que la page soit claire ou marine. */
.brand-mark {
    display: grid; place-items: center;
    width: 2.25rem; height: 2.25rem; flex: none;
    border-radius: var(--radius);
    background: var(--teal);
}
.brand-mark img { width: 1.85rem; height: 1.85rem; }
.brand-name { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; }
    .btn:active:not(:disabled) { transform: none; }
    .spinner { animation-duration: 1.5s; }
}

/* ══════════════════════════ Shell ══════════════════════════ */
.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
    position: sticky; top: 0;
    display: flex; flex-direction: column; gap: 1.25rem;
    height: 100vh; height: 100dvh;
    padding: 1.1rem 0.75rem;
    color: var(--on-brand);
    background: var(--brand);
    overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 0.6rem; padding: 0 0.5rem; }
.sidebar-brand small { display: block; color: rgba(242, 243, 245, 0.65); font-size: 0.75rem; font-weight: 400; }
.nav { display: flex; flex-direction: column; gap: 1rem; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 0.1rem; }
.nav-title { padding: 0 0.6rem 0.3rem; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(242, 243, 245, 0.5); }
.nav-link {
    display: flex; align-items: center; gap: 0.6rem;
    height: 2.125rem; padding: 0 0.6rem;
    border-radius: var(--radius);
    color: rgba(242, 243, 245, 0.78); font-weight: 500;
    transition: background-color 120ms ease, color 120ms ease;
}
.nav-link:hover { text-decoration: none; }
@media (hover: hover) { .nav-link:hover { background: rgba(255, 255, 255, 0.07); color: var(--on-brand); } }
.nav-link[aria-current="page"] { background: rgba(255, 255, 255, 0.12); color: #ffffff; font-weight: 650; }
.nav-link .nav-count { margin-left: auto; }
.sidebar .badge { border-color: transparent; }
.sidebar .badge-accent { color: var(--brand); background: var(--on-brand); }
.sidebar .badge-warning { color: #2b1700; background: #f0b45a; }
.sidebar :focus-visible { outline-color: var(--teal); }
.sidebar-user {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.75rem 0.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.avatar {
    display: grid; place-items: center; flex: none;
    width: 2rem; height: 2rem; border-radius: 50%;
    font-weight: 600; text-transform: uppercase;
    color: var(--accent-text); background: var(--accent-soft);
}
.sidebar-user .who { flex: 1; min-width: 0; }
.sidebar-user .avatar { color: var(--brand); background: var(--teal); }
.sidebar-user .who small { display: block; color: rgba(242, 243, 245, 0.6); font-size: 0.75rem; }
.sidebar-user .btn-ghost { color: rgba(242, 243, 245, 0.78); }
@media (hover: hover) and (pointer: fine) { .sidebar-user .btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); color: #ffffff; } }

.main { padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 4rem; min-width: 0; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-header .desc { color: var(--text-2); margin-top: 0.3rem; max-width: 46rem; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.toolbar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.section-block + .section-block { margin-top: 2rem; }
.section-block > h2 { margin-bottom: 0.75rem; }

details.help { margin-bottom: 1.25rem; color: var(--text-2); }
details.help > summary {
    display: inline-flex; align-items: center; gap: 0.4rem;
    cursor: pointer; list-style: none;
    color: var(--accent-text); font-weight: 500;
}
details.help > summary::-webkit-details-marker { display: none; }
details.help > div { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.6rem; padding: 0.9rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }

@media (max-width: 900px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: sticky; z-index: 10;
        height: auto; flex-direction: row; align-items: center; gap: 0.75rem;
        padding: 0.6rem 0.75rem;
        overflow: visible;
    }
    .sidebar-brand small, .nav-title, .sidebar-user .who { display: none; }
    .nav { flex-direction: row; gap: 0.25rem; min-width: 0; overflow-x: auto; scrollbar-width: none; }
    .nav-group { flex-direction: row; }
    .nav-link { white-space: nowrap; }
    .sidebar-user { border-top: none; padding: 0; }
}

/* ══════════════════════════ Arbres dépliables ══════════════════════════ */
details.tree > summary {
    display: flex; align-items: center; gap: 0.55rem;
    min-height: 2.75rem; padding: 0.4rem 0.75rem;
    cursor: pointer; list-style: none;
    font-weight: 600;
    border-radius: var(--radius);
    transition: background-color 120ms ease;
}
details.tree > summary::-webkit-details-marker { display: none; }
@media (hover: hover) { details.tree > summary:hover { background: var(--surface-2); } }
.chevron { display: inline-flex; flex: none; width: 1rem; height: 1rem; }
details.tree > summary > .chevron { color: var(--text-3); transition: transform 160ms var(--ease-out); }
details.tree[open] > summary > .chevron { transform: rotate(90deg); }
details.tree > summary .summary-end { margin-left: auto; display: flex; align-items: center; gap: 0.4rem; }
.tree-body { padding: 0.25rem 0.75rem 0.75rem 2.1rem; display: flex; flex-direction: column; gap: 0.5rem; }

/* ══════════════════════════ Cartes d'application / KB ══════════════════════════ */
.entity-list { display: flex; flex-direction: column; gap: 0.75rem; }
.app-block, .kb-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.entity-head { display: flex; align-items: center; gap: 0.85rem; padding: 0.85rem 1rem; }
.entity-head .title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.entity-head .meta { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.entity-body { border-top: 1px solid var(--border); padding: 0.35rem 0.4rem; }
.entity-body > details.tree + details.tree { border-top: 1px solid var(--border); }
details.tree details.tree > summary { font-weight: 500; color: var(--text-2); min-height: 2.4rem; }

.app-icon {
    position: relative; flex: none;
    display: grid; place-items: center;
    width: 2.5rem; height: 2.5rem;
    border-radius: 10px;
    font-weight: 700; font-size: 1rem; text-transform: uppercase;
    color: var(--text-3); background: var(--surface-2);
    overflow: hidden;
}
.app-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 3px; background: var(--surface); }

/* ══════════════════════════ Releases ══════════════════════════ */
.release {
    padding: 0.75rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex; flex-direction: column; gap: 0.6rem;
}
.release.is-unpublished { border-style: dashed; }
.release-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.release-version code { font-size: 0.875rem; font-weight: 600; background: none; border: none; padding: 0; color: var(--text); }
.release-actions { margin-left: auto; display: flex; gap: 0.3rem; flex-wrap: wrap; }
@media (max-width: 640px) {
    .release-actions { margin-left: 0; width: 100%; }
    .entity-head > .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
    .tree-body { padding-left: 0.5rem; padding-right: 0.25rem; }
    .kv .wide { grid-column: auto; }
    .toolbar .input-group { flex-basis: 100%; }
}
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.35rem 1.25rem; margin: 0; }
.kv > div { min-width: 0; }
.kv dt { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-3); }
.kv dd { margin: 0.1rem 0 0; min-width: 0; }
.kv .wide { grid-column: span 2; }
.hash { display: flex; align-items: center; gap: 0.2rem; min-width: 0; }
.hash code { min-width: 0; word-break: normal; }

.e2e-report { border-radius: var(--radius); background: var(--surface-2); }
.e2e-report > summary {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    padding: 0.45rem 0.65rem;
    cursor: pointer; list-style: none; font-size: 0.8125rem;
}
.e2e-report > summary::-webkit-details-marker { display: none; }
.e2e-report > summary .chevron { color: var(--text-3); transition: transform 160ms var(--ease-out); }
.e2e-report[open] > summary .chevron { transform: rotate(90deg); }
.e2e-report .e2e-body { padding: 0.25rem 0.75rem 0.75rem; display: flex; flex-direction: column; gap: 0.6rem; font-size: 0.8125rem; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.check { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 500; background: var(--surface); border: 1px solid var(--border); color: var(--text-3); }
.check .icon { width: 0.8rem; height: 0.8rem; }
.check.is-ok { color: var(--success); border-color: transparent; background: var(--success-soft); }
.check.is-ko { color: var(--danger); border-color: transparent; background: var(--danger-soft); }
.artefacts { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 0.75rem; align-items: baseline; }
.artefacts .phase { color: var(--text-3); }
.artefacts .links { display: flex; flex-wrap: wrap; gap: 0.2rem 0.75rem; }
.artefacts a { display: inline-flex; align-items: center; gap: 0.25rem; }
.artefacts .icon { width: 0.85rem; height: 0.85rem; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; color: var(--text-2); flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 0.4rem; }
.pager .current { min-width: 6rem; text-align: center; font-variant-numeric: tabular-nums; }
#apps-list.is-loading, #regenerations-list.is-loading { opacity: 0.55; transition: opacity 150ms ease 120ms; }

/* ══════════════════════════ Régénérations ══════════════════════════ */
.regen-list { display: flex; flex-direction: column; gap: 0.75rem; }
.regen-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.regen-card.regeneration-running { border-color: var(--warning); }
.regen-head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.85rem 1rem; }
.regen-head .title { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; flex: 1; }
.regen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; padding: 0 1rem 0.9rem; }
.regen-grid h4 { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-3); margin-bottom: 0.35rem; }
.regen-grid .stack { display: flex; flex-direction: column; align-items: flex-start; gap: 0.4rem; }
.regen-grid .stack > .callout, .regen-grid .stack > .command { align-self: stretch; }
.regen-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; padding: 0.75rem 1rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.command { display: flex; align-items: flex-start; gap: 0.3rem; }
.command code { flex: 1; display: block; white-space: pre-wrap; padding: 0.4rem 0.55rem; font-size: 0.75rem; }
.contract { width: 100%; border-collapse: collapse; margin-top: 0.5rem; font-size: 0.75rem; color: var(--text-2); }
.contract th { text-align: left; font-weight: 600; padding: 0.25rem 0.5rem 0.25rem 0; color: inherit; opacity: 0.8; }
.contract td { padding: 0.2rem 0.5rem 0.2rem 0; vertical-align: top; }
.contract tr.is-changed { color: inherit; font-weight: 600; }
.contract tr.is-same { opacity: 0.6; }

/* ══════════════════════════ Journaux E2E ══════════════════════════ */
#e2e-table .detail-row > td { background: var(--surface-2); }
#e2e-table .e2e-toggle .icon { transition: transform 160ms var(--ease-out); }
#e2e-table .e2e-toggle[aria-expanded="true"] .icon { transform: rotate(90deg); }
.e2e-detail { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.25rem 0; }

.chip-list { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; }
.chip form { display: inline; }

/* ══════════════════════════ Utilitaires ══════════════════════════ */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.fw-medium { font-weight: 500; }
.ml-1 { margin-left: 0.4rem; }
.toast .toast-action { font-weight: 600; color: var(--accent-text); }
.form-error:empty { display: none; }

/* ══════════════════════════ Vue d'ensemble ══════════════════════════ */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: 0.75rem; margin-bottom: 1.5rem; }
.stat {
    display: flex; flex-direction: column; gap: 0.35rem;
    padding: 0.95rem 1rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: border-color 150ms ease, transform 120ms var(--ease-out);
}
.stat:hover { text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .stat:hover { border-color: var(--border-strong); } }
.stat:active { transform: scale(0.99); }
.stat .stat-label { display: flex; align-items: center; gap: 0.4rem; color: var(--text-2); font-weight: 500; }
.stat .stat-value { font-size: 1.75rem; font-weight: 650; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .stat-hint { color: var(--text-3); font-size: 0.75rem; }
.stat.tone-danger .stat-value, .stat.tone-danger .stat-label .icon { color: var(--danger); }
.stat.tone-warning .stat-value, .stat.tone-warning .stat-label .icon { color: var(--warning); }
.stat.tone-accent .stat-value, .stat.tone-accent .stat-label .icon { color: var(--accent-text); }
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: 1rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); }
.panel .table-wrap { border: none; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ══════════════════════════ Filtres ══════════════════════════ */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.2rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); }
.segmented .btn { height: 1.75rem; border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.segmented .btn[aria-pressed="true"] { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-sm); color: var(--text); }
@media (max-width: 640px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat .stat-value { font-size: 1.5rem; }
}

/* Bouton de thème : il montre le mode vers lequel il bascule. */
.theme-toggle .icon-light { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-light { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-dark { display: none; }

/* Case à cocher accompagnée d'un libellé et d'une explication. */
.checkbox { display: flex; align-items: flex-start; gap: 0.6rem; cursor: pointer; color: var(--text); }
.checkbox input { width: 1rem; height: 1rem; margin: 0.2rem 0 0; flex: none; accent-color: var(--accent-solid); }
.checkbox > span { display: flex; flex-direction: column; gap: 0.2rem; }
.checkbox strong { font-weight: 600; }
.checkbox .hint { font-size: 0.8rem; color: var(--text-3); }
