:root {
  --bg: #f3efe6;
  --paper: #fffaf2;
  --ink: #1a1814;
  --muted: #6d665c;
  --line: #d8cebf;
  --accent: #ba4a1a;
  --accent-strong: #922f08;
  --shadow: 0 18px 50px rgba(49, 34, 12, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(186, 74, 26, 0.16), transparent 28%),
    linear-gradient(180deg, #f8f4ed 0%, var(--bg) 100%);
}

.shell {
  width: min(960px, calc(100% - 32px));
  margin: 48px auto;
}

.layout {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.95fr);
}

.main-column,
.side-column {
  display: grid;
  gap: 24px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 0.98;
  margin-bottom: 16px;
}

.lede {
  max-width: 52ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.stack {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-weight: 700;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdfa;
}

button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  padding: 14px 20px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.status {
  min-height: 24px;
  margin-top: 20px;
  color: var(--muted);
}

.meta {
  color: var(--muted);
  margin-bottom: 0;
}

.result.hidden {
  display: none;
}

.result-head,
.history-head,
.history-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.history-card h2 {
  margin-bottom: 0;
}

.history-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.history-item,
.ghost-button {
  font: inherit;
}

.history-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fffdfa;
  padding: 14px;
  cursor: pointer;
}

.history-item:hover,
.history-item.active {
  border-color: rgba(186, 74, 26, 0.45);
  box-shadow: 0 10px 24px rgba(49, 34, 12, 0.08);
}

.history-item p,
.history-item small {
  color: var(--muted);
}

.history-item p {
  margin: 10px 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ghost-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  padding: 10px 16px;
  cursor: pointer;
}

.ghost-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #efe6d7;
  color: #5e4b33;
}

.pill-completed {
  background: #dfeede;
  color: #1d5c2c;
}

.pill-in_progress,
.pill-queued {
  background: #f8ebc9;
  color: #7a5600;
}

.pill-failed {
  background: #f5d8d8;
  color: #8a2626;
}

.block + .block {
  margin-top: 24px;
}

ul {
  padding-left: 20px;
}

pre {
  white-space: pre-wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  max-height: 360px;
  overflow: auto;
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 960px);
    margin: 20px auto;
  }

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

  .card {
    padding: 20px;
    border-radius: 18px;
  }
}
