:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-2: #f0f3f7;
    --border: #dde3ea;
    --text: #1b2430;
    --muted: #5d6b7c;
    --accent: #1d4ed8;
    --accent-ink: #ffffff;
    --accent-soft: #e3ebfd;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --ok: #067647;
    --ok-soft: #e6f4ec;
    --warn: #b54708;
    --warn-soft: #fef3e2;
    --security: #b42318;  --security-soft: #fdecea;
    --major: #6d28d9;     --major-soft: #f1eafd;
    --minor: #1d4ed8;     --minor-soft: #e3ebfd;
    --patch: #475467;     --patch-soft: #eef1f5;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --mono: "Cascadia Code", Consolas, "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f141b;
        --surface: #171e27;
        --surface-2: #1e2732;
        --border: #2c3744;
        --text: #e6ebf1;
        --muted: #97a3b3;
        --accent: #6b9bff;
        --accent-ink: #0b1220;
        --accent-soft: #1b2a47;
        --danger: #ff8a7a;  --danger-soft: #3a1b18;
        --ok: #5fd39a;      --ok-soft: #13301f;
        --warn: #ffb46b;    --warn-soft: #3a2812;
        --security: #ff8a7a; --security-soft: #3a1b18;
        --major: #b99aff;    --major-soft: #2a2140;
        --minor: #6b9bff;    --minor-soft: #1b2a47;
        --patch: #a8b3c2;    --patch-soft: #26303c;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); font-size: 13px; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow: auto; margin: 0; }
pre code { background: none; padding: 0; }
h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 19px; margin: 28px 0 10px; }
h3 { font-size: 16px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 24px; padding-bottom: 40px; min-height: calc(100vh - 140px); }

/* --- Barre du haut --- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 58px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); font-size: 16px; }
.brand svg { color: var(--accent); }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav > a, .nav .linklike { color: var(--muted); padding: 6px 10px; border-radius: 7px; font-size: 14px; }
.nav > a:hover, .nav .linklike:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav > a.active { color: var(--accent); background: var(--accent-soft); }
.nav > a.btn { color: var(--accent-ink); }
.nav-sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }
.count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 600; }
.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; color: var(--accent); padding: 0; }

.footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; padding-top: 16px; padding-bottom: 24px; border-top: 1px solid var(--border); }

/* --- Composants --- */
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: var(--accent-ink); border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; font: 600 14px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(1.07); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; border: 1px solid; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.flash.error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.flash.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.lvl-security { background: var(--security-soft); color: var(--security); }
.lvl-major { background: var(--major-soft); color: var(--major); }
.lvl-minor { background: var(--minor-soft); color: var(--minor); }
.lvl-patch { background: var(--patch-soft); color: var(--patch); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* --- Tableaux --- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Formulaires --- */
form .field { margin-bottom: 14px; }
label, .label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: 14px var(--font);
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; font-size: 14px; margin: 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.error-text, .field-validation-error { color: var(--danger); font-size: 13px; }
.validation-summary-errors ul { margin: 0 0 14px; padding: 10px 14px 10px 30px; background: var(--danger-soft); color: var(--danger); border-radius: 8px; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.auth-box { max-width: 420px; margin: 24px auto; }

/* --- Produits et changelog --- */
.product-card { display: flex; flex-direction: column; gap: 10px; }
.product-card .code { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.product-card .latest { font-size: 22px; font-weight: 650; }
.product-card .foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filters .field { margin: 0; min-width: 160px; }
.summary-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 16px 0; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; padding: 0 0 22px 26px; border-left: 2px solid var(--border); margin-left: 7px; }
.timeline > li:last-child { border-left-color: transparent; }
.timeline > li::before { content: ""; position: absolute; left: -8px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
.timeline > li.has-security::before { border-color: var(--security); }
.ver-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ver-num { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.changes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.changes li { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.changes .ct { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-weight: 600; }
.changes .cd { color: var(--muted); font-size: 14px; margin-top: 3px; white-space: pre-line; }

.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 13px; }

/* --- Édition des évolutions --- */
.item-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); margin-bottom: 10px; }
.item-row .item-body { display: grid; gap: 8px; }
.item-row .item-tools { display: flex; flex-direction: column; gap: 4px; }
.icon-btn { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; width: 30px; height: 30px; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; }
.icon-btn:hover { color: var(--text); }
.icon-btn.del:hover { color: var(--danger); border-color: var(--danger); }

.sub-row td:first-child { min-width: 180px; }
.notif { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.notif:last-child { border-bottom: 0; }
.notif.unread .nt { font-weight: 700; }
.notif .dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; margin-top: 8px; flex: none; }
.notif.unread .dot { background: var(--accent); }
.notif .nb { color: var(--muted); font-size: 14px; white-space: pre-line; }

.empty { text-align: center; padding: 48px 16px; }
.two-cols { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.try-result { max-height: 460px; }

@media (max-width: 760px) {
    .two-cols { grid-template-columns: 1fr; }
    .item-row { grid-template-columns: 1fr; }
    .item-row .item-tools { flex-direction: row; }
    .nav-sep { display: none; }
    h1 { font-size: 22px; }
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Phase 2 : statuts, traductions, parc --- */
.st-current { background: var(--ok-soft); color: var(--ok); }
.st-supported { background: var(--accent-soft); color: var(--accent); }
.st-eos { background: var(--warn-soft); color: var(--warn); }
.st-obsolete { background: var(--patch-soft); color: var(--patch); }
.st-withdrawn { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; }
.tr-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; padding: 8px 0; border-top: 1px solid var(--border); }
.tr-source { white-space: pre-line; color: var(--muted); font-size: 14px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.cve { font-family: var(--mono); font-size: 12px; }
.path { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.path .step { padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.tech { margin-top: 8px; font-size: 13px; color: var(--muted); white-space: pre-line; border-left: 3px solid var(--border); padding-left: 10px; }
.pkg-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.pkg-list li { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 14px; }
.secret { font-family: var(--mono); background: var(--warn-soft); color: var(--text); padding: 10px 12px; border-radius: 8px; word-break: break-all; }
details > summary { cursor: pointer; }
@media (max-width: 760px) { .tr-row { grid-template-columns: 1fr; } }
