/* Fehu Auth — Panel / Agent / Investment */

:root {
  --auth-ink: #101828;
  --auth-muted: #5b667a;
  --auth-line: rgba(16, 24, 40, 0.1);
  --auth-paper: #f7f4ee;
  --auth-paper-2: #fffdf8;
  --auth-accent: #b8860b;
  --auth-accent-2: #8b6914;
  --auth-brand-bg: #0d1524;
  --auth-brand-fg: #f4efe4;
  --auth-ok: #0f766e;
  --auth-danger: #b42318;
  --auth-radius: 4px;
  --auth-font: "Outfit", "Segoe UI", sans-serif;
  --auth-display: "Fraunces", Georgia, serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

.auth-shell {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--auth-font);
  color: var(--auth-ink);
  background: var(--auth-paper);
  -webkit-font-smoothing: antialiased;
}

.auth-stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(320px, 1.08fr);
}

/* —— Brand plane —— */
.auth-brand {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 5vw, 56px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--auth-brand-fg);
  background:
    radial-gradient(900px 520px at 15% 10%, rgba(184, 134, 11, 0.28), transparent 58%),
    radial-gradient(700px 480px at 90% 85%, rgba(15, 118, 110, 0.22), transparent 55%),
    linear-gradient(165deg, #0a101c 0%, #132033 48%, #0d1524 100%);
}

.auth-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(244, 239, 228, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 239, 228, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.55), transparent 75%);
  pointer-events: none;
  animation: authGridDrift 28s linear infinite;
}

.auth-brand::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -140px;
  bottom: -160px;
  border: 1px solid rgba(184, 134, 11, 0.28);
  border-radius: 50%;
  pointer-events: none;
  animation: authOrb 12s ease-in-out infinite;
}

.auth-brand-top,
.auth-brand-mid,
.auth-brand-foot {
  position: relative;
  z-index: 1;
}

.auth-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.auth-wordmark strong {
  font-family: var(--auth-display);
  font-weight: 600;
  font-size: 1.55rem;
  letter-spacing: 0.02em;
}

.auth-wordmark span {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.62;
  font-weight: 600;
}

.auth-kicker {
  margin: 0 0 14px;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(232, 213, 168, 0.85);
  font-weight: 600;
}

.auth-brand h1 {
  margin: 0;
  max-width: 11ch;
  font-family: var(--auth-display);
  font-weight: 560;
  font-size: clamp(2.4rem, 4.6vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.auth-brand h1 em {
  font-style: italic;
  color: #e8d5a8;
  font-weight: 500;
}

.auth-brand-copy {
  margin: 18px 0 0;
  max-width: 34ch;
  font-size: 1.02rem;
  line-height: 1.55;
  color: rgba(244, 239, 228, 0.72);
}

.auth-brand-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  margin-top: 40px;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: rgba(244, 239, 228, 0.55);
}

.auth-brand-foot b {
  display: block;
  color: #e8d5a8;
  font-size: 0.95rem;
  letter-spacing: 0;
  margin-bottom: 2px;
  font-weight: 650;
}

/* —— Form plane —— */
.auth-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: clamp(20px, 3.5vw, 40px);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.92), rgba(247, 244, 238, 0.98)),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 11px,
      rgba(16, 24, 40, 0.015) 11px,
      rgba(16, 24, 40, 0.015) 12px
    );
}

.auth-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.auth-panel-scroll {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8px 0 24px;
}

.auth-form {
  width: min(560px, 100%);
  animation: authRise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-form-head {
  margin-bottom: 22px;
}

.auth-form-head h2 {
  margin: 0 0 8px;
  font-family: var(--auth-display);
  font-size: clamp(1.7rem, 2.6vw, 2.15rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.auth-form-head p {
  margin: 0;
  color: var(--auth-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 42ch;
}

.auth-section {
  margin: 22px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--auth-line);
}

.auth-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.auth-section h3 {
  margin: 0 0 14px;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--auth-muted);
  font-weight: 700;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.82rem;
  font-weight: 650;
  color: #344054;
  letter-spacing: 0.01em;
}

.auth-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
.auth-form select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(16, 24, 40, 0.14);
  border-radius: var(--auth-radius);
  background: rgba(255, 255, 255, 0.78);
  color: var(--auth-ink);
  font: inherit;
  font-size: 16px;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.auth-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):focus,
.auth-form select:focus {
  outline: none;
  border-color: var(--auth-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.16);
}

.auth-hint {
  margin: 6px 0 0;
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--auth-muted);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(16, 24, 40, 0.14);
  border-radius: var(--auth-radius);
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--auth-ink);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
  user-select: none;
}

.chip-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--auth-accent-2);
}

.chip-check:has(input:checked) {
  border-color: var(--auth-accent);
  background: rgba(184, 134, 11, 0.1);
  color: var(--auth-accent-2);
}

.auth-err,
.auth-ok {
  border-radius: var(--auth-radius);
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  margin-bottom: 16px;
  animation: authRise 0.35s ease both;
}

.auth-err {
  background: #fef3f2;
  border: 1px solid #fecdca;
  color: var(--auth-danger);
}

.auth-ok {
  background: #f0fdf9;
  border: 1px solid #99f6e4;
  color: var(--auth-ok);
}

.auth-submit {
  width: 100%;
  min-height: 52px;
  margin-top: 10px;
  border: 0;
  border-radius: var(--auth-radius);
  background: linear-gradient(135deg, #c9a254 0%, #8b6914 100%);
  color: #14110a;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s ease;
  touch-action: manipulation;
}

.auth-submit:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.auth-submit:active { transform: translateY(0); }

.auth-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--auth-muted);
}

.auth-footer a {
  color: var(--auth-accent-2);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(139, 105, 20, 0.35);
}

.auth-footer a:hover { border-bottom-color: var(--auth-accent-2); }

.auth-lang {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.lang-switcher {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--auth-line);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.lang-switcher-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--auth-muted);
  text-decoration: none;
  white-space: nowrap;
}

.lang-switcher-item:hover {
  color: var(--auth-ink);
  background: rgba(16, 24, 40, 0.06);
}

.lang-switcher-item.active {
  color: #fff;
  background: var(--auth-accent);
}

/* —— Theme: Agent —— */
.auth-theme-agent {
  --auth-accent: #0f766e;
  --auth-accent-2: #115e59;
}

.auth-theme-agent .auth-brand {
  background:
    radial-gradient(900px 520px at 12% 8%, rgba(15, 118, 110, 0.35), transparent 58%),
    radial-gradient(700px 480px at 95% 90%, rgba(184, 134, 11, 0.16), transparent 55%),
    linear-gradient(165deg, #071512 0%, #0f2420 50%, #0a1a17 100%);
}

.auth-theme-agent .auth-brand h1 em,
.auth-theme-agent .auth-brand-foot b,
.auth-theme-agent .auth-kicker { color: #99f6e4; }

.auth-theme-agent .auth-submit {
  background: linear-gradient(135deg, #14b8a6 0%, #0f766e 100%);
  color: #042f2e;
}

.auth-theme-agent .auth-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
.auth-theme-agent .auth-form select:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.auth-theme-agent .chip-check:has(input:checked) {
  border-color: #0f766e;
  background: rgba(15, 118, 110, 0.1);
  color: #115e59;
}

/* —— Theme: Investment —— */
.auth-theme-invest {
  --auth-paper: #0b100e;
  --auth-paper-2: #121c18;
  --auth-ink: #f3efe6;
  --auth-muted: #9aaba2;
  --auth-line: rgba(201, 162, 84, 0.22);
  --auth-accent: #c9a254;
  --auth-accent-2: #e8d5a8;
}

.auth-theme-invest .auth-panel {
  background:
    radial-gradient(700px 360px at 100% 0%, rgba(201, 162, 84, 0.08), transparent 50%),
    linear-gradient(180deg, #101914, #0b100e);
}

.auth-theme-invest .auth-brand {
  background:
    radial-gradient(900px 520px at 10% 0%, rgba(201, 162, 84, 0.22), transparent 55%),
    linear-gradient(165deg, #070d0b 0%, #121c18 55%, #0a1410 100%);
}

.auth-theme-invest .auth-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.auth-theme-invest .auth-form select,
.auth-theme-invest .chip-check {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--auth-ink);
}

.auth-theme-invest .auth-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
.auth-theme-invest .auth-form select:focus {
  background: rgba(255, 255, 255, 0.07);
  border-color: #c9a254;
  box-shadow: 0 0 0 3px rgba(201, 162, 84, 0.18);
}

.auth-theme-invest .form-group label { color: rgba(243, 239, 230, 0.88); }

.auth-theme-invest .chip-check:has(input:checked) {
  border-color: #c9a254;
  background: rgba(201, 162, 84, 0.14);
  color: #e8d5a8;
}

.auth-theme-invest .auth-submit {
  background: linear-gradient(135deg, #e8d5a8 0%, #c9a254 55%, #8b6914 100%);
  color: #14110a;
}

.auth-theme-invest .auth-err {
  background: rgba(232, 106, 106, 0.12);
  border-color: rgba(232, 106, 106, 0.35);
  color: #f5b5b5;
}

.auth-theme-invest .auth-ok {
  background: rgba(61, 186, 126, 0.12);
  border-color: rgba(61, 186, 126, 0.3);
  color: #9ae6bf;
}

/* lang switcher on dark paper */
.auth-theme-invest .lang-switcher {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

.auth-theme-invest .lang-switcher-item {
  color: rgba(243, 239, 230, 0.72);
}

.auth-theme-invest .lang-switcher-item:hover {
  color: #f3efe6;
  background: rgba(255, 255, 255, 0.08);
}

.auth-theme-invest .lang-switcher-item.active {
  color: #14110a;
  background: #c9a254;
}

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

@keyframes authGridDrift {
  from { transform: translateY(0); }
  to { transform: translateY(42px); }
}

@keyframes authOrb {
  0%, 100% { transform: scale(1); opacity: 0.55; }
  50% { transform: scale(1.08); opacity: 0.85; }
}

@media (max-width: 960px) {
  .auth-stage {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    min-height: auto;
    padding: 28px 22px 32px;
  }

  .auth-brand h1 {
    max-width: none;
    font-size: clamp(2rem, 8vw, 2.6rem);
  }

  .auth-brand-copy { max-width: none; }

  .auth-brand-foot { margin-top: 28px; }

  .auth-brand::after { display: none; }
}

@media (max-width: 560px) {
  .form-row-2 { grid-template-columns: 1fr; }
  .auth-panel { padding: 16px 14px 28px; }
  .auth-panel-top { flex-direction: column; align-items: stretch; }
  .auth-lang { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-brand::before,
  .auth-brand::after,
  .auth-form,
  .auth-err,
  .auth-ok,
  .auth-submit { animation: none !important; transition: none !important; }
}
