/* Аккаунт: вход/регистрация (auth-premium.html), личный кабинет (profile.html),
   детали заказа (purchase.html). */

/* ═════════ Вход ═════════ */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); /* minmax(0) — поля ввода не раздвигают колонки */
  gap: clamp(24px, 5vw, 80px);
  align-items: center;
  min-height: calc(100svh - var(--header-h) - 40px);
  padding-block: 32px 64px;
}
.auth__visual { position: relative; display: grid; gap: 22px; align-content: center; }
/* «Замочная скважина во вселенную» — fx/keyhole-portal.js */
.auth__portal { width: min(400px, 86%); aspect-ratio: 1; }
.portal { position: relative; }
.portal__canvas { position: absolute; inset: 0; display: block; }
.portal__key {
  position: absolute;
  left: 71%;
  top: 6%;
  width: 11%;
  aspect-ratio: 64 / 160;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 10px rgba(233, 207, 150, 0.25));
  transform: rotate(28deg);
  transform-origin: 50% 80%;
  transition: left 900ms var(--ease-out), top 900ms var(--ease-out), transform 900ms var(--ease-out), filter 600ms;
  animation: portal-key-float 6s ease-in-out infinite;
}
.portal__key svg { width: 100%; height: 100%; display: block; }
@keyframes portal-key-float {
  0%, 100% { translate: 0 0; }
  50% { translate: -4px -10px; }
}
/* ключ входит в скважину: кольцо — в круг, стержень — в прорезь; затем полный оборот */
.portal.is-open .portal__key {
  left: 44.5%;
  top: 35%;
  transform: rotate(0deg);
  animation: portal-key-turn 1.6s 0.9s var(--ease-out) both;
  filter: drop-shadow(0 0 14px rgba(11, 20, 16, 0.9)) drop-shadow(0 0 22px rgba(233, 207, 150, 0.6));
}
@keyframes portal-key-turn {
  0% { scale: 1 1; }
  50% { scale: -1 1; }
  100% { scale: 1 1; }
}
.portal.is-burst .portal__key { filter: drop-shadow(0 0 28px rgba(246, 231, 194, 0.9)); }
@media (prefers-reduced-motion: reduce) {
  .portal__key, .portal.is-open .portal__key { animation: none; transition: none; }
}
.auth__visual h1 { font-size: var(--fs-2xl); max-width: 14ch; }
.auth__visual p { color: var(--muted); max-width: 42ch; }
.auth__perks { display: grid; gap: 10px; }
.auth__perks li { display: flex; gap: 10px; align-items: center; color: var(--cream-dim); font-size: var(--fs-sm); }
.auth__perks svg { width: 18px; height: 18px; color: var(--foil-light); }

.auth__card { padding: clamp(24px, 4vw, 40px); display: grid; gap: 22px; min-width: 0; }
.auth__card .seg { width: 100%; }
.auth-form { display: grid; gap: 16px; animation: card-swap 0.4s var(--ease-out); }
.auth-form h2 { font-size: 1.9rem; }
.auth-form__sub { color: var(--muted); font-size: var(--fs-sm); margin-top: -8px; }
.auth-form__forgot { justify-self: end; font-size: var(--fs-sm); margin-top: -6px; }
.auth-form__back { justify-self: start; font-size: var(--fs-sm); text-decoration: none; }
.auth-form__legal { font-size: var(--fs-xs); color: var(--faint); text-align: center; }
.auth-form__legal a { color: var(--cream-dim); text-decoration: underline; text-decoration-color: var(--line); }
.auth-form__demo { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-radius: var(--r-sm); border: 1px dashed var(--line-strong); font-size: var(--fs-sm); color: var(--cream-dim); }
.auth-form__demo svg { width: 16px; height: 16px; color: var(--foil-light); }
.auth-form__demo strong { font-family: var(--font-display); letter-spacing: 0.2em; color: var(--foil-light); }

.code { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; max-width: 420px; }
.code__cell {
  width: 100%;
  min-width: 0;
  height: 58px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: rgba(7, 13, 10, 0.55);
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--foil-light);
  transition: border-color var(--t), box-shadow var(--t);
}
.code__cell:focus { outline: none; border-color: var(--foil); box-shadow: 0 0 0 4px rgba(201, 161, 90, 0.14); }

.auth-done { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 20px 0; }
.auth-done > svg { width: 48px; height: 48px; color: var(--foil-light); }
.auth-done p { color: var(--muted); }
.auth-done__actions { display: flex; gap: 10px; }

@keyframes card-swap { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; min-height: 0; padding-top: 16px; }
  .auth__visual { justify-items: center; text-align: center; order: 2; }
  .auth__portal { width: min(260px, 70%); }
  .auth__perks { justify-items: start; }
}

/* ═════════ Личный кабинет ═════════
   Одна колонка без карточек: разделы отделяют тонкие золотые линии,
   цифры — крупным Fraunces, всё остальное тихое. */

.me { max-width: 960px; padding-block: clamp(28px, 5vw, 56px) 48px; display: grid; gap: 0; }

.me__head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 22px; padding-bottom: 32px; }
.me__avatar {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  border: 1px solid var(--line-strong); color: var(--foil-light);
  background: radial-gradient(circle at 32% 26%, rgba(233, 207, 150, 0.22), transparent 42%), var(--bg-3);
  font-family: var(--font-display); font-size: 1.4rem;
}
.me__who { display: grid; gap: 6px; min-width: 0; }
.me__who .eyebrow { margin: 0; }
.me__who h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); line-height: 1.05; overflow: hidden; text-overflow: ellipsis; }
.me__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); font-size: var(--fs-sm); }
.me__meta > span:empty { display: none; }
.me__meta > span + span::before { content: "·"; margin-right: 14px; color: var(--faint); }
.me__id {
  display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none;
  color: var(--faint); font: inherit; font-size: var(--fs-sm); cursor: pointer;
}
.me__id strong { color: var(--foil-light); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.92em; letter-spacing: 0.04em; font-weight: 500; }
.me__id svg { width: 14px; height: 14px; opacity: 0.7; }
.me__id:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.me__id[hidden] { display: none; }
.me__id:focus-visible, .me__logout:focus-visible, .me__link:focus-visible { outline: 2px solid var(--foil); outline-offset: 4px; border-radius: 6px; }
.me__logout { display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.me__logout svg { width: 16px; height: 16px; }
.me__logout:hover { color: var(--cream); }

/* баланс · уровень · пополнено — одна строка, разделители-волоски */
.ledger { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid var(--line); }
.ledger__item { display: grid; align-content: start; gap: 10px; padding: 28px 28px 30px; min-width: 0; }
.ledger__item:first-child { padding-left: 0; }
.ledger__item:last-child { padding-right: 0; }
.ledger__item + .ledger__item { border-left: 1px solid var(--line-soft); }
.ledger__label { font-size: var(--fs-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.ledger__value { font-family: var(--font-display); font-size: clamp(2rem, 1.5rem + 1.6vw, 2.6rem); font-weight: 600; line-height: 1; color: var(--foil-light); font-variant-numeric: tabular-nums; }
.ledger__value--plain { color: var(--cream); }
.ledger__note { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.ledger__item .btn { justify-self: start; margin-top: 6px; }
.tier-line { height: 2px; background: var(--line-soft); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.tier-line span { display: block; width: var(--p, 0%); height: 100%; background: var(--foil-sheen); transition: width 1.2s var(--ease-out); }
.perks { display: grid; gap: 4px; margin-top: 2px; }
.perks li { font-size: var(--fs-xs); color: var(--muted); }

/* разделы ниже */
.me__section { padding-block: 34px; border-bottom: 1px solid var(--line-soft); }
.me__section:last-child { border-bottom: 0; }
.me__section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.me__section-head h2 { font-size: var(--fs-2xl); }
.me__section-head span { font-size: var(--fs-sm); color: var(--faint); }

.orders { display: grid; }
.orders__tabs { display: flex; flex-wrap: wrap; gap: 4px 26px; margin-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.otab {
  position: relative; display: inline-flex; align-items: baseline; gap: 6px; padding: 10px 0 12px;
  border: 0; background: none; color: var(--muted); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
}
.otab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--foil-sheen); transform: scaleX(0); transform-origin: left; transition: transform var(--t) var(--ease-out); }
.otab[aria-pressed="true"] { color: var(--cream); }
.otab[aria-pressed="true"]::after { transform: scaleX(1); }
.otab:hover { color: var(--cream); }
.otab:focus-visible { outline: 2px solid var(--foil); outline-offset: 2px; border-radius: 4px; }
.otab__count { font-size: var(--fs-xs); color: var(--faint); font-weight: 500; font-variant-numeric: tabular-nums; }

.order {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 16px 4px; border-bottom: 1px solid var(--line-soft); transition: background var(--t-fast);
}
.order:last-of-type { border-bottom: 0; }
.order:hover { background: linear-gradient(90deg, transparent, rgba(244, 234, 217, 0.035), transparent); }
.order:hover .order__title { color: var(--foil-light); }
.order__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--bg-3); border: 1px solid var(--line-soft); color: var(--foil-light); }
.order__icon img { width: 20px; height: 20px; filter: brightness(0) invert(1); opacity: 0.9; }
.order__icon svg { width: 18px; height: 18px; }
.order__main { display: grid; gap: 3px; min-width: 0; }
.order__title { font-weight: 600; font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color var(--t-fast); }
.order__meta { font-size: var(--fs-xs); color: var(--faint); }
.order__side { display: grid; justify-items: end; gap: 4px; }
.order__total { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--cream); white-space: nowrap; font-variant-numeric: tabular-nums; }
.order__status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--faint); }
.order__status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.order__status.is-active { color: var(--emerald-light); }
.order__status.is-done { color: var(--foil); }
.order.has-unread .order__title { color: var(--cream); }
.order__unread { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: #6fd3a8; }
.order__unread svg { width: 13px; height: 13px; }
.orders__more { justify-self: center; margin-top: 16px; }
.orders__empty { padding: 26px 4px; color: var(--faint); font-size: var(--fs-sm); text-align: center; }

.me__help { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; }
.me__help > p { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: var(--fs-sm); }
.me__help svg { width: 18px; height: 18px; color: var(--foil-light); }
.me__link { display: inline-flex; align-items: center; gap: 10px; color: var(--cream); font-weight: 600; font-size: var(--fs-sm); }
.me__link svg:last-child { width: 16px; height: 16px; transition: transform var(--t) var(--ease-out); }
.me__link:hover svg:last-child { transform: translateX(4px); }
.me__help .chat-archive { flex-basis: 100%; }

.chat {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: 460px;
  min-height: 220px;
  overflow-y: auto;
  padding: 6px 4px 6px 0;
  scroll-behavior: smooth;
}
.chat__day { justify-self: center; font-size: 11px; color: var(--faint); letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 0; }
.chat__msg { max-width: 86%; padding: 12px 16px; border-radius: 18px; font-size: var(--fs-sm); line-height: 1.5; animation: slide-up var(--t) var(--ease-out); }
.chat__msg p { white-space: pre-wrap; word-break: break-word; }
.chat__msg--manager { justify-self: start; border-bottom-left-radius: 6px; background: linear-gradient(160deg, rgba(31, 94, 70, 0.45), rgba(19, 36, 29, 0.85)); border: 1px solid rgba(63, 184, 134, 0.25); }
.chat__msg--me { justify-self: end; border-bottom-right-radius: 6px; background: rgba(201, 161, 90, 0.12); border: 1px solid var(--line); }
.chat__time { display: block; margin-top: 6px; font-size: 11px; color: var(--faint); }
.chip__count { margin-left: 6px; padding: 0 7px; border-radius: 999px; background: rgba(244, 234, 217, 0.08); font-size: 11px; font-variant-numeric: tabular-nums; }
.chat-archive { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.chat-archive summary { cursor: pointer; font-size: var(--fs-xs); color: var(--faint); }
.chat-archive .chat { margin-top: 12px; min-height: 0; max-height: 320px; }
.chat-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line-soft); font-size: var(--fs-xs); color: var(--faint); }

@media (max-width: 860px) {
  .me__head { grid-template-columns: auto minmax(0, 1fr); }
  .me__logout { grid-column: 1 / -1; justify-self: start; }
  .me__meta { display: grid; gap: 2px; }
  .me__meta > span + span::before { content: none; }
  .me__id { justify-self: start; margin-top: 4px; }
  .ledger { grid-template-columns: minmax(0, 1fr); }
  .ledger__item { padding: 24px 0; }
  .ledger__item + .ledger__item { border-left: 0; border-top: 1px solid var(--line-soft); }
  .order { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; }
  .order__icon { width: 36px; height: 36px; }
}

/* ═════════ Детали заказа ═════════ */

.receipt-page { padding-block: 40px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.receipt-page > .skeleton, .receipt-page > .empty { grid-column: 1 / -1; justify-self: center; }
.receipt { display: grid; gap: 18px; text-align: left; overflow: hidden; }
.receipt__seal {
  display: grid;
  place-items: center;
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--bg-3);
  color: var(--foil-light);
  box-shadow: 0 0 40px rgba(201, 161, 90, 0.25);
}
.receipt__seal svg { width: 30px; height: 30px; }
.receipt h1 { font-size: var(--fs-2xl); }
.receipt__meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0; padding: 16px 0; border-block: 1px solid var(--line-soft); }
.receipt__meta dt { font-size: var(--fs-xs); color: var(--faint); text-transform: uppercase; letter-spacing: 0.1em; }
.receipt__meta dd { margin: 4px 0 0; font-size: var(--fs-sm); word-break: break-all; }
.receipt__items { display: grid; gap: 10px; }
.receipt__items li { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; }
.receipt__item-main { display: grid; gap: 2px; }
.receipt__item-main small { color: var(--faint); font-size: var(--fs-xs); }
.receipt__price { font-weight: 700; color: var(--foil-light); white-space: nowrap; }
.receipt__total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.receipt__total strong { font-family: var(--font-display); font-size: 1.8rem; color: var(--foil-light); }
.receipt__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.receipt__support { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--faint); transition: color var(--t-fast); }
.receipt__support svg { width: 16px; height: 16px; }
.receipt__support:hover { color: var(--cream); }
@media (max-width: 560px) { .receipt__meta { grid-template-columns: 1fr; } }

/* ── Чат по заказу ── */
.ochat {
  position: sticky;
  top: calc(var(--header-h) + 18px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  height: min(640px, calc(100dvh - var(--header-h) - 60px));
  min-height: 420px;
  padding: 0;
  overflow: hidden;
}
.ochat__head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); background: linear-gradient(180deg, rgba(31, 94, 70, 0.28), transparent); }
.ochat__avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-strong); color: var(--foil-light); background: var(--bg-3); }
.ochat__avatar svg { width: 20px; height: 20px; }
.ochat__who { display: grid; gap: 2px; }
.ochat__who strong { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.ochat__who small { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-xs); color: var(--faint); }
.ochat__pulse { width: 7px; height: 7px; border-radius: 50%; background: #3fb886; box-shadow: 0 0 0 0 rgba(63, 184, 134, 0.6); animation: ochat-pulse 2.4s infinite; }
@keyframes ochat-pulse { 70% { box-shadow: 0 0 0 7px rgba(63, 184, 134, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 184, 134, 0); } }
.ochat__list { display: flex; flex-direction: column; gap: 10px; padding: 18px 16px 10px 20px; overflow-y: auto; overscroll-behavior: contain; }
.ochat__day { align-self: center; font-size: 11px; color: var(--faint); letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 0; }
.ochat__msg { max-width: 86%; padding: 11px 15px; border-radius: 18px; font-size: var(--fs-sm); line-height: 1.5; animation: slide-up var(--t) var(--ease-out); }
.ochat__msg p { white-space: pre-wrap; word-break: break-word; }
.ochat__msg--support { align-self: flex-start; border-bottom-left-radius: 6px; background: linear-gradient(160deg, rgba(31, 94, 70, 0.45), rgba(19, 36, 29, 0.85)); border: 1px solid rgba(63, 184, 134, 0.25); }
.ochat__msg--intro { border-style: dashed; background: rgba(31, 94, 70, 0.18); }
.ochat__msg--me { align-self: flex-end; border-bottom-right-radius: 6px; background: rgba(201, 161, 90, 0.13); border: 1px solid var(--line); }
.ochat__msg.is-pending { opacity: 0.6; }
.ochat__time { display: block; margin-top: 5px; font-size: 11px; color: var(--faint); }
.ochat__closed {
  align-self: stretch; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center;
  margin-top: 6px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line-strong); background: rgba(201, 161, 90, 0.08);
  font-size: var(--fs-sm); color: var(--cream-dim); animation: slide-up var(--t) var(--ease-out);
}
.ochat__closed svg { grid-row: span 2; width: 20px; height: 20px; color: var(--foil-light); }
.ochat__closed strong { color: var(--foil-light); }
.ochat__closed small { color: var(--faint); font-size: var(--fs-xs); }
.ochat__status { min-height: 0; padding: 0 20px; font-size: var(--fs-xs); color: #e08a7a; }
.ochat__status:not(:empty) { padding-block: 6px; }
.ochat__composer { display: flex; align-items: flex-end; gap: 10px; padding: 12px 14px 14px 16px; border-top: 1px solid var(--line-soft); background: rgba(11, 20, 16, 0.5); }
.ochat__input {
  flex: 1;
  min-height: 44px;
  max-height: 140px;
  padding: 11px 14px;
  resize: none;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--cream);
  font: inherit;
  font-size: var(--fs-sm);
  line-height: 1.45;
  transition: border-color var(--t), box-shadow var(--t);
}
.ochat__input::placeholder { color: var(--faint); }
.ochat__input:focus { outline: none; border-color: var(--foil); box-shadow: 0 0 0 4px rgba(201, 161, 90, 0.12); }
.ochat__send {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--foil-sheen);
  background-size: 200% 100%;
  color: var(--graphite-900, #101915);
  cursor: pointer;
  transition: background-position var(--t), transform var(--t-fast), opacity var(--t-fast);
}
.ochat__send:hover { background-position: 100% 0; }
.ochat__send:active { transform: scale(0.94); }
.ochat__send:disabled { opacity: 0.55; cursor: progress; }
.ochat__send svg { width: 18px; height: 18px; }
@media (max-width: 1000px) {
  .receipt-page { grid-template-columns: 1fr; }
  .ochat { position: relative; top: 0; height: min(560px, 78dvh); }
}

