@font-face {
  font-family: InterLocal;
  src: url('/fonts/inter-latin.woff2') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: MarcellusLocal;
  src: url('/fonts/marcellus-latin.woff2') format('woff2');
  font-display: swap;
}

:root {
  font-family: InterLocal, Arial, sans-serif;
  color: #0b1f3a;
  background: #edf0f1;
  font-synthesis: none;
  --navy: #0b1f3a;
  --navy-light: #153050;
  --gold: #c6a063;
  --gold-light: #d9bc83;
  --paper: #fffdf8;
  --line: #d7dcdf;
  --muted: #667085;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
}

body:not(.legal-body) {
  background: #f6f7f9;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

button,
input {
  font: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(198, 160, 99, .5);
  outline-offset: 3px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.login-shell {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.login-panel {
  width: min(100%, 400px);
  padding: 32px;
  border: 1px solid #e3e7ec;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 8px 32px rgba(11, 31, 58, .04);
}

.login-header {
  display: grid;
  justify-items: center;
  gap: 16px;
}

.login-header img {
  display: block;
  border-radius: 10px;
}

.login-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.035em;
  text-align: center;
}

#login-form {
  display: grid;
  gap: 24px;
  margin-top: 32px;
}

#login-form fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

#login-form legend,
.password-field > span {
  display: block;
  margin-bottom: 8px;
  padding: 0;
  color: #344055;
  font-size: 13px;
  font-weight: 600;
}

.identity-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: #f1f3f6;
}

.identity-option {
  position: relative;
}

.identity-option span {
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #667085;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.identity-option input:checked + span {
  border-color: #e3e7ec;
  background: #fff;
  color: var(--navy);
  box-shadow: 0 1px 3px rgba(11, 31, 58, .06);
}

.identity-option input:focus-visible + span {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.password-field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #cbd2dc;
  border-radius: 10px;
  background: #fff;
  color: var(--navy);
  font-size: 16px;
}

.password-field input:focus {
  outline: 3px solid rgba(11, 31, 58, .09);
  outline-offset: 1px;
  border-color: #64748b;
}

.error {
  margin: -8px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fbefec;
  color: #8b493d;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#login-button {
  min-height: 48px;
  padding: 12px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

#login-button:hover {
  background: var(--navy-light);
}

#login-button:disabled {
  cursor: wait;
  opacity: .68;
}

.legal-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 24px;
}

.legal-links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
}

.legal-links a:hover {
  color: var(--navy);
  text-decoration: underline;
}

.ownership-card { margin: 18px 0 0; color: var(--muted); text-align: center; font-size: 10px; line-height: 1.6; }

/* Setup keeps its existing authentication markup and accessible form contract. */
.login-shell:has(#setup-form) { align-content: center; gap: 24px; }
.login-shell:has(#setup-form) .login-context { width: min(100%, 440px); text-align: center; }
.login-shell:has(#setup-form) .login-context h1 { margin: 12px 0; font-size: 26px; }
.login-shell:has(#setup-form) .login-context p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.login-shell:has(#setup-form) .brand-mark { display: grid; place-items: center; width: 40px; height: 40px; margin: auto; border-radius: 10px; background: var(--navy); color: var(--gold-light); font-family: Georgia, serif; }
#setup-form { display: grid; gap: 20px; }
#setup-message { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
#setup-button { min-height: 48px; padding: 12px 18px; border: 0; border-radius: 10px; background: var(--navy); color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
#setup-button:disabled { opacity: .68; cursor: wait; }

.eyebrow {
  display: block;
  margin-top: 48px;
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.legal-intro h1,
.legal-card h2 {
  font-family: MarcellusLocal, Georgia, serif;
  font-weight: 400;
}

.legal-owner span {
  color: var(--gold-light);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.legal-body {
  background: #f4f5f4;
  color: #17243a;
}

.legal-topbar {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.legal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--navy);
  text-decoration: none;
}

.legal-brand > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold);
  color: #7c5b24;
  font-family: MarcellusLocal, Georgia, serif;
  font-size: 19px;
}

.legal-brand strong {
  font-family: MarcellusLocal, Georgia, serif;
  font-size: 18px;
  font-weight: 400;
}

.back-link {
  color: #6f5325;
  font-size: 11px;
  font-weight: 800;
}

.legal-shell {
  width: min(1180px, calc(100% - 40px));
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  margin: 0 auto;
  padding: 48px 0 80px;
}

.legal-intro {
  position: sticky;
  top: 24px;
  padding: 34px;
  background: var(--navy);
  color: #fff;
}

.legal-intro .eyebrow {
  margin: 0 0 18px;
}

.legal-intro h1 {
  margin: 0 0 18px;
  color: #fff;
  font-size: clamp(35px, 3.7vw, 48px);
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.legal-intro > p {
  margin: 0;
  color: #c3ccd7;
  font-size: 13px;
  line-height: 1.7;
}

.legal-owner {
  display: grid;
  gap: 5px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, .16);
}

.legal-owner strong {
  color: #fff;
  font-family: MarcellusLocal, Georgia, serif;
  font-size: 24px;
  font-weight: 400;
}

.legal-card {
  padding: clamp(28px, 5vw, 54px);
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 24px 60px rgba(11, 31, 58, .07);
}

.legal-card section {
  padding: 0 0 28px;
  margin: 0 0 28px;
  border-bottom: 1px solid #e3e5e6;
}

.legal-card section:last-of-type {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.legal-card h2 {
  margin: 0 0 12px;
  color: var(--navy);
  font-size: 23px;
}

.legal-card p,
.legal-card li {
  color: #4d5968;
  font-size: 13px;
  line-height: 1.75;
}

.legal-card p {
  margin: 0 0 12px;
}

.legal-card p:last-child {
  margin-bottom: 0;
}

.legal-card a {
  color: #6f5325;
  font-weight: 700;
}

.legal-card code {
  padding: 2px 5px;
  background: #eef0ef;
  color: var(--navy);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .92em;
}

.legal-page-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.legal-page-links a {
  color: #6f5325;
  font-size: 11px;
  font-weight: 800;
}

@media (max-width: 820px) {
  .legal-shell {
    grid-template-columns: 1fr;
    padding-top: 24px;
  }

  .legal-intro {
    position: static;
  }
}

@media (max-width: 460px) {
  .login-panel {
    padding: 28px 24px;
  }

  .legal-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .legal-shell {
    width: min(100% - 24px, 1180px);
    padding-bottom: 48px;
  }

  .legal-intro,
  .legal-card {
    padding: 24px;
  }

  .legal-intro h1 {
    font-size: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
