* { box-sizing: border-box; }
html, body { height: 100%; }
body.auth {
  margin: 0;
  min-height: 100vh;
  position: relative;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: #e8edf5;
  background: #05070c center / cover no-repeat fixed;
}
body.auth-crm {
  background-image:
    linear-gradient(90deg, rgba(8, 6, 8, 0.88) 0%, rgba(10, 6, 8, 0.55) 48%, rgba(20, 4, 8, 0.28) 100%),
    url("login-bg-crm.jpg");
}
body.auth-invest {
  background-color: #05070c;
  background-image:
    linear-gradient(90deg, rgba(5, 7, 12, 0.72) 0%, rgba(5, 7, 12, 0.28) 45%, transparent 72%),
    url("login-bg-avangard.jpg");
  background-position: right center;
  background-size: cover;
}
.auth-stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 6vh 7vw;
  position: relative;
  z-index: 1;
  pointer-events: none;
}
.auth-panel { pointer-events: auto; }
.auth-lang {
  position: absolute; top: 18px; right: 22px; z-index: 40;
}
.auth-lang .lang-pop { position: relative; z-index: 40; }
.auth-lang .lang-pop > summary { list-style: none; cursor: pointer; }
.auth-lang .lang-pop > summary::-webkit-details-marker { display: none; }
.auth-lang .lang-globe {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid rgba(148,163,184,.35);
  background: rgba(8,10,16,.72); color: #fff;
}
.auth-lang .lang-globe svg { width: 20px; height: 20px; display: block; }
.auth-lang .lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  min-width: 176px; max-height: min(70vh, 440px); overflow: auto;
  min-width: 176px; padding: 6px; border-radius: 12px;
  border: 1px solid rgba(148,163,184,.35); background: rgba(8,10,16,.94);
}
.auth-lang .lang-menu button, .auth-lang .lang-menu a {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 8px 10px; border-radius: 8px; font: inherit; color: #fff; cursor: pointer;
  text-decoration: none; box-sizing: border-box;
}
.auth-lang .lang-menu button.on, .auth-lang .lang-menu button:hover,
.auth-lang .lang-menu a.on, .auth-lang .lang-menu a:hover { background: rgba(255,255,255,.08); }
.auth-panel {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.auth-panel[hidden] { display: none !important; }
#auth-flashes:empty { display: none; }
.auth-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin-bottom: 18px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08), 0 12px 40px rgba(0, 0, 0, 0.45);
}
.auth-crm .auth-logo { box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.35), 0 12px 40px rgba(127, 29, 29, 0.45); }
.auth-brand {
  margin: 0 0 22px;
  text-align: left;
}
.auth-lockup-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.auth-mark-round {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
  background: transparent;
}
.auth-lockup-txt { min-width: 0; }
.auth-wordmark {
  margin: 0;
  font-family: Cinzel, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.05;
  color: #d4af67;
}
.auth-ltd {
  margin: 6px 0 8px;
  font-family: Cinzel, "Times New Roman", serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: #d4af67;
}
.auth-tag {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #cfc6b4;
}
.auth-crm .auth-wordmark {
  color: #ef4444;
  font-family: Inter, sans-serif;
  letter-spacing: 0.04em;
  font-size: 28px;
  font-weight: 800;
}
.auth-wordmark span { font-weight: 600; opacity: 0.92; }
.auth-panel h1 {
  margin: 0 0 8px;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #fff;
}
.auth-panel h1 em {
  font-style: normal;
}
.auth-crm h1 em { color: #ef4444; }
.auth-invest h1 em { color: #d4af67; }
.auth-sub { margin: 0 0 28px; color: #9aa3b2; font-size: 15px; }
.auth-flash {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  background: rgba(127, 29, 29, 0.45);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.35);
}
.auth-flash.ok {
  background: rgba(6, 78, 59, 0.5);
  color: #bbf7d0;
  border: 1px solid rgba(52, 211, 153, 0.4);
}
.auth-flash.err {
  background: rgba(127, 29, 29, 0.45);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.35);
}
.auth-field {
  position: relative;
  margin-bottom: 14px;
}
.auth-field input {
  width: 100%;
  height: 52px;
  padding: 0 44px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(8, 10, 16, 0.62);
  color: #fff;
  font-size: 15px;
  outline: none;
}
.auth-field input::placeholder { color: #7b8494; }
.auth-crm .auth-field input:focus { border-color: rgba(239, 68, 68, 0.7); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }
.auth-invest .auth-field input {
  border-color: rgba(212, 175, 103, 0.28);
  background: rgba(8, 10, 16, 0.55);
}
.auth-invest .auth-field input:focus { border-color: rgba(212, 175, 103, 0.7); box-shadow: 0 0 0 3px rgba(212, 175, 103, 0.14); }
.auth-field select {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 44px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(8, 10, 16, 0.62);
  color: #fff;
  font-size: 15px;
  outline: none;
  appearance: none;
  font-family: inherit;
}
.auth-invest .auth-field select:focus { border-color: rgba(212, 175, 103, 0.7); box-shadow: 0 0 0 3px rgba(212, 175, 103, 0.14); }
.auth-flag {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  text-align: center;
  font-size: 20px;
  line-height: 1;
  pointer-events: none;
}
.auth-phone input, .auth-country select { padding-left: 48px; }
.auth-switch { margin: 16px 0 0; color: #9aa3b2; font-size: 14px; }
.auth-switch a { color: #d4af67; font-weight: 700; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.auth-panel .auth-hint { margin: 0 0 16px; }
.auth-ico {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #8b95a5;
  pointer-events: none;
}
.auth-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  color: #8b95a5;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.auth-eye:hover { color: #fff; }
.auth-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 8px 0 22px;
  font-size: 13px;
  color: #b4bcc8;
}
.auth-row label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.auth-row input { accent-color: currentColor; }
.auth-crm .auth-forgot { color: #ef4444; text-decoration: none; font-weight: 600; }
.auth-invest .auth-forgot { color: #d4af67; text-decoration: none; font-weight: 600; }
.auth-forgot:hover { text-decoration: underline; }
.auth-pop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 12, 18, 0.72);
  pointer-events: auto;
}
.auth-pop[hidden] { display: none; }
.auth-pop-card {
  width: min(380px, 100%);
  padding: 22px 22px 18px;
  border-radius: 16px;
  background: #161c26;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e8edf3;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.auth-pop-card p {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.45;
  color: #d5dbe6;
}
.auth-submit {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
}
.auth-crm .auth-submit {
  background: linear-gradient(180deg, #f87171 0%, #b91c1c 100%);
  box-shadow: 0 10px 24px rgba(185, 28, 28, 0.35);
}
.auth-invest .auth-submit {
  background: linear-gradient(90deg, #c9a24a 0%, #edd89a 50%, #c9a24a 100%);
  color: #1a1408;
  box-shadow: 0 8px 28px rgba(201, 162, 74, 0.35);
}
.auth-invest .auth-submit:hover {
  filter: brightness(1.06);
}
.auth-stats {
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 26px;
  margin-left: auto;
  flex-shrink: 0;
}
.auth-crm .auth-stats { display: none; }
.auth-stat {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #e8c57a;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}
.auth-stat svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.auth-stat span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #e8c57a;
}
.auth-stat strong {
  display: block;
  margin-top: 2px;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
}
.auth-otp input {
  padding: 0 16px;
  text-align: center;
  letter-spacing: 0.35em;
  font-size: 22px;
  font-weight: 700;
}
.auth-hint { margin: 16px 0 0; color: #6b7380; font-size: 11px; line-height: 1.45; }
@media (max-width: 720px) {
  .auth-stats { display: none; }
  .auth-stage { padding: 32px 22px 48px; align-items: flex-start; justify-content: flex-start; }
  .auth-panel h1 { font-size: 32px; }
  body.auth {
    background-position: 70% center;
  }
  body.auth-crm { background-image: linear-gradient(180deg, rgba(8,6,8,.9), rgba(8,6,8,.7)), url("login-bg-crm.jpg"); }
  body.auth-invest {
    background-image:
      linear-gradient(180deg, rgba(4, 6, 10, 0.92) 0%, rgba(5, 8, 14, 0.78) 100%),
      url("login-bg-avangard.jpg");
    background-position: 68% center;
  }
}
