/* Authentication surfaces are intentionally independent from the configurable
 * brand surface. A dark or saturated brand color should remain an accent, not
 * turn the entire login form into a low-contrast block. */

.auth-shell {
  --auth-bg: #f4f7fb;
  --auth-surface: rgba(255, 255, 255, 0.96);
  --auth-text: #172033;
  --auth-muted: #64748b;
  --auth-border: #dbe3ec;
  --auth-input-border: #cbd5e1;
  --auth-focus: var(--brand-focus, #2563eb);
  background: var(--auth-bg);
  color: var(--auth-text);
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  overflow-x: clip;
}

.auth-shell__orb {
  pointer-events: none;
  z-index: 0;
  filter: blur(1px);
}

.auth-shell__orb--primary {
  top: -13rem;
  left: -10rem;
  width: 28rem;
  height: 28rem;
  opacity: 0.09;
  background: var(--brand-primary, #2563eb);
}

.auth-shell__orb--accent {
  right: -13rem;
  bottom: -16rem;
  width: 34rem;
  height: 34rem;
  opacity: 0.07;
  background: var(--brand-accent, #0f766e);
}

.auth-shell__container {
  z-index: 1;
  max-width: 1180px;
}

.auth-shell__header {
  min-height: 48px;
}

.auth-shell__header img {
  width: auto;
  height: 34px;
  max-width: 176px;
  max-height: 34px;
}

.auth-shell__content {
  padding-top: clamp(2.5rem, 8vh, 5.5rem);
  padding-bottom: clamp(2.5rem, 8vh, 5.5rem);
}

.auth-shell__inner {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
}

.auth-shell__footer {
  color: var(--auth-muted);
}

.auth-shell__footer a {
  color: var(--auth-text);
}

.auth-panel {
  width: 100%;
  border-color: var(--auth-border) !important;
  background: var(--auth-surface) !important;
  color: var(--auth-text);
  border-radius: 1.25rem !important;
  padding: clamp(1.5rem, 4vw, 2.5rem) !important;
  box-shadow: 0 24px 64px rgba(30, 41, 59, 0.12), 0 4px 14px rgba(30, 41, 59, 0.05) !important;
}

.auth-panel header {
  margin-bottom: 1.75rem;
}

.auth-panel h1 {
  color: var(--auth-text) !important;
  font-size: clamp(1.55rem, 4vw, 1.8rem);
  letter-spacing: -0.025em;
}

.auth-panel header p {
  color: var(--auth-muted) !important;
  font-size: 0.95rem;
}

.auth-field label {
  color: #334155 !important;
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
}

.auth-panel .ui-input {
  min-height: 3.25rem;
  border-color: var(--auth-input-border) !important;
  border-radius: 0.75rem !important;
  background: #fff !important;
  color: var(--auth-text) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.auth-panel .ui-input::placeholder {
  color: #94a3b8 !important;
}

.auth-panel .ui-input:hover {
  border-color: #94a3b8 !important;
}

.auth-panel .ui-input:focus {
  border-color: var(--auth-focus) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-focus) 15%, transparent) !important;
}

.auth-panel .auth-field > .relative > svg {
  color: #94a3b8;
}

.auth-panel [data-password-toggle] {
  color: #64748b;
}

.auth-panel [data-password-toggle]:hover {
  color: #334155;
  background: #f1f5f9;
}

.auth-panel form > .flex.items-center.justify-between {
  margin-top: 0.25rem;
  color: var(--auth-muted);
}

.auth-panel form > .flex.items-center.justify-between a,
.auth-panel form > .flex.items-center.justify-between a:hover {
  color: var(--brand-primary-hover, #1d4ed8) !important;
}

.auth-panel form > p {
  color: var(--auth-muted) !important;
}

.auth-panel .ui-button-primary {
  min-height: 3.25rem;
  border-radius: 0.75rem;
  background: var(--brand-primary, #1e3a8a) !important;
  color: var(--brand-on-primary, #fff) !important;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--brand-primary, #1e3a8a) 22%, transparent) !important;
}

.auth-panel .ui-button-primary:hover {
  background: var(--brand-primary-hover, #172554) !important;
}

.auth-panel .ui-button-primary:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-focus) 20%, transparent), 0 8px 18px color-mix(in srgb, var(--brand-primary, #1e3a8a) 22%, transparent) !important;
}

.auth-panel [aria-hidden='true'] > span {
  color: #94a3b8;
}

.auth-panel > .border-t {
  border-color: #e2e8f0 !important;
}

.auth-panel a {
  text-underline-offset: 3px;
}

.auth-telegram-fallback {
  max-width: 24rem;
  border: 1px solid #fed7aa;
  border-radius: 0.75rem;
  background: #fff7ed;
  padding: 0.75rem 1rem;
  color: #9a3412;
  font-size: 0.8125rem;
  line-height: 1.35;
  text-align: center;
}

html.dark .auth-telegram-fallback {
  border-color: #7c2d12;
  background: rgba(124, 45, 18, 0.22);
  color: #fdba74;
}

.auth-language select,
.auth-theme-button {
  border-color: var(--auth-border) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

.auth-language__select {
  min-width: 10rem;
  width: auto;
  padding-inline-start: 2.75rem !important;
  padding-inline-end: 2.25rem !important;
  appearance: none;
  -webkit-appearance: none;
}

.auth-language__chevron {
  inset-inline-end: 0.75rem;
  width: 1rem;
  height: 1rem;
  color: var(--auth-muted);
}

html.dark .auth-shell {
  --auth-bg: #0f172a;
  --auth-surface: rgba(15, 23, 42, 0.96);
  --auth-text: #e2e8f0;
  --auth-muted: #94a3b8;
  --auth-border: #334155;
  --auth-input-border: #475569;
}

html.dark .auth-panel h1,
html.dark .auth-field label {
  color: var(--auth-text) !important;
}

html.dark .auth-panel .ui-input {
  border-color: var(--auth-input-border) !important;
  background: #111827 !important;
  color: var(--auth-text) !important;
}

html.dark .auth-panel .ui-input::placeholder {
  color: #64748b !important;
}

html.dark .auth-panel form > .flex.items-center.justify-between a,
html.dark .auth-panel form > .flex.items-center.justify-between a:hover {
  color: var(--color-brand-300, #93c5fd) !important;
}

html.dark .auth-panel [data-password-toggle]:hover {
  color: #e2e8f0;
  background: #1e293b;
}

html.dark .auth-panel > .border-t {
  border-color: #334155 !important;
}

@media (max-width: 520px) {
  .auth-shell__container {
    min-width: 0;
    max-width: 100%;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .auth-shell__header {
    align-items: flex-start;
  }

  .auth-shell__controls {
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.375rem;
  }

  .auth-language select {
    min-width: 0;
    width: min(8.75rem, 42vw);
    max-width: 100%;
    font-size: 0.8125rem;
  }

  .auth-shell__content {
    align-items: flex-start;
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }

  .auth-panel {
    min-width: 0;
    max-width: 100%;
    border-radius: 1rem !important;
  }
}

@media (max-width: 340px) {
  .auth-shell__container { padding-inline: 0.75rem; }
  .auth-shell__header { gap: 0.5rem; }
  .auth-shell__header img { max-width: 7rem; }
  .auth-panel { padding: 1.125rem !important; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-panel .ui-input {
    transition: none;
  }
}
