:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --panel: #12151c;
  --panel-2: #171b24;
  --border: #262b36;
  --text: #e7eaf0;
  --muted: #8a91a3;
  --accent: #5b8cff;
  --accent-2: #33d6a6;
  --danger: #ff6b6b;
  font-family: -apple-system, "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

#topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

#topbar h1 {
  font-size: 15px;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.spacer { flex: 1; }

.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge.demo { color: #ffce54; border-color: #ffce5455; }
.badge.production { color: var(--accent-2); border-color: #33d6a655; }

#apiKey {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  width: 220px;
}

main {
  flex: 1;
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 0;
}

#workflow {
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.card h2 {
  font-size: 13px;
  margin: 0 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.hint code { color: var(--text); }

.drop {
  display: block;
  margin-top: 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
}

.drop:hover { border-color: var(--accent); color: var(--text); }
.drop input { display: none; }

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  margin-top: 8px;
}

button:disabled { opacity: 0.5; cursor: not-allowed; }
button:hover:not(:disabled) { filter: brightness(1.08); }

select, label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

select {
  width: 100%;
  margin-top: 4px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
}

.report {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel-2);
  border-radius: 6px;
  padding: 8px 10px;
  max-height: 160px;
  overflow-y: auto;
}

.report .error { color: var(--danger); }
.report .ok { color: var(--accent-2); }

progress {
  width: 100%;
  height: 6px;
  accent-color: var(--accent);
}

.history { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.history li {
  padding: 7px 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.history li:hover { background: var(--panel-2); color: var(--text); }
.history li .state { font-size: 10px; text-transform: uppercase; }

#stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#viewerHost {
  flex: 1;
  position: relative;
  background: #05060a;
}

#viewerPlaceholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  gap: 4px;
}

#stageStatus {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
