:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-alt: #f0f4f8;
  --line: #d7dee9;
  --line-strong: #b9c5d6;
  --text: #172033;
  --muted: #607089;
  --blue: #2563eb;
  --blue-dark: #1e40af;
  --green: #0f8a5f;
  --amber: #b7791f;
  --red: #b42318;
  --code-bg: #0f172a;
  --code-text: #dbeafe;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar h1,
.pane-header h2,
.progress-copy h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pill {
  min-width: 112px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 410px) minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
}

.input-pane,
.progress-band,
.output-toolbar,
.output-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-pane {
  padding: 18px;
  align-self: start;
}

.pane-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.pane-header p,
.progress-copy p,
.empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segment,
.tab {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.segment.active,
.tab.active {
  background: var(--surface);
  color: var(--blue-dark);
  box-shadow: inset 0 0 0 1px var(--line);
}

.input-form label,
.select-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

textarea,
input[type="file"],
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

textarea {
  min-height: 260px;
  padding: 12px;
  resize: vertical;
}

input[type="file"] {
  padding: 12px;
}

select {
  min-width: 160px;
  min-height: 38px;
  padding: 0 10px;
}

.button-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.primary-button,
.secondary-button,
.download-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.primary-button {
  background: var(--blue);
  color: white;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.secondary-button,
.download-link {
  background: var(--surface);
  color: var(--blue-dark);
  border-color: var(--line-strong);
}

.download-link.disabled {
  pointer-events: none;
  color: var(--muted);
  background: var(--surface-alt);
}

.run-meta {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.run-meta div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 10px;
}

.run-meta span {
  color: var(--muted);
  font-size: 13px;
}

.run-meta strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.main-pane {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.progress-band {
  padding: 18px;
}

.progress-meter {
  height: 10px;
  margin: 16px 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-alt);
}

#progressFill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 280ms ease;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(7, minmax(86px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.timeline span {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timeline strong {
  display: block;
  font-size: 13px;
}

.timeline li.running {
  border-color: var(--blue);
  background: #eff6ff;
}

.timeline li.completed {
  border-color: rgba(15, 138, 95, 0.45);
  background: #ecfdf5;
}

.timeline li.error {
  border-color: rgba(180, 35, 24, 0.5);
  background: #fef3f2;
}

.output-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tab {
  padding: 0 12px;
}

.toolbar-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.output-panel {
  min-height: 520px;
  padding: 18px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

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

.section-title h3 {
  margin: 0;
  font-size: 20px;
}

.summary-text {
  max-width: 980px;
  margin: 0 0 18px;
  color: #2b3a52;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

th {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

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

.two-column {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 16px;
}

.file-list {
  display: grid;
  align-content: start;
  gap: 6px;
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.file-button {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  overflow-wrap: anywhere;
}

.file-button.active {
  border-color: var(--blue);
  background: #eff6ff;
  color: var(--blue-dark);
  font-weight: 800;
}

.code-shell {
  min-width: 0;
}

.code-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 0 4px 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

pre {
  max-height: 600px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
}

.list-block {
  display: grid;
  gap: 8px;
  margin: 12px 0 18px;
  padding-left: 18px;
}

.list-block li {
  color: #2b3a52;
}

.empty-state {
  min-height: 260px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-alt);
  text-align: center;
}

.empty-state h3 {
  margin: 0;
  font-size: 20px;
}

.hidden {
  display: none;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .timeline {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar,
  .output-toolbar,
  .toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    padding: 12px;
  }

  .timeline,
  .metric-grid,
  .two-column {
    grid-template-columns: 1fr;
  }
}
