:root {
  --navy: #0e1b2b;
  --navy-deep: #081120;
  --cyan: #3fa9f5;
  --amber: #f2a93b;
  --amber-deep: #d98d1f;
  --steel: #5b6b7a;
  --concrete: #edeff2;
  --hazard-black: #14181d;
  --success: #3ccB7f;
  --error: #ef5b5b;

  --bg-white: #ffffff;
  --grid-line: rgba(63, 169, 245, 0.16);
  --grid-line-fine: rgba(63, 169, 245, 0.08);
  --ink: #16232f;
  --card-bg: rgba(232, 243, 252, 0.88);
  --card-border: rgba(63, 169, 245, 0.45);

  --font-display: "Rajdhani", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-white);
  font-family: var(--font-body);
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.page {
  position: relative;
  height: 100vh;
  width: 100vw;
  background: var(--bg-white);
  overflow: hidden;
}

/* full-page blueprint grid */
.grid-layer {
  position: absolute;
  inset: -2px;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  animation: gridPan 26s linear infinite;
}

.grid-layer--fine {
  background-image: linear-gradient(var(--grid-line-fine) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line-fine) 1px, transparent 1px);
  background-size: 16px 16px;
  animation: gridPan 40s linear infinite reverse;
}

@keyframes gridPan {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 640px 640px;
  }
}

/* hazard strips, top and bottom of page */
.hazard-strip {
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  background: repeating-linear-gradient(
    45deg,
    var(--amber) 0 16px,
    var(--hazard-black) 16px 32px
  );
  background-size: 45px 45px;
  animation: hazardMove 2.2s linear infinite;
  opacity: 0.9;
  z-index: 3;
}

.hazard-strip--top {
  top: 0;
}
.hazard-strip--bottom {
  bottom: 0;
}

@keyframes hazardMove {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 90px 0;
  }
}

/* blueprint annotation overlay */
.bp-annotations {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0;
  animation: fadeInUp 1s ease forwards;
  animation-delay: 0.4s;
}

.bp-line {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.5;
  opacity: 0.4;
}

.bp-line--thin {
  fill: none;
  stroke: var(--steel);
  stroke-width: 1;
  opacity: 0.45;
}

.bp-node {
  fill: var(--cyan);
  opacity: 0.6;
}

.bp-node-fill {
  fill: var(--amber);
  opacity: 0.7;
}

.bp-compass {
  opacity: 0.55;
}

.bp-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  fill: var(--steel);
  opacity: 0.6;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   AUTH STAGE
   ========================================================= */

.auth-stage {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(480px, 92vw);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 40px 38px 34px;
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(16, 40, 66, 0.14), 0 0 0 1px rgba(16, 40, 66, 0.03);
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  animation: cardIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 0.15s;
}

@keyframes cardIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--amber);
  opacity: 0.8;
}
.card-corner--tl {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}
.card-corner--tr {
  top: -1px;
  right: -1px;
  border-left: none;
  border-bottom: none;
}
.card-corner--bl {
  bottom: -1px;
  left: -1px;
  border-right: none;
  border-top: none;
}
.card-corner--br {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}

.view.d-none {
  display: none;
}

.card-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--amber);
  margin-bottom: 10px;
}

.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.7rem;
  color: var(--ink);
  margin: 0 0 6px;
}

.card-sub {
  color: var(--steel);
  font-size: 13.5px;
  margin: 0 0 26px;
  line-height: 1.5;
}

.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--steel);
  margin-bottom: 8px;
  margin-top: 18px;
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--steel);
  font-size: 15px;
}

.mono-input {
  width: 100%;
  background: rgba(63, 169, 245, 0.05);
  border: 1px solid rgba(91, 107, 122, 0.3);
  border-radius: 4px;
  padding: 12px 14px 12px 40px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.mono-input::placeholder {
  color: rgba(91, 107, 122, 0.7);
}

.mono-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(63, 169, 245, 0.18);
}

/* ---------- PIN / PASSWORD BOXES ---------- */

.pin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pin-box {
  width: 38px;
  height: 46px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  background: rgba(63, 169, 245, 0.05);
  border: 1px solid rgba(91, 107, 122, 0.3);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  perspective: 300px;
}

.pin-row--otp .pin-box {
  width: 44px;
  height: 52px;
  font-size: 20px;
}

.pin-box:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(63, 169, 245, 0.18);
  transform: translateY(-1px);
}

.pin-box.filled {
  border-color: rgba(242, 169, 59, 0.55);
}

.pin-box.checking {
  animation: pinFlip 0.6s ease-in-out infinite;
  border-color: var(--cyan);
  color: var(--cyan);
}

@keyframes pinFlip {
  0% {
    transform: rotateX(0deg);
  }
  50% {
    transform: rotateX(180deg);
  }
  100% {
    transform: rotateX(360deg);
  }
}

.pin-box.success {
  animation: none;
  border-color: var(--success);
  color: var(--success);
  box-shadow: 0 0 14px rgba(60, 203, 127, 0.4);
  transform: rotateX(0deg);
}

.pin-box.error {
  animation: pinShake 0.45s ease;
  border-color: var(--error);
  color: var(--error);
  box-shadow: 0 0 14px rgba(239, 91, 91, 0.35);
}

@keyframes pinShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

.error-msg {
  min-height: 18px;
  color: var(--error);
  font-size: 12.5px;
  margin-top: 10px;
  font-family: var(--font-body);
}

/* ---------- BUTTONS ---------- */

.btn-erp {
  position: relative;
  width: 100%;
  margin-top: 22px;
  padding: 13px 18px;
  border: 1px solid var(--amber);
  background: transparent;
  border-radius: 4px;
  color: var(--amber);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  cursor: pointer;
  overflow: hidden;
  transition: color 0.25s ease;
}

.btn-erp-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--amber), var(--amber-deep));
  transform: translateX(-101%);
  transition: transform 0.32s cubic-bezier(0.65, 0, 0.35, 1);
  z-index: 0;
}

.btn-erp:hover .btn-erp-fill,
.btn-erp:focus-visible .btn-erp-fill {
  transform: translateX(0);
}

.btn-erp:hover,
.btn-erp:focus-visible {
  color: var(--hazard-black);
}

.btn-erp-label {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-erp:active {
  transform: scale(0.98);
}

.btn-erp:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.link-btn {
  display: block;
  width: 100%;
  text-align: center;
  background: none;
  border: none;
  color: var(--steel);
  font-size: 12.5px;
  margin-top: 16px;
  cursor: pointer;
  transition: color 0.2s;
}

.link-btn:hover {
  color: var(--cyan);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--steel);
  font-size: 12px;
  font-family: var(--font-mono);
  padding: 0;
  margin-bottom: 18px;
  cursor: pointer;
  transition: color 0.2s;
}

.back-btn:hover {
  color: var(--amber);
}

.success-badge {
  width: 64px;
  height: 64px;
  margin: 8px auto 18px;
  border-radius: 50%;
  border: 2px solid var(--success);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: 0 0 24px rgba(60, 203, 127, 0.35);
  animation: successPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes successPop {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.text-center {
  text-align: center;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 992px) {
  html,
  body {
    overflow-y: auto;
  }

  .page {
    height: auto;
    min-height: 100vh;
  }

  .auth-card {
    margin: 24px 0 40px;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 30px 22px 26px;
  }
  .pin-box {
    width: 32px;
    height: 40px;
    font-size: 15px;
  }
}
