:root,
html[data-theme="light"] {
  --bg: #eef2f7;
  --bg-accent-a: rgba(215, 25, 32, 0.08);
  --bg-accent-b: rgba(29, 78, 216, 0.1);
  --bg-top: #f7f9fc;
  --card: #ffffff;
  --text: #121826;
  --muted: #5b677a;
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --accent: #d71920;
  --accent-dark: #b51218;
  --border: #d5dde8;
  --success: #15803d;
  --success-bg: #ecfdf3;
  --success-text: #166534;
  --error-bg: #fef2f2;
  --error-text: #991b1b;
  --shadow: 0 18px 40px rgba(18, 24, 38, 0.08);
  --input-bg: #ffffff;
  --chip-bg: #eef2f8;
  --status-bg: linear-gradient(180deg, #fbfcfe, #f4f7fb);
  --secondary-btn-bg: #e8eef8;
  --theme-switch-bg: #e8eef8;
  --theme-active-bg: #ffffff;
  --theme-active-text: #121826;
  --login-scrim: linear-gradient(135deg, rgba(15, 23, 42, 0.55), rgba(15, 23, 42, 0.35)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.28));
  --login-footer: rgba(255, 255, 255, 0.88);
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
  --font-display: "Barlow", "Source Sans 3", sans-serif;
}

html[data-theme="dark"] {
  --bg: #0f141c;
  --bg-accent-a: rgba(215, 25, 32, 0.16);
  --bg-accent-b: rgba(59, 130, 246, 0.12);
  --bg-top: #121820;
  --card: #1a222e;
  --text: #eef2f7;
  --muted: #9aa8bc;
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --accent: #ef3340;
  --accent-dark: #d71920;
  --border: #2c3645;
  --success: #4ade80;
  --success-bg: #10261a;
  --success-text: #86efac;
  --error-bg: #2a1518;
  --error-text: #fca5a5;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --input-bg: #121820;
  --chip-bg: #243041;
  --status-bg: linear-gradient(180deg, #1d2633, #171e29);
  --secondary-btn-bg: #243041;
  --theme-switch-bg: #121820;
  --theme-active-bg: #2a3545;
  --theme-active-text: #eef2f7;
  --login-scrim: linear-gradient(135deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.55)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.55));
  --login-footer: rgba(238, 242, 247, 0.82);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  min-height: 100vh;
  background: var(--bg);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.app-page {
  background:
    radial-gradient(circle at top right, var(--bg-accent-a), transparent 30%),
    radial-gradient(circle at top left, var(--bg-accent-b), transparent 28%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 50%);
}

.page {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
}

.header,
.footer,
.card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.header,
.footer {
  border-radius: 18px;
  padding: 0.85rem 1.15rem;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

.theme-switch {
  display: inline-flex;
  padding: 0.2rem;
  border-radius: 999px;
  background: var(--theme-switch-bg);
  border: 1px solid var(--border);
  gap: 0.15rem;
}

.theme-option {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
}

.theme-option.is-active {
  background: var(--theme-active-bg);
  color: var(--theme-active-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.theme-switch-floating {
  margin-bottom: 0.25rem;
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
}

.theme-switch-floating .theme-option {
  color: rgba(255, 255, 255, 0.75);
}

.theme-switch-floating .theme-option.is-active {
  background: rgba(255, 255, 255, 0.92);
  color: #121826;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
}

.brand-mark-wrap {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  overflow: hidden;
  border-radius: 10px;
  background: #000;
  display: block;
}

.brand-logo {
  width: 40px !important;
  height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  object-fit: cover;
  object-position: center;
  display: block;
}

.brand-text {
  min-width: 0;
}

.brand-eyebrow {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}

.brand-title {
  margin: 0.1rem 0 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.signout-link {
  flex: 0 0 auto;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

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

.card {
  border-radius: 24px;
  padding: 2rem;
}

.hero h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
}

.lede,
.help-text,
.footer p,
.policy-audience,
.status-note {
  color: var(--muted);
  line-height: 1.6;
}

.email-chip {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 0.92rem;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 1.25rem 0 0.25rem;
}

.status-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  background: var(--status-bg);
}

.status-label {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.status-value {
  margin: 0.4rem 0 0;
  font-weight: 600;
  line-height: 1.35;
}

.status-note {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
}

.form {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

label {
  font-weight: 600;
}

.field-hint {
  margin: -0.35rem 0 0.25rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.confirm-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.match-status {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  min-height: 1.2em;
}

.match-status.is-match {
  color: var(--success);
}

.match-status.is-mismatch {
  color: var(--error-text);
}

input {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  background: var(--input-bg);
  color: var(--text);
}

input:focus {
  outline: 2px solid rgba(215, 25, 32, 0.2);
  border-color: var(--accent);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.1rem;
  border-radius: 12px;
  border: 0;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button-full {
  width: 100%;
}

.button-primary {
  background: var(--accent);
  color: white;
}

.button-primary:hover {
  background: var(--accent-dark);
}

.button-secondary {
  background: var(--secondary-btn-bg);
  color: var(--text);
}

.link-muted {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

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

.policy-list {
  list-style: none;
  margin: 0.35rem 0 0.25rem;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.policy-list li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  transition: color 0.15s ease;
}

.policy-list li::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  border: 2px solid #c5cedb;
  flex-shrink: 0;
}

.policy-list li.is-met {
  color: var(--success);
  font-weight: 600;
}

.policy-list li.is-met::before {
  border-color: var(--success);
  background: var(--success);
  box-shadow: inset 0 0 0 2px #fff;
}

.policy-list li.is-unmet {
  color: var(--error-text);
}

.policy-list li.is-unmet::before {
  border-color: var(--error-text);
}

.policy-audience {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
}

.alert {
  border-radius: 14px;
  padding: 1rem 1.1rem;
  margin: 1.25rem 0;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.alert-error {
  background: var(--error-bg);
  color: var(--error-text);
}

.alert ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.footer {
  margin-top: 1rem;
}

.footer p {
  margin: 0.35rem 0;
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .page {
    width: min(100%, calc(100% - 1rem));
    padding-top: 1rem;
  }

  .card {
    padding: 1.25rem;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .confirm-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .header {
    flex-wrap: wrap;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* ── Login page ─────────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  background: #0f172a;
  color: #f8fafc;
  font-family: var(--font-body);
}

.login-backdrop {
  position: fixed;
  inset: 0;
  background:
    url("/static/images/login-bg.png") center center / cover no-repeat;
  transform: scale(1.02);
}

.login-scrim {
  position: fixed;
  inset: 0;
  background: var(--login-scrim);
}

.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 1.25rem;
  padding: 2rem 1rem 2.5rem;
}

.login-card {
  width: min(460px, 100%);
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.login-brand {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 2rem 1.5rem 1.5rem;
  background: #000;
}

.login-logo {
  width: min(220px, 72vw);
  height: auto;
  display: block;
}

.login-eyebrow {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.72);
}

.login-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.login-content {
  padding: 1.75rem 1.75rem 2rem;
  background: var(--card);
  color: var(--text);
}

.login-content h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.25;
}

.login-lede,
.login-help {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.login-lede {
  margin-bottom: 1.5rem;
}

.login-help {
  margin-top: 1rem;
  font-size: 0.95rem;
  text-align: center;
}

.login-button.button-primary {
  background: var(--accent);
}

.login-button.button-primary:hover {
  background: var(--accent-dark);
}

.login-footer {
  width: min(460px, 100%);
  text-align: center;
}

.login-footer p {
  margin: 0.35rem 0;
  color: var(--login-footer);
  line-height: 1.5;
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .login-shell {
    padding-top: 1rem;
  }

  .login-brand {
    padding: 1.5rem 1rem 1.25rem;
  }

  .login-content {
    padding: 1.25rem;
  }

  .login-title {
    font-size: 1.7rem;
  }
}
