:root {
  --ink: #171717;
  --muted: #6f6a62;
  --paper: #fffdf9;
  --cream: #f8f3ea;
  --gold: #b98322;
  --gold-deep: #956719;
  --gold-light: #dfbe7a;
  --line: rgba(149, 103, 25, 0.30);
  --shadow: 0 28px 75px rgba(39, 29, 14, 0.18);
  --radius: 20px;
  --blue: #2f61a5;
  --red: #b33d34;
  --green: #2f8b58;
  --brown: #795233;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; }

.skip-link {
  position: fixed;
  z-index: 999;
  left: 16px;
  top: 12px;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 10px;
  background: #111;
  color: #fff;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

.portal-header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(20px, 4vw, 64px);
  background: rgba(255,255,255,0.96);
  border-bottom: 1px solid rgba(149,103,25,.18);
  position: relative;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}
.brand img { width: 62px; height: 62px; object-fit: contain; }
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(19px, 1.7vw, 25px);
  letter-spacing: .04em;
}
.brand-copy small {
  color: var(--gold-deep);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
}

.header-actions { display: flex; align-items: center; gap: 18px; }
.secure-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.back-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 15px;
  color: var(--gold-deep);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: .2s ease;
}
.back-link:hover { background: #fff7e8; transform: translateY(-1px); }

.portal-hero {
  position: relative;
  isolation: isolate;
  min-height: 820px;
  padding: 44px 20px 36px;
  display: grid;
  place-items: center;
  background:
    url("assets/people-background.jpg") center 44% / cover no-repeat,
    linear-gradient(180deg, #f8f3ea, #fff);
  overflow: hidden;
}
.portal-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(252,248,240,.20), rgba(255,255,255,.42) 27%, rgba(255,255,255,.46) 50%, rgba(255,255,255,.42) 73%, rgba(252,248,240,.20)),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(249,241,228,.20));
}
.portal-hero::before,
.portal-hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border: 1px solid rgba(185,131,34,.18);
  border-radius: 50%;
  width: min(88vw, 1320px);
  height: 760px;
  top: -390px;
  left: 50%;
  transform: translateX(-50%);
  z-index: -1;
}
.portal-hero::after {
  width: min(80vw, 1200px);
  top: -350px;
  opacity: .65;
}

.portal-shell {
  width: min(100%, 700px);
  display: grid;
  gap: 14px;
  align-items: start;
}

.portal-card,
.explore-card {
  background: rgba(255, 253, 249, .965);
  border: 1px solid rgba(116, 84, 34, .20);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.portal-card {
  border-radius: var(--radius);
  padding: clamp(28px, 4vw, 46px) clamp(24px, 5vw, 52px) 34px;
}
.portal-identity { text-align: center; }
.portal-logo {
  width: 108px;
  height: 108px;
  object-fit: contain;
  margin: -8px auto 0;
}
.eyebrow {
  margin: 6px 0 4px;
  color: var(--gold-deep);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .19em;
}
.portal-identity h1 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: clamp(34px, 5vw, 50px);
  line-height: .96;
  letter-spacing: -.02em;
}
.portal-identity h1 span {
  display: inline-block;
  margin-top: 4px;
  font-weight: 700;
}
.intro {
  max-width: 470px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.rule {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 11px;
  margin: 22px 0 18px;
  color: var(--gold);
}
.rule span { height: 1px; background: linear-gradient(90deg, transparent, var(--gold-light)); }
.rule span:last-child { background: linear-gradient(90deg, var(--gold-light), transparent); }
.rule i { font-size: 9px; font-style: normal; }

.login-form h2 {
  margin: 0 0 16px;
  text-align: center;
  color: var(--gold-deep);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: .11em;
}
.login-form > label {
  display: block;
  margin: 13px 0 7px;
  color: #35312b;
  font-size: 12px;
  font-weight: 700;
}
.input-wrap {
  min-height: 52px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid #d7d1c8;
  border-radius: 9px;
  background: rgba(255,255,255,.94);
  color: #8e887e;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.input-wrap:focus-within {
  border-color: rgba(185,131,34,.72);
  box-shadow: 0 0 0 4px rgba(185,131,34,.10);
  background: #fff;
}
.input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}
.input-wrap input::placeholder { color: #aaa49b; }
.password-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-right: -6px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8e887e;
  cursor: pointer;
}
.password-toggle:hover { background: #f7f2e8; color: var(--gold-deep); }

.form-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 13px 0 16px;
  font-size: 12px;
}
.remember { display: inline-flex; align-items: center; gap: 7px; color: #4f4b45; }
.remember input { accent-color: var(--gold); }
.form-meta a { color: var(--gold-deep); text-underline-offset: 3px; }

.primary-button,
.secondary-button,
.explore-link {
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.primary-button {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #a9751c, #d2a440 54%, #b67f1d);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  box-shadow: 0 12px 28px rgba(160,113,29,.18);
  cursor: pointer;
}
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 15px 32px rgba(160,113,29,.24); }
.primary-button:focus-visible,
.secondary-button:focus-visible,
.explore-link:focus-visible,
.back-link:focus-visible { outline: 3px solid rgba(185,131,34,.32); outline-offset: 3px; }

.form-status {
  min-height: 18px;
  margin: 10px 0 0;
  text-align: center;
  color: #72561f;
  font-size: 12px;
  line-height: 1.45;
}
.form-status.error { color: #9a342e; }

.new-user { margin-top: 8px; }
.new-user-label {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 15px 0 12px;
}
.new-user-label span { height: 1px; background: linear-gradient(90deg, transparent, var(--line)); }
.new-user-label span:last-child { background: linear-gradient(90deg, var(--line), transparent); }
.new-user-label b { font-family: "Cormorant Garamond", Georgia, serif; font-size: 16px; }
.secondary-button {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(185,131,34,.70);
  border-radius: 8px;
  background: #fff;
  color: var(--gold-deep);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  text-decoration: none;
  text-transform: uppercase;
}
.secondary-button:hover { background: #fff8eb; transform: translateY(-1px); }

.explore-card {
  border-radius: 15px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 17px 18px;
}
.explore-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--gold);
  background: #fff7e8;
  border: 1px solid rgba(185,131,34,.22);
}
.explore-copy { display: grid; gap: 4px; }
.explore-copy strong { font-family: "Cormorant Garamond", Georgia, serif; font-size: 19px; }
.explore-copy span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.explore-link {
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  color: var(--gold-deep);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.explore-link:hover { background: #fff8eb; transform: translateY(-1px); }
.explore-link span { margin-left: 5px; }

.role-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 0 clamp(20px, 5vw, 76px);
  border-top: 1px solid rgba(149,103,25,.18);
  border-bottom: 1px solid rgba(149,103,25,.18);
  background: #fffdfa;
}
.role {
  min-height: 94px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 16px;
  position: relative;
}
.role + .role::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22px;
  bottom: 22px;
  width: 1px;
  background: #eee7dc;
}
.role-dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 5px currentColor; opacity: .72; }
.role div { display: grid; gap: 3px; }
.role strong { font-size: 11px; letter-spacing: .08em; }
.role small { color: var(--muted); font-size: 11px; }
.role-blue { color: var(--blue); }
.role-red { color: var(--red); }
.role-green { color: var(--green); }
.role-brown { color: var(--brown); }
.role small { color: #756f67; }

.portal-footer {
  min-height: 120px;
  display: grid;
  grid-template-columns: 1.2fr auto auto;
  align-items: center;
  gap: 28px;
  padding: 24px clamp(20px, 5vw, 76px);
  background: #fff;
}
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand img { width: 54px; height: 54px; object-fit: contain; }
.footer-brand div { display: grid; gap: 3px; }
.footer-brand strong { font-family: "Cormorant Garamond", Georgia, serif; font-size: 18px; }
.footer-brand small { color: var(--muted); font-size: 10px; letter-spacing: .04em; }
.portal-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.portal-footer nav a { color: #4b4741; font-size: 11px; text-decoration: none; }
.portal-footer nav a:hover { color: var(--gold-deep); }
.portal-footer p { margin: 0; color: #878178; font-size: 10px; text-align: right; }

@media (max-width: 820px) {
  .secure-label { display: none; }
  .portal-header { min-height: 78px; }
  .brand img { width: 52px; height: 52px; }
  .brand-copy strong { font-size: 18px; }
  .brand-copy small { font-size: 8px; }
  .portal-hero { min-height: 760px; padding-top: 28px; background-position: center top; }
  .portal-overlay { background: rgba(255, 250, 242, .47); }
  .explore-card { grid-template-columns: auto 1fr; }
  .explore-link { grid-column: 1 / -1; text-align: center; }
  .role-strip { grid-template-columns: repeat(2, 1fr); padding: 0; }
  .role:nth-child(3)::before { display: none; }
  .role:nth-child(n+3) { border-top: 1px solid #eee7dc; }
  .portal-footer { grid-template-columns: 1fr; text-align: center; }
  .footer-brand { justify-content: center; }
  .portal-footer p { text-align: center; }
}

@media (max-width: 540px) {
  .portal-header { padding: 10px 14px; }
  .brand-copy { display: none; }
  .back-link { padding: 9px 12px; font-size: 11px; }
  .portal-hero { padding: 22px 12px 26px; }
  .portal-card { padding: 24px 18px 25px; border-radius: 16px; }
  .portal-logo { width: 86px; height: 86px; }
  .portal-identity h1 { font-size: 36px; }
  .intro { font-size: 13px; }
  .form-meta { align-items: flex-start; }
  .explore-card { padding: 14px; }
  .role { min-height: 84px; padding: 13px 9px; }
  .role-dot { width: 9px; height: 9px; box-shadow: 0 0 0 4px currentColor; }
  .role small { font-size: 9px; }
  .role strong { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Demo-access additions */
.demo-mode {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 14px auto 0;
  padding: 7px 11px;
  border: 1px solid rgba(160, 119, 36, .25);
  border-radius: 999px;
  background: rgba(255, 250, 239, .86);
  color: #6a5c46;
  font-size: 11px;
  line-height: 1.2;
}

.demo-mode span {
  color: #8d651e;
  font-weight: 800;
  letter-spacing: .09em;
}

.resume-session {
  margin: 2px 0 18px;
  padding: 12px 14px;
  border: 1px solid #d8c5a1;
  border-radius: 12px;
  background: #fffaf0;
  text-align: center;
  font-size: 12px;
  color: #665843;
}

.resume-session span {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
  color: #25221d;
}

.resume-session a {
  color: #8c641b;
  font-weight: 700;
  text-decoration: none;
}

.form-status.success {
  color: #29613e;
}
