:root {
  --background: #f5f3f1;
  --foreground: #0b0b0b;
  --primary: #1d1715;
  --secondary: #e5e2df;
  --muted: #ddd9d6;
  --accent: #cac5c0;
  --zinc-50: #f7f5f4;
  --zinc-100: #ece8e5;
  --zinc-200: #d8d2ce;
  --zinc-300: #b8aea8;
  --zinc-400: #8b7e77;
  --zinc-500: #6a5e58;
  --zinc-600: #4f4642;
  --zinc-700: #342e2b;
  --sage-100: #e3e8e2;
  --sage-500: #869683;
  --slate-100: #e4e7eb;
  --danger: #a8433f;
  --shadow-soft:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 6px 24px rgba(0, 0, 0, 0.03);
  --shadow-floating: 0 12px 40px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  color: var(--foreground);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.42) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.42) 1px, transparent 1px),
    var(--background);
  background-size: 44px 44px;
  font-family: "Public Sans", Inter, "Avenir Next", "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.portal-page {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.portal-page:has(.auth-page) {
  padding: 0;
}

.auth-page {
  width: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: clamp(24px, 5vh, 56px) clamp(24px, 8vw, 128px);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.08) 48%, rgba(255, 255, 255, 0.58) 100%),
    url("/login-background.png"),
    radial-gradient(circle at 24% 50%, rgba(255, 255, 255, 0.88), rgba(245, 243, 241, 0.52) 54%, rgba(245, 243, 241, 0.9) 100%);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.auth-page .portal-panel {
  width: clamp(360px, 34vw, 560px);
  padding: 0;
  background: transparent;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.field-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  z-index: 1;
  width: 24px;
  height: 24px;
  transform: translateY(-50%);
  pointer-events: none;
}

.field-icon,
.ghost-icon-button svg,
.button-arrow {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.ghost-icon-button {
  position: absolute;
  right: 10px;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  color: #a29d99;
  background: transparent;
  transform: translateY(-50%);
  cursor: pointer;
}

.ghost-icon-button:hover {
  color: var(--primary);
}

.login-card .error-text {
  min-height: 20px;
  margin-top: -4px;
  font-size: 13px;
}

.login-card .primary-button {
  min-height: 58px;
  margin-top: 4px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    #1d1d1d;
  box-shadow: 0 8px 18px rgba(29, 23, 21, 0.16);
}

.login-card .primary-button:hover {
  background: #111;
}

.button-arrow {
  width: 26px;
  height: 26px;
  vertical-align: middle;
}

.login-divider {
  position: relative;
  margin: 34px 0 28px;
  color: #8f8984;
  font-size: 16px;
  text-align: center;
}

.login-divider::before,
.login-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 28px);
  height: 1px;
  background: rgba(202, 197, 192, 0.72);
}

.login-divider::before {
  left: 0;
}

.login-divider::after {
  right: 0;
}

.login-footer {
  margin-top: 0;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 12px;
  color: #9a9692;
  font-size: 15px;
}

.login-footer a {
  justify-self: start;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.portal-toolbar {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 10;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--zinc-200);
  border-radius: 999px;
  background: rgba(247, 245, 244, 0.82);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

.language-switcher span {
  margin-left: 8px;
  color: var(--zinc-500);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
}

.language-switcher button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  color: var(--zinc-600);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: background 140ms ease, color 140ms ease;
}

.language-switcher button:hover,
.language-switcher button.is-active {
  color: var(--zinc-50);
  background: var(--primary);
}

.portal-shell {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(420px, 0.98fr);
  overflow: hidden;
  border: 1px solid rgba(184, 174, 168, 0.42);
  border-radius: 24px;
  background: rgba(247, 245, 244, 0.72);
  box-shadow: var(--shadow-floating);
  backdrop-filter: blur(14px);
}

.portal-brand {
  position: relative;
  min-height: 620px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px;
  color: var(--foreground);
  background:
    linear-gradient(135deg, rgba(227, 232, 226, 0.72), transparent 48%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(229, 226, 223, 0.58)),
    var(--zinc-100);
}

.portal-brand::after {
  content: "";
  position: absolute;
  inset: 24px;
  border: 1px solid rgba(184, 174, 168, 0.36);
  border-radius: 18px;
  pointer-events: none;
}

.portal-logo-lockup {
  width: 104px;
  height: 104px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 1px solid var(--zinc-200);
  border-radius: 24px;
  background: rgba(247, 245, 244, 0.78);
  box-shadow: var(--shadow-soft);
}

.portal-logo-image {
  width: 100%;
  height: auto;
  border-radius: 16px;
}

.portal-kicker {
  width: fit-content;
  margin-top: 34px;
  padding: 8px 12px;
  border: 1px solid var(--zinc-200);
  border-radius: 999px;
  color: var(--zinc-600);
  background: rgba(255, 255, 255, 0.46);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.portal-title {
  max-width: 520px;
  margin: 22px 0 16px;
  color: var(--primary);
  font-family: "Lora", Georgia, serif;
  font-size: clamp(42px, 6vw, 68px);
  font-weight: 600;
  line-height: 1.04;
}

.portal-copy {
  max-width: 500px;
  margin: 0;
  color: var(--zinc-600);
  font-size: 17px;
  line-height: 1.7;
}

.portal-notes {
  width: min(100%, 500px);
  margin-top: 34px;
  display: grid;
  gap: 12px;
}

.portal-note {
  padding: 16px 18px;
  border: 1px solid rgba(184, 174, 168, 0.42);
  border-radius: 16px;
  color: var(--zinc-600);
  background: rgba(255, 255, 255, 0.48);
  box-shadow: var(--shadow-soft);
  font-size: 14px;
  line-height: 1.55;
}

.portal-note strong {
  display: block;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 14px;
}

.portal-note code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--zinc-100);
  color: var(--zinc-700);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.portal-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(236, 232, 229, 0.66)),
    var(--zinc-50);
}

.auth-card {
  width: min(456px, 100%);
  padding: 34px;
  border: 1px solid rgba(184, 174, 168, 0.5);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
}

.auth-card h1 {
  margin: 0 0 10px;
  color: var(--primary);
  font-family: "Lora", Georgia, serif;
  font-size: 36px;
  font-weight: 600;
  line-height: 1.15;
}

.auth-card p {
  margin: 0;
  color: var(--zinc-500);
  font-size: 15px;
  line-height: 1.65;
}

.auth-form {
  margin-top: 28px;
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: var(--zinc-600);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 13px 14px;
  border: 1px solid var(--zinc-200);
  border-radius: 12px;
  color: var(--foreground);
  background: rgba(247, 245, 244, 0.76);
  outline: none;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.field input::placeholder {
  color: var(--zinc-400);
}

.field input:focus,
.field select:focus {
  border-color: var(--zinc-400);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(202, 197, 192, 0.35);
}

.field select {
  appearance: none;
  cursor: pointer;
}

.error-text {
  min-height: 22px;
  color: var(--danger);
  font-size: 14px;
  line-height: 1.5;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 48px;
  padding: 13px 18px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease, opacity 140ms ease;
}

.primary-button {
  border: 1px solid var(--primary);
  color: var(--zinc-50);
  background: var(--primary);
}

.primary-button:hover {
  transform: translateY(-1px);
  background: var(--zinc-700);
}

.secondary-button {
  border: 1px solid var(--zinc-200);
  color: var(--primary);
  background: rgba(255, 255, 255, 0.68);
}

.secondary-button:hover {
  transform: translateY(-1px);
  background: var(--secondary);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.auth-footer {
  margin-top: 20px;
  color: var(--zinc-500);
  font-size: 14px;
}

.auth-footer a {
  color: var(--primary);
  font-weight: 800;
}

.status-panel {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(134, 150, 131, 0.28);
  border-radius: 16px;
  color: var(--zinc-600);
  background: rgba(227, 232, 226, 0.54);
  font-size: 13px;
  line-height: 1.6;
}

.auth-page .auth-card.login-card {
  width: 100%;
  max-height: calc(100dvh - clamp(48px, 10vh, 112px));
  padding: clamp(30px, 5vh, 54px) clamp(24px, 3.2vw, 44px) clamp(26px, 4vh, 40px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow-y: auto;
  border-color: rgba(216, 210, 206, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.05),
    0 18px 48px rgba(29, 23, 21, 0.12);
  backdrop-filter: blur(16px);
}

.auth-page .auth-card.register-card {
  padding-top: clamp(24px, 3.4vh, 42px);
  padding-bottom: clamp(22px, 3vh, 34px);
}

.auth-page .login-logo {
  width: clamp(76px, 8vw, 112px);
  height: auto;
  flex: 0 0 auto;
  align-self: center;
  margin-bottom: clamp(14px, 2.4vh, 24px);
  object-fit: contain;
}

.auth-page .auth-card.login-card h1 {
  margin: 0 0 clamp(22px, 4vh, 38px);
  color: #1b1b1b;
  font-family: "Public Sans", Inter, "Avenir Next", "Segoe UI", sans-serif;
  font-size: clamp(26px, 2.4vw, 38px);
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
}

.auth-page .auth-card.register-card h1 {
  margin-bottom: clamp(18px, 2.6vh, 28px);
}

.auth-page .login-card .auth-form {
  margin-top: 0;
  display: grid;
  gap: clamp(12px, 1.9vh, 18px);
}

.auth-page .login-field {
  position: relative;
  display: block;
}

.auth-page .login-field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--zinc-600);
  font-size: 13px;
  font-weight: 700;
}

.auth-page .login-field input,
.auth-page .login-field select {
  min-height: clamp(50px, 6vh, 60px);
  padding: 14px 52px 14px 18px;
  border-color: rgba(202, 197, 192, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: #1d1715;
  font-size: clamp(15px, 1.1vw, 17px);
}

.auth-page .login-field .field-icon + input {
  padding-left: 62px;
}

.auth-page .login-field input::placeholder {
  color: #9e9a96;
}

.auth-page .login-field input:focus,
.auth-page .login-field select:focus {
  border-color: rgba(139, 126, 119, 0.72);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 4px rgba(216, 210, 206, 0.34);
}

.auth-page .login-card .error-text {
  min-height: 20px;
  margin-top: -4px;
  font-size: 13px;
}

.auth-page .login-card .primary-button {
  min-height: clamp(52px, 6vh, 58px);
  margin-top: 0;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    #1d1d1d;
  box-shadow: 0 8px 18px rgba(29, 23, 21, 0.16);
}

.auth-page .login-card .primary-button:hover {
  background: #111;
}

.auth-page .login-card .secondary-button {
  min-height: 48px;
  border-radius: 8px;
}

@media (max-width: 920px) {
  .portal-page {
    align-items: start;
    padding-top: 76px;
  }

  .portal-page:has(.auth-page) {
    padding: 0;
  }

  .auth-page {
    align-items: flex-end;
    justify-content: center;
    padding: 96px 24px 32px;
    background-position: 38% center;
  }

  .auth-page .portal-panel {
    width: min(520px, 100%);
  }

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

  .portal-brand {
    min-height: auto;
    padding: 40px;
  }

  .portal-brand::after {
    inset: 18px;
  }
}

@media (max-width: 640px) {
  .portal-page {
    padding: 76px 16px 16px;
  }

  .portal-page:has(.auth-page) {
    padding: 0;
  }

  .auth-page {
    padding: 84px 16px 20px;
  }

  .auth-page .auth-card.login-card {
    min-height: auto;
    padding: 34px 22px 28px;
    max-height: calc(100dvh - 104px);
  }

  .auth-page .login-logo {
    width: 86px;
    margin-bottom: 18px;
  }

  .auth-page .auth-card.login-card h1 {
    margin-bottom: 28px;
    font-size: 28px;
  }

  .auth-page .login-field input,
  .auth-page .login-field select {
    min-height: 54px;
    font-size: 16px;
  }

  .login-footer {
    grid-template-columns: 1fr auto;
    row-gap: 10px;
  }

  .portal-toolbar {
    top: 16px;
    right: 16px;
  }

  .portal-brand,
  .portal-panel {
    padding: 24px;
  }

  .portal-title {
    font-size: 40px;
  }

  .auth-card {
    padding: 24px 20px;
  }
}

@media (max-width: 640px) and (max-height: 700px) {
  .auth-page {
    padding: 76px 16px 12px;
  }

  .auth-page .auth-card.login-card {
    max-height: calc(100dvh - 88px);
    padding: 20px 22px 18px;
  }

  .auth-page .login-logo {
    width: 58px;
    margin-bottom: 10px;
  }

  .auth-page .auth-card.login-card h1 {
    margin-bottom: 14px;
    font-size: 23px;
  }

  .auth-page .login-card .auth-form {
    gap: 8px;
  }

  .auth-page .login-field-label {
    margin-bottom: 4px;
    font-size: 12px;
  }

  .auth-page .login-field input,
  .auth-page .login-field select {
    min-height: 46px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .auth-page .login-card .primary-button {
    min-height: 48px;
  }

  .auth-page .login-card .error-text {
    min-height: 18px;
  }

  .auth-page .login-divider {
    margin: 12px 0 8px;
    font-size: 13px;
  }

  .auth-page .login-footer {
    margin-top: 0;
    font-size: 13px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .portal-page {
    display: block;
    min-height: 100dvh;
    overflow-y: auto;
  }

  .auth-page {
    min-height: 100dvh;
    align-items: flex-start;
    justify-content: center;
    padding: 52px 16px 6px;
  }

  .auth-page .portal-panel {
    width: min(480px, 100%);
  }

  .auth-page .auth-card.login-card {
    max-height: calc(100dvh - 64px);
    padding: 12px 22px 10px;
    overflow: visible;
  }

  .auth-page .login-logo {
    width: 34px;
    margin-bottom: 2px;
  }

  .auth-page .auth-card.login-card h1 {
    margin-bottom: 4px;
    font-size: 20px;
  }

  .auth-page .login-card .auth-form {
    gap: 4px;
  }

  .auth-page .login-field-label {
    margin-bottom: 2px;
    font-size: 11px;
  }

  .auth-page .login-field input,
  .auth-page .login-field select {
    min-height: 44px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .auth-page .login-card .error-text {
    min-height: 14px;
    font-size: 12px;
  }

  .auth-page .login-card .primary-button {
    min-height: 44px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .auth-page .login-divider {
    margin: 6px 0 4px;
    font-size: 12px;
  }

  .auth-page .login-footer {
    margin-top: 0;
    font-size: 12px;
  }

  .portal-toolbar {
    top: 8px;
  }
}
