:root {
  --bg: #f6f6f4;
  --card: #fff;
  --ink: #1b1b1b;
  --muted: #6b6b6b;
  --line: #e3e3df;
  --accent: #1d4ed8;
  --danger: #b42318;
  --ok: #067647;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px;
}
h1 {
  font-size: 20px;
  margin: 0;
}
h2 {
  font-size: 16px;
  margin: 0 0 12px;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
nav {
  display: flex;
  gap: 6px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.narrow {
  max-width: 380px;
  margin: 12vh auto;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.wide {
  grid-column: 1 / -1;
}
label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}
label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
input,
select {
  font: inherit;
  color: var(--ink);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  width: 100%;
}
input[type="checkbox"] {
  width: auto;
}
button {
  font: inherit;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button.ghost,
.tab {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.tab.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
button.danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
button.small,
a.small {
  padding: 4px 10px;
  font-size: 13px;
}
a {
  color: var(--accent);
}
.error {
  color: var(--danger);
  min-height: 1em;
  margin: 8px 0 0;
  font-size: 14px;
}
.okmsg {
  color: var(--ok);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
.row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 14px;
  align-items: center;
}
.row img {
  width: 72px;
  height: 72px;
  image-rendering: pixelated;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}
.row .meta {
  min-width: 0;
}
.row .meta div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.title {
  font-weight: 600;
}
.stat {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.stat b {
  font-size: 20px;
  display: block;
}
.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.badge {
  display: inline-block;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 99px;
  background: #eee;
  color: var(--muted);
  margin-left: 6px;
}
.badge.off {
  background: #fde8e7;
  color: var(--danger);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  max-width: 560px;
  width: calc(100% - 32px);
}
dialog::backdrop {
  background: rgb(0 0 0 / 0.35);
}
.dialog-body {
  padding: 18px;
}
.dialog-body img {
  width: 220px;
  height: 220px;
  display: block;
  margin: 0 auto 12px;
}
.bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 60px;
  margin: 8px 0;
}
.bars span {
  flex: 1;
  background: var(--accent);
  min-height: 1px;
  border-radius: 2px 2px 0 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
td {
  padding: 4px 0;
  border-top: 1px solid var(--line);
  vertical-align: top;
  word-break: break-all;
}
@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .row {
    grid-template-columns: 56px 1fr;
  }
  .row img {
    width: 56px;
    height: 56px;
  }
  .stat {
    grid-column: 1 / -1;
    text-align: left;
  }
}

/* ---------- statistiques ---------- */
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filters label { flex: 1 1 160px; }
.button-link { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); text-decoration: none; background: #fff; white-space: nowrap; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value { font-size: 30px; font-weight: 650; font-variant-numeric: tabular-nums; margin: 2px 0; }
.tile-sub { font-size: 12px; color: var(--muted); }
.chart-wrap { position: relative; }
.chart { width: 100%; height: 180px; display: block; }
.chart .bar { fill: var(--accent); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover { fill: rgb(29 78 216 / 0.07); }
.chart .hit:hover + .bar { fill: #1e3a8a; }
.chart .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.tops { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tops .card { margin-bottom: 0; }
.toplist table td { border-top: none; padding: 5px 0; word-break: normal; }
.toplist-label { width: 100%; padding-right: 10px !important; }
.toplist .num { text-align: right; font-variant-numeric: tabular-nums; padding-left: 8px !important; white-space: nowrap; }
.meter { height: 4px; background: var(--line); border-radius: 2px; margin-top: 4px; }
.meter span { display: block; height: 4px; background: var(--accent); border-radius: 2px; }
.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 6px; line-height: 1.45; }
.tip-title { font-weight: 600; }
.gastatus { font-size: 13px; padding: 8px 10px; border-radius: 6px; margin: 0 0 12px; }
.gastatus.ok { background: #ecfdf3; color: #054f31; }
.gastatus.warn { background: #fffaeb; color: #7a2e0e; }
.gastatus .bad { color: var(--danger); }
.badge.ok { background: #ecfdf3; color: #067647; }
.badge.warn { background: #fffaeb; color: #b54708; }
.credit { margin-top: 16px; }
@media (max-width: 900px) { .tops { grid-template-columns: 1fr 1fr; } .tiles { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .tops { grid-template-columns: 1fr; } .tile-value { font-size: 24px; } }
@media (max-width: 640px) { nav { flex-wrap: wrap; } nav button { padding: 6px 10px; font-size: 14px; } }

.gastatus code { background: rgb(0 0 0 / 0.06); padding: 1px 5px; border-radius: 4px; }
