:root {
  color-scheme: light;
  --bg: #f4f4f1; --surface: #fcfcfb; --text: #0b0b0b; --text2: #52514e; --muted: #6b6a65;
  --line: #e3e2dc; --accent: #184f95; --accent-ink: #ffffff; --series-1: #2a78d6;
  --good: #0a7a0a; --bad: #c22f2f; --good-bg: #e3f4e3; --warn-bg: #fdefc8; --crit-bg: #fbe1e1; --info-bg: #e3edfb;
  --chip: #ecebe6;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111110; --surface: #1a1a19; --text: #f0efec; --text2: #c3c2b7; --muted: #9c9b93;
    --line: #2f2f2c; --accent: #86b6ef; --accent-ink: #0b0b0b; --series-1: #3987e5;
    --good: #3fc23f; --bad: #ef7c7c; --good-bg: #173417; --warn-bg: #3d3210; --crit-bg: #431c1c; --info-bg: #17293f;
    --chip: #2a2a27;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0; line-height: 1.2; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
p { margin: 0 0 .7rem; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.url { overflow-wrap: anywhere; }

.top { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; gap: .2rem 1.2rem; padding: .55rem 1rem; }
.brand { font-weight: 700; color: var(--text); white-space: nowrap; }
.brand span { font-weight: 400; color: var(--muted); }
.top nav, .tabs { display: flex; gap: .2rem; overflow-x: auto; scrollbar-width: none; }
.top nav a, .tabs a { padding: .4rem .7rem; border-radius: 8px; color: var(--text2); white-space: nowrap; }
.top nav a[aria-current], .tabs a[aria-current] { background: var(--chip); color: var(--text); font-weight: 600; }
.tabs { margin: 0 0 1rem; border-bottom: 1px solid var(--line); padding-bottom: .5rem; }

main { max-width: 1120px; margin: 0 auto; padding: 1rem; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .6rem; margin-bottom: .9rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 1rem; }
.grid2 > .card { margin-bottom: 0; }
.grid2 { margin-bottom: 1rem; }
.sitegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.sitegrid .card { margin: 0; }
.site header { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.site h2 { margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; margin-bottom: .6rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; min-width: 0; }
.kpi-label { font-size: .8rem; color: var(--muted); }
.kpi-value { font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.25; white-space: nowrap; }
.kpi-sub { font-size: .8rem; min-height: 1.2em; }
.kpis.mini { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: .5rem .4rem; margin: .4rem 0 0; }
.kpis.mini .kpi { border: 0; padding: 0; background: none; }
.kpis.mini .kpi-value { font-size: 1.1rem; }

.trend { font-variant-numeric: tabular-nums; white-space: nowrap; }
.trend.good { color: var(--good); } .trend.bad { color: var(--bad); } .trend.flat { color: var(--muted); }

.badge { display: inline-block; padding: .05rem .45rem; border-radius: 999px; background: var(--chip); color: var(--text2); font-size: .76rem; font-weight: 600; white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warning { background: var(--warn-bg); color: var(--text); }
.badge.critical { background: var(--crit-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--accent); }
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { display: flex; gap: .6rem; align-items: baseline; padding: .4rem 0; border-top: 1px solid var(--line); }
.alerts li:first-child { border-top: 0; }
.alerts .badge { flex: none; min-width: 4.6rem; text-align: center; }

.scroll { overflow-x: auto; margin: 0 -.2rem; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; padding: .35rem .5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: break-word; }
.tbl td:first-child { min-width: 8.5rem; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr.off { opacity: .6; }
.empty { color: var(--muted); padding: .6rem 0; margin: 0; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg a { padding: .35rem .7rem; color: var(--text2); font-size: .88rem; }
.seg a[aria-current] { background: var(--accent); color: var(--accent-ink); }

.btn { display: inline-block; font: inherit; font-weight: 600; padding: .5rem .9rem; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: default; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-top: .6rem; }
.row.end { justify-content: flex-end; }
.row label { flex: 1 1 160px; }
.stack { display: grid; gap: .8rem; }
label { display: grid; gap: .25rem; font-size: .86rem; color: var(--text2); font-weight: 600; }
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
input, select, textarea { font: inherit; font-size: 16px; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text); width: 100%; min-width: 0; }
input[type=checkbox] { width: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.err { color: var(--bad); font-weight: 400; }
.count { font-weight: 400; color: var(--muted); }
.count.over { color: var(--bad); }

.flash { padding: .6rem .8rem; border-radius: 10px; margin-bottom: 1rem; background: var(--info-bg); }
.flash.ok { background: var(--good-bg); } .flash.error { background: var(--crit-bg); }
.login { max-width: 340px; margin: 12vh auto 0; display: grid; gap: 1rem; }
.steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .4rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0 .7rem; }
.chip { font: inherit; font-size: .84rem; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 999px; padding: .25rem .65rem; cursor: pointer; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .84rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .15rem .4rem; overflow-wrap: anywhere; }
output.code { display: block; padding: .5rem .6rem; min-height: 2.2rem; }
.copylist { list-style: none; margin: 0 0 .5rem; padding: 0; }
.copylist li { display: flex; justify-content: space-between; gap: .6rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.reviews { list-style: none; padding: 0; margin: 0; }
.reviews li { border-top: 1px solid var(--line); padding: .6rem 0; }
.reviews p { margin: .25rem 0 0; color: var(--text2); }
.advice { border-top: 1px solid var(--line); padding: .55rem 0; }
.advice summary { cursor: pointer; font-weight: 600; }
.advice p { margin: .5rem 0; color: var(--text2); }
.advice ol { margin: 0; padding-left: 1.2rem; }

.serp { border: 1px solid var(--line); border-radius: 10px; padding: .8rem; margin-top: .8rem; background: var(--bg); max-width: 600px; }
.serp-url { font-size: .8rem; color: var(--text2); overflow-wrap: anywhere; }
.serp-title { font-size: 1.15rem; color: var(--accent); margin: .1rem 0; }
.serp-desc { font-size: .88rem; color: var(--text2); }

/* Diagramme */
.chart { margin: 0; }
.chart figcaption { font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.chart .plot { position: relative; }
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--series-1); opacity: .1; }
.chart .dot { fill: var(--series-1); }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .marker { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .tip { position: absolute; top: 0; pointer-events: none; background: var(--text); color: var(--surface); font-size: .8rem; padding: .2rem .5rem; border-radius: 6px; white-space: nowrap; transform: translateX(-50%); }
.spark polyline { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

@media (max-width: 520px) {
  main { padding: .8rem .7rem; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi-value { font-size: 1.25rem; }
  .card { padding: .85rem; }
}
