:root {
  --red: #C8102E;
  --red-dark: #B00020;
  --red-deep: #7A0016;
  --ground: #FBF6F6;
  --line: #EBDDDE;
  --line-soft: #F3E8E9;
  --ink: #1C1517;
  --muted: #5B5254;
  --ok-bg: #DDF5EA; --ok: #0B6B4D;
  --warn-bg: #FFF0D1; --warn: #7A4A00;
  --fail-bg: #FDE4E4; --fail: #9F1D1D;
  --mute-bg: #F3E8E9; --mute: #4A3B3E;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--ground); color: var(--ink); font-size: 15px; }
h1, h2 { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }

.layout { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 240px; background: var(--red-dark); padding: 24px 16px; display: flex; flex-direction: column; gap: 28px; }
.main { flex: 999 1 560px; min-width: 0; padding: 32px 24px; display: flex; flex-direction: column; gap: 24px; }
@media (min-width: 900px) { .side { position: sticky; top: 0; height: 100vh; align-self: flex-start; } }

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; color: #fff; font-size: 18px; font-weight: 700; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; color: var(--red-dark); }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: #FFE3E6; text-decoration: none; font-weight: 500; }
.nav a.active { background: var(--red-deep); color: #fff; font-weight: 600; }
.nav a:hover { background: #960019; }
.userbox { margin-top: auto; padding: 14px 12px; border-radius: 12px; background: #960019; color: #fff; display: flex; flex-direction: column; gap: 6px; }
.userbox small { color: #FFD0D6; font-size: 13px; }
.userbox button { align-self: flex-start; min-height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid #E58A98; background: transparent; color: #fff; cursor: pointer; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.head h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.sub { color: var(--muted); font-size: 15px; margin-top: 4px; }
.muted { color: var(--muted); }
.tag { font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--mute-bg); color: var(--mute); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.kpi .label { font-size: 14px; color: var(--muted); font-weight: 500; }
.kpi .value { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0; }
.kpi .note { font-size: 13px; color: var(--muted); }
.v-ok { color: var(--ok); } .v-fail { color: var(--fail); }

.section { display: flex; flex-direction: column; gap: 14px; }
.section h2 { font-size: 18px; font-weight: 700; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.quick a { display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 0 18px; background: #fff; border: 1px solid #D9C6C8; border-radius: 14px; text-decoration: none; font-weight: 600; }
.quick a.primary { background: var(--red); border-color: var(--red); color: #fff; }
.quick .icon { width: 22px; height: 22px; }
.panels { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.panels > .card { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.watch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.watch-row .what { flex: 1 1 220px; min-width: 0; }
.watch-row .what b { display: block; font-size: 15px; }
.watch-row small { color: var(--muted); font-size: 13px; }
.bar-row { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.bar-row .top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.track { height: 8px; border-radius: 4px; background: #F1E3E4; }
.fill { height: 8px; border-radius: 4px; background: var(--red); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-fail { background: var(--fail-bg); color: var(--fail); }
.b-mute { background: var(--mute-bg); color: var(--mute); }
.dot { width: 8px; height: 8px; border-radius: 4px; background: currentColor; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid #D9C6C8; background: #fff; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-ghost-light { background: transparent; border-color: #E58A98; color: #fff; }
.btn-link { border: none; background: transparent; color: var(--red); text-decoration: underline; padding: 0 8px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.toolbar input[type=search] { flex: 1 1 260px; max-width: 360px; }
.field, .toolbar input, .toolbar select, .modal select, .modal input[type=text] { height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid #D9C6C8; background: #fff; font-size: 14px; }
.actionbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 14px; background: var(--red-deep); color: #fff; }
.actionbar .count { font-weight: 700; margin-right: 8px; }
.actionbar .spacer { margin-left: auto; }
.actionbar .btn-link { color: #FFE3E6; }

.tablebox { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
table { width: 100%; min-width: 1100px; border-collapse: collapse; font-size: 14px; }
th { background: var(--ground); text-align: left; color: var(--mute); font-weight: 600; padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr.sel td { background: #FDECEE; }
td.chk, th.chk { width: 52px; padding: 0; text-align: center; }
td.chk label, th.chk label { display: flex; align-items: center; justify-content: center; width: 52px; height: 44px; cursor: pointer; }
input[type=checkbox] { width: 20px; height: 20px; margin: 0; accent-color: var(--red); }
.chips { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.pager .btns { display: flex; gap: 8px; }

.run { display: flex; flex-direction: column; gap: 16px; }
.run-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.run-head h2 { font-size: 18px; }
.run-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.progress { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; background: #F1E3E4; }
.progress > div { height: 100%; }
.seg-ok { background: var(--ok); } .seg-skip { background: #8C8082; } .seg-fail { background: var(--red); } .seg-cancel { background: #C9B9BB; }
.res { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.res .host { flex: 0 0 150px; font-weight: 600; }
.res .state { flex: 0 0 140px; }
.res .msg { flex: 1 1 240px; min-width: 0; color: var(--mute); }

.overlay { position: fixed; inset: 0; background: rgba(40, 0, 10, .55); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 60; }
.modal { width: 500px; max-width: 100%; max-height: 100%; overflow-y: auto; background: #fff; border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 18px; box-shadow: 0 20px 60px rgba(40, 0, 10, .35); }
.modal h2 { font-size: 22px; }
.modal label.lbl { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.modal select { font-weight: 400; font-size: 15px; }
.info { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 12px; font-size: 14px; }
.info.neutral { border: 1px solid var(--line); background: var(--ground); }
.info.shield { background: #FDECEE; color: #8E0018; }
.info.warn { background: var(--warn-bg); color: var(--warn); }
.info .row { display: flex; justify-content: space-between; gap: 12px; }
.modal .foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login form { width: 380px; max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.login .brand { color: var(--ink); padding: 0; }
.login .logo { background: var(--red-dark); color: #fff; }
.login label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.login input { height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid #D9C6C8; font-size: 15px; }
.err { color: var(--fail); font-size: 14px; min-height: 20px; }

.toast { position: fixed; top: 16px; right: 16px; z-index: 80; max-width: 380px; padding: 14px 18px; border-radius: 12px; background: var(--fail-bg); color: var(--fail); font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, .15); }
.toast.info { background: var(--ok-bg); color: var(--ok); }

/* détails des échecs */
.res-wrap { border-top: 1px solid var(--line-soft); }
.res-wrap .res { border-top: 0; }
.hint { margin-top: 4px; color: var(--ink, #2a1f21); font-size: 0.92em; }
.btn-small { padding: 4px 10px; font-size: 0.85em; }
.causes { margin: 12px 0; padding: 12px 14px; background: var(--fail-bg); border-radius: 10px; }
.causes h3 { margin: 0 0 8px; font-size: 1em; color: var(--fail); }
.cause { display: flex; gap: 12px; padding: 6px 0; align-items: flex-start; }
.cause-n { flex: 0 0 90px; font-weight: 700; color: var(--fail); }
.detail { margin: 0 0 12px; padding: 10px 12px; background: #FAF6F6; border: 1px solid var(--line-soft); border-radius: 8px; }
.detail pre { margin: 0 0 8px; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; font: 12px/1.45 ui-monospace, Menlo, Consolas, monospace; }

/* prise en main intégrée */
.viewer { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: #1b1b1b; }
.viewer-bar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--red-deep); color: #fff; }
.viewer-bar .muted { color: #f1c9cf; }
.viewer .vtabs { display: flex; gap: 4px; margin-left: 12px; }
.viewer .vtab { border: 0; border-radius: 6px; padding: 5px 12px; background: transparent; color: #fff; cursor: pointer; font: inherit; }
.viewer .vtab.on { background: #fff; color: var(--red-deep); font-weight: 600; }
.viewer .vspacer { flex: 1; }
.viewer-frame { flex: 1; width: 100%; border: 0; background: #000; }

/* groupes et formulaires */
.btn-danger { background: var(--fail); border-color: var(--fail); color: #fff; }
.modal label.lbl.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
.modal-form { display: flex; flex-direction: column; gap: 18px; }
.group { margin-bottom: 16px; }
.group .run-head { margin-bottom: 8px; }
.site-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.site-name { flex: 1 1 260px; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.site-count { flex: 0 0 90px; color: var(--muted); white-space: nowrap; }
.site-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.site-actions .btn { min-height: 36px; white-space: nowrap; }

/* étiquettes et détails */
.linkbtn { border: 0; background: transparent; padding: 0; font: inherit; font-weight: 700; color: var(--ink, #2a1f21); cursor: pointer; text-align: left; }
.linkbtn:hover { color: var(--red); text-decoration: underline; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tagchip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tagchip.t0 { background: #FDE4E4; color: #9F1D1D; } .tagchip.t1 { background: #E3F0FF; color: #1D4F91; }
.tagchip.t2 { background: #E2F6E9; color: #1E6B3A; } .tagchip.t3 { background: #FFF1D6; color: #8A5A00; }
.tagchip.t4 { background: #EFE5FA; color: #5B2B8C; } .tagchip.t5 { background: #E4F5F5; color: #146363; }
.drawer-wrap { position: fixed; inset: 0; z-index: 40; display: flex; justify-content: flex-end; }
.drawer-shade { position: absolute; inset: 0; background: rgba(40, 0, 10, .45); }
.drawer { position: relative; width: 440px; max-width: 100%; height: 100%; overflow-y: auto; background: #fff; padding: 24px; display: flex; flex-direction: column; gap: 18px; box-shadow: -12px 0 40px rgba(40, 0, 10, .3); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-head h2 { font-size: 22px; overflow-wrap: anywhere; }
.drawer-body { display: flex; flex-direction: column; gap: 18px; }
.dtop { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dsec h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.drow { display: flex; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.drow span { flex: 0 0 140px; color: var(--muted); }
.drow b { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.drawer-foot { margin-top: auto; display: flex; gap: 10px; }
.small { font-size: 12px; font-weight: 400; }
.tagadd { border: 1px dashed #D9C6C8; background: transparent; color: var(--muted); border-radius: 999px; padding: 1px 8px; font-size: 12px; cursor: pointer; }
.tagadd:hover { border-color: var(--red); color: var(--red); }
.tagwrap { display: inline-flex; align-items: center; gap: 2px; }
.tagx { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 3px; }
.tagx:hover { color: var(--red); }
.tageditor { display: flex; flex-direction: column; gap: 8px; }
.tagform { display: flex; gap: 8px; }
.tagform input { flex: 1; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid #D9C6C8; font-size: 14px; }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: var(--red); }
.ver { font-variant-numeric: tabular-nums; }
.ver.old { color: #8A5A00; font-weight: 700; }
.vbtn { border: 0; border-radius: 8px; padding: 7px 14px; font: inherit; font-weight: 600; cursor: pointer; background: #fff; color: var(--red-deep); }
.vbtn:hover { background: #FDECEE; }
.vbtn-close { background: var(--red); color: #fff; }
.vbtn-close:hover { background: var(--red-dark); }

/* explorateur de fichiers */
.rowacts { display: flex; gap: 8px; white-space: nowrap; }
.fx { position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; background: var(--ground); }
.fx-bar-top { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--red-deep); color: #fff; }
.fx-bar-top .muted { color: #f1c9cf; }
.fx-bar-top .vspacer { flex: 1; }
.fx-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 16px; max-width: 1200px; width: 100%; margin: 0 auto; }
.fx-crumbs { display: flex; align-items: center; gap: 10px; }
.fx-path { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; min-height: 44px; padding: 4px 10px; border: 1px solid #D9C6C8; border-radius: 10px; background: #fff; cursor: text; }
.fx-crumb { border: 0; background: transparent; padding: 6px 8px; border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer; }
.fx-crumb:hover { background: #FDECEE; color: var(--red-deep); }
.fx-sep { color: var(--mute); }
.fx-addr { flex: 1; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--red); background: #fff; font: inherit; font-family: ui-monospace, Menlo, Consolas, monospace; }
.fx-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fx-tools input[type=search] { flex: 1 1 220px; max-width: 320px; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid #D9C6C8; background: #fff; font-size: 14px; }
.fx-tools .spacer { margin-left: auto; }
.fx-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.fx-file { display: none; }
.fx-card { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.fx-list { flex: 1; min-height: 0; overflow: auto; }
.fx-list.busy { opacity: .55; }
.fx-list table { min-width: 0; }
.fx-list th { position: sticky; top: 0; z-index: 1; }
.fx-sort button { border: 0; background: transparent; font: inherit; font-weight: 600; color: inherit; cursor: pointer; padding: 0; }
.fx-sort.on { color: var(--red-deep); }
.fx-tdname { width: 100%; }
.fx-name { display: inline-flex; align-items: center; gap: 10px; overflow-wrap: anywhere; text-align: left; }
.fx-name .icon { flex: 0 0 20px; width: 20px; height: 20px; }
.fx-name:has(.icon) .icon { color: var(--mute); }
.linkbtn.fx-name .icon { color: var(--red); }
.fx-num { text-align: right; white-space: nowrap; }
.fx-acts { white-space: nowrap; text-align: right; }
.fx-acts .btn { min-height: 34px; margin-left: 6px; }
.fx-acts .btn-del { color: var(--fail); }
tr.dim td { opacity: .6; }
.fx-empty { padding: 40px 20px; text-align: center; color: var(--mute); }
.fx-more { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.fx-trans { display: flex; flex-direction: column; gap: 8px; max-height: 190px; overflow-y: auto; }
.fx-t { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.fx-t b { flex: 0 1 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-t .fx-bar { flex: 1; height: 8px; border-radius: 4px; background: #F1E3E4; overflow: hidden; }
.fx-t .fx-fill { height: 100%; width: 0; background: var(--red); transition: width .2s; }
.fx-t.good .fx-fill { background: var(--ok); }
.fx-t.bad .fx-fill { background: var(--fail); }
.fx-t.bad span { color: var(--fail); font-weight: 600; }
.fx-t span { flex: 0 1 280px; }
@media (max-width: 700px) { .fx-crumbs { flex-wrap: wrap; } .fx-t { flex-wrap: wrap; } }

.modal.modal-wide { width: 920px; }
.modal-wide .card { box-shadow: none; border: 0; padding: 0; }

/* serveur, suggestions, tableau de bord */
.gauge { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; }
.gauge .top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 14px; }
.gauge .track { height: 10px; border-radius: 5px; background: #F1E3E4; overflow: hidden; }
.gauge .fill { height: 100%; background: var(--ok); }
.gauge .fill.warn { background: #D98A00; }
.gauge .fill.bad { background: var(--red); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 24px; margin: 8px 0; }
.hint-box { margin: 10px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.btn-link-inline { margin-top: 8px; color: var(--red); font-weight: 600; }
.sug-form { display: flex; flex-direction: column; gap: 12px; }
.sug-form input, .sug-form textarea { padding: 10px 14px; border-radius: 10px; border: 1px solid #D9C6C8; background: #fff; font: inherit; resize: vertical; }
.sug-form input { height: 44px; }
.sug-list { display: flex; flex-direction: column; gap: 12px; }
.sug { display: flex; align-items: flex-start; gap: 16px; }
.sug-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sug-main p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.sug-side { display: flex; align-items: center; gap: 8px; }
.sug-side select { height: 36px; border-radius: 8px; border: 1px solid #D9C6C8; background: #fff; padding: 0 8px; }
.sug-side .btn-del { color: var(--fail); }
.vote { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 56px; padding: 8px; border: 1px solid #D9C6C8; border-radius: 10px; background: #fff; cursor: pointer; font: inherit; }
.vote.on { background: var(--red); border-color: var(--red); color: #fff; }
.vote .arrow { font-size: 12px; }
@media (max-width: 700px) { .sug { flex-wrap: wrap; } }
