/* Back-office formateur : thème clair pour le travail au quotidien */
body.admin {
  --bg: #f3f4ef;
  --surface: #ffffff;
  --text: #1c1c21;
  --muted: #6b6b78;
  --line: #e3e4dd;
  --panel: #ffffff;
  --panel-2: #f0f1ea;
  --ink-2: #ffffff;
  --chart: #4d8a0c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 6px 20px rgba(0, 0, 0, .05);
  background: var(--bg);
  color: var(--text);
}
.admin .input { background: #fff; color: var(--text); border-color: var(--line); font-size: 15px; padding: 11px 13px; border-radius: 12px; }
.admin .input:focus { border-color: var(--lime-deep); }
.admin .btn.dark { --c: #1c1c21; --t: #fff; --d: #000; }
.admin .btn.ghost { --t: var(--text); box-shadow: inset 0 0 0 2px var(--line); }
.admin .btn.light { --c: #fff; --t: var(--text); --d: #d5d6cf; box-shadow: 0 3px 0 var(--d), inset 0 0 0 1px var(--line); }
.admin .card { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.admin .pill { background: var(--panel-2); }
.admin .toast { background: #1c1c21; color: #fff; }

.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: #18181b; color: #f5f5f7; padding: 18px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; overflow: auto; }
.side .logo-img { width: 190px; margin: 0 auto 18px; }
.side a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: #c9c9d2; text-decoration: none; font-weight: 600; }
.side a:hover { background: #26262e; color: #fff; }
.side a.on { background: var(--lime); color: var(--on-lime); }
.side .ico { width: 22px; text-align: center; font-size: 18px; }
.side .sep { height: 1px; background: #2c2c34; margin: 10px 4px; }
.side .foot { margin-top: auto; font-size: 12px; color: #8a8a96; padding: 10px 14px; }
.main { padding: 26px 32px 60px; min-width: 0; }
.head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.head h1 { font-family: var(--display); font-weight: 400; font-size: 32px; margin: 0; flex: 1; min-width: 200px; }
.head .crumb { color: var(--muted); font-size: 14px; width: 100%; margin-bottom: -10px; }
.head .crumb a { color: var(--muted); }
h2.sec { font-size: 18px; margin: 28px 0 12px; display: flex; align-items: center; gap: 10px; }
h2.sec:first-child { margin-top: 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi .v { font-size: 34px; font-weight: 800; line-height: 1.1; }
.kpi .l { color: var(--muted); font-weight: 600; font-size: 14px; }
.kpi .i { position: absolute; right: 14px; top: 12px; font-size: 26px; opacity: .9; }
.kpi.hl { background: #18181b; color: #fff; border-color: #18181b; }
.kpi.hl .v { color: var(--lime); }
.kpi.hl .l { color: #b8b8c2; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f8f9f3; }
.tw { overflow-x: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.meter { display: inline-flex; align-items: center; gap: 8px; min-width: 110px; }
.meter i { flex: 1; height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; display: block; }
.meter i b { display: block; height: 100%; border-radius: 99px; }
.lvl-good b { background: #2e9e5b; } .lvl-mid b { background: #e3a21a; } .lvl-bad b { background: #d9483b; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--panel-2); color: var(--text); white-space: nowrap; }
.tag.good { background: #dff3e6; color: #1d6b3d; } .tag.mid { background: #fdf0d5; color: #8a5a00; } .tag.bad { background: #fde2df; color: #9b2a20; }
.tag.lime { background: var(--lime); color: var(--on-lime); }

.fcard { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); cursor: pointer; transition: transform .15s, box-shadow .15s; border-top: 6px solid var(--c, var(--lime)); }
.fcard:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0, 0, 0, .09); }
.fcard h3 { margin: 0 0 6px; font-size: 19px; }

/* Graphique d'activité */
.chart { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart .grid line { stroke: #ecede6; stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .bar { fill: var(--chart); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .bar, .chart .bar.on { fill: #3a6b06; }
.chart .lab { fill: var(--text); font-size: 11px; font-weight: 700; font-family: var(--font); }
.tip { position: absolute; pointer-events: none; background: #18181b; color: #fff; padding: 8px 10px; border-radius: 10px; font-size: 13px; transform: translate(-50%, -110%); white-space: nowrap; z-index: 5; }

/* Éditeur de questions */
.chap { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.chap > header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.chap > header h3 { margin: 0; font-size: 18px; flex: 1; }
.qrow { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); align-items: start; }
.qrow:last-child { border-bottom: 0; }
.qrow .n { font-weight: 800; color: var(--muted); }
.qrow .qt { font-weight: 700; }
.qrow .opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.opt { font-size: 13px; padding: 3px 9px; border-radius: 8px; background: var(--panel-2); }
.opt.ok { background: #dff3e6; color: #1d6b3d; font-weight: 700; }
.qrow .tools { display: flex; gap: 6px; align-items: center; }
.icon { border: 0; background: var(--panel-2); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 15px; }
.icon:hover { background: #e4e6dc; }

/* Modale */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 15, 20, .55); z-index: 100; display: grid; place-items: center; padding: 16px; animation: pop .15s; }
.modal { background: #fff; color: var(--text); border-radius: 20px; width: min(100%, 680px); max-height: 92vh; overflow: auto; padding: 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal h2 { margin: 0 0 16px; font-family: var(--display); font-weight: 400; font-size: 26px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.field { margin-bottom: 14px; }
.ansedit { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.ansedit .sw { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--c); color: var(--t); font-weight: 800; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--lime-deep); }

.switch { position: relative; width: 46px; height: 26px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d6d7cf; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--lime-deep); }
.switch input:checked + span::before { transform: translateX(20px); }

.drop { border: 3px dashed #c9cbbf; border-radius: 20px; padding: 36px 20px; text-align: center; background: #fafbf6; cursor: pointer; transition: .15s; }
.drop.over, .drop:hover { border-color: var(--lime-deep); background: #f3fbe4; }
.drop .big { font-size: 46px; }
.subtabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.subtabs button { border: 0; background: none; padding: 10px 14px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.subtabs button.on { color: var(--text); border-bottom-color: var(--lime-deep); }

.ext { display: flex; flex-direction: column; gap: 8px; }
.ext .i { font-size: 34px; }
.ext h3 { margin: 0; }
.ext .price { font-weight: 800; }
.ext.on { border-color: var(--lime-deep); background: linear-gradient(180deg, #f6fde9, #fff); }

.logs { font-family: ui-monospace, Consolas, monospace; font-size: 12px; max-height: 420px; overflow: auto; background: #18181b; color: #d7d7de; border-radius: 14px; padding: 12px; }
.logs .error { color: #ff8a80; } .logs .warn { color: #ffd27a; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 54px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: #18181b; }
.login .card { width: min(100%, 420px); background: #fff; color: var(--text); }

.burger { display: none; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 90; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .burger { display: inline-flex; }
  .main { padding: 16px 16px 60px; }
  .grid2 { grid-template-columns: 1fr; }
  .qrow { grid-template-columns: 1fr; }
}
