@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --bg0: #0c1210;
  --bg1: #141c18;
  --bg2: #1c2822;
  --bg3: #24332b;
  --ink: #eef4ef;
  --muted: #8fa396;
  --faint: #5f7366;
  --accent: #6fbf78;
  --accent-2: #c6e27a;
  --warn: #e0b35a;
  --danger: #e07a6a;
  --line: rgba(238, 244, 239, 0.1);
  --glow: rgba(111, 191, 120, 0.18);
  --font: "DM Sans", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1000px 520px at -10% -20%, #1f3d2e 0%, transparent 55%),
    radial-gradient(800px 420px at 110% 0%, #3a3420 0%, transparent 45%),
    radial-gradient(600px 400px at 50% 120%, #143028 0%, transparent 50%),
    linear-gradient(165deg, #0a0f0d 0%, var(--bg0) 40%, #101816 100%);
  background-attachment: fixed;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.tag {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.panel {
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg1) 92%, white), var(--bg1));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}

.panel.wide {
  margin-top: 14px;
}

h2 {
  margin: 0 0 6px;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.hint code {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent-2);
  background: rgba(0, 0, 0, 0.28);
  padding: 1px 6px;
  border-radius: 6px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--ink);
  border-radius: 10px;
  padding: 11px 12px;
  font: 500 0.95rem/1.2 var(--font);
  text-transform: none;
  letter-spacing: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.45;
  resize: vertical;
  min-height: 120px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 3px var(--glow);
}

.row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

button,
.ghost {
  border: 1px solid var(--line);
  background: var(--bg3);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 14px;
  font: 600 0.9rem/1.1 var(--font);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

button:hover,
.ghost:hover {
  transform: translateY(-1px);
  border-color: rgba(238, 244, 239, 0.22);
}

button.primary {
  background: linear-gradient(180deg, #8ad88e, #4f9d5c);
  color: #0d1a12;
  border: none;
  margin-top: 4px;
  width: 100%;
  padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(79, 157, 92, 0.28);
}

button.primary:hover {
  filter: brightness(1.05);
}

button.danger {
  background: #5a2c27;
  border-color: #8a4a40;
  color: #ffd8d2;
}

.actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.code-box {
  margin: 0;
  max-height: 240px;
  overflow: auto;
  background: #080c0a;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  color: #d5e4da;
}

.jobs-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 10px;
}

.jobs-hint {
  margin: 0 0 12px;
}

.jobs-more {
  display: flex;
  justify-content: center;
  margin-top: 12px;
  padding-top: 4px;
}

.job {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  background: rgba(0, 0, 0, 0.22);
}

.job-batch {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.job-child {
  margin-bottom: 8px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  border-color: color-mix(in srgb, var(--line) 80%, transparent);
}

.job-children {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.expand-btn {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.job-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.job-id {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent-2);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
}

.badge.running { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.badge.stuck { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.badge.error,
.badge.cancelled { color: var(--danger); }
.badge.done { color: var(--accent-2); }
.badge.queued { color: var(--muted); }

.bar {
  height: 9px;
  background: #080c0a;
  border-radius: 99px;
  overflow: hidden;
  margin: 12px 0 8px;
  border: 1px solid var(--line);
}

.bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3f8f55, #b7e07a);
  width: 0%;
  transition: width 0.35s ease;
  box-shadow: 0 0 12px rgba(183, 224, 122, 0.35);
}

.job-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.log-panel {
  margin-top: 12px;
  max-height: 340px;
  overflow: auto;
  background: #060908;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.4;
  white-space: pre-wrap;
  color: #c5d6cb;
}

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(400px, 94vw);
  padding: 28px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #1a2420, #121a16);
  display: grid;
  gap: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.login-card .brand {
  font-size: 1.6rem;
}

.login-card input {
  text-transform: none;
  letter-spacing: 0;
}

@media (max-width: 860px) {
  .grid,
  .row {
    grid-template-columns: 1fr;
  }
  .top {
    flex-direction: column;
  }
}
