:root {
  --bg: #f4efe3;
  --bg-soft: #fbf8f0;
  --ink: #1d2a33;
  --ink-muted: #5e6d77;
  --line: rgba(29, 42, 51, 0.14);
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b45309;
  --error: #b91c1c;
  --success: #166534;
  --shadow: 0 18px 40px rgba(29, 42, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 28%),
    linear-gradient(180deg, #f8f4ea 0%, var(--bg) 100%);
}

code,
input,
select,
button {
  font-family: "SFMono-Regular", Menlo, Monaco, monospace;
}

.page-shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.hero {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  animation: slide-up 0.4s ease;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 4vw, 3.5rem);
}

.hero-copy {
  margin: 0;
  max-width: 760px;
  color: var(--ink-muted);
  line-height: 1.55;
}

.layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 20px;
  margin-top: 24px;
}

.panel {
  padding: 22px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  animation: slide-up 0.55s ease;
}

.panel-jobs {
  grid-column: 1 / -1;
}

.panel-header h2,
.detail-block h3 {
  margin: 0;
}

.panel-header p,
.detail-block p,
.job-card p,
.job-card small,
.progress-message {
  color: var(--ink-muted);
}

.job-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  font-size: 0.92rem;
  font-weight: 600;
}

input,
select,
button {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(29, 42, 51, 0.18);
  padding: 14px 16px;
  background: var(--bg-soft);
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 2px solid rgba(15, 118, 110, 0.2);
  border-color: var(--accent);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.button-row {
  display: flex;
  justify-content: flex-end;
}

button {
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  font-weight: 700;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.validation-errors {
  display: none;
  gap: 8px;
}

.validation-errors.is-visible {
  display: grid;
}

.error-block,
.error-state {
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(185, 28, 28, 0.08);
  border: 1px solid rgba(185, 28, 28, 0.18);
}

.job-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.job-card {
  text-align: left;
  background: rgba(255, 255, 255, 0.8);
  color: inherit;
}

.job-card.is-selected {
  outline: 2px solid rgba(15, 118, 110, 0.25);
}

.job-card-header,
.detail-topline,
.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-queued {
  background: rgba(180, 83, 9, 0.12);
  color: var(--warn);
}

.status-running {
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent-strong);
}

.status-succeeded {
  background: rgba(22, 101, 52, 0.12);
  color: var(--success);
}

.status-failed {
  background: rgba(185, 28, 28, 0.12);
  color: var(--error);
}

.job-detail {
  display: grid;
  gap: 18px;
}

.job-detail.empty,
.empty-state {
  color: var(--ink-muted);
}

.progress-shell {
  padding: 16px;
  border-radius: 18px;
  background: rgba(244, 239, 227, 0.8);
  border: 1px solid var(--line);
}

.progress-bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(29, 42, 51, 0.08);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent) 0%, #14b8a6 100%);
  transition: width 0.25s ease;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.detail-block {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
}

.detail-block-preview {
  padding: 18px;
}

.preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.preview-header h3 {
  margin-bottom: 6px;
}

.preview-header p {
  margin: 0;
}

.artifact-preview {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(29, 42, 51, 0.12);
  background:
    linear-gradient(180deg, rgba(29, 42, 51, 0.06), rgba(29, 42, 51, 0.02)),
    #efe8d7;
}

.artifact-player {
  display: block;
  width: 100%;
  max-height: 680px;
  background: #000;
}

.download-row {
  margin-top: 14px;
}

.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1f2937 0%, #0f766e 100%);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.download-button[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .preview-header {
    flex-direction: column;
    align-items: stretch;
  }

  .field-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
