:root {
  --ink: #171b2d;
  --muted: #667085;
  --blue: #2165e8;
  --blue-dark: #174bb2;
  --line: #e6e9f0;
  --panel: #f1f5fa;
  --danger: #c53f52;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: #f8fbff;
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
}

body::before,
body::after {
  position: fixed;
  z-index: -1;
  width: 390px;
  height: 390px;
  border: 1px solid rgba(33, 101, 232, 0.09);
  content: "";
  transform: rotate(42deg);
}

body::before {
  top: -240px;
  right: -120px;
  background: rgba(227, 239, 255, 0.68);
}
body::after {
  bottom: -270px;
  left: -140px;
  background: rgba(231, 241, 255, 0.58);
}

.page-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 2rem 1.25rem;
}

.portal-card {
  width: min(100%, 730px);
  padding: clamp(1.5rem, 5vw, 3rem);
  border: 1px solid #e8ebf2;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 30px rgba(32, 54, 88, 0.08);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand-mark {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  place-items: center;
  border-radius: 7px;
  color: white;
  background: var(--blue);
  font-weight: 800;
}
.brand-name {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
}
.brand-caption {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}
.rule {
  height: 1px;
  margin: 1.7rem 0 2.8rem;
  background: var(--line);
}
.screen {
  animation: appear 240ms ease both;
}
.screen[hidden] {
  display: none;
}
.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--blue);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1 {
  max-width: 600px;
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.45rem);
  line-height: 1.1;
}
.lead {
  max-width: 600px;
  margin: 1rem 0 2rem;
  color: #424b5d;
  font-size: 1.03rem;
  line-height: 1.55;
}
.form-stack {
  display: grid;
  gap: 0.65rem;
  width: 100%;
  max-width: 600px;
}
label {
  color: #4e5d73;
  font-size: 0.85rem;
  font-weight: 800;
}
input {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid #cfd6e2;
  border-radius: 6px;
  color: var(--ink);
  background: white;
  font: inherit;
  outline: none;
}
input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(33, 101, 232, 0.14);
}
button {
  font: inherit;
}
.primary-button {
  margin-top: 0.75rem;
  padding: 0.82rem 1.25rem;
  border: 0;
  border-radius: 6px;
  color: white;
  background: var(--blue);
  font-weight: 800;
  cursor: pointer;
}
.form-stack .primary-button {
  width: 100%;
}
.primary-button:hover {
  background: var(--blue-dark);
}
.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.error {
  min-height: 1.3rem;
  margin: 0.9rem 0 0;
  color: var(--danger);
  font-size: 0.88rem;
}
.code-panel {
  max-width: 540px;
  padding: 1.35rem;
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
}
.code-inputs {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
  margin-top: 1rem;
}
.code-inputs input {
  width: 3.6rem;
  height: 4rem;
  padding: 0;
  text-align: center;
  font-size: 1.7rem;
  font-weight: 800;
}
.code-panel .primary-button {
  margin-right: auto;
  margin-left: auto;
}
.code-inputs input:disabled {
  background: #e7ebf1;
}
.text-button {
  margin-top: 1.2rem;
  padding: 0;
  border: 0;
  color: var(--blue);
  background: transparent;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
}
.invoice-list {
  display: grid;
  gap: 0.65rem;
  max-width: 600px;
}
.invoice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: white;
  text-align: left;
  cursor: pointer;
}
.invoice-row:hover {
  border-color: #a9c3f7;
  background: #fbfdff;
}
.invoice-row span:first-child {
  display: grid;
  gap: 0.25rem;
}
.invoice-row small {
  color: var(--muted);
}
.amount {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  white-space: nowrap;
}
.amount b {
  color: var(--blue);
  font-size: 1.5rem;
  font-weight: 400;
}
.invoice-message {
  min-height: 1.5rem;
  margin: 1.2rem 0 0;
  color: var(--blue-dark);
  font-weight: 800;
  overflow-wrap: anywhere;
}
footer {
  margin-top: 3.5rem;
  color: #687287;
  text-align: center;
  font-size: 0.86rem;
}
footer strong {
  color: var(--blue);
}

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

@media (max-width: 520px) {
  .page-shell {
    padding: 0.75rem;
  }
  .portal-card {
    padding: 1.35rem;
  }
  .rule {
    margin: 1.4rem 0 2rem;
  }
  .code-inputs {
    gap: 0.4rem;
  }
  .code-inputs input {
    width: calc((100vw - 5.55rem) / 4);
    height: 3.5rem;
  }
  .amount {
    gap: 0.4rem;
    font-size: 0.85rem;
  }
  footer {
    margin-top: 2.5rem;
  }
}
