/*
 * Account, Messages and setup flow styles.
 *
 * The same markup powers several states, so these rules give each state the
 * polished app-web treatment without changing the small state machines.
 */

.card--auth .state,
.card--setup .state {
  width: min(100%, 380px);
  margin-inline: auto;
}

.card--wide > #state-loading,
.card--wide > #state-unavailable,
.card--wide > #state-auth {
  width: min(100%, 500px);
  margin: clamp(18px, 4vw, 38px) auto 0;
  padding: clamp(26px, 4vw, 42px) clamp(24px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  text-align: center;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(26px) saturate(128%);
}

.card--auth form,
.card--setup form {
  margin-top: 22px;
  text-align: left;
}

.field-label {
  display: block;
  margin: 0.86rem 0 0.34rem;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 680;
}

.field-shell {
  position: relative;
}

#phone-form::before,
#code-form::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
  opacity: 0.78;
}

.field {
  width: 100%;
  height: 48px;
  padding: 0 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--field);
  color: var(--ink);
  font-size: 15px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.62) inset;
}

.field-shell .field {
  padding-left: 46px;
}

.field-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  width: 19px;
  height: 19px;
  color: #69779f;
  pointer-events: none;
  transform: translateY(-50%);
}

.field-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.field::placeholder {
  color: rgba(85, 101, 143, 0.52);
}

.field:focus {
  border-color: rgba(72, 99, 178, 0.58);
  background: var(--field-focus);
  outline: none;
  box-shadow: 0 0 0 4px rgba(107, 141, 246, 0.12), 0 1px 0 rgba(255, 255, 255, 0.86) inset;
}

.state form .button,
#phone-form .button,
#code-form .button {
  width: 100%;
  margin-top: 1rem;
}

.google-button {
  width: 100%;
  min-height: 48px;
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 11px 16px;
  border: 1px solid rgba(24, 31, 52, 0.16);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.7);
  color: #101522;
  cursor: pointer;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 570;
  box-shadow: 0 12px 28px rgba(42, 60, 98, 0.08), 0 1px 0 rgba(255, 255, 255, 0.82) inset;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.google-button:hover {
  border-color: rgba(24, 31, 52, 0.26);
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(42, 60, 98, 0.12), 0 1px 0 rgba(255, 255, 255, 0.86) inset;
}

.google-button:active { transform: translateY(0); }
.google-button:disabled { cursor: wait; opacity: 0.62; transform: none; }

.google-mark {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: block;
}

.google-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.auth-divider {
  margin: 18px 0 4px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  color: #7b88aa;
  font-size: 0.78rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.auth-switch {
  margin: 16px 0 0;
  color: #65739b;
  font-size: 0.88rem;
  text-align: center;
}

.error {
  margin: 0.7rem 0 0;
  color: var(--danger);
  font-size: 0.84rem;
  text-align: left;
}

.spinner {
  width: 42px;
  height: 42px;
  margin: 22px auto 0;
  border: 3px solid rgba(114, 135, 180, 0.18);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: nem-spin 0.8s linear infinite;
}

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

.stepper {
  width: min(100%, 380px);
  margin: 0 auto 30px;
  display: grid;
  grid-template-columns: 38px 1fr 38px 1fr 38px;
  align-items: center;
  gap: 12px;
}

.step {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(104, 126, 179, 0.38);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.46);
  color: #3c496d;
  font-weight: 650;
}

.step.is-active {
  border-color: transparent;
  background: radial-gradient(circle at 40% 32%, #eef3ff, #dbe6ff);
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(107, 141, 246, 0.2);
}

.stepper i {
  height: 1px;
  display: block;
  background: var(--line);
}

.block {
  margin-top: 20px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
  box-shadow: 0 18px 48px rgba(40, 63, 110, 0.08);
  text-align: left;
}

.block-title {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 1.16rem;
  font-weight: 720;
  letter-spacing: -0.03em;
  text-transform: none;
}

.value {
  margin: 0 0 0.25rem;
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 560;
  letter-spacing: -0.02em;
}

#phone-verified,
#channel-connected,
#channel-absent {
  position: relative;
  min-height: 68px;
  padding-left: 88px;
}

#phone-verified::before,
#channel-connected::before,
#channel-absent::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(145deg, #f8fbff, #e7f0ff);
  box-shadow: 0 14px 34px rgba(71, 97, 143, 0.1);
}

#phone-verified::after,
#channel-absent::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 14px;
  width: 16px;
  height: 27px;
  border: 2.5px solid var(--ink);
  border-radius: 6px;
  box-shadow: inset 0 -4px 0 rgba(7, 13, 40, 0.08);
}

#channel-connected::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 18px;
  width: 26px;
  height: 20px;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
}

#channel-connected .value::after,
#phone-verified .value::after {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--positive-soft);
  color: var(--positive);
  font-size: 0.76rem;
  font-weight: 650;
  vertical-align: middle;
}

#phone-verified .value::after { content: "Verified"; }
#channel-connected .value::after { content: "Connected"; }

.block .actions {
  width: min(100%, 220px);
  margin-top: 14px;
}

.card--wide > .state > .note,
.card--wide #account-email {
  margin-top: 0;
  font-size: clamp(0.98rem, 1.35vw, 1.14rem);
}

.card--wide #state-account .block {
  width: min(100%, 780px);
}

.quote {
  margin: 0.65rem 0 0;
  padding: 0.8rem 0.9rem;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: rgba(246, 249, 255, 0.8);
  color: var(--ink);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

#state-auth .note:last-child,
.card--setup .state > .note:last-child,
.card--handoff .note,
.card--result .note {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; opacity: 0.7; }
}

@media (max-width: 720px) {
  .stepper {
    grid-template-columns: 34px 1fr 34px 1fr 34px;
    gap: 8px;
    margin-bottom: 24px;
  }
  .step {
    width: 34px;
    height: 34px;
  }
  .block {
    padding: 20px 18px;
  }
  #phone-verified,
  #channel-connected,
  #channel-absent {
    padding-left: 0;
    padding-top: 70px;
  }
  .block .actions { width: 100%; }
}
