:root {
  --bg: #f6f7f9; --surface: #fff; --surface-2: #f0f2f5; --border: #dfe3e8;
  --text: #1a1d21; --muted: #6b7280; --accent: #1d4ed8; --accent-soft: #e8eefc;
  --critique: #c02626; --critique-bg: #fdeaea;
  --attention: #b45309; --attention-bg: #fdf3e3;
  --info: #1d4ed8; --info-bg: #e8eefc;
  --ok: #15803d; --ok-bg: #e7f5ec;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d; --surface: #1e2128; --surface-2: #262a32; --border: #343943;
    --text: #e8eaed; --muted: #9aa1ad; --accent: #7aa2f7; --accent-soft: #232c45;
    --critique: #f87171; --critique-bg: #33201f;
    --attention: #fbbf24; --attention-bg: #332a17;
    --info: #7aa2f7; --info-bg: #1f2738;
    --ok: #4ade80; --ok-bg: #1a2a1f;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
header { background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 20; }
header h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
header .sub { color: var(--muted); font-size: 13px; }
nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
nav button { background: none; border: 0; padding: 7px 13px; border-radius: 7px;
  cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 500; font-family: inherit; }
nav button:hover { background: var(--surface-2); color: var(--text); }
nav button.on { background: var(--accent-soft); color: var(--accent); }
main { padding: 20px; max-width: 1180px; margin: 0 auto; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 620; }
h3 { font-size: 14px; margin: 22px 0 10px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; }
.card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--surface-2); }
.scroll { overflow-x: auto; }
button.btn, a.btn { background: var(--accent); color: #fff; border: 0; padding: 8px 14px;
  border-radius: 7px; cursor: pointer; font-size: 14px; font-weight: 500;
  font-family: inherit; text-decoration: none; display: inline-block; }
button.btn:hover { filter: brightness(1.08); }
button.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
button.danger { background: var(--critique-bg); color: var(--critique); border: 1px solid transparent; }
button.mini { padding: 4px 9px; font-size: 12.5px; border-radius: 6px; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--surface); color: var(--text); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft);
  border-color: var(--accent); }
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.field { margin-bottom: 12px; }
.alerte { display: flex; gap: 10px; padding: 11px 13px; border-radius: 8px;
  margin-bottom: 8px; font-size: 14px; align-items: flex-start; border-left: 3px solid; }
.alerte .code { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  font-weight: 700; white-space: nowrap; padding-top: 1px; }
.alerte.critique { background: var(--critique-bg); border-color: var(--critique); }
.alerte.critique .code { color: var(--critique); }
.alerte.attention { background: var(--attention-bg); border-color: var(--attention); }
.alerte.attention .code { color: var(--attention); }
.alerte.info { background: var(--info-bg); border-color: var(--info); }
.alerte.info .code { color: var(--info); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px;
  font-weight: 600; white-space: nowrap; }
.pill.pressenti { background: var(--surface-2); color: var(--muted); }
.pill.qualifie { background: var(--info-bg); color: var(--info); }
.pill.confirme { background: var(--ok-bg); color: var(--ok); }
.pill.desiste { background: var(--critique-bg); color: var(--critique);
  text-decoration: line-through; }
.pill.devis { background: var(--surface-2); color: var(--muted); }
.pill.option { background: var(--attention-bg); color: var(--attention); }
.pill.confirmee { background: var(--ok-bg); color: var(--ok); }
.pill.annulee { background: var(--critique-bg); color: var(--critique); }
.feux { display: flex; gap: 5px; }
.feu { width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.feu.on { background: var(--ok); }
.stat { background: var(--surface-2); border-radius: 8px; padding: 12px 14px; }
.stat .v { font-size: 24px; font-weight: 660; letter-spacing: -.02em; line-height: 1.15; }
.stat .k { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.warn .v { color: var(--attention); }
.stat.bad .v { color: var(--critique); }
.stat.good .v { color: var(--ok); }
dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 0;
  background: var(--surface); color: var(--text); max-width: 560px; width: calc(100% - 32px);
  box-shadow: 0 20px 40px rgba(0,0,0,.22); }
dialog::backdrop { background: rgba(10,12,16,.55); }
dialog .head { padding: 15px 18px; border-bottom: 1px solid var(--border); font-weight: 620; }
dialog .body { padding: 18px; max-height: 65vh; overflow-y: auto; }
dialog .foot { padding: 13px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 9px; justify-content: flex-end; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar > i.bad { background: var(--critique); }
.bar > i.good { background: var(--ok); }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 8px;
  font-size: 14px; z-index: 100; box-shadow: var(--shadow); }
@media (max-width: 640px) {
  main { padding: 14px; }
  header { padding: 10px 14px; }
  nav { margin-left: 0; width: 100%; }
}
