:root {
  --bg: #0b1020;
  --bg2: #121a2e;
  --card: #161f36;
  --line: #243049;
  --text: #e8eefc;
  --muted: #8b97b3;
  --accent: #6ea8ff;
  --ok: #3dd68c;
  --bad: #ff6b7a;
  --warn: #ffc14d;
  --shadow: 0 18px 50px rgba(0,0,0,.35);
  --radius: 16px;
  font-family: "Segoe UI", Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: radial-gradient(1200px 500px at 10% -10%, #1a2a55 0%, var(--bg) 50%);
  color: var(--text); min-height: 100%;
}
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
  background: rgba(11,16,32,.8); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 10;
}
.brand-row, .brand { display: flex; gap: 12px; align-items: center; }
.logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, #4d7cff, #7b5cff);
  display: grid; place-items: center; font-weight: 800;
  box-shadow: 0 8px 20px rgba(77,124,255,.35);
}
.logo.sm { width: 36px; height: 36px; font-size: 14px; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.layout { max-width: 1320px; margin: 0 auto; padding: 24px; display: grid; gap: 18px; }
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent), var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
h1,h2 { margin: 0 0 8px; }
h2 { font-size: 18px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; outline: none; width: 100%;
}
textarea {
  resize: vertical; min-height: 120px; line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(110,168,255,.15); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: center; gap: 10px; padding-top: 24px; }
.check input { width: auto; }
.row { display: flex; gap: 10px; margin-top: 14px; align-items: center; flex-wrap: wrap; }
.row.tight { margin-top: 0; }
.btn {
  border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer; font-weight: 600; color: var(--text);
  background: #243049;
}
.btn.primary { background: linear-gradient(135deg, #4d7cff, #6d5cff); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.preview {
  margin-top: 14px; background: #0a0f1c; border: 1px dashed var(--line); border-radius: 10px;
  padding: 10px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: #b7c4e0;
  word-break: break-all;
}
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.num { font-size: 28px; font-weight: 800; }
.num.accent { color: var(--accent); }
.num.ok { color: var(--ok); }
.num.bad { color: var(--bad); }
.lbl { color: var(--muted); font-size: 12px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; color: var(--muted); border: 0; padding: 7px 10px; cursor: pointer; }
.seg button.on { background: #243049; color: var(--text); }
.tasks {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px; max-height: 420px; overflow: auto;
}
.task {
  border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #121a2e;
  cursor: pointer; display: grid; gap: 6px;
}
.task:hover, .task.active { border-color: var(--accent); background: rgba(110,168,255,.08); }
.task-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.task-title { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-line {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; color: #9aabc8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 16px;
}
.task-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.badge {
  display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: #243049;
}
.badge.queued { color: var(--warn); }
.badge.running { color: var(--accent); }
.badge.success { color: var(--ok); }
.badge.failed { color: var(--bad); }
.badge.canceled { color: var(--muted); }
.pill { font-size: 12px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.live-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #556; display: inline-block;
}
.live-dot.on { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tab {
  border: 1px solid var(--line); background: #121a2e; color: var(--text);
  border-radius: 999px; padding: 5px 10px; cursor: pointer; font-size: 12px;
}
.tab.on { border-color: var(--accent); background: rgba(110,168,255,.12); }
.console-card { min-height: 360px; display: flex; flex-direction: column; }
.meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; white-space: pre-wrap; }
.console {
  flex: 1; margin: 0; background: #070b14; border-radius: 12px; padding: 12px;
  min-height: 280px; max-height: 480px; overflow: auto; font-size: 12px; line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.console .err { color: #ff8b97; }
.console .dim { color: #66728c; }
.login-body { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: min(420px, 92vw); }
.alert.error { background: rgba(255,107,122,.12); color: #ffb3bb; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
@media (max-width: 980px) {
  .grid2, .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
}
