/* Аккаунт: вход (auth-premium.html), кабинет (profile.html), заказ (purchase.html). */

/* ═════ Вход ═════ */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 6vw, 80px); align-items: center; min-height: calc(100svh - var(--header-h) - 60px); padding-block: 24px 48px; }
.auth__visual { display: grid; gap: 18px; justify-items: start; }
.auth__key { display: grid; place-items: center; width: clamp(96px, 11vw, 140px); height: auto; aspect-ratio: 1; border-radius: 28px; background: var(--surface-2); color: var(--accent); border: 1px solid var(--line); }
.auth__key svg { width: 58%; height: 58%; }
.auth__card { padding: clamp(22px, 4vw, 36px); display: grid; gap: 20px; min-width: 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: var(--r-sm); background: var(--bg-2); }
.seg__btn { height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 600; transition: background var(--t-fast), color var(--t-fast); }
.seg__btn[aria-selected="true"] { background: var(--surface-3); color: var(--text); }
.auth-form { display: grid; gap: 16px; }
.auth-form h2 { font-size: var(--fs-xl); }
.auth-form__sub { color: var(--muted); font-size: var(--fs-sm); margin-top: -8px; }
.auth-form__forgot { justify-self: end; border: 0; background: none; color: var(--muted); font-size: var(--fs-sm); }
.auth-form__forgot:hover { color: var(--text); }
.auth-form__back { justify-self: start; display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--muted); font-size: var(--fs-sm); }
.auth-form__back svg { width: 16px; height: 16px; }
.auth-form__legal { color: var(--faint); font-size: var(--fs-xs); }
.auth-form__legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.auth-form__demo { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); font-size: var(--fs-sm); }
.code { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; max-width: 400px; }
.code__cell { width: 100%; min-width: 0; height: 56px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-2); text-align: center; font-size: 1.4rem; font-weight: 600; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.code__cell:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.auth-done { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 16px 0; }
.auth-done svg { width: 36px; height: 36px; color: var(--accent); }
.auth-done p { color: var(--muted); }
.auth-done__actions { display: flex; gap: 8px; margin-top: 6px; }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; min-height: 0; padding-top: 8px; }
  .auth__visual { justify-items: center; text-align: center; }
  .auth__key { width: 84px; border-radius: 22px; }
}

/* ═════ Кабинет ═════ */
.profile { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; padding-top: clamp(12px, 2vw, 24px); }
.profile-card { display: flex; align-items: center; gap: 18px; padding: 24px; }
.profile-card__avatar { flex: none; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 22px; background: var(--accent); color: var(--accent-ink); font-size: 1.6rem; font-weight: 700; }
.profile-card__info { flex: 1; min-width: 0; display: grid; gap: 2px; justify-items: start; }
.profile-card__info h1 { font-size: var(--fs-xl); }
.profile-card__info p { color: var(--muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.profile-card__since { color: var(--faint) !important; font-size: var(--fs-xs) !important; }
.id-chip { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 6px 12px; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: var(--fs-xs); }
.id-chip strong { color: var(--accent); font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.id-chip svg { width: 14px; height: 14px; }
.id-chip:hover { background: var(--surface-3); color: var(--text); }
.balance-card { display: grid; align-content: space-between; gap: 14px; padding: 24px; background: linear-gradient(135deg, rgba(47, 224, 196, 0.16), var(--surface) 60%); }
.balance-card__label { color: var(--muted); font-size: var(--fs-sm); }
.balance-card__value { font-size: clamp(2rem, 1.4rem + 2vw, 2.8rem); font-weight: 600; letter-spacing: -0.03em; }
.balance-card .btn { justify-self: start; }
.panel { padding: 24px; display: grid; gap: 16px; align-content: start; }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.panel__head h2 { font-size: var(--fs-xl); }
.panel__head span { color: var(--faint); font-size: var(--fs-sm); }

.orders { display: grid; gap: 8px; }
.orders__tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.orders__more { justify-self: center; }
.orders__empty { padding: 18px 0; color: var(--faint); text-align: center; font-size: var(--fs-sm); }
.order { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px; border-radius: var(--r-md); background: var(--bg-2); transition: background var(--t-fast); }
.order:hover { background: var(--surface-2); }
.order.has-unread { box-shadow: inset 0 0 0 1px rgba(47, 224, 196, 0.5); }
.order__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--surface-3); color: var(--muted); }
.order__icon { overflow: hidden; }
.order__icon img { width: 100%; height: 100%; object-fit: cover; }
.order__icon--steam { color: var(--accent); }
.order__icon svg { width: 20px; height: 20px; }
.order__main { display: grid; gap: 2px; min-width: 0; }
.order__title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order__meta { color: var(--faint); font-size: var(--fs-xs); }
.order__unread { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 11px; font-weight: 600; }
.order__unread svg { width: 13px; height: 13px; }
.order__side { display: grid; justify-items: end; gap: 4px; }
.order__total { font-weight: 600; white-space: nowrap; }

.help-steps { display: grid; gap: 14px; }
.help-steps li { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; color: var(--muted); font-size: var(--fs-sm); }
.help-steps li > span:first-child { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); color: var(--accent); }
.help-steps li > span:first-child svg { width: 18px; height: 18px; }
.help-steps strong { display: block; color: var(--text); }
.help-panel > .btn { justify-self: start; }
.chat-archive { border-top: 1px solid var(--line); padding-top: 12px; }
.chat-archive summary { cursor: pointer; color: var(--faint); font-size: var(--fs-xs); }
.chat { display: grid; gap: 8px; margin-top: 12px; max-height: 320px; overflow-y: auto; }
.chat__day { justify-self: center; color: var(--faint); font-size: 11px; }
.chat__msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: var(--fs-sm); background: var(--surface-2); }
.chat__msg p { white-space: pre-wrap; word-break: break-word; }
.chat__msg--manager { justify-self: start; }
.chat__msg--me { justify-self: end; background: var(--accent-soft); }
.chat__time { display: block; margin-top: 4px; color: var(--faint); font-size: 11px; }
@media (max-width: 960px) { .profile { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .profile-card { flex-wrap: wrap; } }

/* ═════ Заказ ═════ */
.receipt-page { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 12px; align-items: start; padding-top: clamp(12px, 2vw, 24px); }
.receipt-page > .skeleton, .receipt-page > .empty { grid-column: 1 / -1; }
.receipt-page--single { grid-template-columns: minmax(0, 760px); justify-content: center; }
.receipt--steam.is-waiting .receipt__seal { background: color-mix(in srgb, var(--warn, #ffc24b) 18%, transparent); color: var(--warn, #ffc24b); }
.receipt--steam .receipt__item-main .badge { justify-self: start; margin-top: 4px; }
.receipt__code { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.receipt__code code { padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font: 700 15px/1.3 ui-monospace, Menlo, monospace; letter-spacing: 0.04em; user-select: all; }
.receipt { display: grid; gap: 18px; }
.receipt__seal { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); }
.receipt__seal svg { width: 26px; height: 26px; }
.receipt h1 { font-size: var(--fs-2xl); }
.receipt .eyebrow { color: var(--accent); }
.receipt__meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 16px 0; border-block: 1px solid var(--line); }
.receipt__meta dt { color: var(--faint); font-size: var(--fs-xs); }
.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: 48px 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: 600; white-space: nowrap; }
.receipt__total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 14px; border-top: 1px solid var(--line); }
.receipt__total strong { font-size: 1.8rem; font-weight: 600; letter-spacing: -0.02em; }
.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; color: var(--faint); font-size: var(--fs-xs); }
.receipt__support svg { width: 16px; height: 16px; }
.receipt__support:hover { color: var(--text); }
.badge--done { background: var(--accent); color: var(--accent-ink); }

/* Чат по заказу (features/order-chat.js) */
.ochat { position: sticky; top: calc(var(--header-h) + 16px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; height: min(640px, calc(100svh - var(--header-h) - 40px)); min-height: 420px; overflow: hidden; }
.ochat__head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.ochat__avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--accent); color: var(--accent-ink); }
.ochat__avatar svg { width: 20px; height: 20px; }
.ochat__who { display: grid; gap: 2px; }
.ochat__who strong { font-weight: 600; }
.ochat__who small { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); font-size: var(--fs-xs); }
.ochat__pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--good); animation: pulse-dot 2.4s infinite; }
@keyframes pulse-dot { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.6); } 70% { box-shadow: 0 0 0 7px rgba(61, 220, 151, 0); } }
.ochat__list { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; overflow-y: auto; overscroll-behavior: contain; }
.ochat__day { align-self: center; color: var(--faint); font-size: 11px; padding: 4px 0; }
.ochat__msg { max-width: 86%; padding: 10px 14px; 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; background: var(--surface-2); border-bottom-left-radius: 6px; }
.ochat__msg--intro { background: transparent; border: 1px dashed var(--line-strong); }
.ochat__msg--me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.ochat__msg--me .ochat__time { color: rgba(3, 42, 35, 0.6); }
.ochat__msg.is-pending { opacity: 0.6; }
.ochat__time { display: block; margin-top: 4px; color: var(--faint); font-size: 11px; }
.ochat__closed { align-self: stretch; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; padding: 12px 14px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--muted); font-size: var(--fs-sm); }
.ochat__closed svg { grid-row: span 2; width: 20px; height: 20px; color: var(--accent); }
.ochat__closed strong { color: var(--accent); }
.ochat__closed small { color: var(--faint); font-size: var(--fs-xs); }
.ochat__status { padding: 0 20px; color: var(--bad); font-size: var(--fs-xs); }
.ochat__status:not(:empty) { padding-block: 6px; }
.ochat__composer { display: flex; align-items: flex-end; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.ochat__input { flex: 1; min-height: 46px; max-height: 140px; padding: 12px 14px; resize: none; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-2); color: var(--text); line-height: 1.45; }
.ochat__input::placeholder { color: var(--faint); }
.ochat__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ochat__send { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: var(--r-sm); background: var(--accent); color: var(--accent-ink); transition: background var(--t-fast), transform var(--t-fast); }
.ochat__send:hover { background: var(--accent-hover); }
.ochat__send:active { transform: scale(0.94); }
.ochat__send svg { width: 18px; height: 18px; }
@media (max-width: 960px) {
  .receipt-page { grid-template-columns: 1fr; }
  .ochat { position: relative; top: 0; height: min(560px, 78svh); }
  .receipt__meta { grid-template-columns: 1fr 1fr; }
}
