:root {
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --border: #e3e8ee;
  --text: #0e2438;
  --muted: #6b7d92;
  --accent: #21c97e;
  --accent-hover: #1cb471;
  --navy: #0e2438;
  --success: #16a34a;
  --error: #dc2626;
  --warning: #d97706;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(14, 36, 56, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.logo {
  width: 150px;
  height: auto;
  display: block;
}

.header {
  margin-bottom: 1.75rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.badge.ready {
  color: var(--success);
  background: rgba(33, 201, 126, 0.1);
  border-color: rgba(33, 201, 126, 0.25);
}

.badge.ready .dot {
  background: var(--accent);
}

.badge.warn {
  color: var(--warning);
  background: rgba(217, 119, 6, 0.08);
  border-color: rgba(217, 119, 6, 0.2);
}

.badge.warn .dot {
  background: var(--warning);
}

h1 {
  margin: 0.85rem 0 0.35rem;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--navy);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.field {
  margin-bottom: 1.1rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 1rem;
}

label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(33, 201, 126, 0.15);
}

textarea {
  resize: vertical;
  min-height: 64px;
}

.hint {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.btn-primary {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.85rem 1.25rem;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.result-card h2,
.setup-card h2 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  color: var(--navy);
}

.result-message {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text);
}

.result-output {
  margin: 0.85rem 0 0;
  padding: 0.85rem;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--navy);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
}

.result-card {
  border-left: 4px solid var(--border);
}

.result-card.success {
  border-left-color: var(--success);
}

.result-card.success .result-message {
  color: var(--success);
}

.result-card.error {
  border-left-color: var(--error);
}

.result-card.error .result-message {
  color: var(--error);
}

.creds-card {
  border-left: 4px solid var(--warning);
}

.creds-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.creds-actions {
  display: flex;
  gap: 1rem;
  flex-shrink: 0;
}

.link-btn.danger {
  color: var(--error);
}

.creds-intro {
  margin: 0.4rem 0 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.creds-result {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
}

.creds-result.success {
  color: var(--success);
}

.creds-result.error {
  color: var(--error);
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-hover);
  cursor: pointer;
  text-decoration: underline;
}

.link-btn:hover {
  color: var(--navy);
}

.footer {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.hidden {
  display: none;
}

@media (max-width: 540px) {
  .field-row {
    grid-template-columns: 1fr;
  }

  .logo {
    width: 150px;
  }
}
