:root {
  color-scheme: dark;
  --bg: #101214;
  --panel: #181c20;
  --panel-strong: #20262c;
  --panel-soft: #14181c;
  --text: #f4f7f8;
  --muted: #a8b3bd;
  --line: #34404a;
  --accent: #46d99b;
  --accent-strong: #16a66a;
  --warning: #f0b34f;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(70, 217, 155, 0.08), transparent 32%),
    radial-gradient(circle at 80% 20%, rgba(240, 179, 79, 0.08), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  width: min(1400px, 78vw);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 16px;
  align-items: start;
}

.main-content {
  display: grid;
  gap: 16px;
}

.status-panel,
.message-panel,
.pipeline-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
}

.status-panel {
  min-height: 132px;
  padding: 28px;
}

.eyebrow,
.label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5.5vw, 3.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.pipeline {
  min-width: 124px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
  font-weight: 700;
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 999px;
  background: var(--accent);
}

.status-dot[data-status="building"] {
  background: var(--warning);
}

.status-dot[data-status="failed"] {
  background: var(--danger);
}

.message-panel {
  padding: 28px;
}

.pipeline-panel {
  position: sticky;
  top: 16px;
  padding: 22px;
}

.pipeline-panel h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0;
}

.pipeline-panel-header {
  margin-bottom: 18px;
  display: grid;
  gap: 12px;
}

.pipeline-steps {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 22px;
  list-style: none;
}

.pipeline-steps li {
  position: relative;
  min-height: 54px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.pipeline-steps li:not(:last-child)::after {
  content: "↓";
  position: absolute;
  left: 20px;
  bottom: -21px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
}

.pipeline-steps li[data-step-status="done"]:not(:last-child)::after {
  color: var(--accent);
}

.pipeline-steps li[data-step-status="active"]:not(:last-child)::after {
  color: var(--warning);
}

.pipeline-steps li[data-step-status="failed"]:not(:last-child)::after {
  color: var(--danger);
}

.pipeline-steps span {
  min-width: 0;
}

.pipeline-steps strong {
  color: var(--muted);
  font-size: 0.78rem;
}

.step-marker {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--line);
}

.pipeline-steps li[data-step-status="active"] .step-marker {
  background: var(--warning);
}

.pipeline-steps li[data-step-status="done"] .step-marker {
  background: var(--accent);
}

.pipeline-steps li[data-step-status="failed"] .step-marker {
  background: var(--danger);
}

.pipeline-steps li[data-step-status="active"] strong {
  color: var(--warning);
}

.pipeline-steps li[data-step-status="done"] strong {
  color: var(--accent);
}

.pipeline-steps li[data-step-status="failed"] strong {
  color: var(--danger);
}

.section-header {
  display: grid;
  gap: 22px;
}

.project-description {
  margin: 0;
  max-width: 1100px;
  color: var(--text);
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.live-message {
  min-height: 96px;
  margin: 0 0 24px;
  font-size: clamp(1.5rem, 5vw, 3rem);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

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

.metadata-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metadata div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
}

dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.deployment-details,
.deployment-history {
  margin-top: 24px;
}

.deployment-details {
  display: grid;
  gap: 12px;
}

.deployment-details + .metadata {
  margin-top: 16px;
}

.details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.details-header .label {
  margin: 0;
}

.pipeline-links {
  margin-top: 18px;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.pipeline-links a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.pipeline-links a:hover {
  color: var(--text);
}

#deployment-history {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

#deployment-history li {
  min-height: 44px;
  display: grid;
  grid-template-columns: 96px 96px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

#deployment-history span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deploy-form {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  display: grid;
  gap: 12px;
}

.form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

label {
  color: var(--muted);
  font-weight: 700;
}

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

textarea {
  width: 100%;
  resize: vertical;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #0c0f11;
  color: var(--text);
  font: inherit;
}

textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #0c0f11;
  color: var(--text);
  font: inherit;
}

select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.form-actions {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#form-feedback {
  min-width: 0;
  color: var(--muted);
}

button {
  min-width: 124px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #07120d;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
  color: var(--text);
}

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

@media (max-width: 680px) {
  body {
    place-items: start center;
    padding: 16px 0;
  }

  .app-shell {
    width: calc(100vw - 32px);
    grid-template-columns: 1fr;
  }

  .pipeline-panel {
    position: static;
  }

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

  .metadata-compact {
    grid-template-columns: 1fr;
  }

  .details-header {
    align-items: flex-start;
    flex-direction: column;
  }

  #deployment-history li {
    grid-template-columns: 1fr;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}
