:root {
  --nuit: #102A43; --vert: #238B45; --or: #C9A227; --bleu: #168FE8; --rouge: #C0392B; --orange: #D9822B;
  --bg: #F4F6F8; --card: #FFFFFF; --text: #13222F; --muted: #5B6B79; --line: #E1E6EB; --soft: #EEF2F5;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
a { color: var(--bleu); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { display: grid; place-items: center; min-height: 60vh; }

/* barre du haut */
header.top { background: var(--nuit); color: #fff; position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.brand img { width: 32px; height: 32px; }
.brand small { display: block; font-weight: 400; color: #B8C6D3; font-size: 12px; }
nav.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
nav.tabs button { background: transparent; border: 0; color: #CFDAE4; padding: 7px 12px; border-radius: 8px; cursor: pointer; }
nav.tabs button.on, nav.tabs button:hover { background: rgba(255,255,255,.12); color: #fff; }
.who { color: #CFDAE4; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.who button { background: transparent; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 8px; padding: 5px 10px; cursor: pointer; }

main { max-width: 1240px; margin: 0 auto; padding: 18px 16px 60px; }
h1 { font-size: 22px; margin: 4px 0 4px; }
h2 { font-size: 17px; margin: 0; }
.lead { margin: 0 0 16px; color: var(--muted); }

/* bandeau d'état */
.banner { border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; display: flex; gap: 12px; align-items: center; }
.banner.ok { background: #E6F4EC; color: #17592E; }
.banner.ko { background: #FBE9E7; color: #8E2A1F; }
.banner b { font-size: 16px; }
.banner ul { margin: 4px 0 0; padding-left: 18px; }

/* cartes SaaS */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.card .head { padding: 14px 16px 10px; border-top: 5px solid var(--c, var(--nuit)); display: flex; gap: 10px; align-items: flex-start; }
.card .head .t { flex: 1; min-width: 0; }
.card .head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.pill { font-size: 12px; padding: 2px 9px; border-radius: 99px; white-space: nowrap; background: var(--soft); color: var(--muted); }
.pill.EN_LIGNE { background: #E6F4EC; color: #17592E; }
.pill.EN_PREPARATION { background: #EDE7FA; color: #4E2F95; }
.pill.EN_ATTENTE { background: #FBF3DC; color: #7A5D0A; }
.pill.ARRETE { background: #FBE9E7; color: #8E2A1F; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tile { background: #fff; padding: 10px 12px; }
.tile .v { font-size: 20px; font-weight: 700; }
.tile .v.warn { color: var(--orange); }
.tile .l { font-size: 12px; color: var(--muted); }
.tile .h { font-size: 11.5px; color: var(--muted); }
.note { padding: 10px 16px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.checks { padding: 8px 16px 4px; }
.check { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center; padding: 5px 0; font-size: 13.5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #B9C3CC; }
.dot.ok { background: var(--vert); } .dot.ko { background: var(--rouge); }
.check .meta { color: var(--muted); font-size: 12px; text-align: right; }
.bars { grid-column: 2 / 4; display: flex; gap: 2px; height: 10px; }
.bars i { flex: 1; border-radius: 2px; background: #CFE9D9; }
.bars i.ko { background: #F1B3AB; }
.links { padding: 10px 16px 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.links a { border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 13px; color: var(--nuit); background: #fff; }
.links a:hover { border-color: var(--bleu); text-decoration: none; }

/* panneaux */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > .panel { flex: 1 1 300px; }
.gauge { height: 10px; background: var(--soft); border-radius: 6px; overflow: hidden; margin: 6px 0 4px; }
.gauge i { display: block; height: 100%; background: var(--vert); }
.gauge i.warn { background: var(--orange); } .gauge i.ko { background: var(--rouge); }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.tag { font-size: 12px; background: var(--soft); border-radius: 6px; padding: 1px 7px; margin: 0 4px 3px 0; display: inline-block; }
.tag.alerte { background: #FBE9E7; color: #8E2A1F; } .tag.rétabli { background: #E6F4EC; color: #17592E; }

.btn { border: 0; background: var(--vert); color: #fff; padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; }
.btn.alt { background: #fff; color: var(--nuit); border: 1px solid var(--line); font-weight: 500; }
.btn.danger { background: #fff; color: var(--rouge); border: 1px solid #EDC2BC; font-weight: 500; }
.btn:disabled { opacity: .6; cursor: default; }
.bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.bar .grow { flex: 1; }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 11px; border: 1px solid #CBD4DC; border-radius: 9px; background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #9CC9F2; border-color: var(--bleu); }
.checks-list { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks-list label { display: flex; gap: 6px; align-items: center; font-size: 14px; }
.err { background: #FBE9E7; color: #8E2A1F; border-radius: 9px; padding: 8px 12px; margin-bottom: 12px; font-size: 14px; }
.okmsg { background: #E6F4EC; color: #17592E; border-radius: 9px; padding: 8px 12px; margin-bottom: 12px; font-size: 14px; }

/* connexion */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #102A43 0%, #16385A 60%, #1C4A3A 100%); }
.auth .box { background: #fff; border-radius: 16px; padding: 26px 24px; width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth .logo { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.auth .logo img { width: 42px; height: 42px; }
.auth .logo b { font-size: 18px; display: block; }
.auth .btn { width: 100%; padding: 11px; font-size: 15px; }
.qr { display: grid; place-items: center; margin: 10px 0; min-height: 10px; }
.qr img, .qr canvas { width: 180px; height: 180px; }
.secret { font-family: ui-monospace, Consolas, monospace; background: var(--soft); padding: 8px 10px; border-radius: 8px; text-align: center; letter-spacing: 1px; word-break: break-all; }
.code-input { text-align: center; font-size: 24px !important; letter-spacing: 8px; }
ol.steps { padding-left: 20px; margin: 0 0 12px; font-size: 14px; }

/* fenêtre */
.modal { position: fixed; inset: 0; background: rgba(16,42,67,.45); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal .box { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; }
.modal h2 { margin-bottom: 14px; }
.pairs .pair { display: grid; grid-template-columns: 1fr 2fr auto; gap: 6px; margin-bottom: 6px; }
.pairs input { padding: 7px 9px; border: 1px solid #CBD4DC; border-radius: 8px; width: 100%; }
.x { border: 0; background: var(--soft); border-radius: 8px; cursor: pointer; padding: 0 10px; }

@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  nav.tabs { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  nav.tabs button { white-space: nowrap; }
  .who { width: 100%; justify-content: space-between; }
  table.resp thead { display: none; }
  table.resp tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  table.resp td { display: block; border: 0; padding: 3px 4px; }
  table.resp td[data-l]::before { content: attr(data-l) " : "; color: var(--muted); font-size: 12px; }
  .pairs .pair { grid-template-columns: 1fr; }
}
