:root {
  --bg: #0b1020;
  --bg-soft: #111a33;
  --card: #151f3d;
  --card-2: #1a2547;
  --border: #243156;
  --text: #e8ecf8;
  --text-dim: #9aa7cc;
  --accent: #6c8cff;
  --accent-2: #8a63ff;
  --green: #3ecf8e;
  --amber: #f5b84c;
  --red: #ff6b81;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1000px 600px at 80% -10%, rgba(138, 99, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(108, 140, 255, 0.14), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.8);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 18px;
}
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: 0.2px; }
.brand-name span { color: var(--accent); }

.nav-user { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.nav-user .avatar { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--accent); }
.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.btn-logout:hover { color: var(--text); border-color: var(--accent); }

.container { max-width: 1080px; margin: 0 auto; padding: 32px 20px 60px; width: 100%; flex: 1; }

.footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 18px;
  border-top: 1px solid var(--border);
}

/* ---------- landing ---------- */
.hero { text-align: center; padding: 60px 0 40px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); margin: 0 0 14px; }
.hero h1 span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--text-dim); font-size: 17px; max-width: 640px; margin: 0 auto 28px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 6px 20px rgba(108, 140, 255, 0.35);
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.secondary {
  background: var(--card-2);
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--border);
}
.btn.ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  box-shadow: none;
  padding: 8px 16px;
  font-size: 13px;
}
.btn.ghost:hover { color: var(--text); border-color: var(--accent); }
.btn.ghost.stop { border-color: rgba(255, 107, 129, 0.5); color: var(--red); }
.btn.ghost.stop:hover { background: rgba(255, 107, 129, 0.12); }
.btn svg { width: 18px; height: 18px; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin: 40px 0 20px;
}
.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.feature .icon { font-size: 26px; }
.feature h3 { margin: 10px 0 6px; font-size: 16px; }
.feature p { color: var(--text-dim); font-size: 14px; margin: 0; }

/* ---------- dashboard ---------- */
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.dash-head h1 { font-size: 26px; margin: 0; }
.dash-head p { color: var(--text-dim); margin: 4px 0 0; font-size: 14px; }

.status-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-dim);
}
.pill b { color: var(--text); font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.off { background: var(--text-dim); }
.dot.warn { background: var(--amber); }
.dot.busy { background: var(--accent); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

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

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card.full { grid-column: 1 / -1; }
.card h2 { margin: 0 0 4px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.card .sub { color: var(--text-dim); font-size: 13px; margin: 0 0 18px; }
.card .step { color: var(--accent); font-weight: 700; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.input, select.input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
}
.input:focus { outline: none; border-color: var(--accent); }
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.row { display: flex; gap: 10px; align-items: flex-end; }

.msg {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-top: 12px;
  display: none;
}
.msg.show { display: block; }
.msg.ok { background: rgba(62, 207, 142, 0.12); color: var(--green); border: 1px solid rgba(62, 207, 142, 0.35); }
.msg.err { background: rgba(255, 107, 129, 0.12); color: var(--red); border: 1px solid rgba(255, 107, 129, 0.35); }
.msg.info { background: rgba(108, 140, 255, 0.12); color: var(--accent); border: 1px solid rgba(108, 140, 255, 0.35); }

.hint {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  word-break: break-all;
}
.hint code { background: rgba(0, 0, 0, 0.3); padding: 2px 6px; border-radius: 6px; font-size: 12px; color: var(--accent); }

table.runs { width: 100%; border-collapse: collapse; font-size: 13px; }
table.runs th, table.runs td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.runs th { color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
table.runs tr:last-child td { border-bottom: none; }
table.runs td a { color: var(--accent); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.in_progress, .badge.queued { background: rgba(108, 140, 255, 0.16); color: var(--accent); }
.badge.success { background: rgba(62, 207, 142, 0.16); color: var(--green); }
.badge.failure, .badge.cancelled, .badge.timed_out { background: rgba(255, 107, 129, 0.16); color: var(--red); }
.badge.completed { background: rgba(245, 184, 76, 0.16); color: var(--amber); }
.badge.empty { background: rgba(154, 167, 204, 0.14); color: var(--text-dim); }

.empty { text-align: center; color: var(--text-dim); padding: 24px 0; font-size: 13px; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 90vw;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--red); color: var(--red); }
.toast.ok { border-color: var(--green); color: var(--green); }
