/* Экран входа ProcessDesk — из mockup-welcome-final */

html:has(.welcome-gate:not(.hidden)),
body:has(.welcome-gate:not(.hidden)) {
  height: 100%;
  overflow: hidden;
}

.welcome-gate {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  background: #0e1320;
}

.welcome-gate.hidden {
  display: none !important;
}

.welcome-split {
  display: grid;
  grid-template-columns: 1fr min(440px, 42%);
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
  align-items: stretch;
}

.welcome-hero {
  position: relative;
  padding: 22px 36px 18px;
  color: #e8edf5;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(160deg, #1a2540 0%, #12182a 50%, #0d1220 100%);
}

.welcome-hero .content {
  position: relative;
  z-index: 4;
  animation: welcomeHeroIn 0.55s ease both;
  max-width: min(100%, 680px);
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 8px;
}

.welcome-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.22rem, 2vw, 1.62rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.18;
  margin: 0 0 8px;
}

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

.welcome-hero-lead {
  color: #8b9bb8;
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0 0 10px;
  max-width: 26rem;
}

.welcome-aside {
  padding: 14px 20px;
  background: var(--paper);
  display: flex;
  align-items: flex-start;
  align-content: flex-start;
  min-height: 0;
  height: 100%;
  max-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.welcome-edges {
  margin-top: auto;
  padding: 18px 20px 12px;
  max-width: min(100%, 620px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--r);
  background: rgba(14, 20, 36, 0.62);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.32);
  position: relative;
  overflow: hidden;
  animation: welcomeHeroIn 0.65s ease 0.2s both;
}

.welcome-edges::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(120deg, rgba(52, 87, 213, 0.55), rgba(26, 166, 161, 0.4), rgba(52, 87, 213, 0.25));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  animation: welcome-edge-glow 4.5s ease-in-out infinite;
}

@keyframes welcome-edge-glow {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.95; }
}

.welcome-edges-kicker {
  margin: 0 0 12px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8b9bb8;
  font-weight: 600;
}

.welcome-edges-stage {
  position: relative;
  min-height: 88px;
}

.welcome-edge {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}

.welcome-edge.is-on {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.welcome-edge-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(52, 87, 213, 0.35);
}

.welcome-edge strong {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  color: #e8edf5;
}

.welcome-edge p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: #8b9bb8;
}

.welcome-edges-nav {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  justify-content: flex-start;
}

.welcome-edges-nav button {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.welcome-edges-nav button.is-on {
  background: var(--teal);
  transform: scale(1.25);
  box-shadow: 0 0 8px rgba(26, 166, 161, 0.55);
}

.welcome-edges-nav button:hover {
  background: rgba(158, 184, 255, 0.75);
}

.welcome-edges-ticker {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.welcome-edges-ticker-track {
  display: flex;
  gap: 20px;
  width: max-content;
  animation: welcome-edges-marquee 28s linear infinite;
}

.welcome-edges-ticker-track span {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: rgba(158, 184, 255, 0.85);
  white-space: nowrap;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

@keyframes welcome-edges-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.welcome-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 18px 20px 10px;
  width: 100%;
  animation: welcomeCardIn 0.5s ease 0.08s both;
}

.welcome-card-title {
  margin: 0 0 4px;
  font-size: 1.28rem;
}

.welcome-card .auth-field {
  margin-bottom: 8px;
}
.welcome-card .auth-field input {
  height: 38px;
}
.welcome-card .auth-submit {
  margin-top: 2px;
}

.welcome-forms {
  display: grid;
}

.welcome-forms > #authLoginPanel,
.welcome-forms > #authRegisterPanel {
  grid-area: 1 / 1;
  min-width: 0;
}

.welcome-forms > .hidden {
  display: block !important;
  visibility: hidden;
  pointer-events: none;
}

.welcome-forms form {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.welcome-forms .err {
  margin: 4px 0 0;
  min-height: 1.1em;
}

.welcome-tabs {
  display: flex;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.welcome-tabs button {
  flex: 1;
  border: 0;
  background: none;
  padding: 9px 8px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.22s ease;
}

.welcome-tabs button.on {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.welcome-trial {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(26, 166, 161, 0.08);
  border: 1px solid rgba(26, 166, 161, 0.25);
  border-radius: var(--r);
  font-size: 0.8rem;
  line-height: 1.35;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.welcome-trial:hover {
  background: rgba(26, 166, 161, 0.12);
  border-color: rgba(26, 166, 161, 0.35);
}

.welcome-trial strong {
  color: var(--teal);
  font-weight: 700;
}

.welcome-trial svg {
  flex-shrink: 0;
  color: var(--teal);
}

.welcome-support {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}
.welcome-support-label {
  margin: 0 0 4px;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}
.welcome-support p { margin: 0; }
.welcome-support a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
}
.welcome-support a:hover { text-decoration: underline; }

.welcome-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--muted);
}

.welcome-loading.hidden {
  display: none !important;
}

.welcome-loading::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: welcome-spin 0.7s linear infinite;
}

@keyframes welcome-spin {
  to { transform: rotate(360deg); }
}

/* ——— фон: сияние ——— */
.welcome-aurora {
  position: absolute;
  inset: -40%;
  z-index: 0;
  filter: blur(60px);
  opacity: 0.55;
  pointer-events: none;
}

.welcome-aurora-a {
  background: radial-gradient(circle, rgba(52, 87, 213, 0.45) 0%, transparent 55%);
  animation: welcome-aurora-a 14s ease-in-out infinite;
}

.welcome-aurora-b {
  background: radial-gradient(circle, rgba(26, 166, 161, 0.35) 0%, transparent 55%);
  animation: welcome-aurora-b 18s ease-in-out infinite;
}

.welcome-aurora-c {
  background: radial-gradient(circle, rgba(90, 120, 220, 0.22) 0%, transparent 50%);
  animation: welcome-aurora-c 22s ease-in-out infinite;
}

@keyframes welcome-aurora-a {
  0%, 100% { transform: translate(10%, 5%) scale(1); }
  33% { transform: translate(35%, 25%) scale(1.15); }
  66% { transform: translate(-5%, 40%) scale(0.9); }
}

@keyframes welcome-aurora-b {
  0%, 100% { transform: translate(50%, 30%) scale(1.1); }
  50% { transform: translate(15%, 60%) scale(0.85); }
}

@keyframes welcome-aurora-c {
  0%, 100% { transform: translate(70%, 10%) scale(0.9); }
  40% { transform: translate(30%, 50%) scale(1.2); }
  80% { transform: translate(60%, 70%) scale(1); }
}

.welcome-grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.04;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.welcome-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 70% at 30% 50%, transparent 40%, rgba(8, 12, 22, 0.65) 100%);
}

/* ——— созвездия ——— */
.welcome-stars {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.welcome-constellation {
  position: absolute;
  opacity: 0.85;
}

.welcome-constellation svg {
  width: 100%;
  height: 100%;
  display: block;
}

.welcome-constellation line {
  stroke-width: 1;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: welcome-const-draw 7s ease-in-out infinite;
}

.welcome-constellation circle {
  fill: rgba(255, 255, 255, 0.45);
  animation: welcome-star-pulse 5s ease-in-out infinite;
}

@keyframes welcome-const-draw {
  0%, 18% { stroke-dashoffset: 100; opacity: 0.25; }
  38%, 72% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0.25; }
}

@keyframes welcome-star-pulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.95; }
}

.welcome-constellation.c-main {
  top: 6%;
  right: 5%;
  width: 200px;
  height: 170px;
}

.welcome-constellation.c-main line { stroke: rgba(52, 87, 213, 0.22); }
.welcome-constellation.c-main line:nth-child(2) { stroke: rgba(26, 166, 161, 0.28); animation-delay: 0.7s; }
.welcome-constellation.c-main line:nth-child(3) { animation-delay: 1.4s; }
.welcome-constellation.c-main line:nth-child(4) { stroke: rgba(26, 166, 161, 0.2); animation-delay: 2.1s; }

.welcome-constellation.c-a {
  top: 14%;
  left: 8%;
  width: 120px;
  height: 100px;
  opacity: 0.45;
}

.welcome-constellation.c-a line { stroke: rgba(52, 87, 213, 0.15); animation-duration: 9s; animation-delay: 1s; }

.welcome-constellation.c-b {
  bottom: 12%;
  right: 18%;
  width: 140px;
  height: 110px;
  opacity: 0.35;
}

.welcome-constellation.c-b line { stroke: rgba(26, 166, 161, 0.14); animation-duration: 11s; animation-delay: 2s; }

.welcome-constellation.c-c {
  top: 42%;
  right: 28%;
  width: 90px;
  height: 80px;
  opacity: 0.28;
}

.welcome-constellation.c-c line { stroke: rgba(255, 255, 255, 0.1); animation-duration: 13s; }

.welcome-constellation.c-d {
  bottom: 28%;
  left: 12%;
  width: 100px;
  height: 90px;
  opacity: 0.3;
}

.welcome-sparks {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.welcome-spark {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--teal);
  border-radius: 50%;
  opacity: 0;
  animation: welcome-spark-rise 4.5s ease-in infinite;
}

.welcome-spark:nth-child(1) { left: 18%; animation-delay: 0s; }
.welcome-spark:nth-child(2) { left: 32%; animation-delay: 1.1s; }
.welcome-spark:nth-child(3) { left: 48%; animation-delay: 2.3s; }
.welcome-spark:nth-child(4) { left: 62%; animation-delay: 0.7s; }
.welcome-spark:nth-child(5) { left: 78%; animation-delay: 1.9s; }
.welcome-spark:nth-child(6) { left: 42%; animation-delay: 3.1s; }

@keyframes welcome-spark-rise {
  0% { bottom: -4px; opacity: 0; }
  12% { opacity: 0.85; }
  88% { opacity: 0.35; }
  100% { bottom: 100%; opacity: 0; }
}

/* ——— лестница слоёв ——— */
.welcome-ladder {
  --welcome-pulse-dur: 5s;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(100%, 680px);
  overflow: visible;
  padding-bottom: 10px;
}

.welcome-ladder::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: rgba(255, 255, 255, 0.06);
  z-index: 0;
}

.welcome-ladder::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 14px;
  width: 6px;
  height: 28px;
  border-radius: 3px;
  background: linear-gradient(180deg, transparent, var(--teal), var(--blue), transparent);
  filter: blur(1.5px);
  z-index: 1;
  animation: welcome-pulse-travel var(--welcome-pulse-dur) ease-in-out infinite;
}

@keyframes welcome-pulse-travel {
  0% { top: 14px; opacity: 0; }
  6% { opacity: 1; }
  92% { opacity: 1; }
  100% { top: calc(100% - 38px); opacity: 0; }
}

.welcome-step {
  display: grid;
  grid-template-columns: 36px minmax(0, 220px);
  gap: 12px;
  align-items: center;
  position: relative;
  overflow: visible;
  min-height: 72px;
}
.welcome-branch {
  position: absolute;
  left: calc(36px + 220px + 12px);
  top: 50%;
  display: flex;
  align-items: center;
  gap: 0;
  width: max(0px, calc(100% - 36px - 220px - 12px));
  max-width: 320px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-12px);
  transition: opacity 0.38s ease, transform 0.38s ease;
  z-index: 6;
}
.welcome-step:hover .welcome-branch,
.welcome-step.is-active .welcome-branch {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
  pointer-events: auto;
}
.welcome-branch-lines {
  width: 96px;
  height: 72px;
  flex-shrink: 0;
  overflow: visible;
}
.welcome-branch-path {
  fill: none;
  stroke: rgba(158, 184, 255, 0.55);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 0.55s ease;
}
.welcome-branch-path--b {
  stroke: rgba(26, 166, 161, 0.6);
  transition-delay: 0.1s;
}
.welcome-step:hover .welcome-branch-path,
.welcome-step.is-active .welcome-branch-path {
  stroke-dashoffset: 0;
}
.welcome-branch-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 168px;
}
.welcome-branch-card {
  box-sizing: border-box;
  padding: 7px 11px;
  border-radius: var(--r);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(4px);
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease, border-color 0.22s ease, background 0.22s ease;
}
.welcome-branch-card:nth-child(1) { transition-delay: 0.14s; }
.welcome-branch-card:nth-child(2) { transition-delay: 0.22s; }
.welcome-step:hover .welcome-branch-card,
.welcome-step.is-active .welcome-branch-card {
  opacity: 1;
  transform: translateX(0);
}
.welcome-branch-card strong {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #e8edf5;
}
.welcome-branch-card span {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  color: #8b9bb8;
  line-height: 1.35;
}
@media (max-width: 960px) {
  .welcome-branch { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .welcome-branch,
  .welcome-branch-path,
  .welcome-branch-card {
    transition: none !important;
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    stroke-dashoffset: 0 !important;
  }
  .welcome-branch { display: none; }
}


.welcome-node {
  width: 36px;
  height: 36px;
  border-radius: var(--r);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  position: relative;
  z-index: 2;
  background: rgba(52, 87, 213, 0.2);
  color: #9eb8ff;
  border: 1px solid rgba(52, 87, 213, 0.3);
}

.welcome-step-card {
  padding: 7px 10px;
  border-radius: var(--r);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.welcome-step:hover .welcome-step-card {
  transform: translateX(4px);
  border-color: rgba(255, 255, 255, 0.18);
}

.welcome-step-card b {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
}

.welcome-step-card span {
  font-size: 0.74rem;
  color: #8b9bb8;
}

.welcome-step:nth-child(1) .welcome-node { animation: welcome-node-glow var(--welcome-pulse-dur) ease-in-out infinite 0s; }
.welcome-step:nth-child(2) .welcome-node { animation: welcome-node-glow var(--welcome-pulse-dur) ease-in-out infinite 0.55s; }
.welcome-step:nth-child(3) .welcome-node { animation: welcome-node-glow var(--welcome-pulse-dur) ease-in-out infinite 1.1s; }
.welcome-step:nth-child(4) .welcome-node { animation: welcome-node-glow var(--welcome-pulse-dur) ease-in-out infinite 1.65s; }
.welcome-step:nth-child(5) .welcome-node { animation: welcome-node-glow var(--welcome-pulse-dur) ease-in-out infinite 2.2s; }
.welcome-step:nth-child(1) .welcome-step-card { animation: welcome-card-glow var(--welcome-pulse-dur) ease-in-out infinite 0s; }
.welcome-step:nth-child(2) .welcome-step-card { animation: welcome-card-glow var(--welcome-pulse-dur) ease-in-out infinite 0.55s; }
.welcome-step:nth-child(3) .welcome-step-card { animation: welcome-card-glow var(--welcome-pulse-dur) ease-in-out infinite 1.1s; }
.welcome-step:nth-child(4) .welcome-step-card { animation: welcome-card-glow var(--welcome-pulse-dur) ease-in-out infinite 1.65s; }
.welcome-step:nth-child(5) .welcome-step-card { animation: welcome-card-glow var(--welcome-pulse-dur) ease-in-out infinite 2.2s; }

@keyframes welcome-node-glow {
  0%, 12%, 100% { box-shadow: none; background: rgba(52, 87, 213, 0.2); color: #9eb8ff; }
  6% {
    box-shadow: 0 0 22px rgba(26, 166, 161, 0.65), 0 0 44px rgba(52, 87, 213, 0.35);
    background: rgba(26, 166, 161, 0.38);
    color: #fff;
  }
}

@keyframes welcome-card-glow {
  0%, 12%, 100% { border-color: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04); transform: none; }
  6% { border-color: rgba(26, 166, 161, 0.5); background: rgba(26, 166, 161, 0.1); transform: translateX(5px); }
}

.welcome-hero .brand-text strong {
  color: #fff;
}

.welcome-hero .brand-text em {
  color: #8b9bb8;
}

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

@keyframes welcomeCardIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 900px) {
  .welcome-gate {
    height: auto;
    max-height: none;
    overflow: auto;
  }

  .welcome-split {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .welcome-hero {
    max-height: none;
    height: auto;
  }

  .welcome-aside {
    max-height: none;
    height: auto;
  }

  .welcome-aside {
    border-top: 1px solid var(--line);
  }

  .welcome-stars {
    opacity: 0.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  .welcome-gate *,
  .welcome-gate *::before,
  .welcome-gate *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
