:root {
  --ink: #18212f;
  --muted: #607089;
  --line: #d9e0e8;
  --surface: #ffffff;
  --band: #f6f8fb;
  --brand: #b8322a;
  --brand-dark: #7f1f1a;
  --blue: #245a84;
  --green: #25765d;
  --amber: #9b6413;
  --red: #a43131;
  --shadow: 0 12px 30px rgba(20, 35, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #f7f2ee 0, #f4f7fb 290px, #eef3f6 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  min-height: 38px;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: var(--blue);
}

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

.primary,
.create-form button[type="submit"] {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.primary:hover:not(:disabled),
.create-form button[type="submit"]:hover:not(:disabled) {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  min-height: 112px;
  padding: 24px 32px 20px;
  border-bottom: 1px solid rgba(130, 90, 62, 0.18);
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.health {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  padding: 7px 12px;
  white-space: nowrap;
}

.shell {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 24px;
  padding: 24px 32px 40px;
}

.project-list,
.workspace {
  min-width: 0;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.project-list {
  align-self: start;
  padding: 18px;
}

.workspace {
  padding: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
}

.icon-button {
  width: 38px;
  padding: 0;
}

.create-form {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.create-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  color: var(--ink);
  background: var(--surface);
}

.project-rows {
  display: grid;
  gap: 8px;
}

.project-row {
  display: grid;
  gap: 8px;
  width: 100%;
  text-align: left;
  border-radius: 7px;
  padding: 12px;
}

.project-row.active {
  border-color: var(--brand);
  box-shadow: inset 3px 0 0 var(--brand);
}

.project-row strong {
  font-size: 14px;
  line-height: 1.25;
}

.project-row span {
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 360px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--band);
  padding: 12px;
  min-height: 76px;
}

.metrics span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.metrics strong {
  font-size: 21px;
  line-height: 1.15;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.tab {
  min-height: 34px;
  font-size: 13px;
}

.tab.active {
  background: #20354f;
  border-color: #20354f;
  color: white;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-weight: 600;
  background: var(--band);
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.status.succeeded,
.status.video_ready {
  background: rgba(37, 118, 93, 0.12);
  color: var(--green);
}

.status.running,
.status.queued {
  background: rgba(36, 90, 132, 0.12);
  color: var(--blue);
}

.status.pending {
  background: rgba(96, 112, 137, 0.13);
  color: var(--muted);
}

.status.failed,
.status.blocked {
  background: rgba(164, 49, 49, 0.12);
  color: var(--red);
}

.status.draft,
.status.active {
  background: rgba(155, 100, 19, 0.13);
  color: var(--amber);
}

.progress-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #e5eaf0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.json-view {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111a24;
  color: #dce8f2;
  padding: 14px;
  font-size: 12px;
  line-height: 1.55;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

@media (max-width: 920px) {
  .topbar,
  .shell {
    padding-left: 16px;
    padding-right: 16px;
  }

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

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

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

  .table {
    font-size: 12px;
  }
}
