:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1d2430;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --danger-bg: #fff4f2;
  --success: #067647;
  --success-bg: #ecfdf3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(840px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 28px;
  box-shadow: 0 14px 32px rgb(30 41 59 / 8%);
}

.auth-panel {
  width: min(420px, 100%);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: 0;
}

.stack {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.upload-stack {
  margin-top: 0;
}

.guide {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 16px;
  padding: 18px 20px;
}

.guide h2 {
  font-size: 18px;
  margin: 0 0 10px;
}

.guide ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-weight: 700;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
}

textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  line-height: 1.45;
  padding: 10px 12px;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 10px 16px;
}

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

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

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.secondary:hover {
  background: #f1f5f9;
}

.alert,
.success {
  border-radius: 6px;
  margin: 0 0 18px;
  padding: 12px 14px;
}

.alert {
  border: 1px solid #fecdca;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 700;
}

.success {
  display: grid;
  gap: 5px;
  border: 1px solid #abefc6;
  background: var(--success-bg);
  color: var(--success);
}

.success a {
  color: var(--success);
  font-weight: 800;
}

.muted {
  margin: 0;
  color: var(--muted);
}

.section-heading {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.history-panel {
  margin-top: 16px;
}

.preview-panel {
  margin-top: 16px;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preview-status {
  margin-bottom: 14px;
}

.status-chip {
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  padding: 6px 10px;
  white-space: nowrap;
}

.status-ready {
  background: var(--success-bg);
  color: var(--success);
}

.status-pending,
.status-building,
.status-queued,
.status-unknown {
  background: #fffaeb;
  color: #b54708;
}

.status-failed,
.status-error,
.status-unavailable {
  background: var(--danger-bg);
  color: var(--danger);
}

.button-link {
  align-items: center;
  border-radius: 6px;
  display: inline-flex;
  font-weight: 800;
  min-height: 44px;
  padding: 10px 16px;
  text-decoration: none;
}

.secondary-link {
  border: 1px solid var(--line);
  color: var(--text);
}

.secondary-link:hover {
  background: #f1f5f9;
}

.disabled-link {
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.65;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.history-item strong,
.history-item span {
  display: block;
}

.history-item strong {
  overflow-wrap: anywhere;
}

.history-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.icon-link {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  display: inline-flex;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  height: 36px;
  justify-content: center;
  min-width: 42px;
  padding: 0 10px;
}

.icon-link:hover {
  background: #f1f5f9;
}

.history-actions form {
  margin: 0;
}

.history-actions button {
  min-height: 36px;
}

.current-badge {
  border-radius: 999px;
  background: #eef4ff;
  color: #3538cd;
  font-size: 13px;
  font-weight: 800;
  margin: 0;
  padding: 6px 10px;
}

.progress-wrap {
  display: grid;
  gap: 8px;
}

.progress-wrap strong {
  color: var(--muted);
  font-size: 13px;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e7ec;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 150ms ease;
}

@media (max-width: 720px) {
  .shell {
    padding: 28px 0;
  }

  .topbar,
  .history-item {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .history-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}
