:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #17202c;
  --muted: #5d6b7c;
  --line: #dde3ea;
  --accent: #0d5bd7;
  --accent-soft: #e6effd;
  --good: #1a8a4a;
  --good-soft: #e5f5ec;
  --bad: #c0362c;
  --bad-soft: #fbeae8;
  --mid: #b7791f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b;
    --card: #18202a;
    --text: #e7ecf2;
    --muted: #9aa8b8;
    --line: #2a3542;
    --accent: #5b9bff;
    --accent-soft: #1a2a44;
    --good: #4cc47e;
    --good-soft: #15301f;
    --bad: #f07067;
    --bad-soft: #3a1c1a;
    --mid: #e0a84a;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
main { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.7rem; line-height: 1.25; margin: 0 0 12px; }
h2 { font-size: 1.25rem; margin: 0 0 12px; }
h3 { font-size: 1.05rem; margin: 4px 0 10px; }

.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; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); font-size: 1.1rem; }
.brand small { color: var(--muted); font-weight: 500; }
.logo { color: var(--accent); }
nav { display: flex; align-items: center; gap: 14px; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row.center { justify-content: center; margin-top: 16px; }
.meta { color: var(--muted); font-size: .9rem; margin: 0 0 6px; }
.note { background: var(--accent-soft); padding: 10px 14px; border-radius: 8px; }
.inline { display: inline; margin: 0; }

.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 11px 20px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; }

.hero { margin-bottom: 20px; }
.hero p { color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 600; margin-bottom: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; cursor: pointer; }
.opt span { flex: 1; }
.opt em { float: right; margin-left: 8px; color: var(--muted); font-style: normal; font-size: .9rem; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt input { margin-top: 4px; accent-color: var(--accent); }
.answer b { color: var(--accent); margin-right: 4px; }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: 6px 16px; cursor: pointer; }
.pill:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pill input { accent-color: var(--accent); }

.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 12px; }
.progress div { height: 100%; background: var(--accent); }
.question h2 { font-size: 1.2rem; line-height: 1.4; }

.score { text-align: center; }
.big { font-size: 3rem; font-weight: 800; }
.big.good { color: var(--good); } .big.mid { color: var(--mid); } .big.bad { color: var(--bad); }
table { width: 100%; border-collapse: collapse; text-align: left; }
td, th { padding: 7px 6px; border-bottom: 1px solid var(--line); font-size: .95rem; }
.themes td:nth-child(2) { white-space: nowrap; width: 70px; }
td.bar { width: 35%; }
td.bar div { height: 8px; background: var(--good); border-radius: 99px; min-width: 2px; }
.history { font-size: .9rem; }

.review { border-left: 4px solid var(--line); }
.review.ok { border-left-color: var(--good); }
.review.ko { border-left-color: var(--bad); }
.review ul { list-style: none; padding: 0; margin: 0; }
.review li { padding: 6px 10px; border-radius: 6px; margin-bottom: 4px; }
.review li.right { background: var(--good-soft); font-weight: 600; }
.review li.wrong { background: var(--bad-soft); text-decoration: line-through; }
.review li em { font-weight: 400; color: var(--muted); }
.expl { margin: 10px 0 0; color: var(--muted); font-size: .92rem; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { text-align: center; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { color: var(--muted); font-size: .9rem; }

.auth { max-width: 420px; margin: 0 auto; }
.auth label { display: block; margin-bottom: 14px; font-weight: 600; font-size: .95rem; }
.auth input:not([type=hidden]) { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--bg); color: var(--text); }
.auth .btn { width: 100%; margin: 6px 0 12px; }
.error { background: var(--bad-soft); color: var(--bad); padding: 10px 12px; border-radius: 8px; }

@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  h1 { font-size: 1.4rem; }
  .big { font-size: 2.4rem; }
}
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 10px; }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }

/* Brand logos (image in public/logos/, or lettered badge) */
.logo-img, .logo-badge { display: inline-flex; vertical-align: middle; margin-right: 8px; height: 24px; }
.logo-img { width: auto; max-width: 72px; object-fit: contain; }
.logo-badge { width: 24px; border-radius: 6px; align-items: center; justify-content: center; font-size: .7rem; font-weight: 800; color: #fff; background: #5d6b7c; letter-spacing: -.02em; }
.meta .logo-img, .meta .logo-badge { height: 18px; }
.meta .logo-badge { width: 18px; font-size: .58rem; }
.b-genetec { background: #1f3a5f; }
.b-vanderbilt { background: #00857c; }
.b-stid { background: #c8102e; }
.b-ajax { background: #111; }
.b-alarm-com { background: #0072ce; }
.b-eden-innovations { background: #6a9a1f; }
.b-vauban-systems { background: #2b4c9b; }
.b-knx { background: #5b8f22; }

/* Problem reports */
.report { display: inline-block; margin-top: 12px; font-size: .85rem; color: var(--muted); }
.question .report { margin-left: 16px; }
.comment { background: var(--bg); border-radius: 8px; padding: 10px 12px; margin: 10px 0 0; }
.auth select, .auth textarea { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--bg); color: var(--text); }
footer p { margin: 4px 0; }

/* Back office */
.admin-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.admin-nav a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: .9rem; background: var(--card); }
.admin-nav a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; font-size: .85rem; font-weight: 600; gap: 4px; }
.filters select, .filters input:not([type=checkbox]) { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--bg); color: var(--text); min-width: 140px; }
.filters label.check { flex-direction: row; align-items: center; padding-bottom: 8px; }
.qlist { display: flex; flex-direction: column; }
.qrow { display: block; text-decoration: none; color: var(--text); padding: 14px 16px; margin-bottom: 8px; }
.qrow:hover { border-color: var(--accent); }
.qrow.off { opacity: .6; }
.qtext { display: block; font-weight: 600; margin: 2px 0 4px; }
.flag { color: var(--bad); }
.auth.wide { max-width: 720px; }
.auth label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.auth label.check input { width: auto; margin: 0; }
.choice-row { border-top: 1px solid var(--line); padding-top: 10px; }
.choice-row label.check { margin-bottom: 4px; font-size: .85rem; color: var(--muted); }
.card.danger { max-width: 720px; margin: 0 auto 16px; border-color: var(--bad); }
.btn.danger { background: var(--bad); }
.errors { color: var(--bad); font-size: .9rem; }
code { font-size: .85em; background: var(--bg); padding: 1px 4px; border-radius: 4px; }

/* Admin: members */
a.stat { color: inherit; text-decoration: none; }
a.stat:hover b { color: var(--accent); }
.members td { vertical-align: top; }
.members .meta { font-size: .85rem; word-break: break-all; }
@media (max-width: 640px) {
  .members th:nth-child(2), .members td:nth-child(2), .members th:nth-child(5), .members td:nth-child(5) { display: none; }
}

/* Admin: categories */
.logo-preview { display: block; max-height: 48px; max-width: 160px; margin: 6px 0; }
.auth fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 0; display: grid; gap: 10px; }
.auth label.check select { width: auto; flex: 1; }
.cats td:first-child { white-space: nowrap; }
