/* Régie Mooverflow — charte : porcelaine, graphite, un seul accent bronze. */

:root {
  --paper: #F7F7F5;
  --surface: #FFFFFF;
  --ink: #1B1D22;
  --ink-soft: #3A3C42;
  --muted: #6E7076;
  --rule: #E3E3DE;
  --rule-strong: #CFCEC8;
  --bronze: #8A6A3B;
  --bronze-soft: #F1ECE3;
  --ok: #4F6F58;
  --warn: #A27A2C;
  --bad: #8C3A36;

  --serif: "Didot", "Bodoni 72", "Bodoni MT", "Bodoni Moda", "Libre Bodoni", "Playfair Display", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --sidebar: 288px;
  --radius: 2px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  font-feature-settings: "kern", "tnum";
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--bronze); color: var(--bronze); }
:focus-visible { outline: 2px solid var(--bronze); outline-offset: 2px; }
code { font: 13px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
h1, h2, h3 { font-weight: 400; margin: 0; }
p { margin: 0; }

.wordmark {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}
.wordmark.small { font-size: 22px; }
.house { display: block; font-size: 12px; letter-spacing: 0.08em; color: var(--muted); margin: 6px 0 0; }
.muted { color: var(--muted); }

/* ---------- Boutons et champs ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 0 20px;
  border: 1px solid var(--ink); border-radius: var(--radius);
  background: transparent; color: var(--ink);
  font: 500 13.5px/1 var(--sans); letter-spacing: 0.01em;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:hover { border-color: var(--bronze); color: var(--bronze); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--bronze); border-color: var(--bronze); color: #fff; }
.btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-danger:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn-link {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 13.5px; color: var(--muted);
  text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px;
}
.btn-link:hover { color: var(--bronze); text-decoration-color: var(--bronze); }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 13px; color: var(--ink-soft); }
.field em { font-style: normal; color: var(--muted); }
input:not([type=checkbox]):not([type=hidden]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font: 15px/1.4 var(--sans);
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--bronze-soft); }
input.otp { font: 26px/1 var(--serif); letter-spacing: 0.32em; text-align: center; padding: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-soft); }
.check input { margin-top: 3px; accent-color: var(--ink); }
.strength { font-size: 12.5px; color: var(--muted); min-height: 1em; }
.strength.weak { color: var(--bad); }
.strength.fair { color: var(--warn); }
.strength.good { color: var(--ok); }

.flash {
  margin: 0 0 24px; padding: 12px 16px;
  border-left: 2px solid var(--ink); background: var(--surface);
  font-size: 14px;
}
.flash-success { border-color: var(--ok); }
.flash-error { border-color: var(--bad); color: var(--bad); }

.note { font-size: 13px; color: var(--muted); margin-top: 28px; max-width: 64ch; }
.note code { color: var(--ink); }

/* ---------- Écrans d'accès ---------- */

body.auth { min-height: 100vh; display: flex; }
.auth-shell { width: 100%; max-width: 440px; margin: auto; padding: 64px 24px; }
.auth-brand { text-align: center; margin-bottom: 48px; }
.auth-brand .wordmark { font-size: 64px; }
.auth-panel { background: var(--surface); border: 1px solid var(--rule); padding: 40px 36px; }
.auth-panel h1 { font-family: var(--serif); font-size: 32px; line-height: 1.1; margin-bottom: 14px; }
.lede { color: var(--ink-soft); margin-bottom: 28px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack .btn { width: 100%; margin-top: 4px; }
.aside-form { margin-top: 22px; text-align: center; }
.aside-form.split { display: flex; justify-content: space-between; }
.auth-panel .note { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--rule); }

.progress { list-style: none; margin: 0 0 32px; padding: 0; display: flex; gap: 6px; }
.progress li {
  flex: 1; padding-top: 10px; border-top: 2px solid var(--rule);
  font-size: 11.5px; color: var(--muted); line-height: 1.3;
}
.progress li.done { border-color: var(--ink); color: var(--ink-soft); }
.progress li.current { color: var(--ink); font-weight: 600; }

.qr-block { display: flex; gap: 22px; align-items: center; margin: 4px 0 28px; }
.qr svg { display: block; width: 168px; height: 168px; border: 1px solid var(--rule); }
.secret p { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.secret code { display: block; word-spacing: 0.2em; margin-bottom: 8px; color: var(--ink); }

/* ---------- Application ---------- */

.shell { display: flex; min-height: 100vh; background: linear-gradient(to right, var(--surface) var(--sidebar), var(--paper) var(--sidebar)); }
.shell::before { content: none; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--sidebar); flex: none;
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--rule);
  padding: 36px 0 24px; overflow-y: auto;
}
.brand { display: block; padding: 0 28px 34px; text-decoration: none; }
.brand:hover .wordmark { color: var(--bronze); }

.nav-main a, .sidebar-foot a {
  display: block; padding: 8px 28px; font-size: 14px; text-decoration: none; color: var(--ink-soft);
  border-left: 2px solid transparent;
}
.nav-main a.is-active, .sidebar-foot a.is-active { color: var(--ink); border-left-color: var(--bronze); }
.nav-main a:hover, .sidebar-foot a:hover { color: var(--bronze); }

.projects-head { display: flex; align-items: baseline; justify-content: space-between; padding: 30px 28px 10px; }
.projects-head h2 { font-family: var(--serif); font-size: 21px; }
.projects-head .count { font-size: 12px; color: var(--muted); }
.filter { margin: 4px 28px 10px; width: calc(100% - 56px) !important; min-height: 36px !important; font-size: 14px !important; }

.project-list { list-style: none; margin: 0; padding: 0; }
.project-list a {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 28px 10px 26px; text-decoration: none;
  border-left: 2px solid transparent;
}
.project-list a:hover { background: var(--paper); color: inherit; }
.project-list a.is-active { border-left-color: var(--bronze); background: var(--paper); }
.p-name { font-size: 14.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-list .is-archived .p-name { color: var(--muted); }

.p-state { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.p-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--rule-strong); flex: none; }
.state-up i { background: var(--ok); }
.state-down { color: var(--bad); }
.state-down i { background: var(--bad); box-shadow: 0 0 0 3px rgba(140, 58, 54, .15); }
.state-unknown i, .state-off i { background: transparent; border: 1px solid var(--rule-strong); }

.add-project {
  margin: 12px 28px 0; padding: 10px 0; font-size: 13.5px; color: var(--muted);
  text-decoration: none; border-top: 1px solid var(--rule);
}
.add-project::before { content: "+"; display: inline-block; width: 18px; color: var(--bronze); }
.add-project:hover { color: var(--bronze); }

.sidebar-foot { margin-top: auto; padding-top: 28px; }
.sidebar-foot form { padding: 8px 28px; }

.main-wrap { flex: 1; min-width: 0; }
.topbar { display: none; }
.main { max-width: 1040px; padding: 64px 72px 96px; }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 32px;
  padding-bottom: 32px; margin-bottom: 8px;
}
.page-head h1 { font-family: var(--serif); font-size: 56px; line-height: 1.02; letter-spacing: -0.015em; }
.page-head .sub { margin-top: 14px; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; }
.page-head .sub a { color: var(--ink-soft); }
.actions { display: flex; gap: 10px; flex: none; }
.state-line.state-up { color: var(--ok); }
.state-line.state-down { color: var(--bad); }
.tag { font-size: 12px; padding: 2px 8px; border: 1px solid var(--rule-strong); color: var(--muted); }

.env-tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--rule); margin-bottom: 8px; }
.env-tabs a { padding: 10px 0; font-size: 14px; text-decoration: none; color: var(--muted); border-bottom: 1px solid transparent; margin-bottom: -1px; }
.env-tabs a.is-active { color: var(--ink); border-bottom-color: var(--ink); }

/* Le score : l'élément signature */
.score-band {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 48px;
  align-items: end; padding: 40px 0 44px; border-bottom: 1px solid var(--rule);
}
.score-main { display: flex; align-items: flex-end; gap: 22px; }
.score-figure {
  font-family: var(--serif); font-size: 168px; line-height: .78; letter-spacing: -0.04em;
  font-variant-numeric: lining-nums tabular-nums; color: var(--ink);
}
.score-main.is-mid .score-figure { color: var(--warn); }
.score-main.is-low .score-figure { color: var(--bad); }
.score-meta { padding-bottom: 6px; font-size: 13.5px; }
.score-meta p + p { margin-top: 3px; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.history { display: block; width: 160px; height: 36px; margin-top: 12px; }
.history polyline { fill: none; stroke: var(--ink); stroke-width: 1; }
.history circle { fill: var(--bronze); }

.subscores { margin: 0; display: flex; flex-direction: column; gap: 18px; padding-bottom: 6px; }
.subscores div { display: grid; grid-template-columns: 1fr auto; align-items: baseline; }
.subscores dt { font-size: 13.5px; color: var(--ink-soft); }
.subscores dd { margin: 0; display: contents; }
.subscores .n { font-family: var(--serif); font-size: 28px; line-height: 1; text-align: right; }
.bar { grid-column: 1 / -1; width: 100%; height: 2px; margin-top: 8px; display: block; }
.b-track { fill: var(--rule); }
.b-good { fill: var(--ink); }
.b-mid { fill: var(--warn); }
.b-low { fill: var(--bad); }

.score-empty { grid-column: 1 / -1; display: flex; gap: 32px; align-items: center; }
.muted-figure { color: var(--rule-strong); font-size: 120px; }
.score-empty p + p { margin-top: 6px; }

.block { padding: 40px 0 8px; border-bottom: 1px solid var(--rule); padding-bottom: 40px; }
.block > h2, .block > summary h2 { font-family: var(--serif); font-size: 28px; line-height: 1.1; margin-bottom: 24px; }
.block h3 { font-size: 14px; font-weight: 600; margin: 32px 0 12px; }
.block > p { max-width: 68ch; margin-bottom: 16px; }

.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin: 0 0 28px; }
.figures dt { font-size: 12.5px; color: var(--muted); }
.figures dd { margin: 4px 0 0; font-family: var(--serif); font-size: 30px; line-height: 1.1; }
.figures dd.warn { color: var(--bad); }

.checks-figure { margin: 0; }
.checks { display: block; width: 100%; height: 44px; }
.c-up { fill: var(--ink); }
.c-slow { fill: var(--warn); }
.c-down { fill: var(--bad); }
.c-empty { fill: var(--rule); }
.checks-figure figcaption { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 8px; }

.incidents { list-style: none; margin: 0; padding: 0; }
.incidents li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 1px solid var(--rule); font-size: 14px; }

.findings { list-style: none; margin: 0; padding: 0; counter-reset: f; }
.findings li { padding: 18px 0 18px 20px; border-top: 1px solid var(--rule); border-left: 2px solid transparent; }
.findings li:first-child { border-top: 0; }
.findings .sev-critique { border-left-color: var(--bad); }
.findings .sev-elevee { border-left-color: #9A5B2A; }
.findings .sev-moyenne { border-left-color: var(--warn); }
.findings .sev-faible { border-left-color: var(--rule-strong); }
.f-head { display: flex; gap: 14px; font-size: 12.5px; margin-bottom: 4px; }
.f-head .sev { font-weight: 600; }
.sev-critique .sev { color: var(--bad); }
.sev-elevee .sev { color: #9A5B2A; }
.sev-moyenne .sev { color: var(--warn); }
.sev-faible .sev { color: var(--muted); }
.f-head .cat { color: var(--muted); }
.f-title { font-size: 15.5px; font-weight: 500; }
.f-advice { color: var(--ink-soft); font-size: 14px; margin-top: 4px; max-width: 72ch; }
.calm { color: var(--ok); }

.passed { margin-top: 20px; font-size: 14px; }
.minor { margin-top: 8px; }
.minor > summary { cursor: pointer; color: var(--ink-soft); font-size: 14px; padding: 14px 0; border-top: 1px solid var(--rule); }
.minor .findings li:first-child { border-top: 1px solid var(--rule); }
.passed summary { cursor: pointer; color: var(--muted); }
.passed ul { list-style: none; padding: 0; margin: 12px 0 0; }
.passed li { padding: 6px 0; border-top: 1px solid var(--rule); display: flex; gap: 14px; }
.passed .cat { width: 190px; flex: none; color: var(--muted); font-size: 12.5px; padding-top: 2px; }
.metrics { margin-top: 24px; font-size: 13px; color: var(--muted); }

.notes { white-space: normal; max-width: 72ch; }
.placeholder { color: var(--muted); padding: 28px; border: 1px dashed var(--rule-strong); text-align: center; }

.settings > summary { list-style: none; cursor: pointer; }
.settings > summary::-webkit-details-marker { display: none; }
.settings > summary h2 { display: inline-flex; align-items: baseline; gap: 12px; margin-bottom: 0; }
.settings > summary h2::after { content: "Afficher"; font: 13px var(--sans); color: var(--muted); }
.settings[open] > summary h2::after { content: "Masquer"; }
.settings[open] > summary { margin-bottom: 24px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; max-width: 760px; }
.span-2 { grid-column: 1 / -1; }
.inline-actions { display: flex; gap: 20px; align-items: center; }
.reorder { display: flex; gap: 24px; margin-top: 28px; }
.danger { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--rule); max-width: 760px; }
.danger p { font-size: 13.5px; color: var(--muted); margin-bottom: 12px; }
.danger .inline { display: flex; gap: 12px; }
.danger input { max-width: 320px; }

/* Vue d'ensemble */
.overview, .log { width: 100%; border-collapse: collapse; margin-top: 16px; }
.overview th, .overview td, .log th, .log td { text-align: left; padding: 16px 12px; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.overview th:first-child, .overview td:first-child, .log th:first-child, .log td:first-child { padding-left: 0; }
.overview thead th, .log thead th { font-size: 12.5px; font-weight: 400; color: var(--muted); padding-top: 0; }
.overview tbody th { font-weight: 400; }
.overview tbody th a { font-size: 16px; text-decoration: none; }
.overview .host { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.overview .num { text-align: right; font-variant-numeric: tabular-nums; }
.score-cell { font-family: var(--serif); font-size: 26px; line-height: 1; }
.score-cell.is-mid { color: var(--warn); }
.score-cell.is-low { color: var(--bad); }
.overview .is-archived th a, .overview .is-archived td { color: var(--muted); }
.log td { font-size: 13.5px; padding: 10px 12px; }
.log .is-alert td:nth-child(2) { color: var(--bad); }
.log .detail { color: var(--muted); margin-left: 10px; }

.empty { padding: 72px 0; max-width: 520px; }
.empty h1, .empty h2 { font-family: var(--serif); font-size: 40px; line-height: 1.1; margin-bottom: 14px; }
.empty p { color: var(--ink-soft); margin-bottom: 28px; }

/* ---------- Mobile ---------- */

@media (max-width: 960px) {
  .main { padding: 40px 32px 80px; }
  .score-band { grid-template-columns: 1fr; gap: 36px; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .shell { background: var(--paper); }
  .sidebar {
    position: fixed; z-index: 20; left: 0; top: 0;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: none;
  }
  .sidebar.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(27, 29, 34, .28); }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 10;
    padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--rule);
  }
  .menu-toggle { border: 1px solid var(--rule-strong); background: none; padding: 8px 14px; font: 13.5px var(--sans); color: var(--ink); border-radius: var(--radius); }
  .main { padding: 32px 16px 64px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 20px; }
  .page-head h1 { font-size: 40px; }
  .actions { width: 100%; }
  .actions .btn { flex: 1; }
  .score-figure { font-size: 120px; }
  .form-grid { grid-template-columns: 1fr; }
  .overview thead { display: none; }
  .overview tr { display: grid; grid-template-columns: 1fr auto; padding: 14px 0; border-bottom: 1px solid var(--rule); }
  .overview th, .overview td { border: 0; padding: 2px 0; }
  .overview td.num { text-align: left; font-size: 13px; color: var(--muted); }
  .overview td.score-cell { grid-row: 1 / span 2; grid-column: 2; align-self: center; text-align: right; font-size: 34px; color: var(--ink); }
  .passed li { flex-direction: column; gap: 0; }
  .danger .inline { flex-direction: column; }
  .qr-block { flex-direction: column; align-items: flex-start; }
  .auth-panel { padding: 32px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Archivage ---------- */
.btn-quiet { border-color: var(--rule-strong); color: var(--muted); }
.btn-quiet:hover { border-color: var(--ink); color: var(--ink); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bulk-bar { display: flex; align-items: center; gap: 20px; padding: 18px 0 4px; min-height: 64px; }
.bulk-bar .btn { margin-left: auto; min-height: 36px; }
.bulk-bar .btn[disabled] { opacity: .35; cursor: default; }
.overview .sel { width: 28px; padding-left: 0; padding-right: 0; }
.overview .sel input, .bulk-bar input { accent-color: var(--ink); width: 15px; height: 15px; }
.overview tbody tr.is-selected { background: var(--bronze-soft); }
.env-tabs .muted { font-size: 12px; margin-left: 4px; }
.archived { margin: 18px 0 0; }
.archived > summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 28px; font-size: 13.5px; color: var(--muted);
}
.archived > summary::-webkit-details-marker { display: none; }
.archived > summary:hover { color: var(--ink); }
.archived > summary .count { font-size: 12px; }
.archived .project-list a { padding-top: 7px; padding-bottom: 7px; }
.archived .p-name { font-size: 13.5px; }
@media (max-width: 820px) {
  .overview .sel { grid-row: 1 / span 2; align-self: center; padding-right: 12px; }
  .overview tr { grid-template-columns: auto 1fr auto; }
  .bulk-bar { flex-wrap: wrap; }
}
.overview thead th, .overview .p-state, .overview td.num { white-space: nowrap; }
