:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #1a73e8;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fe;
  --ai: #d93025;
  --ai-soft: #fce8e6;
  --warn: #e37400;
  --warn-soft: #fef3e0;
  --human: #188038;
  --human-soft: #e6f4ea;
  --neutral: #5f6368;
  --neutral-soft: #f1f3f4;
  --llm: #7c4dff;
  --llm-soft: #f1ecff;
  --code-bg: #f6f8fa;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214; --surface: #1b1c1f; --text: #ececf1; --muted: #9aa0a6; --line: #2c2e33; --line-strong: #3c4043;
    --accent: #8ab4f8; --accent-ink: #0b1a33; --accent-soft: #1f2a3c;
    --ai: #f28b82; --ai-soft: #3a2220; --warn: #fdc069; --warn-soft: #3a2e1a; --human: #81c995; --human-soft: #1c3324;
    --neutral: #bdc1c6; --neutral-soft: #2a2b2f; --llm: #b39dff; --llm-soft: #2a2440; --code-bg: #141518;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .88em; background: var(--code-bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .4em; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* Barre du haut */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 17px; }
.topbar nav { display: flex; gap: 18px; align-items: center; font-size: 14px; }
.topbar nav a { color: var(--muted); }
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.pill { border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 12px; }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px 48px; }
.hero { text-align: center; padding: 48px 0 28px; }
.hero h1 { font-size: clamp(28px, 5vw, 42px); font-weight: 720; }
.accent { color: var(--accent); }
.lead { color: var(--muted); font-size: 17px; max-width: 620px; margin: 0 auto; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 16px; }

/* Onglets */
.tabs { display: flex; gap: 4px; background: var(--neutral-soft); padding: 4px; border-radius: 12px; margin-bottom: 16px; overflow-x: auto; }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); font: 500 14px var(--font); padding: 8px 12px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

.field input, .field textarea, .form input, .form select, .form textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--text);
  font: 15px/1.5 var(--font); padding: 12px 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { font-family: var(--mono); font-size: 13.5px; resize: vertical; min-height: 120px; }
.field input:focus, .field textarea:focus, .form input:focus, .form select:focus, .form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.opts { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--neutral-soft); }
.hint { margin: 6px 0 10px; color: var(--muted); font-size: 13.5px; }
.range { display: flex; align-items: center; gap: 12px; font-weight: 500; font-size: 14px; flex-wrap: wrap; }
.range input { flex: 1; min-width: 160px; accent-color: var(--accent); }
.range output { min-width: 1.5em; font-weight: 700; color: var(--accent); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; font-size: 14px; flex-wrap: wrap; }
.switch small { color: var(--muted); font-weight: 400; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 36px; height: 20px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background .2s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.cmd { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 8px 8px 12px; }
.cmd code { border: 0; background: none; padding: 0; flex: 1; overflow-x: auto; white-space: nowrap; }

.actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 16px; }
.detected { color: var(--muted); font-size: 13.5px; margin-right: auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 999px; font: 600 14.5px var(--font); padding: 10px 22px; cursor: pointer; transition: background .15s, box-shadow .15s, opacity .15s; }
.btn:disabled { opacity: .7; cursor: progress; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 2px 8px rgba(26, 115, 232, .35); text-decoration: none; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { background: var(--neutral-soft); text-decoration: none; }
.btn-danger { background: var(--ai); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.spin { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

.examples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13.5px; }
.chip { display: flex; flex-direction: column; align-items: flex-start; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 12px; padding: 7px 12px; cursor: pointer; font: 500 13.5px var(--font); text-align: left; }
.chip small { color: var(--muted); font-weight: 400; font-size: 12px; }
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.disclaimer { color: var(--muted); font-size: 13px; text-align: center; margin: 4px 0 24px; }

/* Résultat */
.result { scroll-margin-top: 80px; }
.loading { display: flex; align-items: center; gap: 16px; color: var(--muted); }
.loading p { margin: 0; }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); animation: pulse 1.1s ease-in-out infinite; flex: none; }
@keyframes pulse { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1.15); opacity: 1; } }

.verdict { display: flex; gap: 26px; align-items: center; border-width: 1px; }
.verdict.tone-ai { background: linear-gradient(135deg, var(--ai-soft), var(--surface) 60%); }
.verdict.tone-warn { background: linear-gradient(135deg, var(--warn-soft), var(--surface) 60%); }
.verdict.tone-human { background: linear-gradient(135deg, var(--human-soft), var(--surface) 60%); }
.ring { width: 132px; height: 132px; flex: none; }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: var(--line); }
.ring .bar { stroke-linecap: round; transform: rotate(-90deg); transform-origin: 60px 60px; transition: stroke-dashoffset 1s cubic-bezier(.2, .8, .2, 1); }
.ring .num { font: 750 30px var(--font); text-anchor: middle; fill: var(--text); }
.ring .pct { font-size: 15px; font-weight: 600; }
.ring .sub { font: 600 11px var(--font); text-anchor: middle; fill: var(--muted); letter-spacing: .08em; }
.tone-ai .bar { stroke: var(--ai); } .tone-warn .bar { stroke: var(--warn); } .tone-human .bar { stroke: var(--human); } .tone-neutral .bar { stroke: var(--neutral); }
.v-body { min-width: 0; }
.v-body h2 { font-size: 24px; }
.tone-ai h2 { color: var(--ai); } .tone-warn h2 { color: var(--warn); } .tone-human h2 { color: var(--human); }
.v-mode { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.v-target { margin: 0 0 4px; font-family: var(--mono); font-size: 13px; color: var(--muted); word-break: break-all; }
.v-conf { margin: 0 0 10px; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip-s { font-size: 12.5px; background: var(--neutral-soft); border-radius: 99px; padding: 3px 10px; color: var(--muted); }

.llm { background: var(--llm-soft); border: 1px solid transparent; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 14.5px; }
.warns { background: var(--warn-soft); border-radius: 12px; padding: 10px 16px 10px 32px; margin: 0 0 16px; font-size: 13.5px; }

.group h3 { font-size: 16px; margin-bottom: 12px; }
.evs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ev { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.ev-signature { border-color: var(--ai); }
.ev p { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.ev-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ev-head strong { font-size: 14.5px; }
.w { margin-left: auto; font: 600 12.5px var(--mono); color: var(--muted); }
.badge { font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; border-radius: 6px; padding: 2px 7px; }
.b-signature { background: var(--ai); color: #fff; }
.b-ai { background: var(--ai-soft); color: var(--ai); }
.b-human { background: var(--human-soft); color: var(--human); }
.b-llm { background: var(--llm-soft); color: var(--llm); }
.meter { height: 4px; background: var(--neutral-soft); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 4px; background: var(--ai); }
.ev-human .meter span { background: var(--human); }
.srcs { display: block; margin-top: 6px; font: 12px var(--mono); color: var(--muted); word-break: break-all; }
.ex { margin-top: 6px; display: flex; gap: 8px; align-items: baseline; }
.ex .where { font: 11.5px var(--mono); color: var(--muted); white-space: nowrap; max-width: 30%; overflow: hidden; text-overflow: ellipsis; }
.ex code { display: block; flex: 1; overflow-x: auto; white-space: pre; padding: 6px 10px; font-size: 12.5px; }

/* Historique */
.history-head { display: flex; justify-content: space-between; align-items: center; }
.history h2 { font-size: 17px; margin: 0; }
#hist { list-style: none; margin: 12px 0 0; padding: 0; }
#hist li a { display: flex; align-items: center; gap: 14px; padding: 10px 6px; border-top: 1px solid var(--line); color: var(--text); }
#hist li a:hover { background: var(--neutral-soft); text-decoration: none; border-radius: 8px; }
#hist .score { font-weight: 700; min-width: 48px; text-align: center; border-radius: 8px; padding: 3px 0; font-size: 13.5px; }
.score.tone-ai { background: var(--ai-soft); color: var(--ai); } .score.tone-warn { background: var(--warn-soft); color: var(--warn); }
.score.tone-human { background: var(--human-soft); color: var(--human); } .score.tone-neutral { background: var(--neutral-soft); color: var(--neutral); }
#hist .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
#hist .t small { display: block; color: var(--muted); font-size: 12px; }
#hist .v { font-size: 13px; color: var(--muted); white-space: nowrap; }
.empty { margin: 10px 0 0; }

.method { margin-top: 36px; }
.method h2 { font-size: 22px; text-align: center; margin-bottom: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid3 > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid3 h3 { font-size: 15.5px; }
.grid3 p { margin: 0; color: var(--muted); font-size: 14px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 40px; }
.foot a { color: var(--muted); }

/* Formulaires, installation, admin */
.page-narrow { min-height: 100vh; }
.install { max-width: 560px; margin: 0 auto; padding: 48px 16px; }
.brand-lg { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.steps { display: flex; gap: 6px; margin: 10px 0 20px; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps span.on { background: var(--accent); }
.checks { list-style: none; padding: 0; }
.checks li { padding: 4px 0; }
.checks .ok { color: var(--human); } .checks .ko { color: var(--ai); }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-weight: 500; font-size: 14px; }
.form label small { font-weight: 400; color: var(--muted); }
.form .switch { display: flex; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.alert { border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; font-size: 14px; }
.alert-err { background: var(--ai-soft); color: var(--ai); border-color: transparent; }
.alert-ok { background: var(--human-soft); color: var(--human); }
.alert-info { background: var(--accent-soft); color: var(--text); }

.admin-wrap { max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; }
.admin-nav { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-nav a { padding: 7px 14px; border-radius: 99px; color: var(--muted); font-weight: 500; font-size: 14px; }
.admin-nav a.on { background: var(--accent-soft); color: var(--accent); }
.admin-nav a:hover { text-decoration: none; color: var(--text); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.kpi b { display: block; font-size: 26px; font-weight: 720; }
.kpi span { color: var(--muted); font-size: 13px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; padding: 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.trunc { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; }
.section-title { font-size: 17px; margin: 0 0 4px; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }
.copyline { display: flex; gap: 8px; align-items: center; }
.copyline code { flex: 1; overflow-x: auto; white-space: nowrap; padding: 6px 10px; }
.legal { max-width: 720px; }
.legal h2 { margin-top: 1.4em; font-size: 19px; }

@media (max-width: 720px) {
  .topbar { padding: 12px 16px; }
  .hero { padding: 32px 0 20px; }
  .card { padding: 16px; }
  .verdict { flex-direction: column; text-align: center; gap: 12px; }
  .chips { justify-content: center; }
  .grid3, .kpis { grid-template-columns: 1fr 1fr; }
  .grid3 { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; }
  #hist .v { display: none; }
  .ex { flex-direction: column; gap: 2px; } .ex .where { max-width: 100%; }
  .actions { flex-wrap: wrap; } .actions .btn { width: 100%; }
}
