/* =====================================================================
   SecurityServ - feuille de style
   Theme sombre, polices systeme (CSP : aucune ressource externe)
   ===================================================================== */

:root {
    --bg: #0e1218;
    --bg-elev: #151b24;
    --bg-elev-2: #1b2330;
    --border: #263040;
    --text: #e6ebf2;
    --text-muted: #8d99ab;
    --primary: #4f8cff;
    --primary-hover: #6a9eff;
    --accent: #7c5cff;
    --ok: #2ecc71;
    --outdated: #f39c12;
    --error: #e74c3c;
    --never: #6c7a8c;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(79, 140, 255, .12), transparent 60%),
        radial-gradient(900px 500px at 100% 0%, rgba(124, 92, 255, .10), transparent 60%),
        var(--bg);
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

code { font-family: var(--mono); font-size: .9em; background: var(--bg-elev-2); padding: 2px 6px; border-radius: 6px; }

h1 { font-size: 1.9rem; margin: 0 0 .35rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }

.container { width: min(1140px, 100% - 2rem); margin: 0 auto; }
.muted { color: var(--text-muted); }
.small { font-size: .82rem; }
.t-right { text-align: right; }

/* ---------- Top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 10;
    background: rgba(14, 18, 24, .85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.05rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(46, 204, 113, .18); }
.nav { display: flex; gap: .25rem; align-items: center; }
.nav a, .nav__soon { padding: .45rem .8rem; border-radius: 8px; color: var(--text-muted); font-weight: 500; }
.nav a:hover { background: var(--bg-elev); color: var(--text); text-decoration: none; }
.nav a.is-active { background: var(--bg-elev-2); color: var(--text); }
.nav__soon { opacity: .45; cursor: not-allowed; }

main.container { padding: 2rem 0 3rem; }

/* ---------- Flash ---------- */
.flash {
    padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem;
    border: 1px solid; background: var(--bg-elev); transition: opacity .5s, transform .5s;
}
.flash.is-hiding { opacity: 0; transform: translateY(-6px); }
.flash--success { border-color: rgba(46, 204, 113, .5); }
.flash--info    { border-color: rgba(79, 140, 255, .5); }
.flash--warning { border-color: rgba(243, 156, 18, .6); }
.flash--error   { border-color: rgba(231, 76, 60, .6); }

/* ---------- Cards / grid ---------- */
.card {
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem 1.4rem; box-shadow: var(--shadow);
}
.card__title { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin: 0 0 .4rem; }
.card--soon { opacity: .7; }
.stat { font-size: 2.2rem; font-weight: 700; margin: 0; }
.grid { display: grid; gap: 1rem; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.empty { text-align: center; padding: 2.5rem 1.5rem; }

/* ---------- Hero ---------- */
.hero { padding: 2.5rem 0 2rem; }
.hero__kicker { color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; margin: 0 0 .5rem; }
.hero h1 { font-size: 2.4rem; }
.hero__lead { color: var(--text-muted); max-width: 640px; font-size: 1.05rem; }
.hero__actions { display: flex; gap: .75rem; flex-wrap: wrap; margin: 1.5rem 0 2rem; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem 1rem; border-radius: 9px; border: 1px solid transparent;
    font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--lg { padding: .8rem 1.3rem; font-size: 1rem; }
.btn--sm { padding: .35rem .7rem; font-size: .85rem; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); color: #fff; }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { background: #8f73ff; color: #fff; }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--bg-elev-2); color: var(--text); }
.btn--warn { background: var(--outdated); color: #1a1200; }
.btn--warn:hover { background: #f5ab3a; color: #1a1200; }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; }
.btn.is-loading { opacity: .8; }

/* ---------- Bloc derniere version ---------- */
.card--latest { margin-bottom: 1.25rem; }
.latest { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.latest__version { font-size: 2.6rem; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.latest__version--unknown { color: var(--text-muted); }
.branches { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .5rem; }
.chip { background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 999px; padding: .1rem .6rem; font-size: .8rem; font-family: var(--mono); }

/* ---------- Formulaire d'ajout ---------- */
.card--add { margin-bottom: 1.25rem; }
.add-form { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: .5rem; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 180px; }
.field--grow { flex: 1 1 320px; }
.field__label { font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.field input {
    font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
    border-radius: 9px; padding: .55rem .75rem; outline: none; width: 100%;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 140, 255, .2); }
.field input::placeholder { color: #5c6878; }
.btn--danger { background: transparent; color: var(--error); border-color: rgba(231, 76, 60, .4); padding-inline: .6rem; }
.btn--danger:hover { background: rgba(231, 76, 60, .12); color: var(--error); }

/* ---------- Toolbar ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1.25rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.toolbar__stats { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.pill { border-radius: 999px; padding: .2rem .7rem; font-size: .82rem; font-weight: 600; border: 1px solid; }
.pill--ok       { color: var(--ok);       border-color: rgba(46, 204, 113, .5); }
.pill--outdated { color: var(--outdated); border-color: rgba(243, 156, 18, .6); }
.pill--error    { color: var(--error);    border-color: rgba(231, 76, 60, .6); }
.pill--never    { color: var(--never);    border-color: var(--border); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; min-width: 720px; }
.table th, .table td { padding: .9rem 1.1rem; text-align: left; vertical-align: middle; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--bg-elev-2); }
.table tbody tr { border-bottom: 1px solid var(--border); }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, .02); }
.row--outdated { box-shadow: inset 3px 0 0 var(--outdated); }
.row--ok       { box-shadow: inset 3px 0 0 var(--ok); }
.row--error    { box-shadow: inset 3px 0 0 var(--error); }

.site { display: flex; flex-direction: column; }
.site__name { font-weight: 600; }
.site__url { font-size: .85rem; color: var(--text-muted); }
.version { font-family: var(--mono); font-weight: 600; display: block; }

.status { display: flex; align-items: flex-start; gap: .7rem; }
.status__label { font-weight: 500; }
.light { flex: none; width: 12px; height: 12px; border-radius: 50%; margin-top: .35rem; background: var(--never); }
.light--ok       { background: var(--ok);       box-shadow: 0 0 0 4px rgba(46, 204, 113, .18), 0 0 12px var(--ok); }
.light--outdated { background: var(--outdated); box-shadow: 0 0 0 4px rgba(243, 156, 18, .2),  0 0 12px var(--outdated); animation: pulse 1.8s infinite; }
.light--error    { background: var(--error);    box-shadow: 0 0 0 4px rgba(231, 76, 60, .2),   0 0 12px var(--error); }
.light--unknown, .light--never { background: var(--never); box-shadow: 0 0 0 4px rgba(108, 122, 140, .15); }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(243, 156, 18, .2), 0 0 12px var(--outdated); }
    50%      { box-shadow: 0 0 0 7px rgba(243, 156, 18, .08), 0 0 18px var(--outdated); }
}

.ssl-warn { color: var(--outdated); margin-top: .15rem; }

.note {
    margin: 0 0 .9rem; padding: .8rem 1rem; font-size: .88rem; color: var(--text-muted);
    background: var(--bg-elev); border: 1px solid var(--border); border-left: 3px solid var(--primary);
    border-radius: 8px;
}
.note strong { color: var(--text); }

.actions { display: inline-flex; gap: .5rem; align-items: center; }
.actions form { margin: 0; }

/* ---------- Onglets SPIP ---------- */
[hidden] { display: none !important; }
.t-center { text-align: center; }
.text-warn { color: var(--outdated); } .text-err { color: var(--error); } .text-ok { color: var(--ok); }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; box-shadow: inset 0 -1px 0 var(--border); margin-bottom: 1.25rem; }
.tab {
    display: flex; align-items: center; gap: .55rem; padding: .75rem 1rem;
    border-bottom: 2px solid transparent; color: var(--text-muted); font-weight: 600; white-space: nowrap;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--text); border-bottom-color: var(--primary); }
.tab:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 6px; }
.count {
    font-size: .75rem; font-weight: 700; padding: .05rem .5rem; border-radius: 999px;
    border: 1px solid var(--border); color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.count--ok   { color: var(--ok);       border-color: rgba(46, 204, 113, .5); }
.count--warn { color: var(--outdated); border-color: rgba(243, 156, 18, .6); }
.count--err  { color: var(--error);    border-color: rgba(231, 76, 60, .6); }

/* Filtres (onglet plugins) */
.filters { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.select, .search {
    font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
    border-radius: 9px; padding: .5rem .75rem; outline: none;
}
.select:focus, .search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 140, 255, .2); }
.toggle { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--text-muted); cursor: pointer; }
.toggle input { accent-color: var(--primary); width: 16px; height: 16px; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; }

/* Groupes par site */
.site-group { margin-bottom: 1.25rem; }
.site-group__head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .6rem .2rem .7rem; }
.site-group__head--card { padding: 0 0 .6rem; }
.site-group__title { display: flex; align-items: center; gap: .75rem; font-weight: 700; font-size: 1.05rem; }
.site-group__title .light { margin-top: 0; }
.site-group__title .muted { font-weight: 500; font-size: .9rem; }
.tag { font-size: .75rem; font-weight: 600; padding: .12rem .55rem; border-radius: 6px; border: 1px solid var(--border); color: var(--text-muted); white-space: nowrap; }
.tag--dist   { color: #9fb3ff; border-color: rgba(79, 140, 255, .35); }
.tag--maison { color: #c9a8ff; border-color: rgba(124, 92, 255, .4); }
.tag--ignored { color: var(--text-muted); border-style: dashed; white-space: normal; }
.status--actions { align-items: center; flex-wrap: wrap; }
.inline-form { margin: 0; display: inline-flex; }
.btn--xs { padding: .15rem .5rem; font-size: .75rem; font-weight: 500; }
.row--ignored { opacity: .7; }
.plugin-name { font-weight: 600; }
.plugin-prefix { font-family: var(--mono); color: var(--text-muted); font-size: .8rem; margin-left: .4rem; }
.table--plugins { min-width: 640px; }
.row--nocompat, .row--unknown, .row--dist { box-shadow: none; }

/* Accordeons (un par site) */
.toolbar--tight { margin-bottom: .75rem; }
.acc-list { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.acc {
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
}
.acc[open] { border-color: #34435a; }
.acc__summary {
    display: flex; align-items: center; gap: .8rem; padding: .85rem 1.1rem; cursor: pointer;
    list-style: none; user-select: none;
}
.acc__summary::-webkit-details-marker { display: none; }
.acc__summary:hover { background: rgba(255, 255, 255, .02); }
.acc__summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.acc__summary .light { margin-top: 0; }
.acc__title { font-weight: 700; font-size: 1.02rem; white-space: nowrap; }
.acc__meta { font-size: .88rem; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc__badges { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.acc__chevron { flex: none; width: 9px; height: 9px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); transition: transform .15s; margin: 0 .2rem 0 .3rem; }
.acc[open] .acc__chevron { transform: rotate(-135deg); margin-top: .3rem; }
.acc__body { padding: 0 1.1rem 1rem; border-top: 1px solid var(--border); }
.acc__actions { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .85rem 0; }
.acc__body .table-wrap { box-shadow: none; }
.acc__foot { margin: .6rem 0 0; }
@media (max-width: 720px) {
    .acc__meta { display: none; }
    .acc__summary { flex-wrap: wrap; }
}

/* Onglet securite */
.checks { padding-top: .3rem; }
.check { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.check:last-child { border-bottom: 0; }
.check__label { font-weight: 500; }
.check__detail { color: var(--text-muted); font-size: .82rem; }
.verdict { font-weight: 700; font-size: .82rem; white-space: nowrap; padding-top: .1rem; }
.verdict--ok { color: var(--ok); } .verdict--info { color: var(--text-muted); }
.verdict--warn { color: var(--outdated); } .verdict--critical { color: var(--error); }
.score { display: flex; align-items: baseline; gap: .5rem; }
.score b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }

/* ---------- Authentification ---------- */
.nav__logout { display: inline-flex; align-items: center; gap: .6rem; margin-left: .6rem; padding-left: .8rem; border-left: 1px solid var(--border); }
.nav__user { color: var(--text-muted); font-size: .88rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth { display: flex; justify-content: center; padding: 3rem 0; }
.auth__card { width: min(440px, 100%); }
.auth__title { font-size: 1.6rem; margin: 0 0 1rem; }
.auth__form { display: flex; flex-direction: column; gap: .9rem; margin-top: .5rem; }
.auth__form .btn { margin-top: .4rem; }
.auth__note { margin: 1rem 0 0; }
.nav__user:hover { color: var(--text); text-decoration: none; }

/* ---------- Comptes ---------- */
.temp-pass { margin-bottom: 1.25rem; border-color: rgba(243, 156, 18, .6); }
.temp-pass__row { display: flex; gap: 2rem; align-items: flex-end; flex-wrap: wrap; }
.temp-pass__value { font-size: 1.25rem; font-weight: 700; letter-spacing: .04em; user-select: all; }
.actions--wrap { flex-wrap: wrap; justify-content: flex-end; }
.table--accounts { min-width: 900px; }
.table--log { min-width: 760px; }
.table--log td { padding: .5rem 1rem; }
.table-wrap--flat { box-shadow: none; margin-top: .6rem; }
.log { font-weight: 600; font-size: .85rem; }
.log--ok { color: var(--ok); } .log--warn { color: var(--outdated); } .log--err { color: var(--error); } .log--info { color: var(--text); }
.btn.is-copied { border-color: var(--ok); color: var(--ok); }

/* ---------- Divers ---------- */
.debug { text-align: left; background: #0b0f14; border: 1px solid var(--border); padding: 1rem; border-radius: 8px; overflow: auto; font-size: .8rem; }
.footer { padding: 1.5rem 0 2.5rem; color: var(--text-muted); font-size: .85rem; border-top: 1px solid var(--border); }

@media (max-width: 720px) {
    .hero h1 { font-size: 1.8rem; }
    .latest__version { font-size: 2rem; }
    .table th:nth-child(2), .table td:nth-child(2) { display: none; }
}
