/* Diagnostic de cybervigilance — page TNS, palette du site tchatnsign.com */
:root {
  --purple: #533589; --purple-light: #6b44a8; --purple-dark: #3d2766; --purple-deep: #30204d;
  --orange: #ff9500; --orange-dark: #e08600;
  --ink: #1e1e2e; --ink-2: #334155; --ink-3: #64748b; --ink-4: #94a3b8;
  --line: #e2e8f0; --line-strong: #cbd5e1;
  --paper: #ffffff; --ground: #f1f5f9; --tint: #f6f2fb;
  --green: #15803d; --green-soft: #dcfce7; --amber: #b45309; --amber-soft: #fef3c7; --red: #b91c1c; --red-soft: #fee2e2;
  --radius: 12px; --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(30, 30, 46, .06), 0 8px 24px rgba(30, 30, 46, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 16px/1.55 Arimo, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.01em; }
p { margin: 0; }
button { font: inherit; cursor: pointer; }
.wrap { width: min(760px, 100% - 32px); margin-inline: auto; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 13.5px; }
[hidden] { display: none !important; }

/* ── en-tête ─────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--purple-deep) 0%, var(--purple) 60%, var(--purple-dark) 100%);
  color: #fff; padding-block: 28px 34px;
}
.hero .brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.hero .logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; }
.hero .logo .mark { width: 30px; height: 30px; border-radius: 8px; background: var(--orange); display: grid; place-items: center; color: var(--purple-deep); font-weight: 900; font-size: 15px; }
.hero .live { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #ffd8a3; }
.hero .live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px rgba(255, 149, 0, .25); }
.hero .eyebrow { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #ffd8a3; margin-bottom: 8px; }
.hero h1 { font-size: clamp(26px, 5vw, 38px); font-weight: 800; text-wrap: balance; }
.hero h1 em { font-style: normal; color: var(--orange); }
.hero .lede { margin-top: 12px; color: #e8e2f3; max-width: 60ch; }
.hero .meta { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13.5px; color: #d6cbea; }

/* ── bandeau de salle ────────────────────────────────────── */
.room {
  margin-top: -18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.room .n { font-size: 22px; font-weight: 800; color: var(--purple); }
.room .lock { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-3); }

/* ── cartes ──────────────────────────────────────────────── */
main { padding-block: 22px 60px; display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 22px; }
.card h2 { font-size: 20px; font-weight: 800; }
.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.progress .bar { flex: 1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--purple), var(--orange)); transition: width .3s; }
.progress .volet { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--purple); }
.qtext { font-size: 20px; font-weight: 700; line-height: 1.3; text-wrap: balance; }
.options { display: flex; flex-direction: column; gap: 9px; margin-top: 18px; }
.opt {
  display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; align-items: start; text-align: left;
  padding: 13px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink);
  transition: border-color .12s, background .12s;
}
.opt:hover { border-color: var(--purple-light); background: var(--tint); }
.opt .k { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.opt.on { border-color: var(--purple); background: var(--tint); }
.opt.on .k { background: var(--purple); border-color: var(--purple); color: #fff; }
.opt:focus-visible { outline: 3px solid rgba(83, 53, 137, .35); outline-offset: 2px; }

.note { margin-top: 16px; padding: 14px 16px; border-left: 3px solid var(--orange); background: #fff8ec; border-radius: 0 var(--radius) var(--radius) 0; font-size: 15px; }
.note b { display: block; font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--amber); margin-bottom: 4px; }

.dist { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.dist .row { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 10px; align-items: center; font-size: 13.5px; }
.dist .row .lab { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dist .row .lab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.dist .row .lab i { display: block; height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; }
.dist .row .lab i b { display: block; height: 100%; background: var(--purple-light); transition: width .4s; }
.dist .row.you .lab i b { background: var(--orange); }
.dist .row .pct { text-align: right; font-weight: 700; color: var(--ink-2); }
.dist .cap { font-size: 12.5px; color: var(--ink-3); }

.nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 20px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--paper); color: var(--ink-2); font-weight: 700;
}
.btn:hover { border-color: var(--purple); color: var(--purple); }
.btn.primary { background: linear-gradient(135deg, var(--purple), var(--purple-dark)); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.orange { background: linear-gradient(135deg, var(--orange), var(--orange-dark)); border-color: transparent; color: #1e1e2e; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { border-color: transparent; }

/* ── résultat ────────────────────────────────────────────── */
.gauges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
@media (max-width: 520px) { .gauges { grid-template-columns: 1fr; } }
.gauge { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.gauge .t { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--purple); }
.gauge .v { font-size: 40px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.gauge .v small { font-size: 16px; color: var(--ink-3); font-weight: 600; }
.gauge .track { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; position: relative; }
.gauge .track i { display: block; height: 100%; background: linear-gradient(90deg, var(--purple), var(--orange)); }
.gauge .track .avg { position: absolute; top: -4px; width: 2px; height: 16px; background: var(--ink); }
.gauge .cmp { font-size: 13.5px; color: var(--ink-2); }
.level { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.level.a { background: var(--green-soft); color: var(--green); }
.level.b { background: #ede9fe; color: var(--purple); }
.level.c { background: var(--amber-soft); color: var(--amber); }
.level.d { background: var(--red-soft); color: var(--red); }

.hist { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; align-items: end; height: 96px; margin-top: 10px; }
.hist .col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; font-size: 12px; color: var(--ink-3); }
.hist .col i { display: block; width: 100%; border-radius: 6px 6px 0 0; background: var(--purple-light); min-height: 2px; }
.hist .col.you i { background: var(--orange); }
.hist .col b { font-weight: 700; color: var(--ink-2); }

.actions { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 10px; }
.actions li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--tint); }
.actions li .key { font-weight: 800; color: var(--purple); font-size: 13px; padding-top: 2px; }
.actions li .why { display: block; font-size: 13.5px; color: var(--ink-3); margin-top: 3px; }

.answers { margin-top: 12px; border-top: 1px solid var(--line); }
.answers .a { display: grid; grid-template-columns: 34px minmax(0, 1fr) 28px; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; align-items: start; }
.answers .a .n { color: var(--ink-4); font-weight: 700; }
.answers .a .q { color: var(--ink-2); }
.answers .a .r { color: var(--ink); margin-top: 2px; }
.answers .a .s { text-align: right; font-weight: 800; }
.s3 { color: var(--green); } .s2 { color: var(--purple); } .s1 { color: var(--amber); } .s0 { color: var(--red); }

.disclaimer { font-size: 13px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 18px; line-height: 1.5; }
footer { padding-block: 22px 40px; font-size: 13px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 6px 18px; }
footer a { color: var(--purple); }

/* ── animateur ───────────────────────────────────────────── */
body.animateur { background: var(--purple-deep); color: #fff; }
.anim { width: min(1400px, 100% - 40px); margin-inline: auto; padding-block: 24px 40px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
@media (max-width: 900px) { .anim { grid-template-columns: 1fr; } }
.anim .panel { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); border-radius: 20px; padding: 24px; backdrop-filter: blur(10px); }
.anim h1 { font-size: 26px; font-weight: 800; }
.anim .big { font-size: 64px; font-weight: 800; line-height: 1; color: var(--orange); }
.anim .qpick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.anim .qpick button { border: 1px solid rgba(255, 255, 255, .25); background: transparent; color: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700; }
.anim .qpick button.on { background: var(--orange); border-color: var(--orange); color: var(--purple-deep); }
.anim .qtext { font-size: 28px; margin-top: 18px; }
.anim .dist { margin-top: 22px; gap: 14px; }
.anim .dist .row { grid-template-columns: minmax(0, 1fr) 80px; font-size: 19px; }
.anim .dist .row .lab span { color: #fff; white-space: normal; }
.anim .dist .row .lab i { height: 14px; background: rgba(255, 255, 255, .12); }
.anim .dist .row .lab i b { background: var(--orange); }
.anim .dist .row .pct { color: #fff; font-size: 24px; }
.anim .hist { height: 140px; }
.anim .hist .col { color: #d6cbea; font-size: 13px; }
.anim .hist .col i { background: var(--orange); }
.anim .hist .col b { color: #fff; }
.anim .qr { display: grid; place-items: center; background: #fff; border-radius: 14px; padding: 12px; }
.anim .url { font-weight: 700; word-break: break-all; margin-top: 10px; color: #ffd8a3; }
.anim .kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 15px; margin-top: 12px; color: #e8e2f3; }
.anim .kv b { color: #fff; }

@media print {
  body { background: #fff; }
  .hero, .room, .nav, footer, [data-noprint] { display: none !important; }
  .card { box-shadow: none; border: 0; padding: 0; }
}

/* ── administration ──────────────────────────────────────── */
body.admin { background: var(--ground); }
.admin-wrap { width: min(1100px, 100% - 32px); margin-inline: auto; padding-block: 28px 60px; display: flex; flex-direction: column; gap: 18px; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.admin-head h1 { font-size: 26px; font-weight: 800; }
.eyebrow-dark { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--purple); margin-bottom: 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.tile .t { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--purple); }
.tile .v { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.tile .s { font-size: 13px; color: var(--ink-3); }
.tbl-wrap { overflow-x: auto; margin-top: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.qlist { display: flex; flex-direction: column; gap: 18px; margin-top: 14px; }
.qrow .qt { font-weight: 700; line-height: 1.4; }
.qrow .dist { margin-top: 10px; }
.qrow .dist .row.best .lab i b { background: var(--purple); }
.qrow .dist .row.worst .lab i b { background: var(--orange); }
.anim .kv .all { grid-column: 1 / -1; font-size: 13px; color: #d6cbea; margin-top: 4px; }
.md { margin-top: 16px; line-height: 1.6; max-width: 78ch; }
.md h1 { font-size: 22px; margin-top: 8px; }
.md h2 { font-size: 18px; margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); }
.md h3 { font-size: 15.5px; margin-top: 22px; color: var(--purple); }
.md p, .md ul, .md ol { margin-top: 8px; }
.md blockquote { margin: 10px 0; padding: 10px 14px; border-left: 3px solid var(--orange); background: #fff8ec; border-radius: 0 var(--radius) var(--radius) 0; }
.md table { border-collapse: collapse; width: 100%; margin-top: 10px; font-size: 14px; }
.md th, .md td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.md th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.md code { font-size: 13px; background: var(--tint); padding: 1px 5px; border-radius: 4px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.evform { margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--tint); }
.evform .field > span:first-child { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.evform input[type=text], .evform textarea { font: inherit; width: 100%; padding: 9px 11px; border: 1.5px solid var(--line-strong); border-radius: 8px; background: var(--paper); color: var(--ink); }
.evform textarea { min-height: 60px; resize: vertical; }
.evform input:focus, .evform textarea:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(83, 53, 137, .15); }
.field { display: flex; flex-direction: column; gap: 5px; }
.evlist { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.ev { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ev.closed { background: var(--ground); }
.ev-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ev-title { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.ev-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-2); align-items: center; }
.ev-links { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ev-links code, .ev code { font-size: 12.5px; background: var(--tint); padding: 2px 6px; border-radius: 4px; }
.ev-actions { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; }
.btn.danger { color: var(--red); }
.pill { display: inline-flex; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.off { background: var(--red-soft); color: var(--red); }
