:root {
  color-scheme: dark;
  --bg: #030712;
  --panel: rgba(12, 18, 39, 0.82);
  --panel-strong: rgba(18, 27, 57, 0.92);
  --text: #eef4ff;
  --muted: #9aa8c7;
  --line: rgba(91, 122, 201, 0.32);
  --line-bright: rgba(109, 91, 255, 0.8);
  --accent: #5b6cff;
  --accent-2: #8a3ffc;
  --accent-3: #20a4ff;
  --ok: #48d597;
  --warn: #f4bd50;
  --bad: #ff6f91;
  --soft: rgba(61, 95, 230, 0.13);
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 13% 5%, rgba(91, 108, 255, 0.18), transparent 26%),
    radial-gradient(circle at 82% 0%, rgba(32, 164, 255, 0.12), transparent 22%),
    linear-gradient(180deg, #040817 0%, #071023 46%, #030712 100%);
  color: var(--text);
  overflow-x: hidden;
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.95;
  background:
    linear-gradient(90deg, transparent 0 68%, rgba(67, 105, 255, 0.1) 68% 68.15%, transparent 68.15%),
    linear-gradient(135deg, transparent 0 58%, rgba(79, 117, 255, 0.12) 58% 58.15%, transparent 58.15%),
    radial-gradient(circle at 50% 7%, rgba(83, 92, 255, 0.18), transparent 1px),
    radial-gradient(circle at 89% 11%, rgba(83, 92, 255, 0.18), transparent 2px);
  mask-image: linear-gradient(to bottom, #000 0 35%, transparent 92%);
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 100px;
  padding: 24px 32px 22px;
  border-bottom: 1px solid rgba(52, 86, 165, 0.46);
  background:
    linear-gradient(90deg, rgba(3, 7, 18, 0.92), rgba(8, 16, 38, 0.82)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
  box-shadow: inset 0 -1px 0 rgba(87, 127, 255, 0.32);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: min(280px, 30vw);
  height: 2px;
  background: linear-gradient(90deg, transparent, #2fa4ff 18%, #7b52ff 58%, transparent);
  box-shadow: 0 0 18px rgba(84, 108, 255, 0.9);
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 13px;
  background: linear-gradient(145deg, #21b8ff 4%, #6b52ff 44%, #8f36ff 88%);
  box-shadow: 0 0 28px rgba(89, 103, 255, 0.56);
  clip-path: polygon(10% 4%, 94% 50%, 10% 96%, 28% 57%, 28% 43%);
}

.brand h1 {
  margin: 0;
  font-size: clamp(24px, 2vw, 32px);
  line-height: 1.1;
  letter-spacing: 0;
}

.brand p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.runtime {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--text);
  font-size: 14px;
}

.runtime span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(126, 145, 203, 0.28);
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(8, 13, 31, 0.86);
  box-shadow: inset 0 0 18px rgba(72, 89, 180, 0.13);
}

.runtime span::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 12px var(--ok);
}

.runtime-button {
  padding: 10px 14px;
  border-color: rgba(112, 136, 205, 0.32);
  background: rgba(8, 13, 31, 0.86);
  box-shadow: none;
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 22px;
  padding: 16px 24px 28px;
}

.panel {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(20, 29, 62, 0.86), rgba(8, 13, 31, 0.86)),
    radial-gradient(circle at 40% 0%, rgba(91, 108, 255, 0.18), transparent 38%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.submit-panel {
  padding: 26px 24px 0;
}

.status-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 144px);
  padding: 26px 26px 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}

.panel-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.panel-head h2::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(145deg, var(--accent-3), var(--accent-2));
  box-shadow: 0 0 18px rgba(85, 97, 255, 0.65);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button,
.button-link {
  border: 1px solid rgba(102, 129, 255, 0.72);
  border-radius: 9px;
  background: linear-gradient(135deg, #6f42ff, #2f72ff);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 760;
  padding: 11px 18px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 10px 28px rgba(72, 87, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

button:hover,
.button-link:hover {
  filter: brightness(1.08);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

#refreshBtn {
  background: rgba(12, 18, 39, 0.82);
  color: #dce7ff;
}

.field {
  display: grid;
  gap: 9px;
  margin-bottom: 20px;
}

.field span,
.check span,
.advanced summary {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid rgba(112, 136, 205, 0.34);
  border-radius: 9px;
  background: rgba(8, 13, 31, 0.78);
  color: var(--text);
  font: inherit;
  padding: 14px 15px;
  outline: none;
  box-shadow: inset 0 0 22px rgba(74, 92, 170, 0.08);
}

textarea::placeholder,
input::placeholder {
  color: #687798;
}

textarea:focus,
input:focus {
  border-color: rgba(100, 124, 255, 0.92);
  box-shadow: 0 0 0 3px rgba(91, 108, 255, 0.18), inset 0 0 22px rgba(74, 92, 170, 0.1);
}

#urlsText {
  min-height: 232px;
  resize: vertical;
}

#requestOverrides {
  min-height: 118px;
  resize: vertical;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.auto-mode {
  display: grid;
  gap: 6px;
  border-top: 1px solid rgba(116, 139, 209, 0.24);
  border-bottom: 1px solid rgba(116, 139, 209, 0.24);
  padding: 18px 0;
  margin-bottom: 16px;
}

.auto-mode strong {
  color: #f3f7ff;
  font-size: 15px;
}

.auto-mode span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.advanced {
  padding: 2px 0 12px;
  margin-top: 6px;
}

.advanced summary {
  cursor: pointer;
  color: #7aa8ff;
}

.advanced .field {
  margin-top: 16px;
}

.login-box {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  border-top: 1px solid rgba(116, 139, 209, 0.24);
  margin-top: 14px;
  padding-top: 16px;
}

.login-box .field {
  margin-bottom: 0;
}

.change-password-box {
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(116, 139, 209, 0.24);
  margin-top: 14px;
  padding-top: 16px;
}

.change-password-box strong {
  color: #f3f7ff;
}

.change-password-box .field {
  margin-bottom: 0;
}

.change-password-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 10px;
}

.secondary-button {
  border-color: rgba(116, 139, 209, 0.28);
  background: rgba(5, 10, 25, 0.62);
  color: var(--muted);
  box-shadow: none;
}

.admin-panel {
  display: grid;
  gap: 14px;
  margin: -6px 0 18px;
  border: 1px solid rgba(91, 122, 201, 0.24);
  border-radius: 12px;
  padding: 16px;
  background: rgba(5, 10, 25, 0.45);
}

.admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(116, 139, 209, 0.18);
  padding-bottom: 12px;
}

.admin-panel-head strong {
  font-size: 15px;
}

.admin-panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.admin-filter {
  margin-bottom: 0;
}

.create-user {
  border-top: 1px solid rgba(116, 139, 209, 0.18);
  padding-top: 12px;
}

.create-user summary {
  cursor: pointer;
  width: fit-content;
  border: 1px solid rgba(102, 129, 255, 0.46);
  border-radius: 8px;
  color: #dce7ff;
  background: rgba(50, 91, 255, 0.1);
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 800;
}

.create-user-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 1.2fr) minmax(120px, 0.8fr) auto;
  gap: 10px;
  margin-top: 12px;
}

.message {
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0 0;
}

.download-art {
  position: relative;
  height: 230px;
  margin: 22px -24px 0;
  overflow: hidden;
  background: radial-gradient(circle at 48% 48%, rgba(80, 76, 255, 0.36), transparent 34%);
}

.art-grid {
  position: absolute;
  inset: 42px -12px -30px;
  background:
    linear-gradient(rgba(63, 92, 190, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63, 92, 190, 0.16) 1px, transparent 1px);
  background-size: 28px 28px;
  transform: perspective(480px) rotateX(58deg);
  transform-origin: center bottom;
}

.art-platform {
  position: absolute;
  left: 50%;
  bottom: 32px;
  width: 176px;
  height: 76px;
  transform: translateX(-50%) rotateX(58deg) rotateZ(45deg);
  border: 1px solid rgba(72, 135, 255, 0.78);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(33, 170, 255, 0.46), rgba(129, 66, 255, 0.56));
  box-shadow: 0 0 50px rgba(83, 93, 255, 0.7);
}

.art-arrow {
  position: absolute;
  left: 50%;
  top: -72px;
  width: 38px;
  height: 100px;
  transform: translateX(-50%) rotateZ(-45deg) rotateX(-58deg);
  background: linear-gradient(180deg, #75e0ff, #6f42ff);
  clip-path: polygon(31% 0, 69% 0, 69% 55%, 100% 55%, 50% 100%, 0 55%, 31% 55%);
  filter: drop-shadow(0 0 20px rgba(91, 108, 255, 0.92));
}

.summary {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
  border: 1px solid rgba(91, 122, 201, 0.28);
  border-radius: 13px;
  padding: 24px;
  background: rgba(5, 10, 25, 0.62);
}

.summary.empty {
  color: var(--muted);
}

.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  justify-content: space-between;
}

.summary-row strong {
  font-size: 16px;
}

.summary-row span {
  color: var(--muted);
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(65, 83, 147, 0.36);
  overflow: hidden;
}

.progress div {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3f65ff, #7d39ff);
  box-shadow: 0 0 18px rgba(91, 108, 255, 0.76);
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 12px 0;
  border-top: 1px solid rgba(116, 139, 209, 0.2);
  border-bottom: 1px solid rgba(116, 139, 209, 0.2);
}

.bulk-select,
.job-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #dce7ff;
  font-size: 14px;
  font-weight: 760;
  cursor: pointer;
  user-select: none;
}

.bulk-select input,
.job-select input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-3);
}

.bulk-select:has(input:disabled),
.job-select:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.58;
}

.bulk-summary {
  color: var(--muted);
  font-size: 13px;
}

.bulk-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}

.bulk-actions button {
  padding: 9px 13px;
  box-shadow: none;
}

.bulk-delete {
  border-color: rgba(255, 111, 145, 0.48);
  background: rgba(255, 111, 145, 0.08);
  color: var(--bad);
}

.pager button {
  background: rgba(8, 13, 31, 0.78);
  color: #dce7ff;
  border: 1px solid rgba(112, 136, 205, 0.32);
  box-shadow: none;
  padding: 12px 18px;
}

.pager span {
  color: var(--muted);
  font-size: 14px;
}

.jobs {
  display: grid;
  gap: 16px;
}

.job {
  display: grid;
  grid-template-columns: minmax(150px, 230px) minmax(0, 1fr);
  gap: 22px;
  border: 1px solid rgba(91, 122, 201, 0.24);
  border-radius: 12px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(23, 32, 67, 0.88), rgba(13, 20, 44, 0.88)),
    radial-gradient(circle at 30% 0%, rgba(82, 102, 255, 0.13), transparent 42%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.job-preview {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 9px;
  overflow: hidden;
  background:
    radial-gradient(circle at 44% 30%, rgba(68, 217, 255, 0.42), transparent 16%),
    linear-gradient(135deg, #102341, #091224 58%, #180f35);
  border: 1px solid rgba(97, 126, 201, 0.25);
}

.job-preview video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.job-preview.placeholder::before {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(31, 164, 255, 0.36), rgba(123, 57, 255, 0.38));
  transform: perspective(300px) rotateX(55deg) rotateZ(45deg);
  box-shadow: 0 0 34px rgba(91, 108, 255, 0.48);
}

.playmark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform: translate(-35%, -50%);
  border-top: 13px solid transparent;
  border-bottom: 13px solid transparent;
  border-left: 20px solid #fff;
  filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.68));
}

.job-body {
  min-width: 0;
}

.job-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.job-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.job-select {
  padding: 7px 2px;
  color: var(--muted);
  font-size: 13px;
}

.job-title {
  min-width: 0;
}

.job-title strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.45;
}

.job-title a {
  display: block;
  margin-top: 10px;
  color: #4f8cff;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.badge {
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
}

.delete-job {
  border-color: rgba(255, 111, 145, 0.48);
  background: rgba(255, 111, 145, 0.08);
  color: var(--bad);
  box-shadow: none;
  padding: 8px 13px;
}

.retry-job {
  border-color: rgba(79, 140, 255, 0.58);
  background: rgba(79, 140, 255, 0.1);
  color: #77a7ff;
  box-shadow: none;
  padding: 8px 13px;
}

.retry-job:hover {
  background: rgba(79, 140, 255, 0.2);
}

.delete-job:hover {
  background: rgba(255, 111, 145, 0.16);
}

.queued {
  color: #9aa8c7;
}

.running {
  color: var(--warn);
}

.succeeded {
  color: var(--ok);
}

.failed {
  color: var(--bad);
}

.job-meta {
  color: var(--muted);
  font-size: 14px;
  margin-top: 10px;
}

.owner-badge {
  display: inline-flex;
  align-items: center;
  margin-right: 10px;
  border: 1px solid rgba(72, 213, 151, 0.34);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--ok);
  background: rgba(72, 213, 151, 0.08);
  font-weight: 800;
}

.files {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.files a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(66, 113, 255, 0.58);
  border-radius: 8px;
  color: #5d8dff;
  background: rgba(50, 91, 255, 0.1);
  padding: 12px 16px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.files a::before {
  content: "";
  width: 16px;
  height: 13px;
  flex: 0 0 auto;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  clip-path: polygon(0 12%, 70% 12%, 70% 0, 100% 20%, 100% 88%, 0 88%);
}

.error {
  color: var(--bad);
  background: rgba(255, 111, 145, 0.08);
  border: 1px solid rgba(255, 111, 145, 0.22);
  border-radius: 8px;
  padding: 10px;
  margin-top: 14px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .runtime {
    justify-content: flex-start;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .status-panel {
    min-height: auto;
  }

  .download-art {
    height: 180px;
  }

  .login-box,
  .create-user-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .topbar {
    padding: 20px 18px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .submit-panel,
  .status-panel {
    padding: 18px;
  }

  #urlsText {
    min-height: 180px;
  }

  .job {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .job-head {
    flex-direction: column;
  }

  .bulk-actions {
    width: 100%;
    margin-left: 0;
  }
}
