:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #52606d;
  --border: #d9e2ec;
  --accent: #0b6e4f;
  --accent-2: #147a57;
  --danger: #9b1c1c;
  --warn: #8a6d1b;
  --ok: #05603a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: #102a43;
  color: #fff;
}
.topbar a { color: #fff; }
.topbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.9rem;
}
.topbar nav { display: flex; flex-wrap: wrap; gap: 0.9rem; }
.brand { font-weight: 700; letter-spacing: 0.02em; }
.brand a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
}
.brand a:hover { text-decoration: none; }
.brand-logo {
  display: block;
  height: 1.75rem;
  width: auto;
  border-radius: 3px;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.9rem;
}
.lang-switch label {
  margin: 0;
  font-weight: 500;
  color: #d9e2ec;
  white-space: nowrap;
}
.lang-switch select {
  display: inline-block;
  width: auto;
  min-width: 8.5rem;
  margin: 0;
  padding: 0.3rem 0.45rem;
  border: 1px solid #486581;
  border-radius: 6px;
  background: #243b53;
  color: #fff;
  font: inherit;
}

.container {
  max-width: 980px;
  margin: 1.25rem auto;
  padding: 0 1rem 2rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(16, 42, 67, 0.04);
}
.card.narrow { max-width: 480px; }
.card.narrow-wide { max-width: 640px; }
textarea {
  resize: vertical;
}
textarea.mono, .config-block, pre.config-block {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.config-block {
  background: #f0f4f8;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  overflow: auto;
  max-height: 22rem;
}
.copy-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.wizard-step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  margin-right: 0.35rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  flex-shrink: 0;
}
details.wizard-step > summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  cursor: pointer;
  list-style: none;
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}
details.wizard-step > summary::-webkit-details-marker { display: none; }
details.wizard-step > summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 0.85em;
  width: 0.9rem;
}
details.wizard-step[open] > summary::before { content: "▾"; }
details.wizard-step > summary .step-title { flex: 1 1 auto; }
.wizard-step-body { margin-top: 0.85rem; }
.step-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  vertical-align: middle;
}
.step-badge.done { background: #d8f3dc; color: #1b4332; }
.step-badge.todo { background: #fff3cd; color: #664d03; }
.step-badge.muted-badge { background: #e9ecef; color: #495057; }
.meta .step-badge { margin-right: 0.35rem; margin-bottom: 0.25rem; }
.stack-form { margin-top: 1rem; max-width: 28rem; }
.file-list {
  columns: 2;
  gap: 1rem;
  margin: 0.5rem 0 1rem;
  padding-left: 1.2rem;
}
@media (max-width: 640px) {
  .file-list { columns: 1; }
}
.secret-value { word-break: break-all; }
.inline-filter { margin-bottom: 1rem; }
.inline-filter label { font-weight: 600; }
.inline-filter select { display: inline-block; width: auto; min-width: 16rem; margin-left: 0.5rem; }
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
h1, h2 { margin-top: 0; }
.muted, .hint { color: var(--muted); font-size: 0.92rem; display: block; margin-top: 0.25rem; }

form label { display: block; margin-bottom: 0.85rem; font-weight: 600; }
form input[type="text"],
form input[type="password"],
form input[type="number"],
form select,
form textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}
label.checkbox { font-weight: 500; }
label.checkbox input { width: auto; display: inline; margin-right: 0.4rem; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  border: none;
  border-radius: 6px;
  padding: 0.55rem 0.95rem;
  font: inherit;
  cursor: pointer;
  text-decoration: none !important;
}
.btn:hover { background: var(--accent-2); }
.btn.secondary { background: #334e68; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #7f1d1d; }

form.inline { display: inline; margin: 0; }
.actions { white-space: nowrap; }
.actions a, .actions form { margin-right: 0.65rem; }
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.danger-zone { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

.flashes { list-style: none; padding: 0; }
.flash {
  padding: 0.7rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 0.7rem;
  border: 1px solid var(--border);
  background: #fff;
}
.flash-danger { border-color: #f5c2c2; background: #fff5f5; color: var(--danger); }
.flash-danger .ssh-fix-cmd {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.2rem 0.45rem;
  font-weight: 700;
  color: #b91c1c;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 4px;
}
.flash-warning { border-color: #f0e2a8; background: #fffbeb; color: var(--warn); }
.flash-success { border-color: #b7e4c7; background: #f0fff4; color: var(--ok); }
.flash-info { border-color: #bfdbfe; background: #eff6ff; }

.status {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.85rem;
  background: #e4e7eb;
}
.status-succeeded { background: #d3f9d8; color: var(--ok); }
.status-failed { background: #ffe3e3; color: var(--danger); }
.status-running, .status-queued { background: #e7f5ff; color: #1864ab; }

.meta { display: grid; grid-template-columns: 12rem 1fr; gap: 0.4rem 0.8rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.error {
  background: #fff5f5;
  border: 1px solid #f5c2c2;
  padding: 0.75rem;
  overflow: auto;
}
.field-error {
  display: block;
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}
code { background: #f0f4f8; padding: 0.1rem 0.3rem; border-radius: 4px; }

.generate-wait {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(16, 42, 67, 0.55);
}
.generate-wait[hidden] { display: none; }
.generate-wait-panel {
  max-width: 26rem;
  width: 100%;
  padding: 1.5rem 1.35rem;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  text-align: center;
  box-shadow: 0 12px 40px rgba(16, 42, 67, 0.25);
}
.generate-wait-title {
  margin: 0.9rem 0 0.35rem;
  font-weight: 600;
  font-size: 1.05rem;
}
.spinner {
  width: 2.25rem;
  height: 2.25rem;
  margin: 0 auto;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.site-setup-probe-wait[hidden] { display: none; }
.site-setup-probe-panel {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.site-setup-probe-panel .spinner {
  margin: 0.15rem 0 0;
  flex: 0 0 auto;
}
.site-setup-probe-copy { flex: 1 1 auto; min-width: 0; }
.site-setup-probe-copy .generate-wait-title {
  margin: 0 0 0.25rem;
  text-align: left;
}
.site-setup-probe-copy .muted { margin-top: 0; }
.site-setup-progress {
  margin: 0.85rem 0 0.35rem;
  max-width: 22rem;
  height: 0.45rem;
  border-radius: 999px;
  background: #e4e7eb;
  overflow: hidden;
}
.site-setup-progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}
.site-setup-progress-count {
  margin: 0;
  font-size: 0.85rem;
}

