* { box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  padding: 2rem;
  background: #0f1419;
  color: #e6edf3;
}

/* Stack everything vertically so the auth form never shares a row with header buttons */
.page {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
}

/* Row 1: titles (left) + Log in / Sign up (right) */
.top-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto;
  gap: 0.75rem 1.25rem;
  align-items: start;
  width: 100%;
  margin-bottom: 1rem;
}

.header-titles {
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
}

.header-actions {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: start;
}

.site-title-primary {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.site-title-sub {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  font-weight: 500;
  color: #8b949e;
  letter-spacing: 0.02em;
}

.auth-buttons {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
}

.logged-in-cluster {
  gap: 0.75rem;
}

.link-pill {
  font-size: 0.8125rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #21262d;
  border: 1px solid #30363d;
  color: #8b949e;
}

/* Row 2: full-width slot for login form only (below top-bar) */
.auth-panel-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  min-height: 0;
}

.auth-panel.card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 22rem;
}

.field-label {
  display: block;
  width: 100%;
  font-size: 0.8125rem;
  color: #8b949e;
  margin: 0.75rem 0 0.35rem;
}
.field-label:first-of-type {
  margin-top: 0;
}

.field-input {
  display: block;
  width: 100%;
  max-width: 100%;
  flex: 0 0 auto;
}

.auth-panel-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.card {
  padding: 1.25rem;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
}

.input {
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid #30363d;
  background: #0d1117;
  color: #e6edf3;
  font-size: 1rem;
}

.input-grow {
  flex: 1;
  min-width: 0;
}

.title { margin-top: 0; }

.btn {
  margin: 0;
  padding: 0.5rem 0.75rem;
  background: #238636;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
}
.btn:hover { filter: brightness(1.08); }

.btn-ghost {
  background: transparent;
  color: #e6edf3;
  border: 1px solid #30363d;
}
.btn-ghost:hover {
  background: #21262d;
  filter: none;
}

.main {
  width: 100%;
  margin-top: 0.25rem;
}

.hint {
  color: #8b949e;
  line-height: 1.5;
  margin: 0;
}

.profile h2 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
}

.field-hint {
  font-size: 0.875rem;
  color: #8b949e;
  margin: 0 0 1rem;
}

.name-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.status {
  margin-top: 1rem;
  padding: 1rem;
  background: #161b22;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 36rem) {
  .top-bar {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }
  .header-titles {
    grid-column: 1;
    grid-row: 1;
  }
  .header-actions {
    grid-column: 1;
    grid-row: 2;
    justify-self: end;
  }
  .auth-panel.card {
    max-width: none;
  }
}
