/* Supervision MdM — charte MdM Services (mêmes couleurs et police que mdm-services.fr). */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url('/archivo-latin-var.woff') format('woff');
}

:root {
  --pin: #12382b;
  --pin-2: #1b4a3a;
  --mousse: #2e6b52;
  --brume: #d3e0d7;
  --ecume: #eef4ef;
  --resine: #f4b63f;
  --resine-f: #d9a238;
  --rouge: #b3362f;
  --rouge-fond: #fbeceb;
  --orange-fond: #fdf3dc;
  --vert-fond: #e3efe7;
  --texte-doux: #46665a;
  --blanc: #ffffff;
  --rayon: 10px;
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--pin);
  background: var(--ecume);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ecume);
}

a {
  color: var(--mousse);
}

:focus-visible {
  outline: 3px solid var(--resine);
  outline-offset: 2px;
  border-radius: 4px;
}

h1,
h2,
h3 {
  font-stretch: 75%;
  font-weight: 780;
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-wrap: balance;
  margin: 0;
}

[hidden] {
  display: none !important;
}

/* ── Barre du haut ─────────────────────────────────────────────── */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem clamp(1rem, 4vw, 2.5rem);
  background: var(--pin);
  color: var(--blanc);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--blanc);
  text-decoration: none;
  font-weight: 800;
  font-stretch: 75%;
  font-size: 1.35rem;
  line-height: 1;
}

.brand img {
  border-radius: 9px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.brand small {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  font-weight: 500;
  font-stretch: 100%;
  color: var(--brume);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.nav a,
.nav .link {
  color: var(--blanc);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
}

.nav a:hover,
.nav .link:hover {
  background: var(--pin-2);
}

.nav a[aria-current='page'] {
  background: var(--pin-2);
  box-shadow: inset 0 -3px 0 var(--resine);
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  margin-left: 0.2rem;
  border-radius: 999px;
  background: var(--resine);
  color: var(--pin);
  font-size: 0.8rem;
  font-weight: 800;
}

/* ── Mise en page ──────────────────────────────────────────────── */
main {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2.5rem) 4rem;
  outline: none;
}

.loading,
.empty {
  color: var(--texte-doux);
}

.verdict {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-stretch: 70%;
  font-weight: 800;
  max-width: 18em;
}

.verdict.ok {
  color: var(--mousse);
}

.verdict-sub {
  margin: 0.6rem 0 2.2rem;
  color: var(--texte-doux);
  font-size: 1.05rem;
  max-width: 42em;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.2rem 0 0.8rem;
  font-size: 1.45rem;
}

.section-title .muted {
  font-family: inherit;
  font-stretch: 100%;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--texte-doux);
}

/* ── Liste du parc ─────────────────────────────────────────────── */
.fleet {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--blanc);
  border: 1px solid var(--brume);
  border-radius: var(--rayon);
  overflow: hidden;
}

.fleet li + li {
  border-top: 1px solid var(--brume);
}

.pc {
  display: grid;
  grid-template-columns: 0.55rem minmax(12rem, 1.5fr) minmax(9rem, 1fr) repeat(2, 4.5rem) 7.5rem;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.1rem 0.85rem 0;
  color: inherit;
  text-decoration: none;
}

.pc:hover {
  background: var(--ecume);
}

.pc .stripe {
  align-self: stretch;
  border-radius: 0 3px 3px 0;
  background: var(--mousse);
}

.pc.warning .stripe {
  background: var(--resine);
}

.pc.critical .stripe {
  background: var(--rouge);
}

.pc.offline .stripe {
  background: var(--brume);
}

.pc-name {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.25;
}

.pc-name small {
  display: block;
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--texte-doux);
}

.pc-issue {
  font-size: 0.92rem;
  color: var(--texte-doux);
}

.pc.critical .pc-issue {
  color: var(--rouge);
  font-weight: 600;
}

.pc.warning .pc-issue {
  color: #7a5205;
  font-weight: 600;
}

.metric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

.metric small {
  display: block;
  color: var(--texte-doux);
  font-size: 0.75rem;
}

.seen {
  text-align: right;
  font-size: 0.85rem;
  color: var(--texte-doux);
}

.seen .dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.35rem;
  border-radius: 50%;
  background: var(--brume);
  vertical-align: 0.05rem;
}

.seen.on .dot {
  background: var(--mousse);
}

/* Barre de disque */
.gauge {
  height: 6px;
  margin-top: 0.3rem;
  border-radius: 3px;
  background: var(--ecume);
  overflow: hidden;
}

.gauge > span {
  display: block;
  height: 100%;
  background: var(--mousse);
}

.gauge.warning > span {
  background: var(--resine);
}

.gauge.critical > span {
  background: var(--rouge);
}

/* ── Boutons et formulaires ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0 1.15rem;
  border: 0;
  border-radius: 8px;
  background: var(--resine);
  color: var(--pin);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--resine-f);
}

.btn.secondary {
  background: transparent;
  border: 1.5px solid var(--pin);
}

.btn.secondary:hover {
  background: var(--pin);
  color: var(--blanc);
}

.btn.danger {
  background: transparent;
  border: 1.5px solid var(--rouge);
  color: var(--rouge);
}

.btn.danger:hover {
  background: var(--rouge);
  color: var(--blanc);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: progress;
}

.link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--mousse);
  text-decoration: underline;
  cursor: pointer;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.2rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.field {
  margin-bottom: 1rem;
}

.field .hint {
  font-size: 0.85rem;
  color: var(--texte-doux);
  margin-top: 0.25rem;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--brume);
  border-radius: 8px;
  background: var(--blanc);
  color: var(--pin);
  font: inherit;
}

input:focus,
select:focus {
  border-color: var(--mousse);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0 1.2rem;
}

/* ── Panneaux ──────────────────────────────────────────────────── */
.panel {
  background: var(--blanc);
  border: 1px solid var(--brume);
  border-radius: var(--rayon);
  padding: clamp(1rem, 2.5vw, 1.6rem);
}

.panel + .panel {
  margin-top: 1.2rem;
}

.panel h2 {
  font-size: 1.3rem;
  margin-bottom: 0.9rem;
}

.panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.2rem;
  align-items: start;
}

.panels .panel + .panel {
  margin-top: 0;
}

.narrow {
  max-width: 30rem;
  margin: clamp(1rem, 6vh, 4rem) auto 0;
}

.narrow h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.narrow p {
  color: var(--texte-doux);
}

.error {
  color: var(--rouge);
  font-weight: 600;
  min-height: 1.5em;
}

/* ── Fiche PC ──────────────────────────────────────────────────── */
.back {
  display: inline-block;
  margin-bottom: 1rem;
  font-weight: 600;
}

.pc-title {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-stretch: 70%;
  font-weight: 800;
}

.pc-meta {
  margin: 0.4rem 0 1.6rem;
  color: var(--texte-doux);
}

.vitals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1.2rem;
}

.vital strong {
  display: block;
  font-size: 2.1rem;
  font-stretch: 72%;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.vital span {
  color: var(--texte-doux);
  font-size: 0.9rem;
}

.spark {
  display: block;
  width: 100%;
  height: 44px;
  margin-top: 0.5rem;
}

.spark polyline {
  fill: none;
  stroke: var(--mousse);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.checks {
  list-style: none;
  margin: 0;
  padding: 0;
}

.checks li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--ecume);
}

.checks li:first-child {
  border-top: 0;
}

.checks .state {
  font-weight: 700;
  text-align: right;
}

.state.good {
  color: var(--mousse);
}

.state.warning {
  color: #7a5205;
}

.state.critical {
  color: var(--rouge);
}

.state.none {
  color: var(--texte-doux);
  font-weight: 400;
}

.disk + .disk {
  margin-top: 0.9rem;
}

.disk-head {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}

/* ── Alertes ───────────────────────────────────────────────────── */
.alerts {
  list-style: none;
  margin: 0;
  padding: 0;
}

.alert {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.9rem;
  align-items: start;
  padding: 0.85rem 0;
  border-top: 1px solid var(--brume);
}

.alert:first-child {
  border-top: 0;
}

.sev {
  margin-top: 0.15rem;
  padding: 0.1rem 0.55rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.sev.critical {
  background: var(--rouge-fond);
  color: var(--rouge);
}

.sev.warning {
  background: var(--orange-fond);
  color: #7a5205;
}

.sev.resolved {
  background: var(--vert-fond);
  color: var(--mousse);
}

.alert p {
  margin: 0;
}

.alert .when {
  font-size: 0.85rem;
  color: var(--texte-doux);
}

.alert.acked {
  opacity: 0.65;
}

/* Code d'inscription affiché en grand */
.code {
  display: inline-block;
  margin: 0.6rem 0;
  padding: 0.6rem 1rem;
  border: 2px dashed var(--resine);
  border-radius: 8px;
  font-size: 1.6rem;
  font-weight: 800;
  font-stretch: 85%;
  letter-spacing: 0.06em;
  user-select: all;
}

.secret {
  word-break: break-all;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

table.simple {
  width: 100%;
  border-collapse: collapse;
}

table.simple td {
  padding: 0.55rem 0;
  border-top: 1px solid var(--ecume);
}

table.simple td:last-child {
  text-align: right;
}

.toast {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 2rem);
  padding: 0.75rem 1.2rem;
  border-radius: 8px;
  background: var(--pin);
  color: var(--blanc);
  font-weight: 600;
  box-shadow: 0 12px 30px -12px rgba(18, 56, 43, 0.6);
}

/* ── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .pc {
    grid-template-columns: 0.45rem 1fr auto;
    grid-template-areas:
      'stripe name seen'
      'stripe issue issue';
    row-gap: 0.25rem;
  }
  .pc .stripe {
    grid-area: stripe;
  }
  .pc .pc-name {
    grid-area: name;
  }
  .pc .pc-issue {
    grid-area: issue;
  }
  .pc .seen {
    grid-area: seen;
  }
  .pc .metric {
    display: none;
  }
  .nav a,
  .nav .link {
    padding: 0.4rem 0.5rem;
    font-size: 0.9rem;
  }
  .brand small {
    display: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .toast {
    animation: rise 0.2s ease-out;
  }
  @keyframes rise {
    from {
      opacity: 0;
      transform: translate(-50%, 0.5rem);
    }
  }
}

/* ── Retouches ─────────────────────────────────────────────────── */
main:focus,
main:focus-visible {
  outline: none;
}

.error:empty {
  min-height: 0;
  margin: 0;
}

form h3 {
  margin: 1.4rem 0 0.6rem;
  font-size: 1.1rem;
}

table.simple tr:first-child td {
  border-top: 0;
}

table.simple + form {
  margin-top: 1.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--brume);
}

@media (max-width: 760px) {
  .brand > span {
    display: none;
  }
  .nav {
    flex-wrap: nowrap;
    gap: 0;
  }
}

@media (max-width: 760px) {
  .nav a,
  .nav .link {
    white-space: nowrap;
    padding: 0.35rem 0.4rem;
    font-size: 0.85rem;
  }
}

/* ── Clients ───────────────────────────────────────────────────── */
.pc.client {
  grid-template-columns: 0.55rem minmax(12rem, 1.4fr) minmax(10rem, 1.4fr) 10rem;
}

textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--brume);
  border-radius: 8px;
  background: var(--blanc);
  color: var(--pin);
  font: inherit;
  resize: vertical;
}

textarea:focus {
  border-color: var(--mousse);
}

input[type='search'] {
  max-width: 34rem;
}

.banner {
  margin: -0.6rem 0 1.6rem;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  background: var(--orange-fond);
  color: #5c3e04;
  font-weight: 600;
}

.code-panel {
  margin-bottom: 1.2rem;
  border: 2px solid var(--resine);
}

.btn[disabled].danger {
  cursor: not-allowed;
}

@media (max-width: 760px) {
  .pc.client {
    grid-template-columns: 0.45rem 1fr;
    grid-template-areas:
      'stripe name'
      'stripe issue'
      'stripe seen';
  }
  .pc.client .seen {
    text-align: left;
  }
}
