/* =========================================================
   WEBHOOK HANDLER - THEME VERITY
   A charger APRES Bootstrap
   ========================================================= */


/* =========================================================
   1. VARIABLES
   ========================================================= */

:root {
  --color-bg: #f5f7ff;
  --color-surface: #ffffff;
  --color-surface-soft: #fafbff;

  --color-navy: #0b1030;
  --color-navy-2: #121844;

  --color-primary: #4d56f5;
  --color-primary-dark: #3742df;
  --color-primary-soft: #eef0ff;

  --color-text: #11183d;
  --color-text-secondary: #56618c;
  --color-muted: #7d86a7;

  --color-border: #dce1f2;
  --color-border-strong: #c8d0ee;

  --color-success: #1aaa70;
  --color-success-soft: #eafaf3;

  --color-warning: #efa329;
  --color-warning-soft: #fff7e8;

  --color-danger: #df4f66;
  --color-danger-soft: #fff1f4;

  --color-violet: #8b5cf6;
  --color-violet-soft: #f3efff;

  --radius-small: 8px;
  --radius-medium: 12px;
  --radius-large: 16px;

  --shadow-small: 0 4px 14px rgba(25, 37, 95, 0.06);
  --shadow-medium: 0 12px 28px rgba(25, 37, 95, 0.10);
}



/* =========================================================
   2. BASE
   ========================================================= */

html,
body {
  min-height: 100%;
}

body {
  margin: 0;

  color: var(--color-text);

  background:
    linear-gradient(
      135deg,
      rgba(77, 86, 245, 0.05),
      rgba(77, 86, 245, 0) 420px
    ),
    var(--color-bg);

  font-family:
    Inter,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;

  font-size: 15px;
  line-height: 1.45;
}

a {
  color: var(--color-primary-dark);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary);
}

code {
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);

  border: 1px solid #e2e5ff;
  border-radius: 6px;

  padding: 2px 5px;
}



/* =========================================================
   3. STRUCTURE : SIDEBAR + BANDEAU
   ========================================================= */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  --bs-offcanvas-width: 260px;

  width: 240px;
  flex-shrink: 0;

  display: flex;
  flex-direction: column;

  padding: 0 14px 18px;

  color: #ffffff;
  background:
    radial-gradient(
      120% 60% at 0% 100%,
      rgba(77, 86, 245, 0.28),
      rgba(77, 86, 245, 0) 70%
    ),
    linear-gradient(
      180deg,
      var(--color-navy) 0%,
      var(--color-navy-2) 100%
    ) !important;
}

.app-sidebar-brand {
  height: 74px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  margin: 0 -14px 22px;
  padding: 0 22px;

  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar-brand img {
  height: 34px;
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 12px 14px;

  color: rgba(255, 255, 255, 0.82);

  border-radius: 10px;

  font-size: 14.5px;
  font-weight: 500;

  transition: background 0.15s ease, color 0.15s ease;
}

.app-nav-link i {
  font-size: 17px;
  color: rgba(255, 255, 255, 0.75);
}

.app-nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.app-nav-link.active {
  color: #ffffff;

  background:
    linear-gradient(
      135deg,
      var(--color-primary-dark),
      var(--color-primary)
    );

  box-shadow: 0 8px 20px rgba(77, 86, 245, 0.35);
}

.app-nav-link.active i {
  color: #ffffff;
}

.app-sidebar-status {
  margin-top: auto;

  padding: 14px 16px;

  background: rgba(255, 255, 255, 0.04);

  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-medium);

  font-size: 12.5px;
}

.app-sidebar-status .label {
  color: rgba(255, 255, 255, 0.70);
}

.app-sidebar-status .value {
  font-weight: 600;
}

.app-sidebar-status .value-muted {
  color: rgba(255, 255, 255, 0.88);
}

.app-sidebar-status .text-on  { color: #35d399; }
.app-sidebar-status .text-off { color: #ff7a8e; }

.status-dot {
  width: 14px;
  height: 14px;

  flex-shrink: 0;

  border-radius: 50%;
}

.status-dot.is-on {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}

.status-dot.is-off {
  background: var(--color-danger);
  box-shadow: 0 0 0 4px rgba(223, 79, 102, 0.20);
}

.app-main {
  flex: 1;
  min-width: 0;

  display: flex;
  flex-direction: column;
}

.app-topbar {
  height: 74px;

  display: flex;
  align-items: center;
  gap: 16px;

  padding: 0 28px;

  color: #ffffff;

  background:
    linear-gradient(
      100deg,
      var(--color-navy-2) 0%,
      #1b2366 60%,
      var(--color-navy-2) 100%
    );

  box-shadow: 0 8px 24px rgba(9, 13, 42, 0.14);
}

.app-topbar-title .name {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.app-topbar-title .tagline {
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
}

.app-topbar-clock {
  margin-left: auto;

  display: flex;
  align-items: center;
  gap: 12px;

  padding-left: 18px;

  border-left: 1px solid rgba(255, 255, 255, 0.15);

  font-size: 13.5px;
  line-height: 1.35;
}

.app-topbar-clock i {
  font-size: 22px;
  color: rgba(255, 255, 255, 0.85);
}

.lang-switch {
  margin-left: auto;

  display: flex;
  gap: 2px;

  padding: 3px;

  background: rgba(255, 255, 255, 0.08);

  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.lang-switch a {
  padding: 3px 10px;

  color: rgba(255, 255, 255, 0.75);

  border-radius: 999px;

  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.lang-switch a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.10);
}

.lang-switch a.active {
  color: var(--color-navy);
  background: #ffffff;
}

.lang-switch + .app-topbar-clock {
  margin-left: 16px;
}

.app-user {
  margin-left: 14px;
}

.app-user > .btn {
  display: flex;
  align-items: center;
  gap: 8px;

  padding: 4px 10px 4px 4px;

  color: #ffffff;

  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

.app-user > .btn:hover,
.app-user > .btn.show {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.10);
}

.app-user-avatar {
  width: 30px;
  height: 30px;

  display: grid;
  place-items: center;

  color: var(--color-navy);
  background: #ffffff;

  border-radius: 50%;

  font-size: 13px;
  font-weight: 700;
}

.app-user-name {
  max-width: 180px;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  font-size: 13.5px;
}

/* Page de connexion */

body.auth-page {
  min-height: 100vh;

  display: grid;
  place-items: center;

  padding: 24px 16px;

  background:
    radial-gradient(90% 70% at 10% 100%, rgba(77, 86, 245, 0.35), rgba(77, 86, 245, 0) 70%),
    linear-gradient(160deg, var(--color-navy) 0%, var(--color-navy-2) 100%);
}

.auth-card {
  width: min(100%, 420px);

  background: var(--color-surface);

  border-radius: var(--radius-large);

  box-shadow: 0 24px 60px rgba(5, 8, 30, 0.45);

  overflow: hidden;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 18px 24px;

  background: linear-gradient(115deg, var(--color-navy) 0%, var(--color-navy-2) 100%);
}

.auth-brand img { height: 30px; }
.auth-brand .lang-switch { margin-left: 0; }

.auth-body { padding: 26px 24px 24px; }

.auth-body h1 {
  margin: 0 0 4px;

  font-size: 22px;
  font-weight: 700;
}

.app-menu-btn {
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.app-menu-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}


/* =========================================================
   4. CONTENU PRINCIPAL / EN-TETE DE PAGE
   ========================================================= */

.app-content {
  width: 100%;
  max-width: 1640px;

  padding: 22px 24px 40px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  margin-bottom: 20px;
}

.page-header-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-icon {
  width: 52px;
  height: 52px;

  display: grid;
  place-items: center;

  flex-shrink: 0;

  color: var(--color-primary-dark);
  background: var(--color-surface);

  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);

  box-shadow: var(--shadow-small);

  font-size: 22px;
}

.page-header h1 {
  margin: 0;

  font-size: 24px;
  font-weight: 700;
}

.page-header p {
  margin: 2px 0 0;

  color: var(--color-text-secondary);
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.update-box {
  display: flex;
  align-items: center;
  gap: 14px;

  padding: 10px 12px 10px 14px;

  background: var(--color-surface);

  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);

  box-shadow: var(--shadow-small);

  font-size: 13px;
}

.update-box .update-icon {
  width: 38px;
  height: 38px;

  display: grid;
  place-items: center;

  color: var(--color-primary);
  background: var(--color-primary-soft);

  border-radius: 10px;
}

.update-box strong {
  display: block;
  font-weight: 600;
}

.update-box span {
  color: var(--color-text-secondary);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;

  margin: 30px 0 14px;

  color: var(--color-text);

  font-size: 17px;
  font-weight: 700;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.section-title i {
  color: var(--color-primary);
}


/* =========================================================
   5. ALERTES
   ========================================================= */

.alert {
  border-radius: var(--radius-medium);

  border:
    1px solid
    var(--color-border) !important;

  box-shadow: none;
}

.alert-info {
  color: #46558e;

  background:
    #f5f6ff !important;

  border-color:
    #cfd5ff !important;

  border-left:
    4px solid
    var(--color-primary) !important;
}

.alert-warning {
  color: #74531b;

  background:
    var(--color-warning-soft) !important;

  border-color:
    #f2d28f !important;

  border-left:
    4px solid
    var(--color-warning) !important;
}



/* =========================================================
   6. CARTES
   ========================================================= */

.card {
  background:
    var(--color-surface);

  border:
    1px solid
    var(--color-border) !important;

  border-radius:
    var(--radius-medium) !important;

  box-shadow:
    var(--shadow-small);

  overflow: hidden;
}

.card-header {
  padding:
    14px
    16px;

  color:
    var(--color-text);

  background:
    var(--color-surface-soft) !important;

  border-bottom:
    1px solid
    var(--color-border) !important;

  font-size: 16px;
  font-weight: 700;
}

.card-body {
  padding: 16px;
}

.card-footer {
  padding:
    12px
    16px;

  color:
    var(--color-muted);

  background:
    var(--color-surface-soft);

  border-top:
    1px solid
    var(--color-border);
}



/* =========================================================
   7. TABLEAU DE BORD : KPI
   ========================================================= */

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

  padding: 18px;

  color: var(--color-text);
  background: var(--color-surface);

  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);

  box-shadow: var(--shadow-small);
}

button.kpi {
  width: 100%;

  text-align: left;

  cursor: pointer;

  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button.kpi:disabled {
  cursor: default;
  opacity: 1;
}

button.kpi:disabled:hover {
  transform: none;
  box-shadow: var(--shadow-small);
}

button.kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.kpi-icon {
  width: 62px;
  height: 62px;

  display: grid;
  place-items: center;

  flex-shrink: 0;

  border-radius: var(--radius-medium);

  font-size: 26px;
}

.kpi-icon.tone-success { color: var(--color-success); background: var(--color-success-soft); }
.kpi-icon.tone-primary { color: var(--color-primary); background: var(--color-primary-soft); }
.kpi-icon.tone-violet  { color: var(--color-violet);  background: var(--color-violet-soft); }
.kpi-icon.tone-warning { color: var(--color-warning); background: var(--color-warning-soft); }
.kpi-icon.tone-danger  { color: var(--color-danger);  background: var(--color-danger-soft); }
.kpi-icon.tone-muted   { color: var(--color-muted);   background: #f1f3f8; }

.kpi-body {
  min-width: 0;
}

.kpi-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;

  font-size: 15px;
  font-weight: 700;
}

.kpi-label {
  color: var(--color-text-secondary);
  font-size: 14px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-sub {
  margin-top: 3px;

  color: var(--color-text-secondary);
  font-size: 13px;
}

.mini-stat {
  height: 100%;

  padding: 12px 14px;

  background: var(--color-surface);

  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
}

.mini-stat .label {
  color: var(--color-text-secondary);

  font-size: 11.5px;
  font-weight: 700;

  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mini-stat .value {
  margin-top: 2px;

  font-size: 20px;
  font-weight: 700;
}

.mini-stat.is-warning { border-color: #f2d28f; background: var(--color-warning-soft); }
.mini-stat.is-warning .value { color: #a46a0b; }
.mini-stat.is-danger  { border-color: #efc2cb; background: var(--color-danger-soft); }
.mini-stat.is-danger .value  { color: #b33a51; }


/* =========================================================
   8. TABLEAU DE BORD : PANNEAUX
   ========================================================= */

.panel {
  display: flex;
  flex-direction: column;

  background: var(--color-surface);

  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);

  box-shadow: var(--shadow-small);
}

[class*="col"] > .panel,
[class*="col"] > .kpi,
[class*="col"] > form > .kpi {
  height: 100%;
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;

  padding: 16px 18px 12px;
}

.panel-header h2 {
  display: flex;
  align-items: center;
  gap: 12px;

  margin: 0;

  font-size: 16px;
  font-weight: 700;
}

.panel-header h2 i {
  font-size: 20px;
  color: var(--color-navy-2);
}

.panel-header .panel-tools {
  margin-left: auto;

  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.panel-body {
  flex: 1;

  padding: 0 14px 14px;
}

.panel-body.padded {
  padding: 4px 18px 18px;
}

.panel-footer {
  padding: 10px 18px;

  color: var(--color-muted);

  border-top: 1px solid var(--color-border);

  font-size: 12.5px;
}

.btn-soft {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 6px 12px;

  color: var(--color-primary-dark);
  background: var(--color-primary-soft);

  border: 1px solid transparent;
  border-radius: var(--radius-small);

  font-size: 13px;
  font-weight: 600;
}

.btn-soft:hover {
  color: var(--color-primary-dark);
  background: #e2e5ff;
}

.count-pill {
  padding: 4px 10px;

  color: var(--color-primary-dark);
  background: var(--color-primary-soft);

  border-radius: 999px;

  font-size: 12.5px;
  font-weight: 600;
}

.pill {
  display: inline-block;

  padding: 3px 10px;

  border-radius: 999px;

  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.pill-success { color: #087248; background: #dcf6ea; }
.pill-warning { color: #8a5a06; background: #fff0c7; }
.pill-danger  { color: #a12f44; background: #ffe0e6; }
.pill-muted   { color: #59627d; background: #eef1f7; }

.pill-solid-success { color: #ffffff; background: var(--color-success); }
.pill-solid-danger  { color: #ffffff; background: var(--color-danger); }
.pill-solid-primary { color: #ffffff; background: var(--color-primary); }
.pill-solid-muted   { color: #ffffff; background: #8d95ad; }

.table-clean {
  width: 100%;
  margin: 0;

  font-size: 13.5px;
}

.table-clean thead th {
  padding: 9px 12px;

  color: #3d4670;
  background: #f3f5fb;

  font-size: 11.5px;
  font-weight: 700;

  text-transform: uppercase;
  letter-spacing: 0.05em;

  white-space: nowrap;
}

.table-clean tbody td {
  padding: 9px 12px;

  vertical-align: middle;

  border-bottom: 1px solid #edf0f7;
}

.table-clean tbody tr:last-child td {
  border-bottom: 0;
}

.table-clean tbody tr:hover td {
  background: #f8f9ff;
}

.table-clean .file-cell {
  display: flex;
  align-items: center;
  gap: 10px;

  min-width: 0;
}

.table-clean .file-cell i {
  color: var(--color-primary);
}

.table-clean .file-cell span:not(.pill) {
  max-width: 280px;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  width: 32px;
  height: 26px;

  display: inline-grid;
  place-items: center;

  color: var(--color-navy-2);
  background: #f1f3f9;

  border: 1px solid transparent;
  border-radius: 999px;

  font-size: 13px;
}

.icon-btn:hover {
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);
}

.dot {
  width: 10px;
  height: 10px;

  display: inline-block;

  border-radius: 50%;
}

.dot-success { background: var(--color-success); }
.dot-warning { background: var(--color-warning); }
.dot-danger  { background: var(--color-danger); }

.empty-state {
  padding: 26px 12px;

  color: var(--color-muted);

  text-align: center;
  font-size: 13.5px;
}

.empty-state i {
  display: block;

  margin-bottom: 8px;

  font-size: 22px;
  opacity: 0.6;
}

.chart-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.chart-split > div + div {
  padding-left: 18px;
  border-left: 1px solid var(--color-border);
}

.chart-caption {
  margin-bottom: 10px;

  color: var(--color-text-secondary);
  font-size: 13.5px;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
}

.donut-canvas {
  position: relative;

  width: 140px;
  height: 140px;

  flex-shrink: 0;
}

.donut-center {
  position: absolute;
  inset: 0;

  display: grid;
  place-content: center;

  text-align: center;
  pointer-events: none;
}

.donut-center strong {
  font-size: 20px;
  line-height: 1.1;
}

.donut-center span {
  color: var(--color-text-secondary);
  font-size: 12px;
}

.donut-legend {
  flex: 1;
  min-width: 0;

  margin: 0;
  padding: 0;

  list-style: none;

  font-size: 12.5px;
}

.donut-legend li {
  display: flex;
  align-items: center;
  gap: 8px;

  padding: 4px 0;
}

.donut-legend .name {
  flex: 1;
  min-width: 0;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  font-weight: 600;
}

.donut-legend .count {
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.log-preview {
  max-height: 320px;

  margin: 0;

  overflow: auto;

  color: #d8ddff;
  background: var(--color-navy);

  border-radius: var(--radius-small);

  padding: 12px 0;

  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  line-height: 1.7;
}

.log-preview .log-line {
  display: flex;
  gap: 18px;

  padding: 0 16px;

  white-space: pre;
}

.log-preview .ln {
  width: 2ch;
  flex-shrink: 0;

  color: #5d6694;
  text-align: right;
  user-select: none;
}

.log-preview .ts    { color: #8ea2ff; }
.log-preview .ok    { color: #35d399; }
.log-preview .warn  { color: #fbbf24; }
.log-preview .err   { color: #ff6b81; }

.danger-zone {
  border-color: #efc2cb;
}

.danger-zone .panel-header h2,
.danger-zone .panel-header h2 i {
  color: #b33a51;
}


/* =========================================================
   8b. SANTÉ DES INGESTIONS / ALERTES
   ========================================================= */

.health-strip {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.health-state,
.health-metric {
  padding: 14px 16px;

  background: var(--color-surface);

  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);

  box-shadow: var(--shadow-small);
}

.health-strip .label {
  color: var(--color-text-secondary);

  font-size: 11.5px;
  font-weight: 700;

  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.health-strip .value {
  margin-top: 2px;

  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}

.health-strip .value small {
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.health-strip .sub {
  margin-top: 3px;

  color: var(--color-text-secondary);
  font-size: 12.5px;
}

.health-state {
  display: flex;
  align-items: center;
  gap: 14px;
}

.health-dot {
  width: 18px;
  height: 18px;

  flex-shrink: 0;

  border-radius: 50%;
}

.health-state.level-ok       { border-color: #bfe7d6; background: linear-gradient(135deg, var(--color-success-soft), #fff); }
.health-state.level-ok .health-dot       { background: var(--color-success); box-shadow: 0 0 0 5px rgba(26, 170, 112, 0.18); }
.health-state.level-warning  { border-color: #f2d28f; background: linear-gradient(135deg, var(--color-warning-soft), #fff); }
.health-state.level-warning .health-dot  { background: var(--color-warning); box-shadow: 0 0 0 5px rgba(239, 163, 41, 0.2); }
.health-state.level-critical { border-color: #efc2cb; background: linear-gradient(135deg, var(--color-danger-soft), #fff); }
.health-state.level-critical .health-dot { background: var(--color-danger); box-shadow: 0 0 0 5px rgba(223, 79, 102, 0.2); animation: health-pulse 1.6s ease-in-out infinite; }

@keyframes health-pulse {
  50% { box-shadow: 0 0 0 9px rgba(223, 79, 102, 0.08); }
}

.health-metric.is-ok      .value { color: #10734c; }
.health-metric.is-warning { border-color: #f2d28f; }
.health-metric.is-warning .value { color: #a46a0b; }
.health-metric.is-danger  { border-color: #efc2cb; background: var(--color-danger-soft); }
.health-metric.is-danger  .value { color: #b33a51; }

.alert-list {
  margin: 0;
  padding: 0 4px;

  list-style: none;
}

.alert-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;

  padding: 12px 6px;

  border-bottom: 1px solid #edf0f7;
}

.alert-list li:last-child {
  border-bottom: 0;
}

.alert-list .sev-icon {
  margin-top: 1px;
  font-size: 18px;
}

.alert-list .sev-critical .sev-icon { color: var(--color-danger); }
.alert-list .sev-warning  .sev-icon { color: var(--color-warning); }
.alert-list .sev-info     .sev-icon { color: var(--color-primary); }

.alert-list li.is-ack { opacity: 0.65; }

.alert-list .alert-main {
  flex: 1;
  min-width: 0;
}

.alert-list .alert-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;

  font-weight: 700;
}

.alert-list .alert-detail {
  margin-top: 2px;

  color: var(--color-text-secondary);

  font-size: 13px;
  overflow-wrap: anywhere;
}

.alert-list .alert-meta {
  margin-top: 3px;

  color: var(--color-muted);
  font-size: 12px;
}


/* Variables / fiche opération */

button.mini-stat {
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

button.mini-stat:hover { box-shadow: var(--shadow-small); }

button.mini-stat.is-selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(77, 86, 245, 0.15);
}

.spark { display: block; }

.kv-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;

  margin: 0;

  font-size: 13.5px;
}

.kv-list dt {
  color: var(--color-text-secondary);
  font-weight: 600;
}

.kv-list dd { margin: 0; }

.timeline {
  margin: 0;
  padding: 0;

  list-style: none;
}

.timeline li {
  position: relative;

  display: flex;
  gap: 14px;

  padding-bottom: 16px;
}

.timeline li:not(:last-child)::before {
  content: "";

  position: absolute;
  top: 32px;
  bottom: 0;
  left: 15px;

  width: 2px;

  background: var(--color-border);
}

.timeline .tl-icon {
  width: 32px;
  height: 32px;

  display: grid;
  place-items: center;

  flex-shrink: 0;

  color: var(--color-primary);
  background: var(--color-primary-soft);

  border-radius: 50%;

  font-size: 13px;
}

.timeline .tl-label { font-weight: 700; }
.timeline .tl-time  { color: var(--color-text-secondary); font-size: 13px; }

/* Carte de chaleur jour × heure */

.heatmap {
  display: grid;
  grid-template-columns: 74px repeat(24, minmax(18px, 1fr));
  gap: 3px;

  min-width: 620px;
}

.hm-hour {
  color: var(--color-muted);
  font-size: 11px;
}

.hm-day {
  display: flex;
  align-items: center;

  color: var(--color-text-secondary);

  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.hm-cell {
  display: block;

  height: 22px;

  background: rgba(77, 86, 245, var(--a, 0));

  border: 1px solid transparent;
  border-radius: 4px;
}

.hm-cell.is-empty { background: #f1f3f9; }
.hm-cell.has-bad  { border-color: var(--color-danger); box-shadow: inset 0 0 0 1px var(--color-danger); }
a.hm-cell:hover   { outline: 2px solid var(--color-navy-2); outline-offset: 1px; }

.hm-legend {
  display: inline-flex;
  align-items: center;
  gap: 5px;

  margin-left: 10px;
}

.hm-legend .hm-cell {
  width: 16px;
  height: 14px;
}

@media (max-width: 1200px) {
  .health-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .health-state { grid-column: 1 / -1; }
}

@media (max-width: 576px) {
  .health-strip { grid-template-columns: minmax(0, 1fr); }
}


/* =========================================================
   9. BOUTONS
   ========================================================= */

.btn {
  border-radius:
    var(--radius-small);

  font-weight: 600;
}

.btn-primary {
  color: #ffffff;

  background:
    linear-gradient(
      135deg,
      var(--color-primary-dark),
      var(--color-primary)
    ) !important;

  border-color:
    var(--color-primary-dark) !important;
}

.btn-primary:hover {
  background:
    var(--color-primary-dark) !important;
}

.btn-outline-secondary {
  color: #55607c;

  background: #ffffff;

  border-color:
    #cfd5e6;
}

.btn-outline-secondary:hover {
  color:
    var(--color-text);

  background:
    #f4f5fb;

  border-color:
    #bec6df;
}

.btn-danger {
  background:
    var(--color-danger) !important;

  border-color:
    var(--color-danger) !important;
}



/* =========================================================
   10. FORMULAIRES
   ========================================================= */

.form-label {
  margin-bottom: 5px !important;

  color:
    var(--color-text);

  font-size: 13px;
  font-weight: 700;
}

.form-control,
.form-select {
  min-height: 42px;

  color:
    var(--color-text);

  background:
    #ffffff;

  border:
    1px solid
    var(--color-border-strong);

  border-radius:
    var(--radius-small);

  box-shadow:
    none !important;
}

.form-control:focus,
.form-select:focus {
  border-color:
    var(--color-primary);

  box-shadow:
    0 0 0 3px
    rgba(77, 86, 245, 0.12) !important;
}

.form-control::placeholder {
  color: #a2a9bf;
}



/* =========================================================
   11. TABLEAUX
   ========================================================= */

.table-responsive {
  border:
    1px solid
    var(--color-border);

  border-radius:
    var(--radius-small);

  overflow: hidden;

  background:
    #ffffff;
}

.table {
  margin-bottom: 0;

  --bs-table-striped-bg: #fafbff;
  --bs-table-hover-bg: #f5f6ff;
}

.table > :not(caption) > * > * {
  padding:
    11px
    12px;

  border-bottom-color:
    #e9edf7;
}

.table thead th,
thead.table-primary,
thead.table-primary th {
  color:
    #56618d !important;

  background:
    #f3f5fb !important;

  border-bottom:
    1px solid
    var(--color-border) !important;

  font-size: 12px;
  font-weight: 700;

  text-transform: uppercase;
  letter-spacing: 0.04em;

  white-space: nowrap;
}

.table tbody tr:hover {
  background:
    #f6f7ff;
}



/* =========================================================
   12. STATUTS FLUX
   ========================================================= */

.status-ok {
  color:
    #126747 !important;

  background:
    #effbf6 !important;
}

.status-failed {
  color:
    #982f43 !important;

  background:
    #fff1f3 !important;
}

.status-partial {
  color:
    #7b5b16 !important;

  background:
    #fff8e9 !important;
}

.status-nodata {
  color:
    #50596b !important;

  background:
    #f4f5f7 !important;
}

.status-unknown {
  color:
    #58439e !important;

  background:
    #f2efff !important;
}



/* =========================================================
   13. BADGES
   ========================================================= */

.badge {
  border-radius: 999px;

  padding:
    5px
    8px;

  font-weight: 700;
}

.badge.bg-secondary {
  color: #59627d !important;
  background: #eef1f7 !important;
}

.badge.bg-success {
  color: #087248 !important;
  background: #dff7ec !important;
}

.badge.bg-warning {
  color: #80570c !important;
  background: #fff0c7 !important;
}

.badge.bg-danger,
.badge-dup {
  color: #a12f44 !important;
  background: #ffe0e6 !important;
}



/* =========================================================
   14. FILTRES FLUX CONTROL
   ========================================================= */

#filtersForm {
  align-items: end;
}

#filtersForm .col-12.d-flex {
  align-items: center;

  margin-top: 12px;
  padding-top: 14px;

  border-top:
    1px solid
    var(--color-border);
}

#filtersForm .ms-auto.small.text-muted {
  padding:
    10px
    12px;

  background:
    #f7f8ff;

  border:
    1px solid
    #e1e5f5;

  border-radius:
    var(--radius-small);
}



/* =========================================================
   15. DATATABLES
   ========================================================= */

.dataTables_wrapper {
  color:
    var(--color-text-secondary);
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_paginate {
  padding-top: 12px;

  font-size: 13px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  margin:
    0
    2px;

  border-radius:
    7px !important;
}

.dataTables_wrapper
.dataTables_paginate
.paginate_button.current {
  color:
    #ffffff !important;

  background:
    var(--color-primary) !important;

  border-color:
    var(--color-primary) !important;
}



/* =========================================================
   16. LISTES
   ========================================================= */

.list-group {
  gap: 7px;
}

.list-group-item {
  padding:
    10px
    12px;

  background:
    #ffffff;

  border:
    1px solid
    var(--color-border) !important;

  border-radius:
    var(--radius-small) !important;
}

.list-group-item:hover {
  background:
    #f8f9ff;
}



/* =========================================================
   17. LOGS
   ========================================================= */

pre {
  max-height: 260px;

  margin: 0;

  overflow: auto;

  color:
    #d8ddff !important;

  background:
    var(--color-navy) !important;

  border:
    1px solid
    #242c59 !important;

  border-radius:
    var(--radius-small) !important;

  padding:
    14px
    16px !important;

  font-size:
    13px !important;

  line-height:
    1.5;
}



/* =========================================================
   19. RESPONSIVE
   ========================================================= */

@media (min-width: 992px) {

  .app-sidebar {
    position: sticky;
    top: 0;

    height: 100vh;

    overflow-y: auto;
  }
}


@media (max-width: 991.98px) {

  .app-sidebar {
    width: 260px;
  }

  .app-topbar {
    padding: 0 16px;
  }

  .app-topbar-clock {
    display: none;
  }

  .chart-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .chart-split > div + div {
    padding-left: 0;
    padding-top: 18px;

    border-left: 0;
    border-top: 1px solid var(--color-border);
  }
}


@media (max-width: 768px) {

  .app-content {
    padding: 16px 12px 28px;
  }

  .app-topbar-title .tagline {
    display: none;
  }

  .update-box {
    width: 100%;
  }

  #filtersForm .col-12.d-flex {
    flex-direction: column;
    align-items: stretch;
  }

  #filtersForm .ms-auto.small.text-muted {
    width: 100%;
    max-width: none !important;
    margin-left: 0 !important;
  }
}
