:root {
  --bg: #f6f7f3;
  --surface: #ffffff;
  --surface-strong: #eef1ea;
  --line: #d9ded3;
  --text: #17201b;
  --muted: #657064;
  --accent: #0d746b;
  --accent-strong: #07544e;
  --danger: #b42318;
  --warning: #ad6500;
  --success: #177245;
  --info: #255c99;
  --shadow: 0 12px 28px rgba(23, 32, 27, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

button {
  min-height: 36px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  padding: 0 14px;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

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

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

button.secondary {
  background: #fff;
  color: var(--accent);
}

button.danger {
  border-color: var(--danger);
  background: #fff;
  color: var(--danger);
}

button.danger:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
}

.app-shell {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(16px, 3vw, 36px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 0.94rem;
}

.topbar-actions,
.section-heading,
.template-actions,
.detail-grid {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions,
.section-heading {
  justify-content: space-between;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(240px, 0.74fr) minmax(420px, 1.5fr) minmax(320px, 1fr);
  gap: 1px;
  background: var(--line);
}

.template-pane,
.runs-pane,
.inspector-pane {
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  padding: 18px;
  overflow: auto;
}

.template-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.template-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(23, 32, 27, 0.04);
}

.template-item h3 {
  margin: 0 0 6px;
  font-size: 0.98rem;
}

.template-item p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.template-image {
  display: block;
  max-width: 100%;
  margin-bottom: 12px;
  overflow: hidden;
  color: #314139;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
  font-size: 0.84rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 750;
  white-space: nowrap;
}

.neutral {
  background: var(--surface-strong);
  color: #314139;
}

.running {
  background: #e7f0ff;
  color: var(--info);
}

.pending {
  background: #fff4df;
  color: var(--warning);
}

.complete {
  background: #e4f5ea;
  color: var(--success);
}

.failed {
  background: #ffe8e4;
  color: var(--danger);
}

.table-wrap {
  width: 100%;
  margin-top: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface-strong);
  color: #3a463e;
  font-size: 0.76rem;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
  transition: background 150ms ease;
}

tbody tr:hover,
tbody tr.selected {
  background: #f4faf8;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.run-detail {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.detail-grid {
  align-items: stretch;
  flex-wrap: wrap;
  margin: 12px 0;
}

.metric {
  min-width: 88px;
  border-left: 3px solid var(--line);
  padding-left: 10px;
}

.metric strong {
  display: block;
  font-size: 1rem;
}

.metric span {
  color: var(--muted);
  font-size: 0.78rem;
}

.pod-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.pod {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--surface-strong);
}

.pod strong,
.pod span {
  display: block;
}

.pod span {
  color: var(--muted);
  font-size: 0.82rem;
}

.logs {
  width: 100%;
  min-height: 340px;
  max-height: 48svh;
  margin: 14px 0 0;
  overflow: auto;
  border: 1px solid #16221d;
  border-radius: 8px;
  background: #111916;
  color: #e5f2eb;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.empty-state {
  color: var(--muted);
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: minmax(240px, 0.8fr) minmax(420px, 1.2fr);
  }

  .inspector-pane {
    grid-column: 1 / -1;
    max-height: none;
  }
}

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

  .topbar-actions {
    width: 100%;
  }

  .workspace {
    display: block;
  }

  .template-pane,
  .runs-pane,
  .inspector-pane {
    border-bottom: 1px solid var(--line);
  }
}
