/* ==========================================================================
   用户中心（侧栏用户卡 / 订单 / 余额 / 会员 / 推广 / 工单 / 投稿）
   依赖 assets/css/main.css 中的变量与 yr-user-* 基础组件
   ========================================================================== */

/* ---------------------------------------------------------------- 侧栏 */
.yr-user-card {
    padding: 22px 18px 16px;
    text-align: center;
    border-bottom: 1px solid var(--yr-border-2);
}
.yr-user-card .yr-avatar {
    width: 64px;
    height: 64px;
    margin: 0 auto 10px;
    border: 2px solid var(--yr-border);
}
.yr-user-card__name {
    display: block;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.yr-user-card__id {
    display: block;
    font-size: 12px;
    color: var(--yr-text-3);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.yr-user-card__meta {
    margin: 9px 0 0;
    font-size: 11.5px;
    color: var(--yr-text-3);
}
.yr-user-card__meta strong {
    color: var(--yr-primary);
}
.yr-user-card__wallet {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    padding: 9px 11px;
    background: var(--yr-surface-2);
    border-radius: var(--yr-radius-sm);
    text-align: left;
}
.yr-user-card__wallet span {
    display: block;
    font-size: 11px;
    color: var(--yr-text-3);
}
.yr-user-card__wallet strong {
    font-size: 16px;
    color: var(--yr-accent);
    letter-spacing: -.01em;
}
.yr-user-card__wallet em {
    font-style: normal;
    font-size: 11px;
    color: var(--yr-text-3);
    margin-left: 2px;
}

.yr-user-nav__item em.yr-user-nav__count {
    min-width: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--yr-accent);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.yr-user-side__logout {
    display: block;
    margin-top: 6px;
    padding: 11px 12px;
    border-top: 1px solid var(--yr-border-2);
    text-align: center;
    font-size: 12.5px;
    color: var(--yr-text-3);
}
.yr-user-side__logout:hover {
    color: var(--yr-danger);
}

/* ---------------------------------------------------------------- 主区头部 */
.yr-user-main {
    min-width: 0;
}

.yr-user-main__title h1 {
    font-size: 22px;
}

.yr-user-main__sub {
    margin: 3px 0 0;
    font-size: 12.5px;
    color: var(--yr-text-3);
}

.yr-user-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.yr-user-actions--end {
    justify-content: flex-end;
    margin-top: 16px;
}

.yr-user-hint {
    margin: 12px 0 0;
    font-size: 12px;
    color: var(--yr-text-3);
}

.yr-auth__remember {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--yr-text-2);
}

/* ---------------------------------------------------------------- 资料 */
.yr-profile-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    margin-bottom: 20px;
    background: var(--yr-surface-2);
    border-radius: var(--yr-radius-sm);
}
.yr-profile-head .yr-avatar {
    width: 56px;
    height: 56px;
    margin: 0;
}
.yr-profile-head__text {
    min-width: 0;
    flex: 1;
}
.yr-profile-head__text strong {
    display: block;
    font-size: 15px;
}
.yr-profile-head__text span {
    font-size: 12px;
    color: var(--yr-text-3);
}

/* ---------------------------------------------------------------- 订单 / 列表 */
.yr-toolbar__num {
    display: inline-block;
    margin-left: 4px;
    font-size: 11px;
    opacity: .7;
}

.yr-order-title {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.yr-order-note {
    color: var(--yr-danger);
}
.yr-order-amount {
    white-space: nowrap;
}
.yr-order-close[disabled] {
    cursor: not-allowed;
}

.yr-balance-in {
    color: var(--yr-ok);
}
.yr-balance-out {
    color: var(--yr-accent);
}

/* ---------------------------------------------------------------- 收藏卡片 */
.yr-fav-card {
    position: relative;
}
.yr-fav-card__btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    flex: none;
    height: 28px;
    padding: 0 9px;
    font-size: 11.5px;
    background: var(--yr-surface);
    box-shadow: var(--yr-shadow);
}
/* 取消收藏后先把卡片收起，刷新后彻底移除 */
.yr-fav-card:has(.yr-fav-btn:not(.is-active)) {
    display: none;
}

/* ---------------------------------------------------------------- 推广 */
.yr-aff-hero__text {
    min-width: 0;
}

.yr-aff-share {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 148px;
    gap: 20px;
    align-items: start;
}
.yr-aff-share__main {
    min-width: 0;
}
.yr-copy-box--light input {
    background: var(--yr-surface-2);
    border-color: var(--yr-border);
    color: var(--yr-text);
}
.yr-aff-rules {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 14px;
    font-size: 12.5px;
    color: var(--yr-text-3);
}
.yr-aff-rules li {
    position: relative;
    padding-left: 14px;
}
.yr-aff-rules li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 9px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--yr-border);
}

.yr-aff-qr {
    padding: 12px;
    text-align: center;
    background: var(--yr-surface-2);
    border: 1px dashed var(--yr-border);
    border-radius: var(--yr-radius-sm);
}
.yr-aff-qr__box {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--yr-surface);
    border-radius: var(--yr-radius-xs);
    color: var(--yr-text-3);
}
.yr-aff-qr__tip {
    display: block;
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--yr-text-3);
}

/* ---------------------------------------------------------------- 会员 */
.yr-vip-progress {
    padding-bottom: 4px;
}
.yr-vip-progress__label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 12.5px;
    color: var(--yr-text-3);
}
.yr-vip-progress__label strong {
    color: var(--yr-primary);
    font-size: 13px;
}
.yr-vip-progress__bar {
    display: block;
    width: 100%;
    height: 9px;
    border: none;
    border-radius: 999px;
    overflow: hidden;
    background: var(--yr-border);
    appearance: none;
    -webkit-appearance: none;
}
.yr-vip-progress__bar::-webkit-progress-bar {
    background: var(--yr-border);
    border-radius: 999px;
}
.yr-vip-progress__bar::-webkit-progress-value {
    background: linear-gradient(90deg, var(--yr-primary), #7c9bff);
    border-radius: 999px;
    transition: width var(--yr-speed);
}
.yr-vip-progress__bar::-moz-progress-bar {
    background: var(--yr-primary);
    border-radius: 999px;
}

/* ---------------------------------------------------------------- 工单弹层 */
.yr-ticket-modal {
    z-index: 320;
}
.yr-ticket-modal:target {
    display: flex;
}
.yr-ticket-modal .yr-modal__panel {
    max-width: 560px;
}
.yr-ticket-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.yr-ticket-modal__title {
    font-size: 16px;
    margin-bottom: 14px;
}
.yr-ticket-field {
    margin-bottom: 14px;
}
.yr-ticket-field__label {
    display: block;
    margin-bottom: 5px;
    font-size: 11.5px;
    color: var(--yr-text-3);
}
.yr-ticket-field__body {
    padding: 11px 13px;
    border-radius: var(--yr-radius-xs);
    background: var(--yr-surface-2);
    font-size: 13px;
    color: var(--yr-text-2);
    word-break: break-word;
}
.yr-ticket-field__body--muted {
    color: var(--yr-text-3);
}
.yr-ticket-reply {
    border-left: 3px solid var(--yr-primary);
}
.yr-ticket-reply .yr-muted {
    display: block;
    margin-top: 8px;
    font-size: 11.5px;
}

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 900px) {
    .yr-user-card {
        display: grid;
        grid-template-columns: 52px minmax(0, 1fr) auto;
        align-items: center;
        gap: 2px 12px;
        text-align: left;
        padding: 14px 16px;
    }
    .yr-user-card .yr-avatar {
        grid-row: span 3;
        width: 52px;
        height: 52px;
        margin: 0;
    }
    .yr-user-card__name,
    .yr-user-card__id,
    .yr-user-card__meta {
        grid-column: 2;
        margin: 0;
    }
    .yr-user-card .yr-vip-badge {
        grid-column: 3;
        grid-row: 1;
    }
    .yr-user-card__wallet {
        grid-column: 1 / -1;
        margin-top: 10px;
    }
    .yr-aff-share {
        grid-template-columns: minmax(0, 1fr);
    }
    .yr-aff-qr {
        max-width: 168px;
    }
}

@media (max-width: 640px) {
    .yr-profile-head {
        flex-wrap: wrap;
    }
    .yr-user-main__head {
        align-items: flex-start;
    }
    .yr-order-title {
        max-width: 180px;
    }
    .yr-fav-card__btn {
        top: 8px;
        right: 8px;
    }
}
