:root {
  --ink: #152238;
  --muted: #637188;
  --line: #dbe3ee;
  --surface: #fff;
  --soft: #f3f6fa;
  --navy: #0b1930;
  --blue: #3156d8;
  --cyan: #32d5c8;
  --green: #14866d;
  --red: #b42318;
  --amber: #b54708;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 86% 7%, rgba(50, 213, 200, 0.17), transparent 25%),
    var(--soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
}

button,
select {
  font: inherit;
}

.app-shell {
  width: min(calc(100% - 2rem), 75rem);
  margin-inline: auto;
  padding-block: clamp(2.5rem, 7vw, 5.5rem);
}

.intro {
  max-width: 52rem;
  margin-bottom: 2.5rem;
}

.eyebrow,
.section-label {
  margin: 0 0 0.65rem;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.intro h1 {
  margin: 0;
  font-size: clamp(2.7rem, 8vw, 5.5rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.intro > p:not(.eyebrow) {
  max-width: 46rem;
  margin: 1.35rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.intro a {
  display: inline-block;
  margin-top: 1rem;
  color: var(--blue);
  font-weight: 750;
}

.panel {
  min-width: 0;
  padding: clamp(1.25rem, 4vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  box-shadow: 0 1.2rem 3rem rgba(21, 34, 56, 0.07);
}

.panel h2 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: -0.035em;
}

.control-panel {
  display: grid;
  gap: 1rem;
  align-items: end;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field label {
  font-size: 0.78rem;
  font-weight: 780;
}

.field select {
  width: 100%;
  min-height: 3rem;
  padding: 0.65rem 0.75rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid #aeb9c8;
  border-radius: 0.65rem;
}

.actions {
  display: flex;
  gap: 0.65rem;
}

button {
  min-height: 3rem;
  padding-inline: 1.1rem;
  border-radius: 0.7rem;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  color: #fff;
  background: var(--blue);
  border: 0;
}

.secondary-button {
  color: var(--blue);
  background: #edf1ff;
  border: 1px solid #cdd6ff;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.request-state {
  margin-block: 1rem;
}

.state-heading,
.section-heading,
.task-card {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.state-badge,
.count-badge {
  flex: none;
  padding: 0.3rem 0.65rem;
  color: var(--muted);
  background: var(--soft);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
}

.state-badge[data-state="loading"] {
  color: var(--blue);
  background: #edf1ff;
}

.state-badge[data-state="success"] {
  color: var(--green);
  background: #effaf6;
}

.state-badge[data-state="error"] {
  color: var(--red);
  background: #fff2f1;
}

.state-badge[data-state="cancelled"] {
  color: var(--amber);
  background: #fff7ed;
}

.status {
  margin: 1rem 0 0.75rem;
  color: var(--muted);
}

.status[data-state="error"] {
  color: var(--red);
}

.status[data-state="success"] {
  color: var(--green);
}

.progress-track {
  height: 0.3rem;
  overflow: hidden;
  background: #e3e9f1;
  border-radius: 999px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.progress-track span[data-active="true"] {
  width: 45%;
  animation: loading 1.1s ease-in-out infinite alternate;
}

@keyframes loading {
  from { transform: translateX(-100%); }
  to { transform: translateX(220%); }
}

.content-grid {
  display: grid;
  gap: 1rem;
}

.empty-state {
  display: grid;
  justify-items: center;
  margin-top: 1.25rem;
  padding: 2.5rem 1rem;
  color: var(--muted);
  background: var(--soft);
  border: 1px dashed #b8c4d4;
  border-radius: 0.85rem;
  text-align: center;
}

.task-list,
.pipeline {
  display: grid;
  gap: 0.7rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.task-card {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-left: 0.3rem solid var(--blue);
  border-radius: 0.7rem;
}

.task-card span,
.pipeline small {
  color: var(--muted);
  font-size: 0.75rem;
}

.pipeline li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
}

.pipeline li > span {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: #fff;
  background: #8290a5;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 850;
}

.pipeline li[data-state="success"] > span { background: var(--green); }
.pipeline li[data-state="active"] > span { background: var(--blue); }
.pipeline li[data-state="warning"] > span { background: var(--amber); }
.pipeline li[data-state="error"] > span { background: var(--red); }

.pipeline li div {
  display: grid;
}

.concept-note {
  margin-top: 1rem;
  padding: 1rem 1.2rem;
  color: #244355;
  background: #e8faf7;
  border: 1px solid #b9ebe5;
  border-radius: 0.85rem;
}

.concept-note p {
  margin: 0.35rem 0 0;
}

.concept-note code {
  color: #253faf;
  font-weight: 750;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

@media (min-width: 48rem) {
  .control-panel {
    grid-template-columns: 0.7fr 1.1fr auto;
  }
}

@media (min-width: 62rem) {
  .content-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(19rem, 0.8fr);
    align-items: start;
  }

  .pipeline-panel {
    position: sticky;
    top: 1rem;
  }
}

@media (max-width: 38rem) {
  .actions,
  .state-heading,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
  }
}
