/* Yandex account dialogs: one scroll surface, with a separate type-picker layer. */
:is(#modal-home-yandex-manage, #modal-home-yandex-account-type, #modal-home-yandex-connect) {
  align-items: center;
  padding: 24px 16px;
  background: color-mix(in srgb, var(--color-forest) 28%, transparent);
}

.home-modal.home-modal--nested { z-index: 101; }

:is(#modal-home-yandex-manage, #modal-home-yandex-account-type, #modal-home-yandex-connect) .home-modal__box {
  box-sizing: border-box;
  width: min(640px, calc(100vw - 32px));
  max-height: calc(var(--app-visual-height, 100dvh) - 48px);
  margin: auto;
  padding: 32px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card-lg);
  box-shadow: 0 24px 48px color-mix(in srgb, var(--color-forest) 18%, transparent);
}

#modal-home-yandex-manage .home-modal__box {
  width: min(720px, calc(100vw - 32px));
  background: var(--color-bg-subtle);
}

:is(#modal-home-yandex-manage, #modal-home-yandex-account-type) h3 {
  margin: 0 48px 24px 0;
  font-size: var(--text-4xl);
  line-height: 1.35;
}

:is(#home-yandex-manage-title, #home-yandex-account-type-title, #home-yandex-connect-title):focus {
  outline: none;
  box-shadow: none;
}

:is(#modal-home-yandex-manage, #modal-home-yandex-account-type, #modal-home-yandex-connect) .home-modal-close {
  top: 30px;
  right: 30px;
}

#modal-home-yandex-manage .home-yandex-manage-list {
  max-height: none;
  overflow: visible;
  padding: 0;
}

#modal-home-yandex-manage .home-yandex-manage-account {
  gap: 16px;
  padding: 24px;
  border-radius: var(--radius-card);
}

#modal-home-yandex-manage .home-yandex-manage-dot { background: var(--color-brand-text); }

.home-yandex-account-details {
  grid-column: 1 / -1;
  order: 1;
}

:is(.home-yandex-account-details, .home-yandex-billing-details, .home-yandex-project-details) summary {
  color: var(--color-text-muted);
  font-size: var(--text-base);
  cursor: pointer;
}

#modal-home-yandex-manage details.collapsible { border: 0; border-radius: 0; overflow: visible; }
#modal-home-yandex-manage details.collapsible > summary { padding: 4px 0; background: transparent; gap: 8px; justify-content: flex-start; }
#modal-home-yandex-manage details.collapsible > .collapsible-body { border: 0; padding: 0; }
#modal-home-yandex-manage details.collapsible .chevron { width: 16px; height: 16px; }

.home-yandex-account-details .home-yandex-manage-info { margin: 12px 0; }
.home-yandex-billing-details .home-manage-summary { margin: 12px 0 0; }
.home-yandex-project-details { margin-top: 18px; }
.home-yandex-project-details .home-manage-tip { margin-top: 12px; }


#modal-home-yandex-account-type .home-yandex-type-description {
  margin: 0 0 24px;
  color: var(--color-text-secondary);
  font-size: var(--text-lg);
  line-height: 1.55;
}

.home-yandex-type-description strong { overflow-wrap: anywhere; }
.home-yandex-type-choices { display: grid; gap: 12px; }

#modal-home-yandex-account-type .home-yandex-type-choice {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  margin: 0;
  padding: 18px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-element);
  cursor: pointer;
}

#modal-home-yandex-account-type .home-yandex-type-choice:has(input:checked) {
  border-color: var(--color-brand-text);
  background: var(--color-matcha-lighter);
}

#modal-home-yandex-account-type input[type="radio"] {
  appearance: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  padding: 0;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

#modal-home-yandex-account-type input[type="radio"]:checked {
  border: 6px solid var(--color-brand-text);
}

:is(.home-yandex-type-choice, .home-yandex-type-button):focus-visible,
.home-yandex-type-choice:has(input:focus-visible) {
  outline: 2px solid var(--color-brand-text);
  outline-offset: 3px;
}

.home-yandex-type-choice__text, .home-yandex-type-choice__price {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: var(--text-md);
  line-height: 1.45;
}

.home-yandex-type-choice strong {
  color: var(--color-text);
  font-size: var(--text-xl);
  font-weight: 700;
}

.home-yandex-type-choice__price { text-align: right; }
.home-yandex-type-choice__price strong { max-width: 140px; }

#modal-home-yandex-account-type .home-yandex-type-note {
  margin: 20px 0;
  padding: 14px;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-element);
  color: var(--color-text-secondary);
  font-size: var(--text-md);
  line-height: 1.5;
}

:is(#modal-home-yandex-account-type, #modal-home-yandex-connect) .home-modal__actions {
  display: flex;
  flex-flow: row nowrap;
  gap: 16px;
  margin-top: 20px;
}

:is(#modal-home-yandex-account-type, #modal-home-yandex-connect) .home-modal__actions .btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 52px;
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-xl);
}

#modal-home-yandex-connect .home-modal__box { gap: 16px; }
#modal-home-yandex-connect .home-connect-modal__top h3 { font-size: var(--text-4xl); }
#modal-home-yandex-connect :is(.home-connect-modal__description, .home-connect-hint p, .home-connect-step__body > span) {
  font-size: var(--text-lg);
  line-height: 1.5;
}
#modal-home-yandex-connect .home-connect-step__body strong { font-size: var(--text-xl); }
#modal-home-yandex-connect .home-connect-step { padding: 18px; }
#modal-home-yandex-connect .home-modal__actions { margin-top: 0; }

@media (max-width: 600px) {
  :is(#modal-home-yandex-manage, #modal-home-yandex-account-type, #modal-home-yandex-connect) .home-modal__box {
    padding: 24px 16px;
  }
  :is(#modal-home-yandex-manage, #modal-home-yandex-account-type) h3 { font-size: var(--text-3xl); }
  :is(#modal-home-yandex-manage, #modal-home-yandex-account-type) .home-modal-close { top: 20px; right: 16px; }
  #modal-home-yandex-manage .home-yandex-manage-account { padding: 18px 16px; gap: 12px; }
  #modal-home-yandex-manage .home-yandex-manage-danger { flex-wrap: wrap; }
  #modal-home-yandex-account-type .home-yandex-type-choice { grid-template-columns: 20px minmax(0, 1fr); padding: 14px; }
  .home-yandex-type-choice__price { grid-column: 2; text-align: left; flex-direction: row; flex-wrap: wrap; align-items: baseline; }
  .home-yandex-type-choice__price strong { max-width: none; }
  :is(#modal-home-yandex-account-type, #modal-home-yandex-connect) .home-modal__actions { gap: 8px; }
  :is(#modal-home-yandex-account-type, #modal-home-yandex-connect) .home-modal__actions .btn { padding: 12px 8px; font-size: var(--text-lg); }
}
