:root {
  color-scheme: dark;
  --night: #020b17;
  --night-deep: #010711;
  --panel: rgba(4, 18, 33, .96);
  --panel-soft: rgba(9, 29, 47, .9);
  --paper: #f7fbff;
  --body: #c1d0dc;
  --muted: #91a7b8;
  --blue: #338bc5;
  --blue-bright: #49a7e2;
  --blue-deep: #166aa5;
  --gold: #b78932;
  --gold-soft: #d6b66c;
  --mint: #5bd39d;
  --risk: #ffb2b2;
  --line: rgba(159, 187, 207, .3);
  --line-strong: rgba(204, 174, 105, .68);
  --font-display: "Science Gothic", "Arial Narrow", sans-serif;
  --font-body: "Manrope", Arial, sans-serif;
  --font-mono: "DM Mono", Consolas, monospace;
  --console-width: 800px;
  --focus: 0 0 0 3px rgba(73, 167, 226, .34);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--night-deep);
  scrollbar-color: var(--blue-deep) var(--night-deep);
  scrollbar-width: auto;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--night-deep);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body::-webkit-scrollbar { width: 14px; }
body::-webkit-scrollbar-track { background: var(--night-deep); }
body::-webkit-scrollbar-thumb { border: 3px solid var(--night-deep); border-radius: 8px; background: var(--blue-deep); }

::selection { background: rgba(51, 139, 197, .38); color: #fff; }

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 50;
  top: 12px;
  left: 12px;
  padding: 12px 16px;
  transform: translateY(-150%);
  border-radius: 4px;
  background: var(--paper);
  color: var(--night);
  font-weight: 600;
  text-decoration: none;
  transition: transform 180ms ease;
}

.skip-link:focus { transform: translateY(0); }

.auth-stage {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, rgba(21, 87, 135, .19), transparent 43%),
    linear-gradient(180deg, #020914 0%, #020b17 56%, #010711 100%);
}

.auth-stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 7% 12%, rgba(134, 189, 226, .45) 0 1px, transparent 1.4px),
    radial-gradient(circle at 78% 8%, rgba(255, 255, 255, .38) 0 1px, transparent 1.4px),
    radial-gradient(circle at 90% 25%, rgba(183, 137, 50, .35) 0 1px, transparent 1.5px);
  background-size: 190px 170px, 260px 230px, 310px 280px;
  opacity: .4;
}

.earth-field {
  position: absolute;
  z-index: -2;
  inset: 0 0 auto;
  height: min(61vh, 590px);
  min-height: 470px;
  overflow: hidden;
  transform: translate3d(var(--earth-x, 0), var(--earth-y, 0), 0);
  transition: transform 900ms cubic-bezier(.18, .84, .24, 1);
  will-change: transform;
}

.earth-media {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 53%;
  filter: saturate(.72) contrast(.96) brightness(.74);
}

.earth-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(1, 7, 17, .24), transparent 18%, transparent 82%, rgba(1, 7, 17, .24)),
    linear-gradient(180deg, rgba(1, 7, 17, .1) 0%, transparent 56%, var(--night) 100%);
  pointer-events: none;
}

.return-link {
  position: absolute;
  z-index: 5;
  top: 28px;
  right: clamp(24px, 3.7vw, 58px);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 13px;
  padding: 0 17px;
  border: 1px solid rgba(183, 137, 50, .78);
  border-radius: 4px;
  background: rgba(2, 11, 23, .64);
  color: var(--gold-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .08em;
  text-decoration: none;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
  transition: color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.return-link svg { width: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.return-link:hover { transform: translateY(-2px); background: rgba(183, 137, 50, .12); color: #f4d88f; }
.return-link:focus-visible { outline: none; box-shadow: var(--focus); }

.auth-console {
  position: relative;
  z-index: 2;
  width: min(var(--console-width), 100%);
  padding: 24px 42px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(14, 38, 58, .4), transparent 34%),
    var(--panel);
  backdrop-filter: blur(18px) saturate(120%);
  transform: translate3d(var(--panel-x, 0), var(--panel-y, 0), 0);
  transition: transform 600ms cubic-bezier(.18, .84, .24, 1);
  will-change: transform;
}

.auth-console::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(100deg, rgba(82, 171, 226, .07), transparent 38%, rgba(183, 137, 50, .045));
}


.console-header, .console-footer { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 28px; }

.brand { display: inline-flex; align-items: center; gap: 13px; color: var(--paper); text-decoration: none; }
.brand:focus-visible { outline: none; border-radius: 4px; box-shadow: var(--focus); }
.brand-mark { width: 50px; height: 50px; display: grid; place-items: center; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: contain; }
.brand-name { font-size: 31px; font-weight: 500; letter-spacing: .08em; }

.portal-state {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--gold-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.console-intro { position: relative; z-index: 1; margin-top: 18px; }
.console-intro h1 {
  margin: 0;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 38px;
  font-stretch: expanded;
  font-variation-settings: "wdth" 100, "wght" 300;
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: .17em;
  text-transform: uppercase;
}
.console-intro p { max-width: 680px; margin: 8px 0 0; color: var(--body); font-size: 14px; line-height: 1.58; }

.login-form { position: relative; z-index: 1; margin-top: 14px; }
.field-group + .field-group { margin-top: 12px; }
.field-group label {
  display: block;
  margin-bottom: 5px;
  color: #a9bccb;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.input-shell {
  position: relative;
  min-height: 54px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(2, 11, 23, .58);
  transition: border-color 170ms ease, background-color 170ms ease, box-shadow 170ms ease;
}
.input-shell > svg { width: 20px; height: 20px; margin-left: 16px; flex: 0 0 auto; fill: none; stroke: #90a7b8; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.45; }
.input-shell:focus-within { border-color: var(--blue-bright); background: rgba(5, 22, 39, .84); box-shadow: var(--focus); }
.input-shell.has-error { border-color: #c96666; }
.input-shell input {
  width: 100%; min-width: 0; height: 52px; padding: 0 16px 0 13px; border: 0; outline: 0; background: transparent; color: var(--paper); caret-color: var(--blue-bright); font-size: 16px;
}
.input-shell input::placeholder { color: #8da4b5; opacity: 1; }
.input-shell input:-webkit-autofill { -webkit-text-fill-color: var(--paper); -webkit-box-shadow: 0 0 0 1000px #061729 inset; transition: background-color 9999s ease-out; }

.visibility-toggle {
  width: 48px; height: 48px; margin-right: 4px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 4px; background: transparent; color: #9cb0bf; cursor: pointer;
}
.visibility-toggle svg { grid-area: 1 / 1; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.45; }
.visibility-toggle .eye-closed { display: none; }
.visibility-toggle[aria-pressed="true"] .eye-open { display: none; }
.visibility-toggle[aria-pressed="true"] .eye-closed { display: block; }
.visibility-toggle:hover { color: var(--paper); background: rgba(255, 255, 255, .05); }
.visibility-toggle:focus-visible { outline: none; box-shadow: var(--focus); }

.field-error { min-height: 0; margin: 0; color: var(--risk); font-size: 13px; line-height: 1.45; }
.field-error:not(:empty) { margin-top: 7px; }

.form-actions { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 30px; align-items: start; margin-top: 12px; }
.text-link, .request-link {
  color: var(--blue-bright);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  text-underline-offset: 4px;
  text-transform: uppercase;
}
.text-link { min-height: 44px; display: inline-flex; align-items: center; justify-self: start; padding: 0; border: 0; background: transparent; cursor: pointer; text-decoration: underline; }
.text-link:hover, .request-link:hover { color: #8ed1fa; }
.text-link:focus-visible, .request-link:focus-visible { outline: none; border-radius: 2px; box-shadow: var(--focus); }

.primary-action { display: grid; justify-items: stretch; }
.login-button {
  position: relative;
  min-height: 54px;
  overflow: hidden;
  border: 1px solid var(--blue-bright);
  border-radius: 4px;
  background: #237fbd;
  color: #fff;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  box-shadow: 0 16px 34px rgba(10, 79, 127, .24);
  transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.login-button:hover { transform: translateY(-2px); background: #2e92d2; box-shadow: 0 20px 44px rgba(10, 79, 127, .33); }
.login-button:active { transform: translateY(0); }
.login-button:focus-visible { outline: none; box-shadow: var(--focus), 0 20px 44px rgba(10, 79, 127, .33); }
.login-button:disabled { cursor: wait; opacity: .72; transform: none; }

.access-rule { display: grid; grid-template-columns: 1fr auto 1fr; gap: 9px; align-items: center; margin: 14px 0 9px; }
.access-rule span { height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.access-rule span:last-child { background: linear-gradient(90deg, var(--gold), transparent); }
.access-rule i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold-soft); }
.request-link { justify-self: center; color: var(--gold-soft); }

.form-status { margin: 18px 0 0; padding: 11px 13px; border: 1px solid rgba(255, 178, 178, .32); border-radius: 4px; background: rgba(141, 50, 50, .12); color: #ffd1d1; font-size: 13px; line-height: 1.55; }

.console-footer { margin-top: 14px; padding-top: 13px; border-top: 1px solid rgba(159, 187, 207, .15); }
.console-footer p { margin: 0; color: var(--body); font-size: 13px; line-height: 1.5; }

/* The route to the synthetic dashboard. An outline button rather than a filled
   one, so it is unmistakably a control without competing with LOGIN, and it
   carries a caption naming what it opens — it must never read as the result of
   signing in. */
.demo-access { flex: 0 0 auto; display: grid; justify-items: end; gap: 6px; }

.demo-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border: 1px solid rgba(159, 187, 207, .42);
  border-radius: 4px;
  background: rgba(2, 11, 23, .5);
  color: var(--body);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .1em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.demo-button:hover { transform: translateY(-2px); border-color: var(--blue-bright); background: rgba(35, 127, 189, .16); color: var(--paper); }
.demo-button:active { transform: translateY(0); }
.demo-button:focus-visible { outline: none; box-shadow: var(--focus); }

.demo-note { color: var(--muted); font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; }

@media (max-width: 900px) {
  .earth-field { height: 500px; }
  .earth-media { width: 120%; max-width: none; margin-left: -10%; object-position: center 50%; }
  .auth-console { width: min(700px, 100%); padding: 30px 36px 24px; }
  .console-intro h1 { font-size: 35px; }
}

@media (max-width: 660px) {
  .auth-stage { min-height: 100svh; align-items: flex-start; padding: 225px 16px 28px; overflow: hidden auto; }
  .auth-stage::after { opacity: .24; }
  .earth-field { height: 360px; min-height: 0; }
  .earth-media { width: 150%; margin-left: -25%; object-position: center 51%; }
  .return-link { top: 16px; right: 16px; padding: 0 13px; }
  .return-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .return-link svg { width: 20px; }
  .auth-console { padding: 31px 23px 26px; }
  .console-header { align-items: flex-start; }
  .brand-mark { width: 42px; height: 42px; }
  .brand-name { font-size: 27px; }
  .portal-state { max-width: 120px; justify-content: flex-end; text-align: right; font-size: 9px; }
  .console-intro { margin-top: 29px; }
  .console-intro h1 { font-size: 31px; letter-spacing: .09em; }
  .console-intro p { font-size: 14px; }
  .login-form { margin-top: 24px; }
  .form-actions { grid-template-columns: 1fr; gap: 12px; }
  .primary-action { grid-row: 1; }
  .recovery-link { grid-row: 2; justify-self: center; }
  .login-button { width: 100%; }
  /* Stacked, not side by side: with the dashboard link in the row the sentence
     was squeezed to roughly one word per line at 375px. */
  .console-footer { flex-direction: column; align-items: flex-start; gap: 14px; }
  .console-footer p { max-width: none; }
  .demo-access { justify-items: start; }
}

@media (max-width: 390px) {
  .auth-stage { padding-inline: 10px; }
  .auth-console { padding-inline: 19px; }
  .portal-state span:last-child { max-width: 88px; }
  .console-intro h1 { font-size: 28px; }
  .console-footer p { font-size: 12px; }
}

@media (max-width: 660px) {
  html { scrollbar-width: thin; }
  body::-webkit-scrollbar { width: 4px; }
  body::-webkit-scrollbar-thumb { border-width: 1px; background: #0d3550; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .earth-field, .auth-console { transform: none !important; }
}
