/* KUB ERP — login split + splash v4.3 (compact) */

:root {
  --auth-hero-from: #0E6B5C;
  --auth-hero-to: #2bc793;
  --auth-hero-text: #ffffff;
  --auth-form-bg: #ffffff;
  --auth-form-text: #1a2420;
  --auth-form-muted: #7a8a84;
  --auth-form-line: rgba(14, 107, 92, 0.35);
  --auth-form-line-focus: #0E6B5C;
  --auth-accent: #0E6B5C;
  --auth-accent-deep: #084840;
  --auth-btn-grad-from: #0E6B5C;
  --auth-btn-grad-to: #2bc793;
  --auth-card-shadow: 0 24px 80px rgba(14, 107, 92, 0.18), 0 8px 24px rgba(28, 35, 33, 0.08);
  --auth-page-bg: #eef4f2;
  --auth-err: #e05252;
  --auth-radius: 24px;
  --font-display: 'Manrope', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

body.auth-page.dark {
  --auth-hero-from: #062820;
  --auth-hero-to: #0E6B5C;
  --auth-form-bg: #121a18;
  --auth-form-text: #e8edea;
  --auth-form-muted: #8a9e98;
  --auth-form-line: rgba(43, 199, 147, 0.35);
  --auth-form-line-focus: #2bc793;
  --auth-accent: #2bc793;
  --auth-accent-deep: #3fcba6;
  --auth-btn-grad-from: #0E6B5C;
  --auth-btn-grad-to: #2bc793;
  --auth-card-shadow: 0 32px 90px rgba(0, 0, 0, 0.55);
  --auth-page-bg: #080d0c;
}

body.auth-page.pure-black {
  --auth-hero-from: #000000;
  --auth-hero-to: #0a3d34;
  --auth-form-bg: #0a0a0a;
  --auth-form-text: #f5f5f5;
  --auth-form-muted: #888888;
  --auth-form-line: rgba(255, 255, 255, 0.2);
  --auth-form-line-focus: #2bc793;
  --auth-page-bg: #000000;
  --auth-card-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body.auth-page {
  font-family: var(--font-body);
  color: var(--auth-form-text);
  background: var(--auth-page-bg);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ═══ SPLASH (2 сек) ═══ */
.auth-splash {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--auth-hero-from) 0%, var(--auth-hero-to) 100%);
  transition: opacity 0.65s ease, visibility 0.65s ease;
}

.auth-splash-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-splash-glow {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.25) 0%, transparent 70%);
  animation: authSplashPulse 2s ease-in-out infinite;
}

@keyframes authSplashPulse {
  0%, 100% { transform: scale(0.85); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
}

.auth-splash-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  animation: authSplashIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes authSplashIn {
  from { opacity: 0; transform: scale(0.88) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-splash-ring {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 0 0 8px rgba(255, 255, 255, 0.12);
  animation: authRingSpin 2s ease-in-out infinite;
}

@keyframes authRingSpin {
  0%, 100% { box-shadow: 0 12px 40px rgba(0,0,0,0.15), 0 0 0 8px rgba(255,255,255,0.12); }
  50% { box-shadow: 0 16px 50px rgba(0,0,0,0.2), 0 0 0 14px rgba(255,255,255,0.08); }
}

.auth-splash-logo {
  width: 72px;
  height: auto;
  object-fit: contain;
}

.auth-splash-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.auth-splash-sub {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.82);
  margin-top: 6px;
  font-weight: 500;
}

/* ═══ THEME FLOAT ═══ */
.auth-theme-float {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10050;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: var(--auth-form-bg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.auth-theme-float:hover { transform: scale(1.06); }

.auth-theme-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.08);
}

.auth-theme-dot[data-theme-dot="default"] {
  background: linear-gradient(145deg, #fff 40%, #e8f4f0);
}

.auth-theme-dot[data-theme-dot="dark"] {
  background: linear-gradient(145deg, #1a5c4f, #0E6B5C);
  border-color: rgba(255, 255, 255, 0.15);
}

.auth-theme-dot[data-theme-dot="pure-black"] {
  background: radial-gradient(circle at 30% 30%, #444 0%, #000 70%);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ═══ STAGE ═══ */
.auth-stage {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s ease 0.1s, transform 0.6s ease 0.1s;
}

.auth-stage-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══ CARD (split) ═══ */
.auth-card {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  width: 100%;
  max-width: 860px;
  min-height: 460px;
  border-radius: var(--auth-radius);
  overflow: hidden;
  box-shadow: var(--auth-card-shadow);
  background: var(--auth-form-bg);
  border: 1px solid rgba(14, 107, 92, 0.08);
}

/* ── Hero left ── */
.auth-hero {
  position: relative;
  background: linear-gradient(155deg, var(--auth-hero-from) 0%, var(--auth-hero-to) 100%);
  color: var(--auth-hero-text);
  display: flex;
  align-items: center;
  padding: 32px 32px 32px 36px;
  overflow: hidden;
}

.auth-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.12), transparent 45%),
    radial-gradient(circle at 90% 10%, rgba(255,255,255,0.18), transparent 40%);
  pointer-events: none;
}

.auth-hero-content {
  position: relative;
  z-index: 2;
  max-width: 260px;
}

.auth-hero-welcome {
  font-size: 0.76rem;
  font-weight: 600;
  opacity: 0.88;
  margin-bottom: 14px;
}

.auth-hero-logo-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

.auth-hero-logo {
  width: 46px;
  height: auto;
  object-fit: contain;
}

.auth-hero-brand {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.auth-hero-desc {
  font-size: 0.78rem;
  line-height: 1.5;
  opacity: 0.9;
  margin-bottom: 16px;
}

.auth-hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.auth-hero-tags span {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.auth-hero-points {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-hero-points li {
  position: relative;
  padding-left: 14px;
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0.88;
  font-weight: 500;
}

.auth-hero-points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

/* Wavy divider (desktop — right edge of hero) */
.auth-wave {
  position: absolute;
  top: 0;
  right: -1px;
  width: 56px;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

.auth-wave-fill {
  fill: var(--auth-form-bg);
}

/* ── Form right ── */
.auth-form-side {
  position: relative;
  background: var(--auth-form-bg);
  padding: 32px 34px 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.auth-form-side::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 107, 92, 0.07) 0%, transparent 68%);
  pointer-events: none;
}

.auth-form-side::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--auth-accent), transparent 75%);
  opacity: 0.35;
  pointer-events: none;
}

.auth-form-head {
  position: relative;
  z-index: 1;
  margin-bottom: 18px;
}

.auth-form-kicker {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--auth-accent);
  opacity: 0.85;
  margin-bottom: 5px;
}

.auth-form-lead {
  font-size: 0.74rem;
  color: var(--auth-form-muted);
  line-height: 1.35;
  margin: -4px 0 12px;
  max-width: 28em;
}

.auth-form-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--auth-form-text);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.auth-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(14, 107, 92, 0.06);
  border: 1px solid rgba(14, 107, 92, 0.1);
}

body.auth-page.dark .auth-switch,
body.auth-page.pure-black .auth-switch {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.auth-switch-btn {
  border: none;
  background: transparent;
  color: var(--auth-form-muted);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-switch-btn.active {
  background: var(--auth-form-bg);
  color: var(--auth-accent-deep);
  box-shadow: 0 2px 10px rgba(14, 107, 92, 0.12);
}

body.auth-page.dark .auth-switch-btn.active,
body.auth-page.pure-black .auth-switch-btn.active {
  background: rgba(43, 199, 147, 0.15);
  color: var(--auth-accent-deep);
}

/* ── Underline inputs ── */
.auth-view { display: none; }
.auth-view.active { display: block; position: relative; z-index: 1; }

.auth-field { margin-bottom: 14px; }

.auth-field label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--auth-form-muted);
  margin-bottom: 5px;
}

.auth-line-wrap {
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--auth-form-line);
  transition: border-color 0.2s;
}

.auth-line-wrap:focus-within,
.auth-line-wrap.is-filled {
  border-color: var(--auth-form-line-focus);
}

.auth-line-wrap:focus-within {
  box-shadow: 0 4px 14px rgba(14, 107, 92, 0.06);
}

.auth-line-input {
  flex: 1;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--auth-form-text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 7px 32px 7px 0;
  outline: none;
}

.auth-line-input::placeholder {
  color: var(--auth-form-muted);
  opacity: 0.65;
  font-weight: 500;
}

.auth-line-check {
  position: absolute;
  right: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--auth-accent);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.auth-line-wrap.is-valid .auth-line-check {
  opacity: 1;
  transform: scale(1);
}

.auth-field-hint {
  margin: 4px 0 0;
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--auth-form-muted);
  opacity: 0.72;
  min-height: 0.95em;
  transition: color 0.15s;
}

.auth-field-hint.is-warn {
  color: var(--auth-accent);
  opacity: 0.9;
}

.auth-field-hint.is-ok {
  color: var(--auth-accent);
  opacity: 1;
}

.auth-trust-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 0;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--auth-form-muted);
  background: rgba(14, 107, 92, 0.05);
  border: 1px dashed rgba(14, 107, 92, 0.14);
}

.auth-trust-icon {
  font-size: 0.95em;
  line-height: 1;
}

.auth-field-password .auth-line-check { right: 32px; }

.auth-password-toggle {
  position: absolute;
  right: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  opacity: 0.5;
  padding: 4px;
  z-index: 1;
}

.auth-password-toggle:hover { opacity: 1; }

.auth-password-toggle .kub-icon-inline svg {
  width: 18px;
  height: 18px;
  display: block;
  color: var(--auth-form-muted);
}

.auth-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 12px;
}

.auth-grid-3 .auth-line-wrap { border-bottom-width: 2px; }

/* ── Buttons (pill) ── */
.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.auth-btn {
  width: 100%;
  padding: 11px 20px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, opacity 0.12s;
  border: none;
}

.auth-btn-primary {
  background: linear-gradient(135deg, var(--auth-btn-grad-from), var(--auth-btn-grad-to));
  color: #fff;
  box-shadow: 0 6px 20px rgba(14, 107, 92, 0.3);
}

.auth-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(14, 107, 92, 0.35);
}

.auth-btn-ghost {
  background: transparent;
  color: var(--auth-form-muted);
  border: 1.5px solid var(--auth-form-line);
  box-shadow: none;
}

.auth-btn-ghost:hover:not(:disabled) {
  border-color: var(--auth-accent);
  color: var(--auth-accent);
}

.auth-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.auth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.auth-alert {
  font-size: 12px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 14px;
}

.auth-alert.error {
  color: var(--auth-err);
  background: rgba(224, 82, 82, 0.1);
  border: 1px solid rgba(224, 82, 82, 0.2);
}

.auth-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}

.auth-step {
  height: 3px;
  flex: 1;
  border-radius: 2px;
  background: var(--auth-form-line);
  opacity: 0.5;
}

.auth-step.done,
.auth-step.curr {
  background: var(--auth-accent);
  opacity: 1;
}

.auth-step-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--auth-form-muted);
  white-space: nowrap;
}

.auth-success {
  text-align: center;
  padding: 12px 0;
}

.auth-success-ring {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--auth-btn-grad-from), var(--auth-btn-grad-to));
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-success-text {
  font-size: 0.85rem;
  color: var(--auth-form-muted);
  margin: 10px 0 20px;
  line-height: 1.55;
}

.auth-foot {
  margin-top: auto;
  padding-top: 16px;
  text-align: center;
  font-size: 10px;
  color: var(--auth-form-muted);
  opacity: 0.75;
}

/* ═══ MOBILE ═══ */
@media (max-width: 768px) {
  .auth-card {
    grid-template-columns: 1fr;
    max-width: 400px;
    min-height: auto;
  }

  .auth-hero {
    padding: 28px 22px 44px;
    text-align: center;
    justify-content: center;
  }

  .auth-hero-content {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .auth-hero-welcome { margin-bottom: 10px; }

  .auth-hero-logo-wrap {
    width: 64px;
    height: 64px;
    margin-bottom: 10px;
  }

  .auth-hero-logo { width: 42px; }

  .auth-hero-brand { font-size: 1.28rem; }

  .auth-hero-desc {
    font-size: 0.74rem;
    margin-bottom: 12px;
  }

  .auth-hero-tags { justify-content: center; }

  .auth-hero-points {
    align-items: center;
    text-align: left;
    max-width: 260px;
  }

  /* Wave at bottom of hero on mobile */
  .auth-wave { display: none; }

  .auth-hero::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 36px;
    background: var(--auth-form-bg);
    clip-path: ellipse(62% 100% at 50% 100%);
    z-index: 3;
  }

  .auth-form-side {
    padding: 22px 20px 18px;
    position: relative;
    z-index: 4;
  }

  .auth-form-title { font-size: 1.1rem; }

  .auth-theme-float {
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.92);
  }

  body.auth-page.dark .auth-theme-float,
  body.auth-page.pure-black .auth-theme-float {
    background: rgba(20, 20, 20, 0.9);
  }
}

@media (max-width: 380px) {
  .auth-form-side { padding: 18px 16px 16px; }
  .auth-hero { padding: 24px 18px 40px; }
}
