:root {
  --bg: #0f1419;
  --panel: #1a222c;
  --panel-2: #243040;
  --text: #e7ecf1;
  --muted: #8b9aab;
  --accent: #3d9cfd;
  --ok: #3dd68c;
  --warn: #f0b429;
  --err: #f07178;
  --border: #2c3a4a;
  --mono: "IBM Plex Mono", "SFMono-Regular", ui-monospace, monospace;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 10% -10%, #1b2a3d 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100%;
}
a { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: 0.92em; }

.shell { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }
.auth-card {
  max-width: 420px;
  margin: 10vh auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}
.auth-card h1 { margin: 0 0 0.35rem; font-size: 1.4rem; }
.auth-card p { color: var(--muted); margin-top: 0; }

header.top {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
header.top h1 { margin: 0; font-size: 1.35rem; letter-spacing: 0.02em; }
.brand-sub { color: var(--muted); font-size: 0.9rem; }

.grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
}
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
}

.panel {
  background: color-mix(in srgb, var(--panel) 92%, black);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}
.panel h2 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.pill {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}
.pill.ok { border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); }
.pill.down { border-color: color-mix(in srgb, var(--err) 50%, var(--border)); color: var(--err); }
.pill .label { color: var(--muted); margin-right: 0.35rem; }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
button, .btn {
  background: var(--accent);
  color: #061018;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
button.secondary, .btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
button:disabled { opacity: 0.5; cursor: wait; }

label { display: block; margin: 0.75rem 0 0.35rem; color: var(--muted); font-size: 0.9rem; }
input[type=password], input[type=text], textarea {
  width: 100%;
  background: #0c1117;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font: inherit;
}
textarea { min-height: 120px; resize: vertical; }

.erreur {
  background: color-mix(in srgb, var(--err) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--err) 45%, var(--border));
  color: #ffd4d6;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  margin: 0.75rem 0;
}
.flash {
  background: color-mix(in srgb, var(--ok) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 40%, var(--border));
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.chat-list, .exec-list { list-style: none; margin: 0; padding: 0; }
.chat-list li, .exec-list li {
  border-top: 1px solid var(--border);
  padding: 0.65rem 0;
}
.chat-list li:first-child, .exec-list li:first-child { border-top: 0; }
.meta { color: var(--muted); font-size: 0.8rem; margin-top: 0.25rem; }
.prompt-preview {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.reponse {
  white-space: pre-wrap;
  background: #0c1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  margin-top: 0.75rem;
  line-height: 1.45;
}
.stats-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  min-width: 110px;
}
.stat b { display: block; font-size: 1.2rem; }
.stat span { color: var(--muted); font-size: 0.8rem; }

.bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
@media (max-width: 900px) {
  .bottom { grid-template-columns: 1fr; }
}
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }
