/* ===== LOGIN OVERLAY (ElephantPink Admin Suite style) ===== */
#login-overlay {
  position: fixed;
  inset: 0;
  /* Above mobile topbar (1010) and any drawer (1100) — login must always
     be on top when the user is unauthenticated. */
  z-index: 9999;
  background: #0A0A0A;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  overflow: hidden;
}
#login-overlay.off { display: none; }

.login-ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.login-orb {
  position: absolute;
  display: block;
  width: 520px; height: 520px;
  border-radius: 50%;
  background: #D9A441;
  filter: blur(160px);
  opacity: 0.14;
  mix-blend-mode: screen;
}
.login-orb.a { top: -160px; left: -140px; }
.login-orb.b { bottom: -220px; right: -180px; width: 620px; height: 620px; opacity: 0.08; }

.login-stage {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(40px, 80px) minmax(0, 520px) minmax(40px, 80px);
  gap: 40px;
  align-items: stretch;
  width: 100%;
  max-width: 780px;
}

.stage-rail {
  display: flex;
  align-items: center;
  justify-content: center;
}
.stage-kicker {
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #6D6D6D;
}
.stage-kicker.rotate {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
.stage-kicker.rotate-r {
  writing-mode: vertical-rl;
}

.login-card {
  position: relative;
  width: 100%;
  padding: 40px;
  background: rgba(20, 20, 20, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  gap: 28px;
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
}

/* Pink corner brackets */
.login-card::before,
.login-card::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid #D9A441;
  pointer-events: none;
}
.login-card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.login-card::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.card-head {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.card-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-logo { height: 22px; width: auto; display: block; }
.brand-x {
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 14px;
  font-weight: 300;
  color: #D9A441;
  font-style: italic;
}
.brand-chip {
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #D9A441;
  padding: 4px 10px;
  border: 1px solid rgba(217, 164, 65, 0.35);
  background: rgba(217, 164, 65, 0.06);
  min-width: 120px;
  text-align: center;
  transition: opacity 0.18s ease;
  display: inline-block;
}
.morph-word.out { opacity: 0; }
.card-meta { display: flex; flex-direction: column; gap: 12px; }
.kicker-line { display: flex; align-items: center; gap: 10px; }
.kicker-line .kicker {
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: #D9A441;
  font-weight: 700;
  text-transform: uppercase;
}
.kicker-line .dash { flex: 1; height: 1px; background: rgba(255, 255, 255, 0.08); }
.display-xl {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  margin: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #9A9A9A;
}
.field input {
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 15px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, background 0.15s ease;
  border-radius: 0;
}
.field input::placeholder { color: rgba(255, 255, 255, 0.22); }
.field input:focus {
  border-bottom-color: #D9A441;
  background: rgba(217, 164, 65, 0.04);
}

.password-wrap { position: relative; display: flex; align-items: center; }
.password-wrap input { flex: 1; padding-right: 44px; padding-left: 14px; }
.toggle-visibility {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s ease;
  border-radius: 0;
}
.toggle-visibility:hover { color: #D9A441; }

.submit-btn {
  margin-top: 6px;
  background: transparent;
  color: #D9A441;
  border: 1px solid #D9A441;
  padding: 14px 20px;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.25s ease, color 0.25s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
}
.submit-btn .arrow { font-size: 14px; transition: transform 0.25s ease; }
.submit-btn:hover {
  background: #D9A441;
  color: #0A0A0A;
}
.submit-btn:hover .arrow { transform: translateX(4px); }
.submit-btn:active { transform: scale(0.99); }
.submit-btn:focus-visible { outline: 2px solid #D9A441; outline-offset: 3px; }

.lerr {
  background: rgba(253, 74, 74, 0.14);
  border: 1px solid rgba(253, 74, 74, 0.5);
  color: #ffb8b8;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 12px;
  padding: 12px 14px;
  letter-spacing: 0.02em;
  display: none;
  border-radius: 0;
}
.lerr.on { display: block; }

.card-footer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6D6D6D;
  align-self: center;
}
.bracket-l, .bracket-r { color: #D9A441; font-weight: 700; }

@media (max-width: 720px) {
  #login-overlay {
    padding: 0;
    overflow-y: auto;
    align-items: flex-start;
    padding-top: 0;
  }
  .login-stage {
    grid-template-columns: 1fr;
    gap: 0;
    max-width: 100%;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
  }
  .stage-rail { display: none; }
  /* App-style: card nearly fullscreen, 20px lateral padding. */
  .login-card {
    padding: 28px 20px;
    gap: 22px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    justify-content: center;
    background: #0A0A0A;
    border: 0;
  }
  .login-card::before, .login-card::after { display: none; }
  /* Mobile brand: vertical stack — EP logo on top, static "BACKOFFICE"
     label below. The "×" separator and the rotating chip are hidden on
     mobile; users get a calm, fixed brand mark instead of layout shifts. */
  .card-brand {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    width: 100%;
  }
  .brand-x { display: none; }
  /* Hide the rotating chip and replace it with a static "BACKOFFICE" tag
     using the same chip styling, fixed width so it never shifts. */
  .brand-chip { display: none; }
  .card-brand::after {
    content: "BACKOFFICE";
    font-family: 'Noto Sans Mono', ui-monospace, monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: #D9A441;
    padding: 5px 12px;
    border: 1px solid rgba(217, 164, 65, 0.35);
    background: rgba(217, 164, 65, 0.06);
    text-align: center;
  }
  /* Logo ~10% smaller than before (38 → 34). */
  .brand-logo { height: 34px; }
  .card-head {
    align-items: center;
    text-align: center;
    width: 100%;
  }
  .display-xl { font-size: 24px; letter-spacing: -0.01em; text-align: center; }
  /* iOS anti-zoom: inputs must be exactly 16px to prevent the focus zoom. */
  .login-form .field input,
  .login-form input[type="password"],
  .login-form input[type="text"],
  .login-form input[type="email"] {
    font-size: 16px;
    line-height: 1.3;
    padding: 14px 14px;
  }
  .login-form button[type="submit"],
  .submit-btn {
    font-size: 14px;
    padding: 16px 20px;
    min-height: 52px;
  }
  .card-footer { font-size: 8.5px; letter-spacing: 0.18em; text-align: center; }
  /* Safe-area for iPhone X+ home indicator */
  .login-card { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .submit-btn,
  .submit-btn .arrow,
  .submit-btn:hover .arrow,
  .submit-btn:active { transition: none !important; transform: none !important; }
}

/* ===== Reset flow additions ===== */
.forgot-link {
  display: inline-block;
  margin-top: 2px;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9A9A9A;
  text-decoration: none;
  transition: color 0.15s ease;
  align-self: flex-start;
}
.forgot-link:hover { color: #D9A441; }

.field-help {
  margin: 0;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #9A9A9A;
  line-height: 1.55;
}

.linfo {
  background: rgba(63, 185, 128, 0.10);
  border: 1px solid rgba(63, 185, 128, 0.45);
  color: #A6E5BD;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 12px 14px;
  display: none;
}

/* Honeypot: off-screen rather than display:none, because a fair number of
   bots skip hidden inputs but happily fill anything the DOM exposes. A human
   never sees it, a screen reader skips it (aria-hidden + tabindex -1), and any
   value arriving in `company` means the submitter walked the form. */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Client mark under the headline: whose panel this is should be obvious
   before anyone types a password. Sized by height so a future logo swap of a
   different aspect ratio still lines up. */
.login-client-logo {
  display: block;
  /* 312x48 asset, so 6.5:1. Width is pinned rather than auto because a rule
     further up the login card forces a width on images and the mark rendered
     stretched to 438px. object-fit keeps it honest if the file is swapped. */
  height: 34px;
  width: 221px;
  object-fit: contain;
  object-position: left center;
  margin-top: 22px;
  opacity: .92;
}
@media (max-width: 768px) {
  .login-client-logo { height: 28px; width: 182px; margin-top: 18px; }
}
