/* Страницы входа и активации — мобильная вёрстка */

@media (max-width: 719px) {
  body.auth-page {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #0f766e;
  }

  body.auth-page .auth-bg {
    animation: none;
    background-color: #0d4f4a;
    opacity: 0.55;
  }

  body.auth-page .auth-bg__shape {
    display: none;
  }

  body.auth-page .auth-sparks {
    display: none !important;
  }

  body.auth-page .auth-shell {
    align-items: stretch;
    justify-content: flex-start;
    min-height: 100dvh;
    padding: 0;
  }

  body.auth-page .auth-card {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    max-width: 100%;
    width: 100%;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    overflow: hidden;
  }

  body.auth-page .auth-card.auth-card--intro {
    animation-duration: 0.45s;
  }

  body.auth-page .auth-card__hero {
    display: none !important;
  }

  /* Брендовая шапка — заполняет верх экрана */
  body.auth-page .auth-mobile-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    text-align: center;
    position: relative;
    flex: 0 0 auto;
    min-height: clamp(200px, 34dvh, 300px);
    padding:
      max(20px, env(safe-area-inset-top, 0px))
      24px
      36px;
    color: #fff;
    overflow: hidden;
    background: linear-gradient(165deg, #14b8a6 0%, #0d9488 38%, #0f766e 72%, #115e59 100%);
  }

  body.auth-page .auth-mobile-hero__pattern {
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-opacity='0.35' d='M32 0H0v32'/%3E%3C/svg%3E");
    mask-image: linear-gradient(to bottom, #000 30%, transparent 100%);
  }

  body.auth-page .auth-mobile-hero__orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.12);
  }

  body.auth-page .auth-mobile-hero__orb--1 {
    width: 140px;
    height: 140px;
    top: -30px;
    right: -24px;
  }

  body.auth-page .auth-mobile-hero__orb--2 {
    width: 90px;
    height: 90px;
    bottom: 20%;
    left: -20px;
    background: rgba(255, 255, 255, 0.08);
  }

  body.auth-page .auth-logo--hero {
    position: relative;
    z-index: 1;
    width: 72px;
    height: 72px;
    margin: 0 0 14px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  body.auth-page .auth-logo--hero svg {
    width: 34px;
    height: 34px;
    fill: #fff;
  }

  body.auth-page .auth-mobile-hero__title {
    position: relative;
    z-index: 1;
    font-size: 1.625rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  }

  body.auth-page .auth-mobile-hero__sub {
    position: relative;
    z-index: 1;
    margin-top: 8px;
    max-width: 26ch;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.88);
    transition: opacity 0.35s ease;
  }

  /* Белый «лист» с формой */
  body.auth-page .auth-card__body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-top: -22px;
    padding: 22px 18px max(20px, env(safe-area-inset-bottom, 0px));
    background: var(--surface, #fff);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.12);
    position: relative;
    z-index: 2;
  }

  body.auth-page .auth-form-title {
    font-size: 1.125rem;
    margin-bottom: 2px;
  }

  body.auth-page .auth-form-lead {
    display: block;
    font-size: 0.8125rem;
    margin-bottom: 18px;
    color: var(--muted, #64748b);
    max-width: none;
  }

  body.auth-page .auth-form {
    gap: 16px;
    flex: 0 0 auto;
  }

  body.auth-page .field {
    gap: 8px;
  }

  body.auth-page .field-label {
    font-size: 0.875rem;
  }

  body.auth-page .field-wrap {
    min-height: 52px;
    border-radius: 12px;
  }

  body.auth-page .field-icon {
    width: 44px;
  }

  body.auth-page .field-input {
    min-height: 52px;
    font-size: 16px;
  }

  body.auth-page .field-pass .field-input {
    padding-right: 48px;
  }

  body.auth-page .btn-eye {
    width: 44px;
    height: 44px;
  }

  /* Блок возможностей — заполняет пространство между полями и кнопкой */
  body.auth-page .auth-mobile-perks {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    list-style: none;
    margin: 4px 0 6px;
    padding: 0;
  }

  body.auth-page .auth-mobile-perk {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    border-radius: 12px;
    background: linear-gradient(180deg, #f0fdfa 0%, #f8fafc 100%);
    border: 1px solid #ccfbf1;
    text-align: center;
  }

  body.auth-page .auth-mobile-perk__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #fff;
    color: #0d9488;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.12);
  }

  body.auth-page .auth-mobile-perk__label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #334155;
    line-height: 1.2;
  }

  body.auth-page .btn-submit {
    margin-top: 8px;
    min-height: 52px;
    font-size: 1rem;
    border-radius: 12px;
    position: static;
  }

  body.auth-page .auth-foot {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    font-size: 0.6875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }

  body.auth-page .auth-foot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  }

  body.auth-page .msg {
    margin-bottom: 12px;
    font-size: 0.8125rem;
  }

  body.auth-page .auth-login-overlay {
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  }

  body.auth-page .auth-login-overlay__inner {
    border-radius: 16px;
    padding: 24px 20px;
  }
}

/* Приглашение / активация владельца */
@media (max-width: 719px) {
  body.auth-setup-page {
    align-items: stretch;
    justify-content: flex-start;
    min-height: 100dvh;
    padding: 0;
    overflow-x: hidden;
    background: linear-gradient(165deg, #14b8a6 0%, #0f766e 100%);
  }

  body.auth-setup-page::before {
    content: 'МедСистема';
    display: block;
    text-align: center;
    color: #fff;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    padding: max(20px, env(safe-area-inset-top, 0px)) 20px 12px;
  }

  body.auth-setup-page .auth-setup-card {
    flex: 1;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    margin-top: auto;
    padding: 22px 18px max(24px, env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.12);
    min-height: min(72dvh, 640px);
    display: flex;
    flex-direction: column;
  }

  body.auth-setup-page .auth-setup-card h1 {
    font-size: 1.25rem;
    line-height: 1.3;
    margin-bottom: 8px;
  }

  body.auth-setup-page .auth-setup-card > p {
    font-size: 0.875rem;
    line-height: 1.45;
    color: #64748b;
    margin-bottom: 16px;
  }

  body.auth-setup-page #form {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  body.auth-setup-page label {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 12px 0 6px;
  }

  body.auth-setup-page input {
    min-height: 52px;
    font-size: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    border-color: #e2e8f0;
  }

  body.auth-setup-page button[type="submit"] {
    margin-top: auto;
    min-height: 52px;
    font-size: 1rem;
    border-radius: 12px;
    position: static;
  }

  body.auth-setup-page .msg {
    font-size: 0.875rem;
    line-height: 1.4;
  }
}

@media (max-width: 719px) and (prefers-reduced-motion: reduce) {
  body.auth-page .auth-card.auth-card--intro {
    animation: none !important;
  }
}
