:root {
  --bg: #0A0C0F;
  --bg-2: #0E1116;

  --surface: rgba(255, 255, 255, 0.028);
  --surface-2: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text: #EDEFF2;
  --text-muted: #9BA3AE;
  --text-dim: #838A94;

  --ok: #47D19A;
  --ok-soft: rgba(71, 209, 154, 0.14);
  --ok-text: #85E9BE;

  --hold: #E6B15A;
  --hold-soft: rgba(230, 177, 90, 0.13);
  --hold-text: #F0CB8C;

  --bad: #E66A6A;
  --bad-soft: rgba(230, 106, 106, 0.14);
  --bad-text: #F2A3A3;

  --radius: 20px;
  --radius-sm: 12px;
  --ff: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --gutter: clamp(16px, 5vw, 28px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

.aura {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(71, 209, 154, 0.10), transparent 55%),
    radial-gradient(90% 70% at 85% 110%, rgba(90, 120, 160, 0.08), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top) + var(--gutter))
    calc(env(safe-area-inset-right) + var(--gutter))
    calc(env(safe-area-inset-bottom) + var(--gutter))
    calc(env(safe-area-inset-left) + var(--gutter));
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 30px 80px -40px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ---- Marque ---- */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 2px 18px;
}

.brand__home { display: block; border-radius: 12px; text-decoration: none; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

.brand__id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand__name { font-size: 16px; font-weight: 600; letter-spacing: 0.13em; }
.brand__sub {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
  text-wrap: balance; /* deux lignes équilibrées à 390 px, jamais de « V0 » orphelin */
}

.brand__back {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.brand__back:hover { color: var(--text); border-color: var(--border-strong); }

/* ---- Héros état global ---- */
.hero { padding: 22px clamp(18px, 5vw, 26px); }

.hero__status { display: flex; align-items: center; gap: 16px; }

.hero__dot {
  position: relative;
  flex: none;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
}
.hero__dot i { position: absolute; border-radius: 50%; }
.hero__dot i:first-child { width: 10px; height: 10px; }
.hero__dot i:last-child { width: 16px; height: 16px; border: 1.5px solid transparent; opacity: 0.6; }

.hero__dot[data-state="ok"] i:first-child { background: var(--ok); box-shadow: 0 0 14px 2px rgba(71,209,154,0.6); }
.hero__dot[data-state="ok"] i:last-child { border-color: var(--ok); animation: pulse 2.4s ease-out infinite; }
.hero__dot[data-state="warn"] i:first-child { background: var(--hold); box-shadow: 0 0 12px 2px rgba(230,177,90,0.55); }
.hero__dot[data-state="warn"] i:last-child { border-color: var(--hold); }
.hero__dot[data-state="bad"] i:first-child { background: var(--bad); box-shadow: 0 0 12px 2px rgba(230,106,106,0.55); }
.hero__dot[data-state="bad"] i:last-child { border-color: var(--bad); }
.hero__dot[data-state="loading"] i:first-child { background: var(--text-dim); }
.hero__dot[data-state="loading"] i:last-child { border-color: var(--text-dim); animation: pulse 1.2s ease-out infinite; }

@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.7; }
  70%, 100% { transform: scale(1.9); opacity: 0; }
}

.hero__label {
  display: block;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.hero__value {
  margin: 2px 0 0;
  font-size: clamp(26px, 7.4vw, 32px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.12;
}

.hero__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.hero__updated { margin: 0; font-size: 13px; color: var(--text-muted); }
.hero__updated time { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.hero__msg {
  margin: 14px 0 0;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid rgba(230, 106, 106, 0.3);
  background: var(--bad-soft);
  color: var(--bad-text);
}
.hero__msg[data-tone="warn"] {
  border-color: rgba(230, 177, 90, 0.32);
  background: var(--hold-soft);
  color: var(--hold-text);
}

/* ---- Boutons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(71, 209, 154, 0.35);
  background: var(--ok-soft);
  color: var(--ok-text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: rgba(71, 209, 154, 0.55); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn__ico { font-size: 16px; line-height: 0; }
.btn--busy .btn__ico { display: inline-block; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn--ghost {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}
.btn--ghost:hover { border-color: rgba(255, 255, 255, 0.28); }

/* ---- Grille de cartes ---- */
.grid { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }

.card { padding: 20px clamp(18px, 5vw, 24px); }

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.card__title { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: 0.01em; }

.card__tag {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--text-dim);
}
.card__tag--footer { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.card__tag code, .list__hint code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--text-muted); }

.card__msg {
  margin: 14px 0 0;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid rgba(230, 106, 106, 0.3);
  background: var(--bad-soft);
  color: var(--bad-text);
}

/* ---- Paires clé/valeur ---- */
.kv { list-style: none; margin: 14px 0 0; padding: 0; }
.kv__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.kv__row:last-child { border-bottom: 0; padding-bottom: 0; }
.kv__k { font-size: 13px; color: var(--text-muted); }
.kv__v {
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.kv__v[data-tone="ok"] { color: var(--ok-text); }
.kv__v[data-tone="warn"] { color: var(--hold-text); }
.kv__v[data-tone="bad"] { color: var(--bad-text); }

.chip-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

/* ---- Listes à puces d'état ---- */
.list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.list__row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}
.list__row--hold { background: var(--hold-soft); border-color: rgba(230, 177, 90, 0.26); }
.list__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.list__label { font-size: 14px; font-weight: 600; }
.list__hint { font-size: 12.5px; color: var(--text-muted); overflow-wrap: anywhere; }

.dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--text-dim);
}
.dot--ok, .dot[data-state="ok"] { background: var(--ok); box-shadow: 0 0 8px rgba(71, 209, 154, 0.55); }
.dot--hold, .dot[data-state="warn"] { background: var(--hold); box-shadow: 0 0 8px rgba(230, 177, 90, 0.5); }
.dot[data-state="bad"] { background: var(--bad); box-shadow: 0 0 8px rgba(230, 106, 106, 0.5); }
.dot--doc { background: var(--text-dim); box-shadow: none; }

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  font-style: normal;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  vertical-align: 2px;
  margin-left: 6px;
}
.badge--measured { color: var(--ok-text); border-color: rgba(71, 209, 154, 0.3); }
.badge--file { margin-left: 0; color: var(--hold-text); border-color: rgba(230, 177, 90, 0.32); }

.chain {
  margin: 12px 0 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.chain__arrow { color: var(--text-dim); padding: 0 4px; }

/* ---- Actions ---- */
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.actions .btn { flex: 1 1 180px; }

/* ---- Timeline ---- */
.timeline { list-style: none; margin: 14px 0 0; padding: 0; position: relative; }
.timeline__item {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 9px 0 9px 2px;
}
.timeline__item + .timeline__item { border-top: 1px dashed var(--border); }
.timeline__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.timeline__label { font-size: 14px; font-weight: 600; }
.timeline__label code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--text-muted); }
.timeline__hint { font-size: 12.5px; color: var(--text-muted); }

/* ---- Pied ---- */
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding: 4px 2px 8px;
}
.foot__note { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12.5px; color: var(--text-dim); }
.foot__dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--hold); }
.foot__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.foot__link:hover { color: var(--text); }

/* ---- Desktop / tablette ---- */
@media (min-width: 900px) {
  .shell { max-width: 1080px; }
  .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .card--wide { grid-column: 1 / -1; }
  .hero { padding: 26px 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__dot i:last-child { animation: none !important; opacity: 0.4; }
  .btn--busy .btn__ico { animation: none; }
}
