:root {
  --accent: #D97757;
  --accent-dark: #b5583b;
  --bg: #faf7f5;
  --card-bg: #ffffff;
  --text: #2a2320;
  --text-muted: #6b6058;
  --border: #ece4de;
  --shadow: 0 10px 30px -12px rgba(60, 40, 20, 0.25);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1815;
    --card-bg: #262019;
    --text: #f2ece6;
    --text-muted: #b8ac9f;
    --border: #3a322b;
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }

body.portal {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, rgba(217, 119, 87, 0.16), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(217, 119, 87, 0.12), transparent 45%),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.portal-card {
  width: 100%;
  max-width: 26rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  padding: 2.25rem 2rem;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.portal-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.65rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  flex: none;
}

.portal-brand h1 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.portal-brand span {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.portal-card h2 {
  font-size: 1.4rem;
  margin: 0 0 0.35rem;
  letter-spacing: -0.01em;
}

.portal-card p.lede {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

.portal-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.1rem;
}

.portal-field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.portal-field input {
  font-size: 1rem;
  padding: 0.65rem 0.8rem;
  border-radius: 0.55rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.portal-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.25);
}

.portal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 0.6rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}

.portal-btn:hover {
  box-shadow: 0 6px 18px -6px rgba(217, 119, 87, 0.55);
  transform: translateY(-1px);
}

.portal-flash {
  background: rgba(217, 119, 87, 0.12);
  border: 1px solid rgba(217, 119, 87, 0.35);
  color: var(--text);
  border-radius: 0.55rem;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  margin-bottom: 1.1rem;
  list-style: none;
}

.portal-link-box {
  margin-top: 1.25rem;
  padding: 0.9rem 1rem;
  border-radius: 0.6rem;
  border: 1px dashed var(--border);
  background: var(--bg);
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}

.portal-note {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.75rem;
}

.portal-footer-link {
  display: block;
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
}

.portal-footer-link:hover {
  color: var(--accent);
}

.portal-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}

.portal-status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #9a9088;
}

.portal-status.is-active .portal-status-dot {
  background: #3fa06a;
  box-shadow: 0 0 0 3px rgba(63, 160, 106, 0.2);
}

.portal-status.is-active { color: #2f8557; }

.portal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.portal-btn-secondary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.portal-btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}
