/* Отслеживание заявки и личный кабинет. Общие детали в app.css, токены в site.css. */

.order-page, .cabinet-page { max-width: 820px; }

/* ---------- Отслеживание ---------- */
.track-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.track-head h2 { font-size: var(--fs-28); line-height: 1.2; letter-spacing: -0.015em; margin: 0; }
.track-summary { margin: 12px 0 0; color: var(--ink-2); display: block; border: 0; }

/* ---------- Вход ---------- */
.auth-card { max-width: 520px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); }
.auth-tab { min-height: 40px; border: 0; border-radius: 4px; background: transparent; font-weight: 500; cursor: pointer; }
.auth-tab.active { background: var(--surface); box-shadow: 0 0 0 1px var(--line); font-weight: 600; }
.tg-login .btn-tg { width: 100%; }
.tg-login-status { min-height: 0; margin-top: 12px; font-size: var(--fs-14); color: var(--ink-2); }
.tg-login-status:empty { display: none; }
.tg-login-status.ok { color: var(--up); }
.tg-login-status.bad, .tg-login-status.error { color: var(--down); }
.or-line { display: flex; align-items: center; gap: 12px; margin: 20px 0; font-size: var(--fs-14); color: var(--ink-2); }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-card .btn-lg { width: 100%; }

/* ---------- Кабинет ---------- */
.cab-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; margin-bottom: 24px; }
.avatar { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.avatar.big { width: 56px; height: 56px; font-size: var(--fs-20); }
.cab-who { flex: 1; min-width: 180px; }
.cab-who h1 { font-size: var(--fs-28); line-height: 1.2; letter-spacing: -0.015em; margin: 0; overflow-wrap: anywhere; }
.cab-email { font-size: var(--fs-14); color: var(--ink-2); overflow-wrap: anywhere; }
.cab-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.cab-telegram { margin-bottom: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.cab-telegram p { margin: 4px 0 12px; font-size: var(--fs-14); color: var(--ink-2); }
.cab-telegram:empty { display: none; }

.cab-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.cab-stat { padding: 16px 20px; border-left: 1px solid var(--line); }
.cab-stat:first-child { border-left: 0; }
.cab-stat-value { font-family: var(--mono); font-size: var(--fs-28); font-weight: 500; letter-spacing: -0.02em; }
.cab-stat-label { font-size: var(--fs-14); color: var(--ink-2); }

/* Мои реквизиты */
.details-card { margin-bottom: 32px; padding: 0 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.details-card summary { display: flex; align-items: center; min-height: 56px; font-weight: 600; cursor: pointer; }
.details-card[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.details-hint { margin: 0 0 12px; font-size: var(--fs-14); color: var(--ink-2); }
.details-empty { margin: 0 0 12px; color: var(--ink-2); font-size: var(--fs-14); }
.details-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.details-info { flex: 1; min-width: 0; }
.details-label { font-weight: 600; }
.details-value { font-family: var(--mono); font-size: var(--fs-14); color: var(--ink-2); overflow-wrap: anywhere; }
.details-add { display: grid; grid-template-columns: 170px minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 8px; padding: 12px 0 8px; border-top: 1px solid var(--line); }
.details-add select, .details-add input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font: inherit; color: inherit; min-width: 0; }
.details-add select:focus, .details-add input:focus { border-color: var(--brand); outline: 3px solid rgba(var(--brand-rgb), 0.25); outline-offset: 0; }
.details-card > .uploader-msg { margin: 0 0 12px; display: block; }
.details-card > .uploader-msg:empty { display: none; }

/* История обменов */
.cab-title { font-size: var(--fs-28); line-height: 1.2; margin: 0 0 16px; }
.cab-empty { padding: 32px; border: 1px dashed var(--ink-2); border-radius: var(--r-lg); background: var(--surface); }
.cab-empty p { margin: 0 0 16px; color: var(--ink-2); }
.cab-order { margin-bottom: 12px; padding: 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.cab-order-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cab-order-num { font-weight: 600; font-size: var(--fs-20); }
.cab-order-date { font-family: var(--mono); font-size: var(--fs-14); color: var(--ink-2); }
.cab-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 16px 0 8px; }
.cab-flow-side { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: var(--fs-20); font-weight: 500; letter-spacing: -0.02em; }
.cab-flow-side .cur-icon { width: 24px; height: 24px; border-radius: 50%; }
.cab-arrow { color: var(--ink-2); }
.cab-order-info { font-size: var(--fs-14); color: var(--ink-2); }
.cab-history { margin-top: 12px; border-top: 1px solid var(--line); }
.cab-history summary { display: flex; align-items: center; min-height: 44px; font-size: var(--fs-14); font-weight: 500; cursor: pointer; }
.cab-order-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

@media (max-width: 760px) {
  .cab-stats { grid-template-columns: minmax(0, 1fr); }
  .cab-stat { border-left: 0; border-top: 1px solid var(--line); }
  .cab-stat:first-child { border-top: 0; }
  .details-add { grid-template-columns: minmax(0, 1fr); }
  .cab-order { padding: 16px; }
  .cab-actions { width: 100%; }
  .cab-actions .btn { flex: 1; }
  .auth-card { max-width: none; }
}

/* Группы реквизитов */
.details-group { margin-bottom: 8px; }
.details-group-title { margin: 8px 0 0; font-size: var(--fs-14); font-weight: 600; color: var(--ink-2); }

.details-row .dz-remove { flex: none; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); text-decoration: none; font-size: var(--fs-14); }
.details-row .dz-remove:hover { border-color: var(--ink-2); }

.details-add { display: flex; flex-wrap: wrap; }
.details-add > select { flex: 0 0 170px; }
.details-add > input { flex: 1 1 160px; }
.details-add > .btn { flex: none; }
.details-add > .hidden { display: none; }

/* Реферальная программа в кабинете */
#ref-body { padding-top: 4px; }
.ref-link { display: flex; gap: 8px; margin: 14px 0; }
.ref-link input { flex: 1; min-width: 0; font-family: var(--mono); font-size: var(--fs-14); padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); }
.ref-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.ref-stat { padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.ref-stat-label { color: var(--ink-2); font-size: var(--fs-14); }
.ref-stat-value { font-family: var(--mono); font-size: var(--fs-20); font-weight: 600; }
.ref-stat-value.accent { color: var(--amber); }
.ref-payout-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: 8px; margin-top: 8px; }
.ref-payout-row input { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit; min-width: 0; }
.ref-history { margin-top: 16px; }
.ref-history-row { display: flex; gap: 16px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ref-history-row b { font-family: var(--mono); }
.ref-badge { margin-left: auto; font-size: var(--fs-14); padding: 2px 10px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); }
.ref-badge.paid { background: var(--up-soft); color: var(--up); }
@media (max-width: 640px) {
  .ref-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ref-payout-row { grid-template-columns: minmax(0, 1fr); }
  .ref-link { flex-direction: column; }
}

/* Выбор способа реферальной выплаты */
.ref-methods { display: grid; gap: 8px; margin: 8px 0 16px; }
.ref-group-title { font-size: var(--fs-14); color: var(--ink-2); margin-top: 4px; }
.ref-method-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ref-method { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit; font-weight: 500; color: var(--ink); cursor: pointer; transition: border-color .15s, background .15s; }
.ref-method:hover { border-color: var(--brand); }
.ref-method:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ref-method.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); box-shadow: inset 0 0 0 1px var(--brand); }
.ref-fields { display: grid; gap: 12px; max-width: 560px; }
.ref-method-hint { color: var(--ink-2); font-size: var(--fs-14); margin: 0; }
.ref-field { display: flex; flex-direction: column; gap: 4px; }
.ref-field.hidden { display: none; }
.ref-field-label { font-size: var(--fs-14); color: var(--ink-2); }
.ref-field input, .ref-field select { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit; background: var(--surface); color: var(--ink); min-width: 0; }
.ref-field input:focus, .ref-field select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.ref-saved { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ref-saved:empty { display: none; }
.ref-chip { padding: 6px 12px; border: 1px dashed var(--line); border-radius: 999px; background: var(--paper); font: inherit; font-size: var(--fs-14); color: var(--ink); cursor: pointer; }
.ref-chip:hover { border-color: var(--brand); color: var(--brand); }
.ref-note { color: var(--ink-2); font-size: var(--fs-14); max-width: 560px; margin: 14px 0 12px; }
.ref-history-details { color: var(--ink-2); font-size: var(--fs-14); overflow-wrap: anywhere; min-width: 0; }

/* Пустые состояния с иллюстрацией */
.cab-empty img.empty-art { display: block; width: 132px; height: 132px; margin: 0 auto 8px; }

/* Юани: фото QR и расчёт «вы получите» */
.ref-qr { display: grid; gap: 8px; justify-items: start; }
.ref-qr-input { max-width: 100%; font: inherit; }
.ref-qr-hint { color: var(--ink-2); font-size: var(--fs-14); }
.ref-qr-preview { width: 120px; height: 120px; object-fit: cover; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.ref-qr-preview.hidden, .ref-qr .hidden { display: none; }
.ref-estimate { min-height: 0; }
.ref-estimate:not(:empty) { padding: 12px 14px; border: 1px solid var(--amber-line); border-radius: var(--r-sm); background: var(--amber-soft); display: grid; gap: 4px; }
.ref-est-main { font-family: var(--mono); font-size: var(--fs-20); font-weight: 600; color: var(--amber); overflow-wrap: anywhere; }
.ref-est-sub { font-size: var(--fs-14); color: var(--ink-2); }

.ref-amount-row { display: flex; gap: 8px; align-items: stretch; }
.ref-amount-row input { flex: 1; min-width: 0; }
.ref-amount-row .btn { flex: none; white-space: nowrap; }

.ref-field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
