:root {
  --vert: #3b8c2a; --vert-f: #2c6b1f; --fond: #f3f5f1; --carte: #fff; --texte: #1d2419; --gris: #667060;
  --bord: #dfe4da; --rouge: #c0392b; --jaune: #fff4cc; --rayon: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--fond); color: var(--texte); font-size: 16px; line-height: 1.4; padding-bottom: 90px; }
.top { background: #1f2a1f; color: #fff; position: sticky; top: 0; z-index: 10; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px 6px; max-width: 900px; margin: 0 auto; }
h1 { font-size: 1.1rem; margin: 0; }
.chip { font-size: .85rem; padding: 3px 10px; border-radius: 999px; background: #445; white-space: nowrap; }
.chip.on { background: var(--vert); } .chip.off { background: #7a3b33; } .chip.wait { background: #8a6d1f; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 10px 8px; max-width: 900px; margin: 0 auto; scrollbar-width: none; }
.tabs button { flex: 0 0 auto; background: transparent; color: #cfe3c8; border: 0; padding: 8px 12px; border-radius: 8px; font-size: .95rem; cursor: pointer; }
.tabs button.on { background: #fff; color: #1f2a1f; font-weight: 600; }
main { max-width: 900px; margin: 0 auto; padding: 12px; }
.banner { background: var(--jaune); border-bottom: 1px solid #e8d48a; padding: 10px 16px; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.card { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px 16px; margin-bottom: 12px; }
.card h2 { font-size: 1.05rem; margin: 0 0 10px; }
.card h3 { font-size: .95rem; margin: 14px 0 6px; color: var(--gris); }
.muted { color: var(--gris); font-size: .9rem; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--bord); }
.row:first-of-type { border-top: 0; }
.row .lab { flex: 1 1 auto; min-width: 0; }
.row .lab b { font-weight: 500; display: block; word-break: break-word; }
.row .lab small { color: var(--gris); display: block; }
.row .ctl { flex: 0 0 auto; display: flex; gap: 6px; align-items: center; }
.row.changed { background: #f2f8ee; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 8px; }
.row.col { flex-direction: column; align-items: stretch; }
.row.col .ctl { width: 100%; }
@media (max-width: 560px) {
  .row:has(.wide), .row:has(select) { flex-direction: column; align-items: stretch; }
  .row:has(.wide) .ctl, .row:has(select) .ctl { width: 100%; }
  .wide input[type=text], select { width: 100%; max-width: 100%; }
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--fond); border-radius: 10px; padding: 10px; }
.stat span { display: block; font-size: .8rem; color: var(--gris); }
.stat b { font-size: 1.05rem; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn { background: var(--vert); color: #fff; border: 0; border-radius: 9px; padding: 10px 14px; font-size: .95rem; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { background: var(--vert-f); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--vert-f); border: 1px solid var(--bord); }
.btn.danger { background: var(--rouge); }
.btn.small { padding: 6px 10px; font-size: .85rem; }
input[type=text], input[type=number], select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--bord); border-radius: 8px; background: #fff; max-width: 100%; }
input[type=number] { width: 110px; }
select { max-width: 240px; }
textarea { width: 100%; min-height: 70px; }
.wide input[type=text] { width: min(320px, 55vw); }
.switch { position: relative; display: inline-block; width: 50px; height: 28px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #c9cfc4; border-radius: 999px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--vert); }
.switch input:checked + span::before { transform: translateX(22px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--bord); }
.list li:first-child { border-top: 0; }
.add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.add input { flex: 1 1 160px; }
.badge { font-size: .75rem; background: var(--vert); color: #fff; border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
details { border-top: 1px solid var(--bord); }
details > summary { cursor: pointer; padding: 10px 0; font-weight: 600; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; color: var(--gris); }
details[open] > summary::before { content: "▾ "; }
details .inner { padding-left: 12px; border-left: 2px solid var(--bord); margin-left: 4px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.seg button { border: 1px solid var(--bord); background: #fff; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: .9rem; }
.seg button.on { background: var(--vert); color: #fff; border-color: var(--vert); }
.search { width: 100%; margin-bottom: 8px; }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; background: #1f2a1f; color: #fff; display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 14px; z-index: 20; flex-wrap: wrap; }
.savebar span { margin-right: auto; }
.savebar .btn.ghost { color: #fff; border-color: #556; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 80px; background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; max-width: 92vw; z-index: 30; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.toast.err { background: var(--rouge); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 16px; }
.modal-box { background: #fff; border-radius: var(--rayon); padding: 18px; max-width: 440px; width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.empty { color: var(--gris); font-style: italic; padding: 6px 0; }
.locked { color: var(--gris); font-size: .85rem; }
code { background: var(--fond); padding: 1px 5px; border-radius: 5px; font-size: .9em; }
@media (prefers-color-scheme: dark) {
  :root { --fond: #151a14; --carte: #1e251c; --texte: #e8eee4; --gris: #9aa594; --bord: #2f3a2c; --jaune: #3d3517; }
  input[type=text], input[type=number], select, textarea { background: #11160f; color: var(--texte); }
  .seg button { background: #11160f; color: var(--texte); }
  .row.changed { background: #22301d; }
  .modal-box { background: var(--carte); }
  .banner { border-color: #6b5a1f; }
  .tabs button.on { background: var(--fond); color: var(--texte); }
}

/* Plugins */
#modale-texte { white-space: pre-line; }
.plugin { padding: 12px 14px; }
.plugin-row { display: flex; gap: 12px; align-items: flex-start; }
.plugin-icon { width: 48px; height: 48px; border-radius: 10px; flex: 0 0 48px; object-fit: cover; background: var(--fond); }
.plugin-txt { flex: 1 1 auto; min-width: 0; }
.plugin-txt b { font-weight: 600; }
.plugin-txt .desc { margin: 4px 0 6px; font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.plugin-act { flex: 0 0 auto; }
.compat { font-size: .8rem; border-radius: 999px; padding: 2px 9px; display: inline-block; }
.compat.oui { background: #e3f3dc; color: #2c6b1f; }
.compat.non { background: #ffe3cc; color: #9a3b00; font-weight: 600; }
.card.alerte, .list li.alerte { border-left: 5px solid #e8740c; background: #fff6ee; }
.list li.alerte { padding-left: 8px; }
.btn.warn { background: #e8740c; }
.btn.warn:hover { background: #c45f06; }
.btns.tight { margin-top: 0; justify-content: flex-end; }
@media (max-width: 560px) { .plugin-row { flex-wrap: wrap; } .plugin-act { width: 100%; } .plugin-act .btn { width: 100%; } .list li { flex-wrap: wrap; } }
@media (prefers-color-scheme: dark) {
  .card.alerte, .list li.alerte { background: #3a2412; }
  .compat.oui { background: #22381b; color: #b9e2a8; }
  .compat.non { background: #4a2a10; color: #ffc59a; }
}
.list .lab small { display: block; }
