/* PrivaHost — page de statut v3 : sobre et lisible, sur le modèle des pages de statut professionnelles. */
:root, [data-theme='light'] {
  --bg: #ffffff; --page: #fafbfc; --surface: #ffffff; --soft: #f4f5f7; --line: #e6e8ec; --line-2: #d6d9df;
  --text: #0f1729; --muted: #5b6474; --faint: #8a93a3;
  --accent: #2563eb;
  --up: #0f9d6e; --up-soft: #e7f6f0; --deg: #d97706; --deg-soft: #fdf3e3; --down: #dc3545; --down-soft: #fdecee;
  --maint: #2f6fe4; --maint-soft: #eaf1fd; --none: #e5e7eb; --chart: #2563eb;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.04), 0 1px 3px rgb(16 24 40 / 0.06);
  color-scheme: light;
}
[data-theme='dark'] {
  --bg: #0d1017; --page: #0d1017; --surface: #151922; --soft: #1b202b; --line: #262c38; --line-2: #333a48;
  --text: #e8ecf3; --muted: #a0a9b8; --faint: #6e7889;
  --accent: #5b8fff;
  --up: #20c997; --up-soft: rgb(32 201 151 / 0.12); --deg: #f2a33a; --deg-soft: rgb(242 163 58 / 0.13); --down: #f0525e; --down-soft: rgb(240 82 94 / 0.13);
  --maint: #5b8fff; --maint-soft: rgb(91 143 255 / 0.14); --none: #2a303c; --chart: #3ea1ff;
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-font-smoothing: antialiased; }
body { margin: 0; background: var(--page); color: var(--text); font-family: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.wrap { width: min(1040px, 100% - 32px); margin-inline: auto; }

/* en-tête */
.top { background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 62px; gap: 16px; }
.brand-logo { height: 24px; display: block; }
[data-theme='dark'] .brand-logo { filter: brightness(0) invert(1); }
.tabs { display: flex; gap: 4px; }
.tab { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.on { background: var(--soft); color: var(--text); }
.top-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.btn { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; box-shadow: var(--shadow); }
.btn:hover { text-decoration: none; background: var(--soft); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--soft); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }
[data-theme='dark'] .i-moon, [data-theme='light'] .i-sun { display: none; }

main { padding: 0 0 56px; }
.announce { margin-top: 24px; padding: 12px 16px; border-radius: 10px; background: var(--maint-soft); color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.announce[data-level='warning'] { background: var(--deg-soft); }
.announce[data-level='danger'], .announce[data-level='critical'] { background: var(--down-soft); }

/* état global */
.hero { text-align: center; padding: 64px 0 44px; }
.hero-icon { --c: var(--faint); --s: var(--soft); width: 44px; height: 44px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; box-shadow: 0 0 0 6px var(--s); }
.hero-icon svg { width: 24px; height: 24px; }
.hero[data-state='operational'] .hero-icon { --c: var(--up); --s: var(--up-soft); }
.hero[data-state='degraded'] .hero-icon { --c: var(--deg); --s: var(--deg-soft); }
.hero[data-state='outage'] .hero-icon { --c: var(--down); --s: var(--down-soft); }
.hero[data-state='maintenance'] .hero-icon { --c: var(--maint); --s: var(--maint-soft); }
.hero h1 { margin: 0; font-size: clamp(26px, 3vw + 12px, 34px); font-weight: 800; letter-spacing: -0.025em; line-height: 1.15; }
.hero-sub { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

/* incidents en cours */
.active { display: grid; gap: 12px; margin-bottom: 20px; }
.ai { border: 1px solid var(--line); border-left: 4px solid var(--c, var(--deg)); border-radius: 12px; background: var(--surface); padding: 16px 18px; box-shadow: var(--shadow); }
.ai-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ai h3 { margin: 0; font-size: 16px; }
.ai-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* tableau des services : grille de cartes compactes, la carte ouverte prend toute la largeur */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.board > .svc { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); padding: 14px 14px 14px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.board > .svc + .svc { border-top: 1px solid var(--line); padding-top: 14px; }
.board > .svc:hover { border-color: var(--line-2); transform: translateY(-1px); box-shadow: 0 6px 18px -10px rgb(16 24 40 / 0.25); }
.board > .svc.open { grid-column: 1 / -1; cursor: default; padding: 18px 20px 20px; transform: none; border-color: var(--line-2); }
.board .svc-head { margin-bottom: 8px; }
.svc-title { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.svc-title small { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .svc-name { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc.open .svc-name { font-size: 18px; }
.svc-line { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.board .svc-uptime { margin: 0; font-size: 13px; }
.svc-ms { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); }
.board .bars { height: 18px; gap: 2px; align-items: flex-end; }
.board .bar { height: 100%; min-width: 3px; border-radius: 2px; transform-origin: 50% 100%; transition: flex-grow 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s; }
.svc.open .bars { height: 22px; gap: 2px; }
.svc.open .bar { border-radius: 2px; }
/* Survol : le bloc grandit et pousse ses voisins (flex-grow), les autres s'estompent. */
.board .bars:hover .bar { opacity: 0.45; }
.board .bars .bar:hover { flex-grow: 3; transform: scaleY(1.4); opacity: 1; }
.board .bars .bar:hover + .bar,
.board .bars .bar:has(+ .bar:hover) { flex-grow: 1.6; opacity: 0.75; }
/* Ouverture : les blocs glissent et grandissent l'un après l'autre. */
.svc.just-opened .bar { animation: barIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--i) * 14ms); }
@keyframes barIn { from { transform: translateX(-10px) scaleY(0.15); opacity: 0; } 60% { opacity: 1; } to { transform: none; opacity: 1; } }
.svc.open .bar:hover { animation: none; }
.svc.open .svc-line { margin-bottom: 10px; }
.svc.open .svc-uptime { font-size: 15px; }
.svc.open .svc-ms { font-size: 13px; }
.close { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-left: 4px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.close:hover { background: var(--soft); color: var(--text); }
.close svg { width: 15px; height: 15px; }
.svc-detail { animation: unfold 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.kv { display: grid; grid-template-columns: repeat(6, 1fr); margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kv div { padding: 11px 14px; background: var(--soft); }
.kv div + div { border-left: 1px solid var(--line); }
.kv small { display: block; font-size: 12px; color: var(--faint); font-weight: 600; }
.kv b { font-size: 16px; font-variant-numeric: tabular-nums; }
.kv em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--faint); font-family: 'JetBrains Mono', monospace; }
.svc.open .rt canvas { height: 220px; }
.svc.pop { animation: pop 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes unfold { from { opacity: 0; transform: translateY(-6px); } }
@keyframes pop { from { transform: scale(0.98); opacity: 0.6; } }
::view-transition-group(*) { animation-duration: 0.35s; animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }
.board-legacy { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.group + .group { border-top: 1px solid var(--line); }
.group-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 16px 22px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.group-head:hover { background: var(--soft); }
.group-name { font-weight: 700; font-size: 15px; flex: 1; }
.group-head .chev { width: 18px; height: 18px; color: var(--faint); transition: transform 0.2s; }
.group[data-open='false'] .chev { transform: rotate(-90deg); }
.group[data-open='false'] .group-body { display: none; }
.badge { --c: var(--faint); --s: var(--soft); display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 6px; border-radius: 999px; background: var(--s); font-size: 13px; font-weight: 600; color: var(--text); }
.badge svg { width: 16px; height: 16px; color: var(--c); }
.badge[data-s='up'] { --c: var(--up); --s: var(--up-soft); }
.badge[data-s='degraded'] { --c: var(--deg); --s: var(--deg-soft); }
.badge[data-s='down'] { --c: var(--down); --s: var(--down-soft); }
.badge[data-s='maintenance'] { --c: var(--maint); --s: var(--maint-soft); }
.svc { padding: 6px 22px 22px; }
.svc + .svc { border-top: 1px dashed var(--line); padding-top: 18px; }
.svc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.svc-head .st { width: 18px; height: 18px; flex-shrink: 0; }
.svc-name { font-size: 16px; font-weight: 600; }
.svc-uptime { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--up); font-variant-numeric: tabular-nums; }
.svc-uptime[data-low] { color: var(--deg); }
.bars { display: flex; gap: 3px; height: 34px; }
.bar { flex: 1; border-radius: 3px; background: var(--none); transition: opacity 0.15s; cursor: default; }
.bar[data-s='up'] { background: var(--up); }
.bar[data-s='deg'] { background: var(--deg); }
.bar[data-s='down'] { background: var(--down); }
.axis { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; color: var(--faint); }
.rt { margin-top: 18px; }
.rt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.rt-title { font-size: 13px; color: var(--faint); font-weight: 600; }
.rt-now { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rt-now b { color: var(--text); }
.rt canvas { display: block; width: 100%; height: 150px; }

/* résumé */
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.summary div { padding: 14px 18px; }
.summary div + div { border-left: 1px solid var(--line); }
.summary small { display: block; color: var(--faint); font-size: 12.5px; font-weight: 600; }
.summary b { font-size: 19px; font-variant-numeric: tabular-nums; }

/* onglets secondaires */
.panel-title { margin: 44px 0 18px; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.day { margin-bottom: 26px; }
.day-head { font-weight: 700; font-size: 15px; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.day-none { color: var(--faint); font-size: 14px; }
.inc { margin-bottom: 14px; }
.inc h3 { margin: 0; font-size: 15.5px; color: var(--c, var(--deg)); }
.inc-upd { margin-top: 6px; font-size: 14px; color: var(--muted); }
.inc-upd b { color: var(--text); font-weight: 600; }
.inc-upd time { display: block; font-size: 12.5px; color: var(--faint); }
.empty { padding: 26px; border: 1px dashed var(--line-2); border-radius: 12px; text-align: center; color: var(--muted); }
.more { display: block; margin: 8px auto 0; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; cursor: pointer; }
.more:hover { background: var(--soft); }

/* infobulle */
.tip { position: fixed; z-index: 50; pointer-events: none; padding: 8px 11px; border-radius: 8px; background: #0f1729; color: #fff; font-size: 12.5px; line-height: 1.4; box-shadow: 0 10px 24px -10px rgb(0 0 0 / 0.5); transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }
[data-theme='dark'] .tip { background: #2a3140; }
.tip b { display: block; font-size: 13px; }

/* pied */
.foot { border-top: 1px solid var(--line); background: var(--bg); }
.foot-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 18px 0; font-size: 13px; color: var(--faint); }
.foot-links { display: flex; gap: 14px; }
.foot-links a { color: var(--muted); }

@media (max-width: 920px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv { grid-template-columns: repeat(3, 1fr); }
  .kv div:nth-child(4) { border-left: 0; }
  .kv div:nth-child(n + 4) { border-top: 1px solid var(--line); }
}
@media (max-width: 520px) {
  .board { grid-template-columns: 1fr; }
  .kv { grid-template-columns: repeat(2, 1fr); }
  .kv div:nth-child(odd) { border-left: 0; }
  .kv div:nth-child(4) { border-left: 1px solid var(--line); }
  .kv div:nth-child(n + 3) { border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .top-inner { grid-template-columns: 1fr auto; height: auto; padding: 10px 0; row-gap: 8px; }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .btn { display: none; }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .summary div:nth-child(3) { border-left: 0; }
  .summary div:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .bars { gap: 2px; }
  .svc, .group-head { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
