/* ---------- Jetons de design ---------- */
:root {
  color-scheme: light;
  --bg: #f3f6f4;
  --surface: #ffffff;
  --surface-2: #eef3f0;
  --text: #16211e;
  --muted: #5f6d68;
  --line: #dde5e0;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --primary-ink: #ffffff;
  --primary-soft: #d8efeb;
  --accent: #ef6a4c;
  --accent-ink: #ffffff;
  --accent-soft: #fde6df;
  --good: #0ca30c;
  --good-text: #006300;
  --good-soft: #e3f6e3;
  --warn: #fab219;
  --warn-text: #7a5200;
  --warn-soft: #fff2d3;
  --partial: #ec835a;
  --partial-text: #8a3a1c;
  --partial-soft: #fde8df;
  --bad: #d03b3b;
  --bad-text: #9a2626;
  --bad-soft: #fbe2e2;
  --chart-1: #2a78d6;
  --grid: #e1e0d9;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 28px rgba(22, 33, 30, 0.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1513;
    --surface: #182019;
    --surface-2: #1f2a25;
    --text: #eef3ef;
    --muted: #a3b3ac;
    --line: #2b3832;
    --primary: #2bb3a4;
    --primary-strong: #5ccdc0;
    --primary-ink: #06201d;
    --primary-soft: #163b37;
    --accent: #ff8a6d;
    --accent-ink: #2b120b;
    --accent-soft: #3d2219;
    --good-text: #4fd24f;
    --good-soft: #163d16;
    --warn-text: #ffd27a;
    --warn-soft: #3d3012;
    --partial-text: #ffb595;
    --partial-soft: #3f2418;
    --bad-text: #ff8c8c;
    --bad-soft: #3f1d1d;
    --chart-1: #3987e5;
    --grid: #2c2c2a;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 16px;
}
a { color: var(--primary-strong); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.4em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75em; }
ul, ol { margin: 0 0 0.75em; padding-left: 1.3em; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.eyebrow { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.3em; font-weight: 600; }
.hidden { display: none !important; }
.loading { padding: 3rem; text-align: center; color: var(--muted); }
.error { color: var(--bad-text); font-weight: 600; min-height: 1.4em; margin: 0.5em 0 0; }
.note { color: var(--muted); font-size: 0.93rem; }
sup { font-size: 0.7em; }

/* ---------- Barre du haut ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1040px; margin: 0 auto; padding: 0.55rem 16px; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { font-weight: 800; text-decoration: none; color: var(--text); font-size: 1.05rem; display: flex; gap: 0.4rem; align-items: center; }
.nav { display: flex; gap: 0.25rem; flex: 1; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--muted); padding: 0.4rem 0.7rem; border-radius: 999px; font-weight: 600; font-size: 0.95rem; }
.nav a.active, .nav a:hover { background: var(--primary-soft); color: var(--primary-strong); }
.user { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.user-name { font-weight: 700; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-weight: 800; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.4rem; }
.footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 2rem 16px 3rem; }

/* ---------- Mise en page ---------- */
.container { max-width: 1040px; margin: 0 auto; padding: 1.25rem 16px 2rem; }
.hero { margin: 0.5rem 0 1.25rem; }
.hero p { color: var(--muted); font-size: 1.05rem; max-width: 60ch; }
.grid { display: grid; gap: 1rem; }
.grid.cards { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
.grid > .card { margin-top: 0; }
section.block { margin-top: 1.75rem; }
section.block > h2 { margin-bottom: 0.75rem; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.9rem; }

/* ---------- Boutons et champs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.6rem 1.05rem; border-radius: 999px; border: 1px solid transparent; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; background: var(--surface-2); color: var(--text); transition: transform 0.08s ease, background 0.15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.88rem; }
.input, select.input, textarea.input { width: 100%; padding: 0.7rem 0.85rem; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 1rem; }
.input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
label.field { display: block; font-weight: 600; margin-bottom: 0.8rem; }
label.field .input { margin-top: 0.3rem; font-weight: 400; }
.switch { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font-weight: 600; }
.switch input { width: 44px; height: 24px; appearance: none; background: var(--line); border-radius: 999px; position: relative; cursor: pointer; margin: 0; transition: background 0.15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left 0.15s; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.switch input:checked { background: var(--good); }
.switch input:checked::after { left: 23px; }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 16px; }
.login-card { width: 100%; max-width: 480px; background: var(--surface); border-radius: 24px; padding: 2rem 1.6rem; box-shadow: var(--shadow); border: 1px solid var(--line); text-align: center; }
.login-brand .emoji { font-size: 3rem; line-height: 1; }
.login-brand h1 { margin-top: 0.4rem; }
.login-brand p { color: var(--muted); }
.login-q { font-weight: 700; margin-top: 1.2rem; }
.accounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.account { background: var(--surface-2); border: 2px solid transparent; border-radius: var(--radius); padding: 0.9rem 0.4rem; cursor: pointer; display: grid; justify-items: center; gap: 0.3rem; font: inherit; color: var(--text); }
.account strong { font-size: 1rem; }
.account small { color: var(--muted); }
.account.selected, .account:hover { border-color: var(--primary); background: var(--primary-soft); }
.login-form { margin-top: 1.2rem; text-align: left; }
.login-form label { font-weight: 600; display: block; margin-bottom: 0.4rem; }
.login-form .btn { width: 100%; margin-top: 0.8rem; }
@media (max-width: 420px) { .accounts { grid-template-columns: 1fr; } .account { grid-template-columns: auto 1fr; justify-items: start; text-align: left; } }
@media (max-width: 640px) {
  .topbar-inner { display: grid; grid-template-columns: 1fr auto; gap: 0.35rem 0.5rem; padding: 0.5rem 16px; }
  .brand { grid-row: 1; }
  .user { grid-row: 1; margin-left: 0; }
  .user-name { display: none; }
  .nav { grid-column: 1 / -1; grid-row: 2; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 0.3rem 0.65rem; font-size: 0.9rem; }
  .runner-nav { display: grid; grid-template-columns: 1fr 1fr; }
  .runner-nav > .muted { grid-column: 1 / -1; text-align: center; order: -1; }
  h1 { font-size: 1.45rem; }
}

/* ---------- Cartes de contrôle ---------- */
.quiz-card { display: grid; grid-template-columns: auto 1fr; gap: 1rem; }
.quiz-icon { font-size: 2.2rem; width: 64px; height: 64px; display: grid; place-items: center; background: var(--primary-soft); border-radius: 18px; }
.quiz-card h2 { margin-top: 0.1rem; }
.meta { list-style: none; padding: 0; margin: 0.5rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; color: var(--muted); font-size: 0.92rem; }
.meta li { display: inline-flex; gap: 0.3rem; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.65rem; border-radius: 999px; background: var(--surface-2); font-size: 0.85rem; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }

/* ---------- Passage du contrôle ---------- */
.runner-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 0.6rem; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; background: var(--surface); border: 1px solid var(--line); padding: 0.35rem 0.75rem; border-radius: 999px; white-space: nowrap; }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 1rem; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.25s ease; }
.question .prompt { font-size: 1.2rem; margin: 0.3rem 0 0.9rem; }
.notion-tag { font-size: 0.8rem; color: var(--muted); font-weight: 600; margin: 0; }
.figure { margin: 0 0 1rem; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 0.6rem; max-width: 460px; }
.figure svg { width: 100%; height: auto; }
.figure figcaption { font-size: 0.85rem; color: #52514e; margin-top: 0.4rem; }
.hint { background: var(--warn-soft); color: var(--warn-text); padding: 0.5rem 0.8rem; border-radius: var(--radius-sm); font-size: 0.93rem; }
.options { display: grid; gap: 0.55rem; }
.option { display: flex; align-items: center; gap: 0.8rem; text-align: left; width: 100%; background: var(--surface-2); border: 2px solid transparent; border-radius: 14px; padding: 0.8rem 0.95rem; font: inherit; font-size: 1rem; color: var(--text); cursor: pointer; }
.option:hover { border-color: var(--line); }
.option.selected { border-color: var(--primary); background: var(--primary-soft); }
.option .mark { flex: none; width: 22px; height: 22px; border: 2px solid var(--muted); border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; background: var(--surface); }
.option .mark.square { border-radius: 6px; }
.option.selected .mark { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.order-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.45rem; }
.order-list li { display: flex; align-items: center; gap: 0.7rem; background: var(--surface-2); border-radius: 12px; padding: 0.55rem 0.7rem; }
.order-num { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; font-weight: 800; flex: none; }
.order-text { flex: 1; font-weight: 600; }
.order-btns { display: flex; gap: 0.25rem; }
.order-btns button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 1rem; cursor: pointer; color: var(--text); }
.order-btns button:disabled { opacity: 0.3; cursor: default; }
.match { display: grid; gap: 0.6rem; }
.match-row { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr; gap: 0.6rem; align-items: center; background: var(--surface-2); padding: 0.55rem 0.7rem; border-radius: 12px; font-weight: 600; }
.match-row select { font-weight: 400; }
@media (max-width: 560px) { .match-row { grid-template-columns: 1fr; } }
.runner-nav { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; }
.dots { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 1rem; }
.dot { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); font: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer; color: var(--muted); }
.dot.done { background: var(--primary-soft); color: var(--primary-strong); border-color: var(--primary-soft); }
.dot.current { border-color: var(--primary); color: var(--primary-strong); box-shadow: 0 0 0 2px var(--primary-soft); }

/* ---------- Résultat et correction ---------- */
.score-hero { display: grid; grid-template-columns: auto 1fr; gap: 1.5rem; align-items: center; }
.score-ring { width: 150px; height: 150px; position: relative; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .value { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 800; font-size: 1.9rem; line-height: 1; }
.score-ring .value small { display: block; font-size: 0.85rem; color: var(--muted); font-weight: 600; margin-top: 0.2rem; }
.score-msg { font-size: 1.35rem; font-weight: 800; margin-bottom: 0.3rem; }
.stats-inline { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; color: var(--muted); font-weight: 600; }
.stats-inline b { color: var(--text); }
@media (max-width: 560px) { .score-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; } .stats-inline { justify-content: center; } }
.badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.82rem; font-weight: 700; white-space: nowrap; }
.badge.correct { background: var(--good-soft); color: var(--good-text); }
.badge.partial { background: var(--partial-soft); color: var(--partial-text); }
.badge.wrong { background: var(--bad-soft); color: var(--bad-text); }
.badge.blank { background: var(--surface-2); color: var(--muted); }
.badge.info { background: var(--primary-soft); color: var(--primary-strong); }
.badge.warn { background: var(--warn-soft); color: var(--warn-text); }
.qcard { border-left: 6px solid var(--line); }
.qcard.correct { border-left-color: var(--good); }
.qcard.partial { border-left-color: var(--partial); }
.qcard.wrong { border-left-color: var(--bad); }
.qcard.blank { border-left-color: var(--muted); }
.qcard.practice { border-left-color: var(--primary); }
/* Exercices pratiques (non notés) : consignes numérotées, grande zone de texte, réponse conservée telle quelle */
ol.steps { margin: 0.2rem 0 0.9rem; padding-left: 1.4rem; }
ol.steps li { margin: 0.3rem 0; }
textarea.input.libre { min-height: 11rem; resize: vertical; line-height: 1.45; }
.practice-answer { background: var(--surface-2); border-radius: 12px; padding: 0.6rem 0.8rem; margin: 0.6rem 0; }
.practice-answer h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.3rem; }
.practice-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 26rem; overflow-y: auto; font-size: 0.95rem; line-height: 1.45; }
.practice-item summary { cursor: pointer; }
.practice-item .practice-text { background: var(--surface-2); border-radius: 12px; padding: 0.6rem 0.8rem; margin-top: 0.6rem; }
.qcard header { display: flex; flex-wrap: wrap; gap: 0.5rem 0.8rem; align-items: center; margin-bottom: 0.5rem; color: var(--muted); font-size: 0.9rem; }
.qcard .prompt { font-weight: 700; font-size: 1.05rem; }
.qcard .figure { max-width: 340px; }
.answer-cmp { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; margin: 0.6rem 0; }
.answer-cmp > div { background: var(--surface-2); border-radius: 12px; padding: 0.6rem 0.8rem; }
.answer-cmp h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.3rem; }
.answer-cmp ul { margin: 0; padding-left: 1.1em; }
.why { background: var(--bad-soft); color: var(--bad-text); border-radius: 12px; padding: 0.6rem 0.8rem; margin: 0.5rem 0; }
.explain { background: var(--primary-soft); color: var(--text); border-radius: 12px; padding: 0.6rem 0.8rem; margin: 0.5rem 0 0; }
.explain b, .why b { display: block; margin-bottom: 0.15rem; }
.flags { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ---------- Ressources ---------- */
.resources { display: grid; gap: 0.7rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.resource { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0.8rem 0.95rem; }
.resource:hover { border-color: var(--primary); }
.resource .type { font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.resource strong { display: block; margin: 0.2rem 0; color: var(--primary-strong); }
.resource p { margin: 0; font-size: 0.92rem; color: var(--muted); }

/* ---------- Leçon ---------- */
.fiche { max-width: 760px; }
.fiche .card { margin-top: 1rem; }
.fiche h2 { color: var(--primary-strong); }
.fiche p, .fiche li { font-size: 1.02rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0.9rem; margin-top: 0.5rem; }
.phase { background: var(--surface-2); border-radius: 14px; padding: 0.7rem; }
.phase .figure { max-width: none; margin-bottom: 0.5rem; }
.phase h3 { margin-bottom: 0.1rem; }
.phase .cells { font-size: 0.8rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.phase p { font-size: 0.93rem; margin: 0.3rem 0 0; }

.fiche .formule { margin: 0.6rem 0; padding: 0.55rem 0.8rem; background: var(--surface-2); border-radius: 10px; font-size: 1.08rem; text-align: center; }
.fiche table { width: 100%; border-collapse: collapse; margin: 0.4rem 0 1rem; font-size: 0.98rem; }
.fiche th, .fiche td { text-align: left; vertical-align: top; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); }
.fiche th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.fiche blockquote { margin: 0.6rem 0; padding: 0.5rem 0.9rem; border-left: 4px solid var(--primary); background: var(--surface-2); border-radius: 0 10px 10px 0; }
/* Extraits de code (Python, prompts) : défilent dans leur cadre sur téléphone au lieu d’élargir la page */
.fiche pre { margin: 0.6rem 0; padding: 0.65rem 0.85rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; font-size: 0.88rem; line-height: 1.45; white-space: pre; }
.fiche code { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 0.92em; }
.fiche pre code { font-size: inherit; }
.zh { font-size: 1.18em; }

/* ---------- Écoute (chinois) : boutons 🔊, bloc d’écoute, transcription, tableaux de mots ---------- */
.say { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 0.05rem 0.4rem; margin-right: 0.15rem; cursor: pointer; font: inherit; font-size: 0.92em; line-height: 1.5; color: inherit; }
.say:hover { background: var(--primary-soft); }
.no-voice { display: block; margin: 0.3rem 0; font-size: 0.85rem; color: var(--bad-text); }
.listen { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0 0 1rem; padding: 0.7rem 0.85rem; background: var(--primary-soft); border-radius: var(--radius-sm); }
.listen .listen-help, .listen .transcript { flex-basis: 100%; }
.listen .transcript p { margin: 0.3rem 0; }
.transcript-box { margin: 0.2rem 0 0.9rem; padding: 0.6rem 0.85rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.transcript-box .row { gap: 0.6rem; flex-wrap: wrap; }
.transcript-box p { margin: 0.4rem 0; }
.fiche table.vocab td:first-child { white-space: nowrap; }
.fiche .dialogue p { margin: 0.55rem 0; }

/* ---------- Parents : tableau de bord ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0.8rem 0.95rem; }
.tile .label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.tile .value { font-size: 1.7rem; font-weight: 800; line-height: 1.15; margin-top: 0.15rem; }
.tile .sub { font-size: 0.82rem; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; min-width: 90px; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--chart-1); }
.bar.good > span { background: var(--good); }
.bar.warn > span { background: var(--warn); }
.bar.bad > span { background: var(--bad); }
.notion-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.3rem 1rem; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.notion-row:last-child { border-bottom: 0; }
.notion-row .bar { grid-column: 1 / -1; }
.notion-row .name { font-weight: 600; }
@media (max-width: 520px) { .notion-row { grid-template-columns: minmax(0, 1fr); } .notion-row .status { white-space: normal; } }
.status { font-weight: 700; font-size: 0.85rem; white-space: nowrap; }
.status.good { color: var(--good-text); }
.status.warn { color: var(--warn-text); }
.status.bad { color: var(--bad-text); }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 12px; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--line); stroke-width: 1.5; }
.chart .line { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; }
.chart .marker { fill: var(--surface); stroke: var(--chart-1); stroke-width: 2; }
.chart .marker:hover { stroke-width: 3; }
.chart .label { fill: var(--text); font-weight: 700; }
.spark { width: 100%; max-width: 220px; height: 44px; display: block; }
.alert { border-radius: 12px; padding: 0.7rem 0.9rem; margin-bottom: 0.6rem; display: flex; gap: 0.6rem; align-items: flex-start; }
.alert.warn { background: var(--warn-soft); color: var(--warn-text); }
.alert.bad { background: var(--bad-soft); color: var(--bad-text); }
.alert.good { background: var(--good-soft); color: var(--good-text); }
.alert.info { background: var(--primary-soft); color: var(--primary-strong); }
details.qdetail summary { cursor: pointer; font-weight: 600; }
details.qdetail { border-top: 1px solid var(--line); padding: 0.6rem 0; }
details.qdetail:first-of-type { border-top: 0; }
.qdetail .body { padding: 0.5rem 0 0 0.2rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.8rem; font-size: 0.93rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--surface); border-radius: 18px; padding: 1.4rem; max-width: 420px; width: 100%; box-shadow: var(--shadow); }
.modal .actions { justify-content: flex-end; }
@media print { .topbar, .footer, .actions, .dots, .runner-nav { display: none !important; } body { background: #fff; } }

/* ---------- Recherche (barre du haut, commune aux deux plateformes) ---------- */
/* Écran moyen : la recherche prend une ligne entière sous les liens ; grand écran : elle tient dans la ligne. */
.topbar-search { order: 5; flex: 1 1 100%; min-width: 0; padding-bottom: 0.15rem; }
.topbar .nav a, .topbar .brand { white-space: nowrap; }
@media (min-width: 1240px) {
  .topbar-inner { max-width: 1220px; flex-wrap: nowrap; }
  .nav { flex: 1 1 auto; flex-wrap: nowrap; }
  .topbar-search { order: 0; flex: 0 1 300px; padding-bottom: 0; }
}
.search { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 0.7rem; font-size: 0.9rem; opacity: 0.6; pointer-events: none; }
.search-input { width: 100%; font: inherit; font-size: 0.95rem; padding: 0.45rem 2.2rem 0.45rem 2.1rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--text); }
.search-input:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-input::-webkit-search-cancel-button { display: none; }
.search-kbd { position: absolute; right: 0.6rem; font: 600 0.75rem var(--font); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 0.35rem; background: var(--surface); pointer-events: none; }
.search-input:focus ~ .search-kbd { display: none; }
.search-panel { position: absolute; top: calc(100% + 6px); left: 0; width: min(620px, calc(100vw - 24px)); max-height: min(70vh, 640px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 44px -12px rgba(0,0,0,0.35); padding: 0.4rem; z-index: 60; }
.sr-count { margin: 0.3rem 0.6rem 0.4rem; font-size: 0.8rem; color: var(--muted); }
.sr-empty { margin: 0.6rem; color: var(--muted); font-size: 0.92rem; }
.sr-group { padding: 0.15rem 0 0.35rem; border-top: 1px solid var(--line); }
.sr-group:first-of-type { border-top: 0; }
.sr-group h4 { margin: 0.45rem 0.6rem 0.2rem; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); display: flex; gap: 0.4rem; align-items: center; }
.sr-group h4 span { background: var(--surface-2); border-radius: 999px; padding: 0 0.45rem; font-size: 0.72rem; color: var(--text); }
.sr-item { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: 0.5rem; padding: 0.45rem 0.6rem; border-radius: 10px; text-decoration: none; color: var(--text); }
.sr-item:hover, .sr-item.active { background: var(--primary-soft); }
.sr-ic { font-size: 1.05rem; line-height: 1.4; text-align: center; }
.sr-body { display: grid; gap: 0.1rem; min-width: 0; }
.sr-title { font-weight: 700; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sr-sub { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-snip { font-size: 0.85rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-panel mark { background: color-mix(in srgb, var(--warn) 40%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.sr-more { display: block; margin: 0.2rem 0.6rem 0.2rem 2.7rem; border: 0; background: none; color: var(--primary-strong); font: 600 0.85rem var(--font); cursor: pointer; padding: 0.2rem 0; }
.sr-more:hover { text-decoration: underline; }
.flash { animation: flash 2.2s ease-out 1; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 4px var(--warn); } 100% { box-shadow: 0 0 0 0 transparent; } }
tr.flash td { animation: flashrow 2.4s ease-out 1; }
@keyframes flashrow { 0%, 35% { background: color-mix(in srgb, var(--warn) 35%, transparent); } 100% { background: transparent; } }
@media (max-width: 640px) {
  .topbar-search { grid-column: 1 / -1; grid-row: 3; max-width: none; padding-bottom: 0; }
  .search-kbd { display: none; }
  .search-panel { position: fixed; left: 8px; right: 8px; width: auto; top: auto; }
}
@media print { .topbar-search { display: none !important; } }
