:root {
  --bg: #0f1420;
  --panel: #161c2b;
  --border: #263044;
  --text: #e6ebf5;
  --muted: #8b97ad;
  --accent: #4f8cff;
  --green: #2fbf71;
  --yellow: #e0a13a;
  --red: #e5534b;
  --purple: #9d7bf0;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--panel);
}
.brand { font-weight: 700; font-size: 16px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.muted { color: var(--muted); }
button {
  background: var(--accent); color: #fff; border: 0; border-radius: 6px;
  padding: 8px 14px; cursor: pointer; font-size: 13px;
}
button.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
button.danger { background: var(--red); }
nav {
  display: flex; gap: 4px; padding: 8px 20px; border-bottom: 1px solid var(--border);
  background: var(--panel); flex-wrap: wrap;
}
nav button {
  background: transparent; color: var(--muted); border-radius: 6px;
}
nav button.active { background: var(--border); color: var(--text); }
main { padding: 20px; max-width: 1200px; margin: 0 auto; }
.pane { display: none; }
.pane.active { display: block; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.card .num { font-size: 26px; font-weight: 700; }
.card .lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255,255,255,.02); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.queued, .badge.planning, .badge.awaiting_validation, .badge.planned { background: #2a3550; color: #b8c4dd; }
.badge.in_progress, .badge.validating, .badge.rework { background: #233b57; color: var(--accent); }
.badge.review, .badge.merge_pending { background: #3a3220; color: var(--yellow); }
.badge.merged, .badge.done, .badge.deployed, .badge.post_deploy_verified { background: #1d3a2a; color: var(--green); }
.badge.deploying, .badge.deploy_pending { background: #233b57; color: var(--accent); }
.badge.blocked, .badge.deploy_failed, .badge.failed, .badge.crashed { background: #3a2020; color: var(--red); }
.badge.aborted { background: #333; color: #999; }
.badge.AVAILABLE { background: #1d3a2a; color: var(--green); }
.badge.RESERVED, .badge.IN_USE { background: #233b57; color: var(--accent); }
.badge.RELEASED { background: #333; color: #999; }
.badge.awaiting { background: #3a3220; color: var(--yellow); }
.badge.approved { background: #1d3a2a; color: var(--green); }
.badge.rejected { background: #3a2020; color: var(--red); }

.filters { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
input, select {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 7px 10px; font-size: 13px;
}
h2 { margin: 0 0 12px; font-size: 16px; }
h3 { margin: 18px 0 8px; font-size: 14px; color: var(--muted); }
.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.error { color: var(--red); }
.muted-sm { color: var(--muted); font-size: 12px; }

/* Login */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(1100px 600px at 50% -10%, rgba(79, 140, 255, 0.18), transparent 60%),
    radial-gradient(900px 500px at 90% 110%, rgba(157, 123, 240, 0.12), transparent 60%),
    var(--bg);
}
.login-wrap { width: 100%; display: flex; justify-content: center; padding: 24px; }
.login-card {
  width: 400px;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #4f8cff, #9d7bf0);
  box-shadow: 0 8px 24px rgba(79, 140, 255, 0.35);
}
.login-logo svg { width: 26px; height: 26px; }
.login-brand h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.login-subtitle { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.login-card form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 500; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-icon {
  position: absolute; left: 12px; color: var(--muted);
  display: flex; pointer-events: none;
}
.input-icon svg { width: 17px; height: 17px; }
.input-wrap input {
  width: 100%;
  padding: 11px 40px 11px 38px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input-wrap input::placeholder { color: #55617a; }
.input-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.18);
}
.pwd-toggle {
  position: absolute; right: 8px;
  background: transparent; border: 0; padding: 6px;
  color: var(--muted); cursor: pointer; display: flex;
  border-radius: 6px;
}
.pwd-toggle:hover { color: var(--text); }
.pwd-toggle svg { width: 17px; height: 17px; }

.login-error { min-height: 18px; margin: 0; color: var(--red); font-size: 13px; text-align: center; }

.login-submit {
  width: 100%;
  padding: 12px;
  font-size: 14px; font-weight: 600;
  background: linear-gradient(135deg, #4f8cff, #3d6fe0);
  border-radius: 9px;
  box-shadow: 0 6px 18px rgba(79, 140, 255, 0.28);
  transition: transform .08s ease, filter .15s ease, opacity .15s ease;
}
.login-submit:hover { filter: brightness(1.08); }
.login-submit:active { transform: translateY(1px); }
.login-submit:disabled { opacity: .6; cursor: default; }

.login-foot { margin: 22px 0 0; text-align: center; color: #55617a; font-size: 11.5px; }

/* Users */
.user-form { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }

/* Documents / téléchargement */
.btn-dl {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.btn-dl:hover { filter: brightness(1.08); }
