:root {
  --ink: #0f1b2d;
  --ink-soft: #526070;
  --muted: #8b96a4;
  --line: #e2e7ed;
  --line-strong: #cfd7e1;
  --blue: #2563eb;
  --canvas: #ffffff;
  --font-sans: "Aptos", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font-sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.portal-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(330px, 34%) minmax(0, 1fr);
}

.portal-visual {
  min-height: 100vh;
  padding: 46px clamp(36px, 5vw, 80px) 38px;
  display: flex;
  flex-direction: column;
  color: #f6f8fb;
  background:
    radial-gradient(circle at 73% 12%, rgba(173, 196, 212, 0.34), transparent 28rem),
    radial-gradient(circle at 14% 77%, rgba(65, 92, 115, 0.38), transparent 23rem),
    linear-gradient(135deg, #627e91 0%, #334d60 42%, #121d2a 100%);
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: inherit;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.035em;
  text-decoration: none;
}

.portal-brand small {
  display: inline-block;
  margin-left: 8px;
  padding: 4px 7px;
  border-radius: 4px;
  color: #ffffff;
  background: #111827;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0;
  vertical-align: 2px;
}

.portal-mark {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 11px;
}

.portal-mark svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.portal-brand-light .portal-mark {
  color: #172231;
  background: #f7f9fb;
}

.portal-brand-dark {
  color: var(--ink);
}

.portal-brand-dark .portal-mark {
  color: #ffffff;
  background: #111827;
}

.portal-visual-copy {
  margin: auto 0;
  padding-bottom: 4vh;
}

.portal-visual-copy > p {
  margin: 0 0 20px;
  color: rgba(244, 248, 251, 0.68);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.12em;
}

.portal-visual-copy h1 {
  margin: 0;
  font-size: clamp(36px, 3.35vw, 54px);
  line-height: 1.22;
  letter-spacing: -0.045em;
  font-weight: 560;
}

.portal-visual-copy > span {
  max-width: 460px;
  display: block;
  margin-top: 24px;
  color: rgba(240, 245, 249, 0.74);
  font-size: 13px;
  line-height: 1.8;
}

.portal-visual-copy > a {
  width: fit-content;
  min-height: 42px;
  margin-top: 34px;
  padding: 0 19px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  color: #ffffff;
  font-size: 12px;
  text-decoration: none;
}

.portal-visual footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: rgba(233, 240, 246, 0.44);
  font-size: 9px;
}

.portal-main {
  position: relative;
  min-height: 100vh;
  padding: 0 clamp(28px, 6vw, 90px);
  display: grid;
  place-items: center;
  background: #ffffff;
}

.portal-back {
  position: absolute;
  top: 28px;
  left: 34px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.portal-back:hover {
  color: var(--ink);
}

.portal-auth {
  width: min(570px, 100%);
  padding: 54px 0 38px;
}

.portal-auth > .portal-brand {
  margin: 0 auto 76px;
}

.portal-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.portal-form-heading {
  margin-bottom: 12px;
}

.portal-invite-note {
  padding: 12px 14px;
  display: flex;
  align-items: baseline;
  gap: 9px;
  border: 1px solid #d7e3f8;
  border-radius: 10px;
  color: var(--ink-soft);
  background: #f3f7ff;
  font-size: 10px;
}

.portal-invite-note strong {
  flex: none;
  color: var(--ink);
  font-size: 11px;
}

.portal-form-heading p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
}

.portal-form-heading h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.04em;
}

.portal-mode-switch {
  width: 100%;
  margin-bottom: 2px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.portal-mode-switch button {
  min-height: 38px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.portal-mode-switch button.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 650;
}

.portal-field {
  display: block;
}

.portal-field input {
  width: 100%;
  height: 54px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.portal-field input:focus {
  border-color: #8fb0ef;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.portal-field input::placeholder {
  color: #a3acb8;
}

.portal-phone,
.portal-code {
  display: grid;
  align-items: center;
}

.portal-phone {
  grid-template-columns: auto 1fr;
}

.portal-phone b {
  height: 54px;
  padding: 0 15px 0 17px;
  display: grid;
  place-items: center;
  color: var(--ink);
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 14px 0 0 14px;
  background: #f7f8fa;
  font-size: 12px;
  font-weight: 550;
}

.portal-phone input {
  border-radius: 0 14px 14px 0;
}

.portal-code {
  grid-template-columns: 1fr auto;
}

.portal-code input {
  border-radius: 14px 0 0 14px;
}

.portal-code button {
  min-width: 124px;
  height: 54px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 14px 14px 0;
  color: var(--ink);
  background: #ffffff;
  font-size: 11px;
  font-weight: 600;
}

.portal-code button:not(:disabled)::before {
  content: "";
  width: 1px;
  height: 22px;
  display: inline-block;
  margin-right: 14px;
  vertical-align: middle;
  background: var(--line);
}

.portal-code button:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.portal-submit {
  height: 54px;
  margin-top: 14px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: #0c111a;
  font-size: 13px;
  font-weight: 700;
}

.portal-submit:hover {
  background: #202938;
}

.portal-submit:disabled {
  color: #cbd1d8;
  background: #535b66;
  cursor: wait;
}

.portal-consent {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.portal-consent a,
.portal-agreement a {
  color: var(--ink-soft);
  text-underline-offset: 3px;
}

.portal-agreement {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.65;
  cursor: pointer;
}

.portal-agreement input {
  width: 14px;
  height: 14px;
  margin: 1px 0 0;
  flex: none;
  accent-color: #111827;
}

.portal-actions {
  margin-top: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.portal-actions button,
.portal-inline-back {
  padding: 0;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.portal-actions button:hover,
.portal-inline-back:hover {
  color: var(--blue);
}

.portal-inline-back {
  align-self: flex-start;
  margin-bottom: 10px;
}

.portal-legal {
  margin-top: 31px;
  color: #8b96a4;
  font-size: 9px;
  text-align: center;
}

.portal-legal nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px 15px;
  margin-bottom: 11px;
}

.portal-legal p {
  margin: 4px 0;
}

.portal-legal a {
  color: inherit;
}

.portal-legal a:hover {
  color: var(--ink);
}

.portal-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 20;
  max-width: min(460px, calc(100% - 30px));
  padding: 12px 17px;
  border-radius: 10px;
  color: #ffffff;
  background: #111827;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.22);
  font-size: 12px;
  transform: translateX(-50%);
}

.portal-toast.is-error {
  background: #b42318;
}

@media (max-width: 880px) {
  .portal-shell {
    grid-template-columns: 1fr;
  }

  .portal-visual {
    min-height: 280px;
    padding: 28px;
  }

  .portal-visual-copy {
    margin: 48px 0 24px;
    padding: 0;
  }

  .portal-visual-copy h1 {
    font-size: 38px;
  }

  .portal-visual-copy > span,
  .portal-visual-copy > p,
  .portal-visual-copy > a,
  .portal-visual footer {
    display: none;
  }

  .portal-main {
    min-height: calc(100vh - 280px);
    padding: 0 22px;
    place-items: start center;
  }

  .portal-back {
    display: none;
  }

  .portal-auth {
    padding: 48px 0 52px;
  }

  .portal-auth > .portal-brand {
    display: none;
  }
}

@media (max-width: 480px) {
  .portal-visual {
    min-height: 220px;
  }

  .portal-visual-copy {
    margin-top: 34px;
  }

  .portal-visual-copy h1 {
    font-size: 30px;
  }

  .portal-main {
    min-height: calc(100vh - 220px);
  }

  .portal-auth {
    padding-top: 38px;
  }

  .portal-form-heading h2 {
    font-size: 24px;
  }
}
