:root {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-soft: #11161d;
  --surface: #161b22;
  --surface-2: #1c232c;
  --border: #262d38;
  --border-strong: #37414f;
  --text: #e6edf3;
  --text-dim: #9aa7b6;
  --text-faint: #6b7888;
  --accent: #2dd4a7;
  --accent-dim: #143a31;
  --warn: #f0b429;
  --warn-dim: #3a2e12;
  --danger: #f26d6d;
  --danger-dim: #3a1c1c;
  --info: #6aa9ff;
  --info-dim: #16273f;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

[v-cloak] { display: none; }

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

/* ---------------------------------------------------------------- Layout - */

.shell { max-width: 1180px; margin: 0 auto; padding: 0 20px 64px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(13, 17, 23, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: baseline; gap: 10px; margin-right: auto; }
.brand h1 { font-size: 16px; margin: 0; letter-spacing: -.01em; }
.brand span { color: var(--text-faint); font-size: 12px; }

.tabs { display: flex; gap: 2px; overflow-x: auto; padding: 0 20px; border-bottom: 1px solid var(--border); max-width: 1180px; margin: 0 auto; }
.tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-end { justify-content: flex-end; }
.spacer { flex: 1; }

/* ----------------------------------------------------------------- Cards - */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-soft);
}
.card-head h2 { font-size: 13px; margin: 0; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); font-weight: 600; }
.card-body { padding: 16px; }
.card-body + .card-body { border-top: 1px solid var(--border); }

.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin: 0 0 10px; font-weight: 600; }

/* ---------------------------------------------------------------- Fields - */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.field .hint { font-size: 11px; color: var(--text-faint); }

input, select, textarea {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
  width: 100%;
  min-width: 0;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 212, 167, .12);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
textarea { resize: vertical; font-family: var(--mono); font-size: 12.5px; }
input[type="checkbox"] { width: auto; min-width: 0; accent-color: var(--accent); }

.inline-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }

/* --------------------------------------------------------------- Buttons - */

button {
  appearance: none;
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 14px;
  transition: border-color .12s, background .12s, opacity .12s;
}
button:hover:not(:disabled) { border-color: var(--text-faint); }
button:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #05231b; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: #3ee0b4; border-color: #3ee0b4; }
.btn-danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-link { background: none; border: none; color: var(--accent); padding: 0; text-decoration: underline; }

/* ---------------------------------------------------------------- Badges - */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  white-space: nowrap;
}
.badge-ok { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.badge-warn { color: var(--warn); border-color: var(--warn); background: var(--warn-dim); }
.badge-danger { color: var(--danger); border-color: var(--danger); background: var(--danger-dim); }
.badge-info { color: var(--info); border-color: var(--info); background: var(--info-dim); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex: none; }
.dot-live { background: var(--accent); box-shadow: 0 0 0 0 rgba(45, 212, 167, .6); animation: pulse 2s infinite; }
@keyframes pulse {
  70% { box-shadow: 0 0 0 6px rgba(45, 212, 167, 0); }
  100% { box-shadow: 0 0 0 0 rgba(45, 212, 167, 0); }
}

/* ----------------------------------------------------------------- Alerts - */

.alert { border-radius: 8px; padding: 10px 12px; font-size: 13px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.alert-error { color: #ffc9c9; border-color: var(--danger); background: var(--danger-dim); }
.alert-warn { color: #ffe1a8; border-color: var(--warn); background: var(--warn-dim); }
.alert-ok { color: #b8f5e2; border-color: var(--accent); background: var(--accent-dim); }
.alert-info { color: #cfe1ff; border-color: var(--info); background: var(--info-dim); }

/* ----------------------------------------------------------------- Tables - */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
  font-weight: 600;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-soft); }

/* ------------------------------------------------------------------- Code - */

code, .mono { font-family: var(--mono); font-size: 12.5px; }
.code-inline { background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; word-break: break-all; }
pre.json {
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  max-height: 340px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  color: #cbd5e1;
  white-space: pre;
}

.copyable { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.copyable .code-inline { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ Lists - */

.log-list { display: flex; flex-direction: column; gap: 8px; max-height: 620px; overflow-y: auto; }
.log-item { border: 1px solid var(--border); border-radius: 8px; background: var(--bg-soft); }
.log-item.is-new { animation: flash 1.2s ease-out; }
@keyframes flash { from { border-color: var(--accent); background: var(--accent-dim); } }
.log-head { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; flex-wrap: wrap; }
.log-head:hover { background: var(--surface-2); }
.log-title { font-weight: 600; font-size: 13px; }
.log-meta { color: var(--text-faint); font-size: 11.5px; }
.log-body { padding: 0 12px 12px; }

.empty { color: var(--text-faint); text-align: center; padding: 28px 16px; font-size: 13px; }

.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; font-size: 13px; align-items: baseline; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-step { display: flex; gap: 12px; padding-bottom: 14px; position: relative; }
.timeline-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 20px;
  bottom: 0;
  width: 1px;
  background: var(--border-strong);
}
.timeline-mark { width: 17px; height: 17px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; margin-top: 2px; background: var(--bg); z-index: 1; }
.timeline-step.done .timeline-mark { border-color: var(--accent); background: var(--accent); }
.timeline-step.active .timeline-mark { border-color: var(--warn); }
.timeline-step.failed .timeline-mark { border-color: var(--danger); background: var(--danger); }
.timeline-label { font-size: 13px; }
.timeline-step:not(.done):not(.active):not(.failed) .timeline-label { color: var(--text-faint); }
.timeline-sub { font-size: 11.5px; color: var(--text-faint); }

.toast-area { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: 380px; }
.toast { padding: 11px 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface-2); font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }
.toast.ok { border-color: var(--accent); }
.toast.error { border-color: var(--danger); }

.mode-switch { display: flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.mode-switch button { border: 0; border-radius: 0; background: transparent; padding: 7px 13px; font-size: 12.5px; color: var(--text-dim); }
.mode-switch button.is-active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.mode-switch button.is-active.prod { background: var(--warn-dim); color: var(--warn); }
.mode-switch button:disabled { opacity: .35; }

.prod-banner { background: var(--warn-dim); border-bottom: 1px solid var(--warn); color: #ffe1a8; padding: 8px 20px; font-size: 13px; text-align: center; }

/* Rappel non bloquant : la valeur part quand meme, Efaina tranche. */
.warn-hint { color: var(--warn); }
