/* Sentinelle — 3/3 : écrans (tableau de bord, fiche site, serveurs, découvertes, validation, nettoyage, maintenance). */

/* ---- tableau de bord : tuiles d'état (cliquables = filtre) ---- */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s3); margin: 0 0 var(--s6); }
.tile {
    position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: var(--s1);
    min-height: 0; padding: var(--s4) var(--s5); text-align: left; white-space: normal;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm); color: var(--text); font: inherit; overflow: hidden;
}
.tile::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--c); }
.tile:hover { background: var(--surface); border-color: color-mix(in srgb, var(--c) 45%, var(--border)); box-shadow: var(--shadow); }
.tile-label {
    order: -1; display: flex; align-items: center; gap: var(--s2);
    font-size: .8rem; font-weight: 500; color: var(--text-2);
}
.tile-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.tile-count { font-size: 1.85rem; font-weight: 700; line-height: 1.1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.filter-tiles .tile[aria-pressed="true"] {
    border-color: var(--c); background: color-mix(in srgb, var(--c) 7%, var(--surface));
    box-shadow: 0 0 0 1px var(--c), var(--shadow);
}
.filter-tiles .tile[aria-pressed="true"]::after {
    content: "Filtré"; position: absolute; top: var(--s3); right: var(--s3);
    padding: 0 6px; border-radius: 999px; font-size: .66rem; font-weight: 600;
    color: color-mix(in srgb, var(--c) 64%, var(--text)); background: color-mix(in srgb, var(--c) 15%, var(--surface));
}
.tiles-head { display: flex; align-items: baseline; gap: var(--s3); margin: 0 0 var(--s3); }
.tiles-head h2 { margin: 0; }

/* barre d'outils du parc (dans l'en-tête du panneau) */
.toolbar { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; flex: 1 1 520px; justify-content: flex-end; }
.toolbar input, .toolbar select { margin: 0; }
.toolbar input[type=search] { flex: 1 1 240px; max-width: 360px; }
.toolbar select { flex: 0 1 200px; width: auto; }
.chip-btn .chip { background: color-mix(in srgb, var(--text) 8%, transparent); }
.chip-btn[aria-pressed="true"] {
    --t: var(--warning); color: var(--t); font-weight: 600;
    background: color-mix(in srgb, var(--t) 11%, var(--surface)); border-color: color-mix(in srgb, var(--t) 40%, transparent);
}
.chip-btn[aria-pressed="true"] .chip { background: color-mix(in srgb, var(--t) 18%, transparent); color: inherit; }
.park-title { display: flex; align-items: center; gap: var(--s2); }

/* panneau « analyse complète » */
.scan-panel { margin: 0 0 var(--s5); }
.scan-panel .check { margin: 0; color: var(--text-2); font-weight: 400; }
.scan-run { margin-top: var(--s4); }
.scan-status { margin-top: var(--s2); }

/* constats compacts */
.mini-findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: .84rem; color: var(--text-2); }
.mini-findings li { position: relative; padding-left: 15px; line-height: 1.45; }
.mini-findings li::before {
    content: ""; position: absolute; left: 1px; top: .5em; width: 7px; height: 7px; border-radius: 50%; background: var(--c);
}
.ack-count { margin-top: var(--s1); }
#park-table td:nth-child(2) { min-width: 140px; }
#park-table .site-link { overflow-wrap: anywhere; }
#park-table td:nth-child(4) { min-width: 180px; }
#park-table td:nth-child(3) .pill { margin: 0 0 3px; white-space: normal; }
@media (min-width: 641px) {
    #park-table td.when { white-space: normal; min-width: 6.5rem; }
    #park-table td.actions > * { display: block; margin: 0 0 var(--s1); }
    #park-table td.actions .btn { width: 100%; justify-content: flex-start; }
}

/* ---- fiche site ---- */
.site-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); margin: var(--s1) 0 0; color: var(--text-3); }
.site-meta a { display: inline-flex; align-items: center; gap: 4px; }
.detail-state {
    display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); margin: 0 0 var(--s5);
    padding: var(--s4) var(--s5); background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--c); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.findings { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s2); }
.findings > li {
    display: flex; gap: var(--s4); align-items: flex-start; padding: var(--s4) var(--s5);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.findings > li > .badge { margin-top: 1px; min-width: 88px; }
.findings > li > .grow { flex: 1 1 auto; min-width: 0; }
.findings > li > .grow > strong { display: block; font-size: .92rem; }
.findings > li > .grow > .muted.small { margin-top: var(--s1); }
.findings > li details { margin-top: var(--s2); }
.findings > li.acked { background: var(--surface-2); }
.findings > li.acked > .badge, .findings > li.acked > .grow > strong { opacity: .6; }
.findings > li.acked > .grow > strong { text-decoration: line-through; font-weight: 500; }
.code { display: inline-block; margin-top: var(--s2); font: .72rem var(--mono); color: var(--text-3); background: var(--surface-3); padding: 1px 6px; border-radius: 4px; }
.ack-note { margin-top: var(--s2); font-size: .82rem; color: var(--success); }
.ack-note form { margin-left: var(--s2); }
.ack-form { margin-top: var(--s2); }
.ack-form summary { font-size: .8rem; }
.ack-row { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s2); }
.ack-row input[type=text] { flex: 1 1 18rem; min-width: 0; margin: 0; }
.ack-form p { margin: var(--s2) 0 0; }
ul.files { margin: var(--s2) 0 0; padding-left: var(--s5); font-size: .8rem; }
ul.files li { margin: 3px 0; word-break: break-all; }

/* historique */
.history {
    display: flex; gap: 3px; flex-wrap: wrap; align-items: flex-end; padding: var(--s4) var(--s5);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.tick { width: 12px; height: 28px; border-radius: 3px; display: inline-block; opacity: .9; }
.tick:hover { opacity: 1; transform: scaleY(1.08); }
.history + p { margin-top: var(--s2); }
.hist-list { list-style: none; margin: var(--s3) 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.hist-list li { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); align-items: center; padding: var(--s2) var(--s4); font-size: .86rem; border-top: 1px solid var(--border); }
.hist-list li:first-child { border-top: 0; }
.hist-list .when { min-width: 10.5rem; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---- serveurs : tendance 7 j ---- */
.trend { display: inline-flex; align-items: flex-end; gap: 2px; height: 22px; vertical-align: middle; }
.trend i { display: inline-block; width: 7px; border-radius: 2px 2px 0 0; background: var(--border-strong); }
.trend i.ok { background: color-mix(in srgb, var(--success) 70%, transparent); }
.trend i.bad { background: var(--danger); }
.trend i.none { height: 2px; }
.trend-wrap { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.trend-nums { font-size: .7rem; letter-spacing: .04em; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.servers { font-size: .86rem; }
table.servers th, table.servers td { padding-left: 12px; padding-right: 12px; }
table.servers .last-report { white-space: nowrap; }
table.servers td[data-label="Transfert"] { max-width: 16rem; overflow-wrap: break-word; }
table.servers .col-slug { display: none; }
table.servers .slug-inline { display: block; font-family: var(--mono); font-size: .72rem; }
table.servers td:first-child { min-width: 9rem; }
table.servers td[data-label="Transfert"] { min-width: 10rem; }
@media (min-width: 641px) and (max-width: 1499px) { table.servers .col-root { display: none; } }

/* ---- barres de revue (validation, nettoyage, découvertes) ---- */
.review-bar {
    display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); align-items: center; justify-content: space-between;
    padding: var(--s3) var(--s4); margin-bottom: var(--s3);
}
.review-counts, .review-filters { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.review-counts .pill { padding: 3px 10px; font-size: .78rem; }
.review-filters input:not([type=checkbox]), .review-filters select { width: auto; min-width: 11rem; margin: 0; }
.review-filters label { margin: 0; }
table.review td.decide { white-space: nowrap; }
table.review td.decide .btn + .btn { margin-left: var(--s1); }
table.review input.note, table.review input[type=text], table.review select { margin: 0; min-width: 9rem; font-size: .84rem; min-height: 32px; }
table.review td:nth-child(1) { min-width: 12rem; }
table.review:not(.cleanup) td:nth-child(6) { min-width: 15rem; }
.btn.sm.on { --t: var(--success); }
.btn.sm.off { --t: var(--danger); }
.btn.sm.on, .btn.sm.off {
    color: var(--t); font-weight: 600; background: color-mix(in srgb, var(--t) 12%, var(--surface));
    border-color: color-mix(in srgb, var(--t) 45%, transparent);
}
table.cleanup td:nth-child(3) { min-width: 18rem; }
.plan-list { margin: var(--s1) 0 var(--s4); padding-left: var(--s5); max-height: 18rem; overflow: auto; font-size: .88rem; }
.plan-list li { margin: 2px 0; }

/* ---- découvertes ---- */
table.disc { table-layout: fixed; }
table.disc th, table.disc td { padding: 10px; overflow-wrap: anywhere; }
table.disc th.disc-sel { width: 2.6rem; }
table.disc th:nth-child(2) { width: 16%; } table.disc th:nth-child(3) { width: 11%; } table.disc th:nth-child(4) { width: 11%; }
table.disc th:nth-child(5) { width: 16%; } table.disc th:nth-child(6) { width: 10%; } table.disc th:nth-child(7) { width: 13%; } table.disc th:nth-child(8) { width: 16%; }
table.disc .disc-sel { text-align: center; padding-left: 6px; padding-right: 6px; }
table.disc .disc-sel input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
table.disc tr.picked td { background: rgba(37, 99, 235, .10); }
.disc-bulk { position: sticky; top: var(--s2); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3);
    margin: 0 0 var(--s3); padding: var(--s3) var(--s4); }
.disc-bulk[hidden] { display: none; }
.disc-bulk-count { margin-right: auto; }
.disc-bulk-ignore { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--s1); }
label.check.disc-all-m { display: none; align-items: center; gap: var(--s2); margin: 0 0 var(--s2); }
.disc-bulk-ignore input[type=text] { width: 12rem; max-width: 100%; margin: 0; min-height: 30px; padding: 3px 8px; font-size: .82rem; }
table.disc td.disc-codes .pill { white-space: normal; font-family: var(--mono); font-size: .68rem; margin: 0 2px 3px 0; }
table.disc td.when { white-space: normal; }
table.disc .pill.srv { white-space: normal; text-align: left; }
table.disc tr.off td.disc-actions { opacity: 1; }
td.disc-actions form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); margin: 0 0 var(--s1); }
td.disc-actions .disc-ignore input[type=text] { flex: 1 1 5rem; width: auto; min-width: 0; margin: 0; min-height: 28px; padding: 3px 8px; font-size: .78rem; }
@media (min-width: 641px) and (max-width: 1400px) {
    table.disc .disc-when { display: none; }
    table.disc th:nth-child(2) { width: 21%; } table.disc th:nth-child(5) { width: 22%; } table.disc th:nth-child(8) { width: 19%; }
}
@media (min-width: 641px) and (max-width: 900px) { table.disc { table-layout: auto; } table.disc td.disc-actions { min-width: 10rem; } }
@media (max-width: 640px) {
    table.disc td.disc-sel { text-align: left; }
    label.check.disc-all-m { display: flex; }
    .disc-bulk { top: 64px; }
    .disc-bulk-count { flex: 1 0 100%; }
    .disc-bulk-ignore, .disc-bulk-ignore input[type=text] { flex: 1 1 auto; }
}

/* ---- maintenance ---- */
.mt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: var(--s4); margin: 0 0 var(--s4); }
.mt-grid .card + .card { margin-top: 0; }
.mt-grid .card h2 { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin: 0 0 var(--s2); font-size: .98rem; }
.mt-grid .card h3 { margin: 0 0 var(--s3); }
table.kv-table { font-size: .84rem; margin-top: var(--s2); }
table.kv-table td { padding: 5px var(--s2); }
table.kv-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.kv-table td.warn-text { color: var(--warning); }
pre.mt-log { max-height: 22rem; overflow: auto; font-size: .72rem; margin: var(--s2) 0 0; }
.mt-form { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.mt-form input { margin: 0; flex: 1 1 12rem; min-width: 0; }
.mt-form input[type=number] { flex: 0 0 6.5rem; }
.mt-result {
    margin-top: var(--s3); padding: var(--s3) var(--s4); font-size: .86rem; overflow-wrap: anywhere;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
}
.mt-tools { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.mt-tools p { flex-basis: 100%; margin: var(--s2) 0 0; }
.mt-grid .btn, .mt-tools .btn { white-space: normal; max-width: 100%; text-align: left; }

/* ---- formulaire site : aide skip_checks ---- */
.skip-help { margin-top: var(--s2); font-weight: 400; }
.skip-help summary { font-size: .8rem; }
.skip-codes {
    list-style: none; margin: var(--s2) 0 0; padding: var(--s3); display: grid; gap: 4px var(--s4);
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); font-size: .8rem;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
}

/* ---- responsive ---- */
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) {
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
    .tile { padding: var(--s3) var(--s4); }
    .tile-count { font-size: 1.5rem; }
    .toolbar { flex-basis: 100%; justify-content: stretch; }
    .toolbar input[type=search] { max-width: none; flex-basis: 100%; }
    .toolbar select { flex: 1 1 160px; }
    .review-filters input:not([type=checkbox]), .review-filters select { min-width: 0; width: 100%; }
    table.review td.decide { white-space: normal; }
    .mt-grid { grid-template-columns: 1fr; }
    dl.kv { grid-template-columns: 1fr; gap: 0; } dl.kv dd { margin-bottom: var(--s2); }
    .findings > li { flex-direction: column; gap: var(--s2); padding: var(--s4); }
    .hist-list .when { min-width: 0; width: 100%; }
}
@media (max-width: 640px) {
    #park-table td:nth-child(2), #park-table td:nth-child(4) { min-width: 0; }
    table.disc { table-layout: auto; }
    table.disc td.disc-actions::before, table.servers td.actions::before { display: none; }
    table.disc td.disc-actions { justify-content: flex-start; }
    td.disc-actions .disc-ignore input[type=text] { width: 100%; }
    table.review td:nth-child(1), table.review:not(.cleanup) td:nth-child(6), table.cleanup td:nth-child(3) { min-width: 0; }
}

/* ---- divers ---- */
.list-tools { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin: 0 0 var(--s3); }
.list-tools input[type=search] { margin: 0; flex: 0 1 380px; }
.site-url { overflow-wrap: anywhere; }
.summary-counts { margin-bottom: var(--s5); }
.notice-card { margin-top: var(--s4); }
.confirm-input { display: inline-block; max-width: 10rem; margin: 0 0 0 var(--s2); }
fieldset label:has(input[type=radio]) { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); }

/* ---- comptes : colonne actions + changement de mot de passe inline ---- */
table.accounts td.actions { white-space: normal; }
.acct-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s2) var(--s3); }
.acct-actions .pwd-change { width: auto; }
.acct-actions .pwd-change[open] { width: 100%; }
.pwd-change > summary { list-style: none; }
.pwd-change > summary::-webkit-details-marker { display: none; }
.pwd-change > summary::marker { content: ""; }
.pwd-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-top: var(--s2); justify-content: flex-end; }
.pwd-row input { width: auto; flex: 1 1 14rem; min-width: 0; margin: 0; min-height: 32px; }

/* Copies obsolètes (/obsoletes) — même table que Découvertes, colonnes propres */
table.disc.obs th:nth-child(1) { width: 19%; } table.disc.obs th:nth-child(2) { width: 13%; } table.disc.obs th:nth-child(3) { width: 21%; }
table.disc.obs th:nth-child(4) { width: 19%; } table.disc.obs th:nth-child(5) { width: 15%; } table.disc.obs th:nth-child(6) { width: 13%; }
.obs-path { overflow-wrap: break-word; }
table.disc.obs td .pill:not(.srv) { white-space: normal; }
