:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #1b1f24; --muted: #6a7380; --border: #e2e5ea;
  --accent: #e8590c; --accent-text: #ffffff; --accent-soft: #fff1e8;
  --red: #c92a2a; --red-soft: #fff0f0; --amber: #b7791f; --amber-soft: #fff8e6;
  --green: #2b8a3e; --green-soft: #ebfbee; --blue-soft: #e7f1ff;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418; --surface: #1a1e24; --text: #e6e8eb; --muted: #9aa3ad; --border: #2b3138;
    --accent: #ff7a33; --accent-soft: #3a2316;
    --red: #ff6b6b; --red-soft: #3a1d1f; --amber: #f2b84b; --amber-soft: #352a14;
    --green: #69db7c; --green-soft: #17301d; --blue-soft: #18263a;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .7rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
code { background: var(--accent-soft); padding: 0 .3em; border-radius: 4px; }
main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }

.top { display: flex; align-items: center; gap: 24px; padding: 0 16px; height: 56px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.top nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.top nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.top nav a.active, .top nav a:hover { color: var(--text); background: var(--bg); text-decoration: none; }
.brand { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand.big { font-size: 1.4rem; justify-content: center; }
.logo { background: var(--accent); color: var(--accent-text); border-radius: 6px; padding: 2px 6px; font-size: .85em; }

.jobbar { display: flex; gap: 10px; align-items: center; background: var(--blue-soft); color: var(--text); padding: 8px 16px; font-size: .9rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.jobbar b { font-weight: 400; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card.warn { border-left: 4px solid var(--red); }
.card.good { border-left: 4px solid var(--green); }
.card.empty { color: var(--muted); text-align: center; padding: 32px; }
.card ul { margin: 0; padding-left: 1.2rem; }
.card li { margin: .2rem 0; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.grid2.swot { grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.grid2 > section > h2:first-child { margin-top: 0; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; color: var(--muted); font-size: .9rem; box-shadow: var(--shadow); }
.kpi span { display: block; font-size: 1.9rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.kpi.hot span { color: var(--red); }

.change { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--shadow); }
.change p { margin: .4rem 0; }
.change-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .92rem; }
.impl { color: var(--text); }
.action { background: var(--accent-soft); padding: 6px 10px; border-radius: 6px; }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.t-high, .i-haute { background: var(--red-soft); color: var(--red); }
.t-medium, .i-moyenne { background: var(--amber-soft); color: var(--amber); }
.t-low, .i-faible { background: var(--green-soft); color: var(--green); }
.badge.muted { background: var(--bg); color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: .8rem; background: var(--bg); border: 1px solid var(--border); padding: 1px 8px; border-radius: 6px; }
.chips { display: flex; gap: 6px; margin: 8px 0 16px; flex-wrap: wrap; }
.chip { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); color: var(--text); background: var(--surface); }
.chip.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
tr.off { opacity: .5; }
table.compact td { padding: 6px 4px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

button, .button { font: inherit; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 14px; border-radius: 8px; display: inline-block; }
button:hover, .button:hover { border-color: var(--muted); text-decoration: none; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
input, select, textarea { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); margin-top: 4px; }
label { display: block; margin-bottom: 12px; font-size: .9rem; color: var(--muted); }
.form { max-width: 560px; }
.inline-form { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 200px; margin: 0; }
.login { max-width: 380px; margin: 10vh auto; text-align: left; }
.login .muted { text-align: center; margin-top: 0; }
.login button { width: 100%; }

.alert { background: var(--red-soft); color: var(--red); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.alert.info { background: var(--blue-soft); color: var(--text); }
.note { background: var(--amber-soft); padding: 8px 12px; border-radius: 8px; }
.lead { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.strong { font-weight: 600; }
pre { white-space: pre-wrap; word-break: break-word; font-size: .82rem; margin: 0; max-height: 480px; overflow: auto; }
.diff.del pre { color: var(--red); }
.diff.add pre { color: var(--green); }
pre.log { background: var(--bg); padding: 12px; border-radius: 8px; max-height: 60vh; }

@media (max-width: 860px) {
  .grid2, .grid2.swot, .grid3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .top { gap: 12px; }
  .top form { display: none; }
}
