/* ── Auth dialog (Figma 110:11771) ── */

@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@500;600;700&family=Rubik:wght@600;700&display=swap");

.dialog.dialog--auth {
  width: min(424px, calc(100vw - 32px));
  padding: 0;
  border: none;
  border-radius: 32px;
  background: transparent;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  overflow: visible;
}

.dialog.dialog--auth .dialog__body {
  padding: 0;
}

.dialog.dialog--auth::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
}

.auth-figma {
  --auth-surface: #151515;
  --auth-text: #fafafa;
  --auth-muted: #a1a1a1;
  --auth-line: rgba(255, 255, 255, 0.12);
  --auth-input-bg: rgba(29, 29, 29, 0.56);
  --auth-input-border: rgba(217, 217, 217, 0.16);
  --auth-accent: #8a66ff;
  --auth-accent-hover: #9b7aff;
  --auth-cta: #f07c2d;
  --auth-cta-hover: #f58a42;
  --auth-link: #73a6ff;
  --auth-segment-track: #191919;
  --auth-segment-active: #151515;
  --auth-segment-muted: #969fa8;
  --auth-footer: #616161;
  --auth-close: rgba(255, 255, 255, 0.45);
  --font-body: "Raleway", system-ui, -apple-system, sans-serif;
  --font-display: "Rubik", var(--font-body);

  position: relative;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 32px 32px 24px;
  border-radius: 32px;
  background: var(--auth-surface);
  color: var(--auth-text);
  font-family: var(--font-body);
}

.auth-figma__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--auth-close);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.auth-figma__close:hover {
  color: var(--auth-text);
  background: var(--auth-input-bg);
}

.auth-figma__logo {
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

.auth-figma__logo-img {
  display: block;
  height: 30px;
  width: auto;
}

.auth-figma__logo-img--dark {
  display: block;
}

.auth-figma__logo-img--light {
  display: none;
}

[data-theme="light"] .auth-figma__logo-img--dark,
:root:not([data-theme="dark"]) .auth-figma__logo-img--dark {
  display: none;
}

[data-theme="light"] .auth-figma__logo-img--light,
:root:not([data-theme="dark"]) .auth-figma__logo-img--light {
  display: block;
}

[data-theme="dark"] .auth-figma__logo-img--dark {
  display: block;
}

[data-theme="dark"] .auth-figma__logo-img--light {
  display: none;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .auth-figma__logo-img--dark {
    display: none;
  }

  :root:not([data-theme="dark"]) .auth-figma__logo-img--light {
    display: block;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-figma__logo-img--dark {
    display: block;
  }

  :root:not([data-theme="light"]) .auth-figma__logo-img--light {
    display: none;
  }
}

[data-theme="light"] .auth-figma,
:root:not([data-theme="dark"]) .auth-figma {
  --auth-surface: #ffffff;
  --auth-text: #12131a;
  --auth-muted: #626c77;
  --auth-line: rgba(18, 19, 26, 0.12);
  --auth-input-bg: rgba(127, 140, 153, 0.12);
  --auth-input-border: rgba(127, 140, 153, 0.2);
  --auth-segment-track: rgba(127, 140, 153, 0.12);
  --auth-segment-active: #ffffff;
  --auth-segment-muted: #969fa8;
  --auth-footer: #626c77;
  --auth-close: rgba(18, 19, 26, 0.45);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .auth-figma {
    --auth-surface: #ffffff;
    --auth-text: #12131a;
    --auth-muted: #626c77;
    --auth-line: rgba(18, 19, 26, 0.12);
    --auth-input-bg: rgba(127, 140, 153, 0.12);
    --auth-input-border: rgba(127, 140, 153, 0.2);
    --auth-segment-track: rgba(127, 140, 153, 0.12);
    --auth-segment-active: #ffffff;
    --auth-segment-muted: #969fa8;
    --auth-footer: #626c77;
    --auth-close: rgba(18, 19, 26, 0.45);
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-figma {
    --auth-surface: #151515;
    --auth-text: #fafafa;
    --auth-muted: #a1a1a1;
    --auth-line: rgba(255, 255, 255, 0.12);
    --auth-input-bg: rgba(29, 29, 29, 0.56);
    --auth-input-border: rgba(217, 217, 217, 0.16);
    --auth-segment-track: #191919;
    --auth-segment-active: #151515;
    --auth-segment-muted: #969fa8;
    --auth-footer: #616161;
    --auth-close: rgba(255, 255, 255, 0.45);
  }
}

[data-theme="dark"] .auth-figma {
  --auth-surface: #151515;
  --auth-text: #fafafa;
  --auth-muted: #a1a1a1;
  --auth-line: rgba(255, 255, 255, 0.12);
  --auth-input-bg: rgba(29, 29, 29, 0.56);
  --auth-input-border: rgba(217, 217, 217, 0.16);
  --auth-segment-track: #191919;
  --auth-segment-active: #151515;
  --auth-segment-muted: #969fa8;
  --auth-footer: #616161;
  --auth-close: rgba(255, 255, 255, 0.45);
}

.auth-figma__content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-figma__head {
  text-align: center;
}

.auth-figma__title {
  margin: 0 0 8px;
  font: 600 20px/28px var(--font-display, system-ui, sans-serif);
  letter-spacing: -0.01em;
  color: var(--auth-text);
}

.auth-figma__subtitle {
  margin: 0;
  font: 500 16px/24px var(--font-body, system-ui, sans-serif);
  color: var(--auth-muted);
}

.auth-figma__body {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.auth-figma__body-stack {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 24px;
}

/* Segment control (Figma 115:2514) — один трек + скользящий индикатор */
.auth-segment {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  width: 100%;
  padding: 4px;
  border-radius: 12px;
  background: var(--auth-segment-track);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  isolation: isolate;
}

.auth-segment__indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / 2);
  border-radius: 9px;
  background: var(--auth-segment-active);
  box-shadow: 0 1px 2px rgba(16, 25, 17, 0.1);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 0;
}

.auth-segment[data-active="telegram"] .auth-segment__indicator {
  transform: translateX(100%);
}

.auth-segment__btn {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 8px 22px;
  border: 0;
  border-radius: 9px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: var(--auth-segment-muted);
  font: 600 16px/24px var(--font-body, system-ui, sans-serif);
  text-align: center;
  cursor: pointer;
  box-shadow: none;
  transition: color 0.15s ease;
}

.auth-segment__btn:hover:not(.is-active) {
  color: var(--auth-text);
}

.auth-segment__btn.is-active {
  background: transparent;
  color: var(--auth-text);
  box-shadow: none;
}

.auth-figma__panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 0;
}

.auth-figma__panel--step {
  gap: 14px;
}

.auth-figma__step-note {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--auth-muted);
}

.auth-figma__step-note strong {
  color: var(--auth-text);
  font-weight: 600;
}

.auth-figma__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-figma__label {
  display: block;
  margin: 0;
  padding: 0 12px;
  font: 500 14px/20px var(--font-body, system-ui, sans-serif);
  color: var(--auth-muted);
}

.auth-figma__input-wrap {
  display: block;
}

.auth-figma__input {
  width: 100%;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--auth-input-border);
  border-radius: 20px;
  background: var(--auth-input-bg);
  color: var(--auth-text);
  font: 400 17px/24px var(--font-body, system-ui, sans-serif);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-figma__input::placeholder {
  color: var(--auth-muted);
  opacity: 0.7;
}

.auth-figma__input:focus {
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 3px rgba(138, 102, 255, 0.2);
}

.dialog.dialog--auth .auth-figma__input {
  width: 100%;
  margin-top: 0;
  padding: 16px;
  border-color: var(--auth-input-border);
  border-radius: 20px;
  background: var(--auth-input-bg);
  color: var(--auth-text);
  font-size: 17px;
  line-height: 24px;
}

.auth-figma__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 14px 16px;
  border: 0;
  border-radius: 24px;
  background: var(--auth-cta);
  color: #ffffff;
  font: 700 17px/24px var(--font-body, system-ui, sans-serif);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.auth-figma__submit:hover:not(:disabled) {
  background: var(--auth-cta-hover);
}

.auth-figma__submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

.auth-figma__link {
  align-self: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--auth-link);
  font: 500 14px/20px var(--font-body, system-ui, sans-serif);
  cursor: pointer;
  text-decoration: none;
}

.auth-figma__link:hover {
  text-decoration: underline;
}

.auth-figma__link--muted {
  color: var(--auth-muted);
  font-weight: 500;
}

.auth-figma__link--muted:hover {
  color: var(--auth-text);
}

.auth-figma--code-step .auth-figma__head--code {
  text-align: center;
}

.auth-figma__title--code {
  font: 600 20px/28px var(--font-display, system-ui, sans-serif);
}

.auth-figma__panel--code {
  gap: 20px;
  align-items: stretch;
}

/* OTP (Figma 111:2539) */
.auth-otp {
  --auth-otp-success: #5cb85c;
  --auth-otp-error: #e05252;
  --auth-otp-focus: var(--auth-cta);

  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.auth-otp__field {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0 0;
  cursor: text;
}

.auth-otp__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
}

.auth-otp__cells {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  justify-content: center;
}

.auth-otp__cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 32px;
  height: 48px;
  gap: 8px;
}

.auth-otp__digit {
  min-height: 28px;
  color: var(--auth-text);
  font: 400 17px/28px var(--font-body, system-ui, sans-serif);
  text-align: center;
}

.auth-otp__cell.is-filled .auth-otp__digit,
.auth-otp__cell.is-success .auth-otp__digit {
  font-size: 20px;
  font-weight: 500;
  line-height: 28px;
}

.auth-otp__caret {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 24px;
  margin: -14px 0 0 -1px;
  border-radius: 2px;
  background: var(--auth-otp-focus);
  animation: auth-otp-caret 1s step-end infinite;
}

@keyframes auth-otp-caret {
  50% {
    opacity: 0;
  }
}

.auth-otp__line {
  display: block;
  width: 32px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.16);
}

[data-theme="light"] .auth-otp__line,
:root:not([data-theme="dark"]) .auth-otp__line {
  background: rgba(18, 19, 26, 0.16);
}

.auth-otp__cell.is-active .auth-otp__line {
  background: var(--auth-otp-focus);
}

.auth-otp__cell.is-filled .auth-otp__line {
  background: var(--auth-muted);
  opacity: 0.45;
}

.auth-otp__cell.is-success .auth-otp__line,
.auth-otp.is-verifying .auth-otp__cell.is-filled .auth-otp__line {
  background: var(--auth-otp-success);
  opacity: 1;
}

.auth-otp.is-error .auth-otp__cell .auth-otp__line,
.auth-otp__cell.is-error .auth-otp__line {
  background: var(--auth-otp-error);
  opacity: 1;
}

.auth-otp.is-error .auth-otp__digit {
  color: var(--auth-otp-error);
}

.auth-otp__spinner {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: 2px solid var(--auth-line);
  border-top-color: var(--auth-otp-focus);
  border-radius: 50%;
  animation: auth-otp-spin 0.8s linear infinite;
}

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

.auth-otp__error {
  margin: 0;
  text-align: center;
  color: var(--auth-otp-error);
  font: 500 14px/1.4 var(--font-body, system-ui, sans-serif);
}

.auth-otp__resend {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: 0;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  color: var(--auth-text);
  font: 600 17px/1.35 var(--font-body, system-ui, sans-serif);
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
}

[data-theme="light"] .auth-otp__resend,
:root:not([data-theme="dark"]) .auth-otp__resend {
  background: rgba(18, 19, 26, 0.06);
}

.auth-otp__resend:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

[data-theme="light"] .auth-otp__resend:hover:not(:disabled),
:root:not([data-theme="dark"]) .auth-otp__resend:hover:not(:disabled) {
  background: rgba(18, 19, 26, 0.1);
}

.auth-otp__resend:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.auth-figma__footer {
  margin: 0;
  padding: 0 8px;
  text-align: center;
  font: 500 14px/20px var(--font-body, system-ui, sans-serif);
  color: var(--auth-footer, #616161);
}

.auth-figma__footer a {
  color: var(--auth-link);
  text-decoration: none;
}

.auth-figma__footer a:hover {
  text-decoration: underline;
}

.auth-link {
  display: inline-block;
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--auth-accent);
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
}

.auth-dev-hint {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff6bd;
  border: 1px solid #e0c74b;
  font-size: 13px;
  color: #5c4a00;
}

.auth-form-error {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff0f0;
  border: 1px solid #e8a0a0;
  color: #8b1a1a;
  font-size: 14px;
  line-height: 1.45;
}

.auth-form-error__action {
  display: inline-block;
  margin-top: 8px;
  font-weight: 600;
}

/* Toast поверх native <dialog> (top layer) */
.toast.is-visible {
  z-index: 2147483647;
}

/* Legacy auth (unused in dialog, kept for account pages) */
.auth-dialog__tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tab {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: var(--font-body-sm);
  cursor: pointer;
}

.auth-tab.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.auth-hint,
.auth-note {
  margin: 0 0 14px;
  font-size: 14px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

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

.auth-social {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.auth-social__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--control-tertiary);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
}

.auth-social__btn:hover {
  background: var(--control-tertiary-hover);
}

.vk-oauth-container[hidden] {
  display: none !important;
}

.vk-oauth-container {
  min-height: 44px;
  margin-bottom: 10px;
}

body[data-vk-auth-hidden="1"] [class*="FloatingOneTap"],
body[data-vk-auth-hidden="1"] [class*="floatingOneTap"],
body[data-vk-auth-hidden="1"] iframe[src*="id.vk.ru"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.vk-oauth-container:empty {
  display: none;
}

.auth-social__btn--yandex {
  border-color: #fc3f1d;
  color: #fc3f1d;
}

.auth-social__btn--google {
  border-color: #4285f4;
  color: #4285f4;
}

.auth-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}
/* Pricing */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

@media (max-width: 960px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }
}

.pricing-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.pricing-card.is-current {
  border-color: var(--accent-strong);
  box-shadow: var(--shadow);
}

.pricing-card.is-featured {
  background: linear-gradient(180deg, rgba(255, 240, 107, 0.22), rgba(255, 255, 255, 0.72));
}

.pricing-card__badge {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.pricing-card__price {
  font: var(--font-large);
  letter-spacing: -0.03em;
}

.pricing-card__price small {
  font: var(--font-caption);
  color: var(--muted);
}

.pricing-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.pricing-card ul li {
  margin-bottom: 6px;
}

.pricing-card__actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Account */
.account-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  margin-top: 24px;
}

@media (max-width: 900px) {
  .account-grid {
    grid-template-columns: 1fr;
  }
}

.account-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.account-card h2 {
  margin: 0 0 12px;
  font: var(--font-headline);
}

.account-meta {
  display: grid;
  gap: 10px;
  margin: 0;
}

.account-meta dt {
  color: var(--muted);
  font-size: 13px;
}

.account-meta dd {
  margin: 0 0 8px;
  font-weight: 600;
}

.account-limits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.limit-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  font-size: 13px;
}

.limit-pill.is-ok {
  border-color: rgba(111, 146, 119, 0.35);
  color: var(--green);
}

.limit-pill.is-warn {
  border-color: rgba(234, 219, 48, 0.6);
}

/* Изоляция auth от глобальных .dialog / styles.css */
.dialog.dialog--auth {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: inherit;
}

.dialog.dialog--auth::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
}

.dialog.dialog--auth label.auth-figma__label {
  margin: 0;
  font-weight: 500;
}

.dialog.dialog--auth .auth-figma__input {
  margin-top: 0;
  background: var(--auth-input-bg) !important;
  border-color: var(--auth-input-border) !important;
  color: var(--auth-text) !important;
}

.dialog.dialog--auth .auth-segment {
  background: var(--auth-segment-track) !important;
}

.dialog.dialog--auth .auth-segment__indicator {
  background: var(--auth-segment-active) !important;
  box-shadow: 0 1px 2px rgba(16, 25, 17, 0.1) !important;
}

.dialog.dialog--auth .auth-segment__btn {
  appearance: none !important;
  -webkit-appearance: none !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  min-height: 0 !important;
  font-family: "Raleway", system-ui, sans-serif !important;
  font-weight: 600 !important;
  font-size: 16px !important;
  line-height: 24px !important;
}

.dialog.dialog--auth .auth-segment__btn.is-active {
  background: transparent !important;
  color: var(--auth-text) !important;
  box-shadow: none !important;
}

.dialog.dialog--auth .auth-segment__btn:not(.is-active) {
  color: var(--auth-segment-muted) !important;
}

.dialog.dialog--auth .auth-figma__submit {
  background: #f07c2d;
  color: #fff;
  font-weight: 700;
}

.dialog.dialog--auth .auth-figma__submit:hover:not(:disabled) {
  background: #f58a42;
}
