/* ═══════════════════════════════════════════════════════════════════════
   ERP365 — feuille de style unique (Control Plane + site marketing).
   Pas de framework, pas de build : une seule requete, lisible et modifiable.

   DIRECTION : panneau d'instrumentation. Le produit sert a lire l'etat reel
   d'une infrastructure ; l'interface emprunte donc son vocabulaire visuel aux
   panneaux de controle — surface anodisee, etiquettes serigraphiees en
   capitales condensees, voyants carres, identifiants en chasse fixe.

   ELEMENT SIGNATURE : le « couple d'etats » (.pair). Tout le produit repose
   sur l'ecart entre etat DESIRE et etat REEL. Partout ou ce couple existe, un
   rail relie les deux valeurs : continu quand elles concordent, decroche et
   colore quand elles divergent.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Jetons ────────────────────────────────────────────────────────── */
:root {
  --ground:      #ECEDE8;   /* surface anodisee, gris-vert tiede */
  --ground-deep: #E982E4;   /* remplace plus bas — garde-fou visuel si oubli */
  --panel:       #FFFFFF;
  --panel-alt:   #F6F7F3;
  --rail:        #1E211D;   /* le bati : rail de navigation */
  --rail-soft:   #2C302B;
  --rail-text:   #C9CCC3;

  --ink:         #171A16;
  --ink-soft:    #52584F;
  --ink-faint:   #858B80;
  --line:        #D6D8D0;
  --line-soft:   #E6E8E1;

  --accent:      #4B3FBB;   /* indigo : action primaire et marque */
  --accent-deep: #372CA0;
  --accent-wash: #EDEBFA;

  /* Signaux d'instrument : satures mais jamais fluorescents. */
  --ok:    #2F6B4F;  --ok-wash:   #E4EFE8;
  --warn:  #A9660F;  --warn-wash: #F7EEDF;
  --bad:   #AC3226;  --bad-wash:  #F8E6E3;
  --busy:  #2C5B8A;  --busy-wash: #E3ECF4;
  --muted: #7A8076;  --muted-wash:#EDEEE9;

  --r: 3px;                  /* rayon minimal : panneau, pas application mobile */
  --shadow: 0 1px 2px rgba(23,26,22,.06), 0 8px 24px -16px rgba(23,26,22,.28);

  --font-display: "IBM Plex Sans Condensed", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
:root { --ground-deep: #E1E3DC; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Accessibilite : le focus doit rester visible partout. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

code, .mono, .id { font-family: var(--font-mono); font-size: .92em; }

/* ── Etiquette serigraphiee ────────────────────────────────────────── */
.label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ── Ossature du Control Plane ─────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.rail {
  background: var(--rail);
  color: var(--rail-text);
  padding: 20px 0 24px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.rail__brand {
  display: block; padding: 0 20px 20px;
  border-bottom: 1px solid var(--rail-soft);
  color: #fff; text-decoration: none;
}
.rail__brand:hover { text-decoration: none; }
.rail__wordmark {
  font-family: var(--font-display);
  font-weight: 700; font-size: 21px; letter-spacing: .04em;
  text-transform: uppercase; line-height: 1;
}
.rail__wordmark em { font-style: normal; color: #9A8FF0; }
.rail__env {
  margin-top: 7px; display: inline-block;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--rail-text);
  border: 1px solid var(--rail-soft); border-radius: 2px; padding: 2px 6px;
}
.rail__group { padding: 16px 20px 4px; }
.rail__group .label { color: #6E756A; }
.rail nav { display: flex; flex-direction: column; }
.rail nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 20px; color: var(--rail-text); font-size: 13.5px;
  border-left: 2px solid transparent;
}
.rail nav a:hover { background: var(--rail-soft); color: #fff; text-decoration: none; }
.rail nav a[aria-current="page"] {
  background: var(--rail-soft); color: #fff; border-left-color: #9A8FF0; font-weight: 500;
}
.rail nav a .count {
  font-family: var(--font-mono); font-size: 11px; color: #8B9186;
}
.rail__foot { margin-top: auto; padding: 16px 20px 0; border-top: 1px solid var(--rail-soft); }
.rail__user { font-size: 12.5px; color: var(--rail-text); }
.rail__user strong { display: block; color: #fff; font-weight: 500; }
.rail__logout {
  margin-top: 10px; background: none; border: 1px solid var(--rail-soft);
  color: var(--rail-text); font: inherit; font-size: 12px;
  padding: 5px 10px; border-radius: var(--r); cursor: pointer; width: 100%;
}
.rail__logout:hover { background: var(--rail-soft); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 16px 28px; display: flex; align-items: flex-start;
  justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.topbar h1 { margin: 0; font-family: var(--font-display); font-size: 25px; font-weight: 600; letter-spacing: -.01em; }
.topbar p { margin: 4px 0 0; color: var(--ink-soft); font-size: 13.5px; max-width: 68ch; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.crumbs { font-size: 12.5px; color: var(--ink-faint); margin-bottom: 5px; }
.crumbs a { color: var(--ink-soft); }

.content { padding: 24px 28px 56px; flex: 1; }
.content > * + * { margin-top: 20px; }

/* ── Panneaux ──────────────────────────────────────────────────────── */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow);
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--line-soft);
  background: var(--panel-alt); border-radius: var(--r) var(--r) 0 0;
}
.panel__head h2 { margin: 0; font-family: var(--font-display); font-size: 15px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; }
.panel__body { padding: 16px; }
.panel__body > * + * { margin-top: 14px; }
.panel__foot { padding: 10px 16px; border-top: 1px solid var(--line-soft); background: var(--panel-alt);
  border-radius: 0 0 var(--r) var(--r); font-size: 12.5px; color: var(--ink-soft); }
.panel--flush .panel__body { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }

/* ── Compteurs ─────────────────────────────────────────────────────── */
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.meter { background: var(--panel); padding: 13px 15px; }
.meter__v { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1.05;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.meter__k { margin-top: 3px; }
.meter__sub { margin-top: 3px; font-size: 12px; color: var(--ink-faint); font-family: var(--font-mono); }
.meter--alert .meter__v { color: var(--bad); }
.meter--warn  .meter__v { color: var(--warn); }

/* ── Voyants ───────────────────────────────────────────────────────── */
.lamp {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.lamp::before {
  content: ""; width: 9px; height: 9px; flex: none;
  background: currentColor; border-radius: 1px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.22);
}
.lamp--ok    { color: var(--ok); }
.lamp--warn  { color: var(--warn); }
.lamp--bad   { color: var(--bad); }
.lamp--busy  { color: var(--busy); }
.lamp--muted { color: var(--muted); }
.lamp--busy::before { animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .32; } }

.tag {
  display: inline-block; padding: 2px 7px; border-radius: 2px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .02em;
  background: var(--muted-wash); color: var(--ink-soft); border: 1px solid var(--line);
}
.tag--ok   { background: var(--ok-wash);   color: var(--ok);   border-color: #C6DDD0; }
.tag--warn { background: var(--warn-wash); color: var(--warn); border-color: #E6D2AE; }
.tag--bad  { background: var(--bad-wash);  color: var(--bad);  border-color: #EBC4BE; }
.tag--busy { background: var(--busy-wash); color: var(--busy); border-color: #C2D5E6; }

/* ── SIGNATURE : le couple d'etats desire / reel ───────────────────── */
.pair {
  display: grid; grid-template-columns: auto 26px auto; align-items: center;
  gap: 0; font-family: var(--font-mono); font-size: 12.5px;
}
.pair__v { padding: 2px 7px; border: 1px solid var(--line); border-radius: 2px; background: var(--panel-alt); }
.pair__v--desired { color: var(--ink-soft); }
.pair__v--actual  { color: var(--ink); font-weight: 500; }
/* Rail de liaison : continu quand les deux valeurs concordent. */
.pair__link { position: relative; height: 100%; }
.pair__link::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 1px; background: var(--line); transform: translateY(-50%);
}
/* Divergence : le rail se decroche et prend la couleur du signal. */
.pair--drift .pair__link::before { background: var(--warn); height: 2px; }
.pair--drift .pair__link::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px;
  background: var(--warn); border-radius: 1px;
  box-shadow: 0 0 0 3px var(--panel);
}
.pair--drift .pair__v--actual { color: var(--warn); border-color: #E6D2AE; background: var(--warn-wash); }
.pair--unknown .pair__v--actual { color: var(--ink-faint); font-style: italic; }
.pair__legend { display: flex; gap: 26px; margin-bottom: 6px; }
.pair__legend span { font-family: var(--font-display); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint); }

/* ── Tableaux ──────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 9px 14px; background: var(--panel-alt);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display); font-size: 11px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint);
  white-space: nowrap;
}
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tbody tr:hover { background: var(--panel-alt); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.cell-title { font-weight: 500; }
.cell-sub { display: block; font-size: 12px; color: var(--ink-faint); margin-top: 1px; }

.empty { padding: 34px 16px; text-align: center; color: var(--ink-soft); }
.empty p { margin: 0 0 12px; }

/* ── Listes de definitions ─────────────────────────────────────────── */
.dl { display: grid; grid-template-columns: 158px minmax(0,1fr); gap: 7px 14px; font-size: 13px; }
.dl dt { color: var(--ink-faint); font-size: 12px; }
.dl dd { margin: 0; word-break: break-word; }

/* ── Boutons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--panel); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--panel-alt); border-color: var(--ink-faint); text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn--danger { color: var(--bad); border-color: #E0BDB7; }
.btn--danger:hover { background: var(--bad-wash); border-color: var(--bad); }
.btn--sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Formulaires ───────────────────────────────────────────────────── */
.field { margin-bottom: 15px; }
.field > label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 4px; }
.field .hint { font-size: 12.5px; color: var(--ink-faint); margin: 3px 0 0; }
.field .err { font-size: 12.5px; color: var(--bad); margin: 4px 0 0; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; font: inherit; font-size: 13.5px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel); color: var(--ink);
}
input.mono, .field input.mono { font-family: var(--font-mono); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline-offset: 0; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--bad); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.check input { margin-top: 3px; }

/* ── Messages ──────────────────────────────────────────────────────── */
.note { padding: 11px 14px; border-radius: var(--r); border: 1px solid; font-size: 13px; }
.note--ok   { background: var(--ok-wash);   border-color: #C6DDD0; color: #23503C; }
.note--warn { background: var(--warn-wash); border-color: #E6D2AE; color: #6E4409; }
.note--bad  { background: var(--bad-wash);  border-color: #EBC4BE; color: #83251C; }
.note--info { background: var(--accent-wash); border-color: #CFC9F2; color: #2E2582; }
.note strong { font-weight: 600; }
.note ul { margin: 6px 0 0; padding-left: 18px; }

/* ── Sequence d'etapes (deploiements) ──────────────────────────────── */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 26px minmax(0,1fr) auto; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft); align-items: start; }
.steps li:last-child { border-bottom: 0; }
.steps .n { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint);
  text-align: right; padding-top: 1px; font-variant-numeric: tabular-nums; }
.steps .lbl { font-weight: 500; }
.steps .msg { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.steps .dur { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; }

/* ── Journal ───────────────────────────────────────────────────────── */
.log {
  background: var(--rail); color: #CBD0C6; font-family: var(--font-mono);
  font-size: 12px; line-height: 1.6; padding: 14px 16px;
  border-radius: var(--r); overflow-x: auto; max-height: 460px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word; margin: 0;
}

/* ── Pagination ────────────────────────────────────────────────────── */
.pager { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.pager a, .pager span { padding: 4px 9px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.pager .active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager .disabled { color: var(--ink-faint); }
.pager svg { width: 13px; height: 13px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.toolbar .field { margin: 0; min-width: 168px; }

.stack > * + * { margin-top: 14px; }
.muted { color: var(--ink-faint); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ═══ SITE MARKETING ═══════════════════════════════════════════════ */
.site { background: var(--ground); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

.site-head { border-bottom: 1px solid var(--line); background: rgba(255,255,255,.72); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 10; }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; height: 64px; }
.wordmark { font-family: var(--font-display); font-weight: 700; font-size: 22px;
  letter-spacing: .04em; text-transform: uppercase; color: var(--ink); }
.wordmark:hover { text-decoration: none; }
.wordmark em { font-style: normal; color: var(--accent); }
.site-nav { display: flex; gap: 22px; align-items: center; font-size: 14px; }
.site-nav a { color: var(--ink-soft); }
.site-nav a:hover { color: var(--ink); }

.hero { padding: 76px 0 64px; }
.hero__grid { display: grid; grid-template-columns: minmax(0,1fr) 420px; gap: 56px; align-items: center; }
.hero h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(38px, 5.4vw, 62px); line-height: 1.03;
  letter-spacing: -.02em; margin: 14px 0 0;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lede { font-size: 17px; line-height: 1.6; color: var(--ink-soft); margin: 20px 0 0; max-width: 54ch; }
.hero .btn-row { margin-top: 28px; }

/* Hero : la sequence REELLE de provisioning. Le contenu le plus
   caracteristique du produit, montre tel quel plutot qu'illustre. */
.sequence { background: var(--rail); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); }
.sequence__head { display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--rail-soft); }
.sequence__head .label { color: #7E857A; }
.sequence__head .t { font-family: var(--font-mono); font-size: 11px; color: #7E857A; }
.sequence ol { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.sequence li {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: baseline;
  padding: 5px 0; color: #C4C9BF; font-size: 13px; counter-increment: s;
}
.sequence li::before { content: counter(s, decimal-leading-zero); font-family: var(--font-mono);
  font-size: 11px; color: #6E756A; }
.sequence li .d { font-family: var(--font-mono); font-size: 11px; color: #6E756A; }
.sequence li.on { color: #fff; }
.sequence li.on .d { color: #8FBFA4; }

.section { padding: 60px 0; border-top: 1px solid var(--line); }
.section h2 { font-family: var(--font-display); font-size: clamp(26px, 3vw, 34px); font-weight: 600;
  letter-spacing: -.015em; margin: 10px 0 0; }
.section p.intro { color: var(--ink-soft); font-size: 15.5px; max-width: 62ch; margin: 12px 0 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); gap: 18px; margin-top: 34px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card h3 { font-family: var(--font-display); font-size: 17px; font-weight: 600; margin: 10px 0 7px;
  letter-spacing: .01em; }
.card p { margin: 0; color: var(--ink-soft); font-size: 13.5px; line-height: 1.6; }

.price { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; }
.price--hi { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.price h3 { font-family: var(--font-display); font-size: 19px; margin: 0 0 4px; letter-spacing: .02em; }
.price .amount { font-family: var(--font-display); font-size: 36px; font-weight: 600; letter-spacing: -.02em; }
.price .per { font-size: 13px; color: var(--ink-faint); }
.price ul { list-style: none; margin: 16px 0 0; padding: 0; font-size: 13.5px; }
.price li { padding: 5px 0; border-bottom: 1px solid var(--line-soft); color: var(--ink-soft); }
.price li:last-child { border-bottom: 0; }

.site-foot { border-top: 1px solid var(--line); padding: 34px 0; color: var(--ink-faint); font-size: 13px; }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.site-foot a { color: var(--ink-soft); }

/* ── Page de connexion ─────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ground); }
.auth__box { width: 100%; max-width: 372px; }
.auth__brand { text-align: center; margin-bottom: 22px; }
.auth__brand .wordmark { font-size: 27px; }
.auth__brand p { margin: 6px 0 0; color: var(--ink-faint); font-size: 13px; }

/* ── Adaptatif ─────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; }
  .rail nav { flex-direction: row; flex-wrap: wrap; padding: 0 12px; }
  .rail nav a { border-left: 0; border-bottom: 2px solid transparent; padding: 8px 10px; }
  .rail nav a[aria-current="page"] { border-left: 0; border-bottom-color: #9A8FF0; }
  .rail__group { display: none; }
  .grid--2, .grid--3, .grid--sidebar { grid-template-columns: minmax(0, 1fr); }
  .hero__grid { grid-template-columns: minmax(0,1fr); gap: 34px; }
}
@media (max-width: 640px) {
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .dl { grid-template-columns: minmax(0,1fr); gap: 2px 0; }
  .dl dt { margin-top: 8px; }
  .site-nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media print {
  .rail, .topbar .actions, .btn { display: none; }
  .shell { grid-template-columns: 1fr; }
}
