.vip-gradient-card {
    background: linear-gradient(120deg, var(--surface), rgba(245,158,11,.16), rgba(124,58,237,.12), var(--surface));
    background-size: 260% 260%;
    animation: vipCardGradient 8s ease-in-out infinite;
}
.drawer-top-btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: var(--surface-alt);
    border: 1px solid var(--border);
}
.user-drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(15, 23, 42, .42);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
}
.user-drawer-overlay.show {
    opacity: 1;
    pointer-events: auto;
}
.user-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 80;
    width: min(92vw, 420px);
    padding: calc(env(safe-area-inset-top, 0px) + 14px) 14px calc(env(safe-area-inset-bottom, 0px) + 18px);
    background: var(--bg);
    border-color: var(--border);
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
    overflow-y: auto;
    overscroll-behavior-y: auto;
    transition: transform .26s ease;
}
.user-drawer-left {
    left: 0;
    border-right: 1px solid var(--border);
    transform: translateX(-104%);
}
.user-drawer-right {
    right: 0;
    border-left: 1px solid var(--border);
    transform: translateX(104%);
}
.user-drawer.show {
    transform: translateX(0);
}
.user-drawer-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -14px -14px 12px;
    padding: 14px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}
.user-drawer-close {
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--surface-alt);
    color: var(--text-primary);
}
.user-drawer-body {
    position: relative;
    min-height: calc(100vh - 86px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 72px;
}
.drawer-settings-btn {
    position: sticky;
    bottom: 8px;
    align-self: flex-end;
    z-index: 3;
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #7C3AED);
    box-shadow: 0 14px 32px rgba(124, 58, 237, .32);
}
#userModelSelectModal {
    z-index: 130;
}
#userApiForm,
#userModelSelectModal {
    align-items: center;
}
#userApiForm .modal-box,
#userModelSelectModal .modal-box {
    border-radius: 28px 8px 28px 8px;
}
.user-api-form-modal-box {
    max-width: min(94vw, 620px);
    max-height: min(88vh, 760px);
    overflow-y: auto;
}
.user-settings-modal-box {
    max-width: min(94vw, 760px);
    max-height: min(86vh, 760px);
    overflow-y: auto;
}
.user-model-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.user-model-select-trigger.hidden {
    display: none;
}
.user-model-select-trigger span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-model-select-trigger i {
    flex-shrink: 0;
    color: var(--text-secondary);
}
.user-model-modal-box {
    max-width: min(94vw, 540px);
    max-height: min(88svh, 760px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.user-model-choice-list {
    margin-top: 12px;
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 2px 12px 0;
    overscroll-behavior: contain;
}
.user-model-choice-btn {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    height: auto;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.35;
    text-align: left;
    overflow: hidden;
    box-sizing: border-box;
}
.user-model-choice-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    min-width: 0;
}
.user-model-choice-row .user-model-choice-btn {
    flex: 1 1 auto;
}
.user-model-choice-row.active .user-model-choice-btn {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary-glow);
}
.user-model-map-btn {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 10px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}
.user-model-map-text {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-model-name {
    display: block;
    max-width: 100%;
    font-weight: 700;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.user-model-choice-btn.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary-glow);
}
.user-model-empty {
    padding: 18px 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}
#userApiModelSelect {
    word-break: break-all;
}
.user-action-modal-box {
    max-width: 420px;
    text-align: center;
}
.user-action-modal-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px 6px 20px 6px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #7C3AED);
    box-shadow: 0 12px 28px var(--primary-glow);
}
.user-action-modal-box.danger .user-action-modal-icon {
    background: linear-gradient(135deg, #EF4444, #B91C1C);
    box-shadow: 0 12px 28px rgba(239,68,68,.24);
}
.user-action-modal-title {
    font-size: 18px;
    font-weight: 900;
    line-height: 1.35;
}
.user-action-modal-message {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-line;
}
.user-action-modal-field {
    margin-top: 16px;
    text-align: left;
}
.user-action-modal-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}
.user-action-modal-input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-primary);
}
.user-action-modal-check {
    margin-top: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    text-align: left;
    font-size: 13px;
    color: var(--text-secondary);
}
.user-action-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 18px;
}
.user-action-modal-btn {
    min-height: 44px;
    border-radius: 16px 4px 16px 4px;
    font-size: 14px;
    font-weight: 800;
}
.user-action-modal-cancel {
    background: var(--surface-alt);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.user-action-modal-confirm {
    background: var(--primary);
    color: #fff;
}
.user-action-modal-box.danger .user-action-modal-confirm {
    background: var(--danger);
}

.user-drawer-body .app-panel {
    margin: 0;
}
.user-drawer .fade-in-up {
    opacity: 1;
    transform: none;
}
.scroll-list-limit {
    overflow-y: auto;
    overscroll-behavior-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
}
.scroll-list-limit::-webkit-scrollbar {
    width: 6px;
}
.scroll-list-limit::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
}
.scroll-list-limit::-webkit-scrollbar-track {
    background: transparent;
}
.vip-gradient-glow {
    background-size: 220% 220% !important;
    animation: vipGlowShift 6s ease-in-out infinite;
}
.vip-gradient-avatar {
    background-size: 220% 220% !important;
    animation: vipAvatarGradient 5s ease-in-out infinite;
}
.vip-luxury-text {
    background: linear-gradient(90deg, #F97316, #FACC15, #F59E0B, #DC2626, #FDE68A, #F97316);
    background-size: 280% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important;
    animation: vipLuxuryText 3.8s ease-in-out infinite;
    text-shadow: 0 0 16px rgba(245,158,11,.34);
}
.vip-badge-readable {
    color: #3B1B00 !important;
    background: linear-gradient(135deg, #FFF7CC, #FACC15 38%, #F97316 72%, #FDE68A) !important;
    background-size: 220% 220% !important;
    -webkit-background-clip: border-box !important;
    background-clip: border-box !important;
    border: 1px solid rgba(255,255,255,.72);
    box-shadow: 0 0 0 1px rgba(120,53,15,.18), 0 8px 22px rgba(245,158,11,.35), inset 0 1px 0 rgba(255,255,255,.72);
    text-shadow: 0 1px 0 rgba(255,255,255,.55), 0 0 8px rgba(255,247,204,.65);
    animation: vipBadgeGold 3.8s ease-in-out infinite;
    letter-spacing: .06em;
}
.qq-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
#userApiConfigForm input,
#userApiConfigForm select {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}
#userApiKey {
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-api-key-text {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
}




.token-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.token-stat-card {
    min-width: 0;
    padding: 10px;
    border-radius: 10px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
}
.token-stat-value {
    color: var(--primary);
    font-size: 17px;
    line-height: 1.2;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.token-stat-label {
    margin-top: 2px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 800;
}
.token-stat-sub {
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.4;
}
.token-model-list {
    display: grid;
    gap: 8px;
}
.token-model-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
}
.token-model-name {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.token-model-meta {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.token-model-total {
    flex: 0 0 auto;
    color: var(--primary);
    font-size: 14px;
    font-weight: 900;
    text-align: right;
    white-space: nowrap;
}
.token-model-total span {
    display: block;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
}

.token-period-model-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
.token-period-panel {
    min-width: 0;
    padding: 10px;
    border-radius: 10px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
}
.token-period-title {
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 900;
}
.token-period-list {
    display: grid;
    gap: 6px;
}
.token-period-list .token-model-row {
    padding: 8px;
    background: var(--surface);
}
.token-period-list .token-model-name {
    font-size: 12px;
}
.token-period-list .token-model-total {
    font-size: 12px;
}
@media (min-width: 760px) {
    .token-period-model-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.user-api-guide-btn {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    color: var(--primary);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.user-api-guide-modal-box {
    max-width: min(94vw, 720px);
    max-height: min(88svh, 780px);
    overflow-y: auto;
    border-radius: 28px 8px 28px 8px;
}
.user-api-guide-content {
    display: grid;
    gap: 12px;
    text-align: left;
}
.user-api-guide-content section {
    padding: 12px;
    border-radius: 12px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
}
.user-api-guide-content h3 {
    margin: 0 0 7px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 900;
}
.user-api-guide-content p {
    margin: 7px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.65;
}
.user-api-guide-content code,
.guide-code-row code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.user-api-guide-content p code {
    padding: 1px 5px;
    border-radius: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.guide-code-row {
    display: grid;
    gap: 5px;
    margin-top: 8px;
}
.guide-code-row span {
    color: var(--text-secondary);
    font-size: 12px;
}
.guide-code-row code {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    padding: 7px 9px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 12px;
    scrollbar-width: thin;
}

#userActionModal {
    z-index: 180;
    align-items: center;
}
.proxy-key-header {
    min-width: 0;
}
.proxy-key-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}
.proxy-key-title-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
    flex-wrap: wrap;
}
.proxy-key-title-actions h3 {
    flex: 0 0 auto;
}
.proxy-key-desc {
    display: block;
    line-height: 1.45;
}

.api-switch-link {
    background: var(--primary);
    color: #fff;
    border: 1px solid rgba(255,255,255,.24);
    box-shadow: 0 8px 18px rgba(59,130,246,.22);
    white-space: nowrap;
}
.api-switch-link:hover {
    filter: brightness(1.05);
}
.proxy-endpoint-panel {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.proxy-endpoint-list {
    display: grid;
    gap: 8px;
}
.proxy-endpoint-row {
    min-width: 0;
}
.proxy-endpoint-row > span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-secondary);
}
.proxy-endpoint-code-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
}
.proxy-endpoint-row code {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    word-break: normal;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
    padding: 7px 9px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    line-height: 1.35;
    scrollbar-width: thin;
}
.proxy-endpoint-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 0 0 auto;
    min-width: 64px;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--primary);
    line-height: 1;
    white-space: nowrap;
}
.proxy-endpoint-copy-btn:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    background: var(--accent-soft);
}
.proxy-endpoint-row code::-webkit-scrollbar {
    height: 5px;
}
.proxy-endpoint-row code::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
}

@keyframes vipCardGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
@keyframes vipGlowShift {
    0%, 100% { transform: scale(1); filter: hue-rotate(0deg); }
    50% { transform: scale(1.08); filter: hue-rotate(22deg); }
}
@keyframes vipAvatarGradient {
    0%, 100% { background-position: 0% 50%; transform: translateY(0); }
    50% { background-position: 100% 50%; transform: translateY(-1px); }
}
@keyframes vipLuxuryText {
    0%, 100% { background-position: 0% 50%; filter: drop-shadow(0 0 3px rgba(249,115,22,.4)); }
    50% { background-position: 100% 50%; filter: drop-shadow(0 0 8px rgba(250,204,21,.55)); }
}
@keyframes vipBadgeGold {
    0%, 100% { background-position: 0% 50%; transform: translateY(0); }
    50% { background-position: 100% 50%; transform: translateY(-1px); }
}
