:root {
  --auth-navy: #10233f;
  --auth-blue: #1d4ed8;
  --auth-blue-soft: #e8f0ff;
  --auth-ink: #172033;
  --auth-muted: #64748b;
  --auth-line: #dbe3ef;
  --auth-surface: #ffffff;
  --auth-danger: #b42318;
  --auth-shadow: 0 24px 65px rgba(8, 22, 45, 0.24);
}

.login-gate,
.login-gate * {
  box-sizing: border-box;
}

.login-gate button,
.login-gate input {
  font: inherit;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 32px 24px;
  background: rgba(16, 35, 63, 0.78)
    url("https://images.unsplash.com/photo-1524178232363-1fb2b075b655?auto=format&fit=crop&w=1800&q=85")
    center / cover;
}

.login-gate::before {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(
    135deg,
    rgba(7, 22, 46, 0.91),
    rgba(16, 35, 63, 0.72)
  );
}

.login-gate.hidden {
  display: none;
}

.login-card {
  position: relative;
  width: min(100%, 456px);
  max-height: 100%;
  padding: clamp(20px, 4vh, 38px);
  overflow-y: auto;
  background: var(--auth-surface);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 16px;
  box-shadow: var(--auth-shadow);
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 34px;
}

.login-brand span {
  color: var(--auth-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.login-logo {
  display: block;
  width: auto;
  height: 34px;
  max-width: 62%;
}

.login-card h1,
.login-card h2 {
  margin: 0 0 10px;
  color: var(--auth-navy);
  font-size: clamp(1.7rem, 4vw, 2rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.login-eyebrow {
  margin: 0 0 6px;
  color: var(--auth-blue);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-subtitle {
  margin: 0 0 28px;
  color: var(--auth-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.field-group {
  margin-bottom: 20px;
}

.login-card label {
  display: block;
  margin: 0;
  color: var(--auth-ink);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.3;
}

.field-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 7px;
}

.field-help,
.caps-lock {
  margin: 6px 0 0;
  color: var(--auth-muted);
  font-size: 0.76rem;
}

.caps-lock {
  color: #a15c00;
  font-weight: 700;
}

.login-card input {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 13px 14px;
  color: var(--auth-ink);
  border: 1px solid var(--auth-line);
  border-radius: 8px;
  background: #fff;
  outline: none;
  line-height: 1.2;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.login-card input:focus {
  border-color: var(--auth-blue);
  box-shadow: 0 0 0 3px var(--auth-blue-soft);
}

.login-card input[aria-invalid="true"] {
  border-color: var(--auth-danger);
  box-shadow: 0 0 0 3px #fee4e2;
}

.password-field {
  position: relative;
}
.password-field input {
  padding-right: 64px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  padding: 7px 8px;
  color: var(--auth-blue);
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: #163fae;
}

.submit-button {
  width: 100%;
  min-height: 50px;
  margin-top: 4px;
  color: white;
  border: 0;
  border-radius: 8px;
  background: var(--auth-blue);
  cursor: pointer;
  font-weight: 700;
  line-height: 1.2;
  transition:
    background 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.submit-button:hover {
  background: #163fae;
  box-shadow: 0 8px 18px rgba(29, 78, 216, 0.22);
  transform: translateY(-1px);
}

.submit-button:focus-visible,
.password-toggle:focus-visible {
  outline: 3px solid var(--auth-blue-soft);
  outline-offset: 2px;
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.8;
  transform: none;
}

.button-loading {
  display: none;
}
.submit-button.is-loading .button-label {
  display: none;
}
.submit-button.is-loading .button-loading {
  display: inline;
}

.login-security-note {
  margin: 24px 0 0;
  color: var(--auth-muted);
  font-size: 0.76rem;
  text-align: center;
}

.login-error {
  min-height: 0;
  margin: 0;
  color: var(--auth-danger);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.45;
}

.login-error:not(:empty) {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid #fecdca;
  border-radius: 8px;
  background: #fffbfa;
}

/* Standalone sign-in experience */
.login-gate {
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #eef4fc, #f8fbff);
}

.login-gate::before {
  display: none;
}

.login-card {
  display: block;
  width: min(100%, 410px);
  min-height: auto;
  padding: 32px;
  border: 1px solid #e5ebf4;
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(16, 35, 63, 0.12);
}
.login-card > * {
  width: 100%;
}
.login-card h1,
.login-card h2 {
  font-size: 1.75rem;
}
.login-eyebrow {
  display: none;
}
.login-subtitle {
  margin-bottom: 25px;
  font-size: 0.9rem;
}
.field-group {
  margin-bottom: 17px;
}
.login-card input {
  padding: 12px 14px;
  border-radius: 8px;
  background: #fbfcff;
}
.login-card input:focus {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 4px #e8f0ff;
  background: #fff;
}
.submit-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 8px;
}
@media (max-width: 480px) {
  .login-gate {
    padding: 16px;
  }
  .login-card {
    padding: 26px 22px;
  }
  .login-card h1,
  .login-card h2 {
    font-size: 1.6rem;
  }
  .login-subtitle {
    margin-bottom: 23px;
  }
}

@media (max-height: 620px) {
  .login-card {
    padding: 22px 26px;
  }
  .login-brand {
    margin-bottom: 20px;
  }
  .login-subtitle {
    margin-bottom: 16px;
  }
  .field-group {
    margin-bottom: 12px;
  }
  .login-card input {
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .submit-button {
    min-height: 44px;
  }
}

@media (max-width: 480px) and (max-height: 620px) {
  .login-card {
    padding: 20px;
  }
  .login-logo {
    height: 29px;
  }
  .login-brand {
    margin-bottom: 16px;
  }
}

.global-nav {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 68px;
  padding: 0 clamp(20px, 6vw, 72px);
  color: white;
  background: var(--auth-navy);
}

.global-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.global-brand img {
  width: 132px;
  filter: brightness(0) invert(1);
}
.global-links {
  display: flex;
  gap: 20px;
  margin-left: auto;
}
.global-links a {
  color: #c6d3e6;
  font-size: 0.86rem;
  text-decoration: none;
}
.global-links a:hover,
.global-links a:focus-visible {
  color: white;
}
.user-panel {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: 4px;
}
.user-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--auth-navy);
  border-radius: 50%;
  background: #dbeafe;
  font-size: 0.82rem;
  font-weight: 800;
}
.user-identity {
  display: grid;
  gap: 1px;
  min-width: 72px;
}
.user-identity strong {
  color: white;
  font-size: 0.8rem;
}
.user-identity span {
  color: #aebfd6;
  font-size: 0.7rem;
  text-transform: capitalize;
}
.logout-button {
  padding: 7px 10px;
  color: #dbeafe;
  border: 1px solid #55708f;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}
.logout-button:hover,
.logout-button:focus-visible {
  color: white;
  border-color: white;
}
.global-nav [hidden] {
  display: none;
}

@media (max-width: 760px) {
  .global-nav {
    flex-wrap: wrap;
    gap: 12px 18px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .global-links {
    order: 3;
    width: 100%;
    margin-left: 0;
  }
  .user-panel {
    margin-left: auto;
  }
  .global-brand span {
    display: none;
  }
}
