/* =====================================================
   Profile Page — Liquid Glass
   ===================================================== */

.profile-page {
    max-width: 500px;
    margin: 0 auto;
}

/* Своего заголовка у профиля нет: .page-title из общего пакета. Здесь он
   был на восемь пикселей крупнее, чем на соседних страницах, — просто
   потому что этот файл написали позже. */

.profile-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-light);
    position: relative;
    overflow: hidden;
}

.profile-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4) 30%, rgba(255,255,255,0.4) 70%, transparent);
    opacity: 0.5;
}

.profile-avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar .lucide {
    width: 44px;
    height: 44px;
    color: var(--color-primary);
}

.profile-avatar-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 2px 0;
    letter-spacing: -0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-joined {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Clickable ID → copy */
.profile-id {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 3px 8px 3px 0;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
    max-width: 100%;
    -webkit-tap-highlight-color: transparent;
    transition: color var(--duration-fast) var(--ease-smooth);
}

.profile-id-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-id-copy {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    color: var(--text-tertiary);
    transition: color var(--duration-fast) var(--ease-smooth),
                transform var(--duration-fast) var(--ease-spring);
}

.profile-id:hover { color: var(--text-primary); }
.profile-id:hover .profile-id-copy { color: var(--color-primary); }
.profile-id:active .profile-id-copy { transform: scale(0.82); }

.profile-id.is-copied { color: var(--color-success); }
.profile-id.is-copied .profile-id-copy { color: var(--color-success); }

/* Compact inline stats inside the header card */
.profile-stats {
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
    margin: 0;
    padding-left: 14px;
    border-left: 1px solid var(--border-color);
}

.stat-item {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0 12px;
    text-align: center;
    position: relative;
    overflow: visible;
}

.stat-item + .stat-item {
    border-left: 1px solid var(--border-color);
}

.stat-item::before {
    display: none;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1px;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

/* Users metric — same size & color as bots */
.stat-item--primary .stat-value {
    font-size: 18px;
    color: var(--text-primary);
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Строки списка — .settings-group / .settings-cell из ui/css/lists.css */

/* =====================================================
   Referral card — gradient hero + transparency
   ===================================================== */
.referral-group {
    margin-bottom: 24px;
}

.referral-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius-large);
    padding: 20px;
    color: var(--text-white);
    background:
        radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.28), transparent 42%),
        var(--color-primary);
    box-shadow: var(--shadow-medium);
}

.referral-card::before {
    content: '';
    position: absolute;
    right: -40px;
    bottom: -50px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 70%);
    pointer-events: none;
}

.referral-hero {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    position: relative;
}

.referral-hero-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-white);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.referral-hero-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.referral-hero-subtitle {
    font-size: 13.5px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.88);
}

.referral-hero-subtitle b {
    font-weight: 700;
    color: var(--text-white);
}

/* Stats */
.referral-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 18px;
    position: relative;
}

.referral-stat {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    padding: 12px 8px;
    text-align: center;
}

.referral-stat-value {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.referral-stat-label {
    font-size: 11px;
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.82);
}

/* Ambassador badge */
.referral-ambassador {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 14px;
    padding: 9px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.28);
    font-size: 12.5px;
    font-weight: 600;
    position: relative;
}

/* Progress ladder */
.referral-ladder {
    margin-top: 16px;
    position: relative;
}

.referral-ladder-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 10px;
}

.referral-ladder-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.78);
}

.referral-ladder-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-white);
}

.referral-ladder-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.referral-tier {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.referral-tier.is-reached {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.3);
}

.referral-tier-mark {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.22);
    color: var(--text-white);
}

.referral-tier.is-reached .referral-tier-mark {
    background: var(--text-white);
    color: var(--color-primary);
}

.referral-tier-mark .lucide {
    width: 15px;
    height: 15px;
}

.referral-tier-body {
    flex: 1;
    min-width: 0;
}

.referral-tier-reward {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
}

.referral-tier-need {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.78);
    margin-top: 2px;
}

.referral-tier-status {
    font-size: 11.5px;
    font-weight: 700;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.92);
}

.referral-tier:not(.is-reached) .referral-tier-status {
    color: rgba(255, 255, 255, 0.6);
}

/* Compact balance summary (always visible in the hero) */
.referral-balance-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
    padding: 10px 8px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    position: relative;
}

.referral-balance-bar-item {
    text-align: center;
    min-width: 0;
}

.referral-balance-bar-item + .referral-balance-bar-item {
    border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.referral-balance-bar-value {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.referral-balance-bar-label {
    font-size: 10.5px;
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.78);
}

/* Note explaining the after-10-friends cash perk */
.referral-ladder-note {
    margin-top: 9px;
    padding: 9px 11px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px dashed rgba(255, 255, 255, 0.28);
    font-size: 11.5px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.82);
}

.referral-ladder-note b {
    font-weight: 700;
    color: var(--text-white);
}

/* Withdrawable balance */
.referral-balance-block {
    margin-top: 14px;
}

.referral-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.28);
    position: relative;
}

.referral-balance-note {
    margin-top: 8px;
    font-size: 11.5px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.78);
    padding: 0 2px;
}

.referral-balance-note b {
    font-weight: 700;
    color: var(--text-white);
}

.referral-balance-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.82);
}

.referral-balance-value {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-top: 2px;
}

.referral-withdraw-btn {
    flex-shrink: 0;
    border: none;
    border-radius: 12px;
    padding: 10px 18px;
    background: var(--text-white);
    color: var(--color-primary);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-spring), opacity 0.2s;
}

.referral-withdraw-btn:active {
    transform: scale(0.95);
}

.referral-withdraw-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Earned reward codes */
.referral-rewards {
    margin-top: 16px;
    position: relative;
}

.referral-rewards-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.78);
    margin-bottom: 8px;
}

.referral-rewards-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.referral-reward-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 9px 12px;
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-spring),
                background var(--duration-fast) var(--ease-smooth);
}

.referral-reward-item:active {
    transform: scale(0.98);
}

.referral-reward-item.is-used {
    opacity: 0.55;
    cursor: default;
}

.referral-reward-badge {
    font-size: 13px;
    font-weight: 800;
    background: var(--text-white);
    color: var(--color-primary);
    border-radius: 8px;
    padding: 3px 8px;
    flex-shrink: 0;
}

.referral-reward-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.referral-reward-status {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.82);
    flex-shrink: 0;
}

/* Link block */
.referral-link-block {
    margin-top: 18px;
    position: relative;
}

.referral-link-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.82);
    margin-bottom: 7px;
}

.referral-link-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.referral-link-input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    color: var(--text-white);
    font-size: 13px;
    outline: none;
}

.referral-link-input::selection {
    background: rgba(255, 255, 255, 0.35);
}

.referral-icon-btn {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.22);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-spring);
}

.referral-icon-btn:active {
    transform: scale(0.92);
}

.referral-share-btn {
    width: 100%;
    margin-top: 16px;
    padding: 13px;
    border: none;
    border-radius: 14px;
    background: var(--text-white);
    color: var(--color-primary);
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transition: transform var(--duration-fast) var(--ease-spring);
}

.referral-share-btn:active {
    transform: scale(0.98);
}

/* Collapsible details + toggle */
.referral-details[hidden] {
    display: none;
}

.referral-details {
    margin-top: 4px;
}

.referral-toggle {
    width: 100%;
    margin-top: 12px;
    padding: 9px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-white);
    font-size: 13.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-spring),
                background var(--duration-fast) var(--ease-smooth);
}

.referral-toggle:active {
    transform: scale(0.98);
}

.referral-toggle .lucide {
    transition: transform var(--duration-normal) var(--ease-smooth);
}

.referral-toggle.is-open .lucide {
    transform: rotate(180deg);
}

/* ── Receipt email ── */
.receipt-email-item {
    cursor: default;
}

.receipt-email-form {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.receipt-email-input {
    flex: 1;
    min-width: 0;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-color-strong);
    border-radius: var(--border-radius-small);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--fs-base);
    outline: none;
    transition: border-color var(--duration-fast) var(--ease-smooth);
}

.receipt-email-input:focus {
    border-color: var(--color-primary);
}

.receipt-email-input::placeholder {
    color: var(--text-tertiary);
}

.receipt-email-save-btn {
    width: var(--control-height-sm);
    height: var(--control-height-sm);
    border: none;
    border-radius: var(--border-radius-small);
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.receipt-email-save-btn:active {
    transform: scale(0.92);
}

.receipt-email-save-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ── Toggle switch ── */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--text-tertiary);
    border-radius: 31px;
    transition: background 0.25s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 27px;
    height: 27px;
    left: 2px;
    bottom: 2px;
    background: var(--text-white);
    border-radius: 50%;
    transition: transform 0.25s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--color-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* =====================================================
   Auto-renewals modal
   ===================================================== */
.autorenew-loading {
    display: flex;
    justify-content: center;
    padding: 32px 0;
    color: var(--color-primary);
}

.autorenew-intro {
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--text-secondary);
    margin: 0 0 14px;
}

.autorenew-list {
    display: flex;
    flex-direction: column;
}

.autorenew-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius, 14px);
    padding: 14px 16px;
    margin-bottom: 10px;
}

.autorenew-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.autorenew-item-info {
    min-width: 0;
    flex: 1;
}

.autorenew-item-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.autorenew-item-username {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.autorenew-cancel-btn {
    flex-shrink: 0;
    border: none;
    border-radius: 10px;
    padding: 9px 14px;
    background: var(--color-error);
    color: var(--text-white);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    min-width: 96px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--duration-fast) var(--ease-spring), opacity 0.2s;
}

.autorenew-cancel-btn:active {
    transform: scale(0.95);
}

.autorenew-cancel-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.autorenew-item-meta {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.autorenew-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--text-secondary);
}

.autorenew-meta-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-tertiary);
}

.autorenew-empty {
    text-align: center;
    padding: 20px 12px 8px;
}

.autorenew-empty-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: var(--color-success-light, rgba(52, 199, 89, 0.15));
    color: var(--color-success);
}

.autorenew-empty-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.autorenew-empty-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
    max-width: 320px;
    margin: 0 auto;
}

/* Блоков «тёмная тема» здесь нет намеренно: карточка и ячейки уже собраны
   из токенов (--bg-glass-thick, --glass-border, --text-primary), а токены
   сами меняются и по системной теме, и по теме клиента Telegram. Раньше
   те же правила были продублированы числами — и расходились с общими. */
