/* Pangolin — Digital Trust
   Palette reprise de digitaltrust.cm : bleu marine, bleu institutionnel, cyan. */

:root {
  --navy-950: #06192e;
  --navy-900: #0a2a48;
  --navy-800: #0e3457;
  --blue-700: #12477e;
  --blue-600: #14538a;
  --blue-500: #1f66a6;
  --cyan-400: #6cc4e0;
  --cyan-300: #93d6ec;

  --ink: #0d2038;
  --ink-soft: #40566e;
  --ink-faint: #6b7f95;
  --line: #dde7f1;
  --line-strong: #c9d6e4;
  --bg: #f6f9fc;
  --bg-alt: #eef4fa;
  --surface: #ffffff;

  --ok: #17704a;      --ok-bg: #e7f4ed;
  --warn: #8a5a00;    --warn-bg: #fbf1dc;
  --crit: #a8291c;    --crit-bg: #fbeae8;

  --font: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --radius: 6px;
  --side: 236px;
}

* { box-sizing: border-box; }

/* Les classes qui fixent `display` l'emporteraient sur l'attribut hidden. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-500); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code, .mono { font-family: var(--mono); font-size: .92em; }
:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; }

/* ------------------------------------------------------------------ */
/* Ossature                                                            */
/* ------------------------------------------------------------------ */

.app {
  display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh;
  /* la colonne reste marine sous la barre laterale collante, quelle que soit la hauteur */
  background: linear-gradient(90deg, var(--navy-950) var(--side), var(--bg) var(--side));
}

.side {
  background: var(--navy-950);
  color: #c7d5e3;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand img { width: 28px; height: auto; display: block; }
.brand strong { display: block; color: #fff; font-size: 15px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.brand span { display: block; color: var(--cyan-300); font-size: 12px; line-height: 1.3; }

.nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: #6f86a0; padding: 14px 10px 6px;
}
.nav-label:first-child { padding-top: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 4px;
  color: #c7d5e3; font-size: 13.5px;
  position: relative;
}
.nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(255, 255, 255, .08); color: #fff; font-weight: 500; }
.nav a.on::before {
  content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px;
  width: 2px; background: var(--cyan-400); border-radius: 0 2px 2px 0;
}
.nav svg { width: 16px; height: 16px; flex: none; opacity: .8; }
.nav a.on svg { opacity: 1; }

.side-foot {
  margin-top: auto; padding: 14px 20px 18px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  font-size: 12px; color: #6f86a0; line-height: 1.6;
}
.side-foot b { color: #c7d5e3; font-weight: 500; }

.main { min-width: 0; display: flex; flex-direction: column; }

.top {
  height: 56px; flex: none;
  display: flex; align-items: center; gap: 16px;
  padding: 0 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.top h2 { margin: 0 auto 0 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-soft); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy-800); color: #fff;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.who .sep { width: 1px; height: 18px; background: var(--line); }

.page { padding: 28px 32px 56px; max-width: 1240px; width: 100%; }

.page-head { display: flex; align-items: center; gap: 24px; margin-bottom: 22px; }
.page-head > div { margin-right: auto; }
.page-head h1 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -.015em; }
.page-head p { margin: 4px 0 0; color: var(--ink-faint); font-size: 13.5px; }

h3 { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.section-head h3 { margin: 0; }
.section-head span { font-size: 12.5px; color: var(--ink-faint); }

/* ------------------------------------------------------------------ */
/* Boutons et champs                                                   */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  font: 500 13.5px/1 var(--font);
  border-radius: 4px; border: 1px solid transparent;
  background: var(--blue-600); color: #fff;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--blue-700); text-decoration: none; }
.btn:disabled { background: var(--line-strong); cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-alt); }
.btn-danger { background: var(--crit); }
.btn-danger:hover { background: #8c2216; }
.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: var(--blue-500);
}
.link-btn:hover { text-decoration: underline; text-underline-offset: 2px; }
.link-btn.danger { color: var(--crit); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 16px; }
label, .label { font-size: 13px; font-weight: 500; color: var(--ink); }
.hint { font-size: 12.5px; color: var(--ink-faint); line-height: 1.5; }

input[type="text"], input[type="password"], input[type="time"], select {
  width: 100%; height: 36px; padding: 0 11px;
  font: 400 14px var(--font); color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 4px;
}
select {
  appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%236b7f95' stroke-width='1.5'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input:hover, select:hover { border-color: #a9bbcf; }
input:focus, select:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(31, 102, 166, .14); }

.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--blue-600); flex: none; }
.check label { font-weight: 500; }

/* ------------------------------------------------------------------ */
/* Panneaux, tableaux                                                  */
/* ------------------------------------------------------------------ */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-body { padding: 20px; }
.panel-foot {
  padding: 14px 20px; border-top: 1px solid var(--line); background: #fbfcfe;
  display: flex; align-items: center; gap: 12px; border-radius: 0 0 var(--radius) var(--radius);
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-faint);
  padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: #fbfcfe;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcfe; }
td.num { font-variant-numeric: tabular-nums; }
td .sub { display: block; font-size: 12.5px; color: var(--ink-faint); margin-top: 1px; }
td.actions { text-align: right; white-space: nowrap; }
th:first-child { border-top-left-radius: var(--radius); }
th:last-child { border-top-right-radius: var(--radius); }

/* Etat : un repere de couleur et un mot, jamais la couleur seule. */
.state { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--ink-faint); }
.state.ok::before, .state.nominal::before, .state.succes::before { background: var(--ok); }
.state.warn::before, .state.attention::before, .state.partiel::before { background: #c58a10; }
.state.crit::before, .state.critique::before, .state.echec::before, .state.interrompu::before { background: var(--crit); }
.state.run::before, .state.encours::before { background: var(--blue-500); }

.tag {
  display: inline-block; font-size: 12px; line-height: 20px; padding: 0 7px;
  border-radius: 3px; background: var(--bg-alt); color: var(--ink-soft);
  white-space: nowrap;
}
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.crit { background: var(--crit-bg); color: var(--crit); }

.count { font-variant-numeric: tabular-nums; font-weight: 500; }
.count.crit { color: var(--crit); }
.count.warn { color: var(--warn); }
.muted { color: var(--ink-faint); }

/* ------------------------------------------------------------------ */
/* Indicateurs                                                         */
/* ------------------------------------------------------------------ */

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); }
.kpi { padding: 18px 20px 20px; }
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi dt { font-size: 12.5px; color: var(--ink-soft); }
.kpi dd { margin: 6px 0 0; display: flex; align-items: baseline; gap: 8px; }
.kpi .value { font-size: 28px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.kpi .value.crit { color: var(--crit); }
.kpi .of { font-size: 12.5px; color: var(--ink-faint); }

/* ------------------------------------------------------------------ */
/* Messages                                                            */
/* ------------------------------------------------------------------ */

.notice {
  padding: 11px 14px; border-radius: 4px; font-size: 13.5px;
  border: 1px solid var(--line); background: var(--surface); margin-bottom: 16px;
}
.notice.err { border-color: #f0c4be; background: var(--crit-bg); color: #6e1c13; }
.notice.ok { border-color: #bfdfcd; background: var(--ok-bg); color: #0f4d33; }
.notice.warn { border-color: #ecd6a6; background: var(--warn-bg); color: #5c3c00; }
.notice.info { border-color: #c4dbef; background: #eef5fb; color: var(--navy-800); }

.running {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; margin-bottom: 18px;
  background: #eef5fb; border: 1px solid #c4dbef; border-radius: 4px;
  font-size: 13.5px; color: var(--navy-800);
}
.running .spin {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid #b6d3ec; border-top-color: var(--blue-500);
  animation: spin .9s linear infinite; flex: none;
}
.running a { margin-left: auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ */
/* Execution                                                           */
/* ------------------------------------------------------------------ */

.run-grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.run-grid .console-box { position: sticky; top: 20px; }

.option {
  border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; margin-top: 16px;
  background: #fbfcfe;
}
.confirm-box {
  margin-top: 16px; padding: 14px; border-radius: 4px;
  background: var(--crit-bg); border: 1px solid #f0c4be;
}
.confirm-box p { margin: 0 0 10px; font-size: 13px; color: #6e1c13; }

.console-box { background: var(--navy-950); border-radius: var(--radius); overflow: hidden; }
.console-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08);
  font-size: 12.5px; color: #8fa6bf;
}
.console-head .cmd {
  font-family: var(--mono); font-size: 12px; color: #c7d5e3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: auto;
}
.console-head .status { white-space: nowrap; }
.console-head .status.ok { color: #6fd3a3; }
.console-head .status.err { color: #f2958a; }
.console-head button {
  background: none; border: 1px solid rgba(255, 255, 255, .16); color: #c7d5e3;
  font: 500 12px var(--font); padding: 4px 10px; border-radius: 3px; cursor: pointer;
}
.console-head button:hover { border-color: rgba(255, 255, 255, .3); color: #fff; }

.console {
  margin: 0; padding: 14px 16px 18px;
  height: 540px; overflow: auto;
  font: 12.5px/1.65 var(--mono); color: #c7d5e3;
  white-space: pre-wrap; word-break: break-word;
}
.console:empty::before { content: "La sortie s'affichera ici."; color: #5d7690; }
.console .l-task { color: #93d6ec; }
.console .l-ok { color: #79d1a6; }
.console .l-chg { color: #e7c16b; }
.console .l-err { color: #f2958a; }
.console .l-cmd { color: #7d93ab; }
.console::-webkit-scrollbar { width: 10px; }
.console::-webkit-scrollbar-thumb { background: #1d3a57; border-radius: 5px; }

.meta-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.meta-list div { padding: 14px 20px; }
.meta-list div + div { border-left: 1px solid var(--line); }
.meta-list dt { font-size: 12px; color: var(--ink-faint); }
.meta-list dd { margin: 4px 0 0; font-size: 14px; }

.cmdline {
  font: 12.5px/1.5 var(--mono); color: var(--ink-soft);
  background: var(--bg-alt); border-radius: 4px; padding: 10px 14px;
  overflow-x: auto; white-space: nowrap; margin: 16px 0;
}

/* ------------------------------------------------------------------ */
/* Jours de la semaine                                                 */
/* ------------------------------------------------------------------ */

.days { display: flex; border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; width: fit-content; }
.day { position: relative; }
.day input { position: absolute; opacity: 0; pointer-events: none; }
.day span {
  display: block; padding: 7px 11px; font-size: 13px; color: var(--ink-soft);
  cursor: pointer; user-select: none; text-transform: capitalize;
}
.day + .day span { border-left: 1px solid var(--line-strong); }
.day input:checked + span { background: var(--blue-600); color: #fff; }
.day input:focus-visible + span { outline: 2px solid var(--blue-500); outline-offset: -2px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .field + .field { margin-top: 0; }

/* ------------------------------------------------------------------ */
/* Connexion                                                           */
/* ------------------------------------------------------------------ */

.login { display: grid; grid-template-columns: minmax(340px, 44%) 1fr; min-height: 100vh; }
.login-brand {
  background: var(--navy-950); color: #c7d5e3;
  padding: 44px 52px; display: flex; flex-direction: column;
}
.login-brand .mark { display: flex; align-items: center; gap: 12px; }
.login-brand .mark img { width: 34px; }
.login-brand .mark strong { color: #fff; font-size: 17px; font-weight: 600; display: block; }
.login-brand .mark span { color: var(--cyan-300); font-size: 12.5px; display: block; }
.login-brand h1 {
  margin: auto 0 0; max-width: 400px;
  font-size: 30px; line-height: 1.22; font-weight: 600; color: #fff; letter-spacing: -.02em;
}
.login-brand p { margin: 16px 0 0; max-width: 400px; font-size: 14.5px; line-height: 1.6; color: #9fb4ca; }
.login-brand small { margin-top: 48px; font-size: 12px; color: #6f86a0; }

.login-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.login-form form { width: 100%; max-width: 340px; }
.login-form h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.015em; }
.login-form .lead { margin: 6px 0 28px; color: var(--ink-faint); font-size: 13.5px; }
.login-form .btn { width: 100%; height: 38px; margin-top: 24px; }

/* ------------------------------------------------------------------ */
/* Petits ecrans                                                       */
/* ------------------------------------------------------------------ */

@media (max-width: 1080px) {
  .run-grid { grid-template-columns: 1fr; }
  .run-grid .console-box { position: static; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; background: var(--bg); }
  .side { position: static; height: auto; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-label, .side-foot { display: none; }
  .nav a.on::before { display: none; }
  .top, .page { padding-left: 18px; padding-right: 18px; }
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 28px; }
  .login-brand h1 { margin-top: 36px; font-size: 24px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .running .spin { animation: none; } }
