/* 虾觅 · 参考 Kimi API 开放平台控制台：白底、顶栏 + 左侧导航 */
/* 不使用 Google Fonts 外链，避免内网/防火墙下 @import 阻塞整份 CSS（原 Inter 已写入 --font-sans 回退栈） */

:root {
    /* 三端断点：手机 / 平板 / 桌面（与媒体查询配合使用） */
    --bp-sm: 480px;
    --bp-md: 768px;
    --bp-lg: 1024px;
    --bp-xl: 1280px;
    --bg-base: #f4f5f7;
    --bg-surface: #ffffff;
    --bg-elevated: #f9fafb;
    --bg-input: #ffffff;
    --border-subtle: #e8eaed;
    --border-strong: #d1d5db;
    --text-primary: #1a1a1a;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --accent: #6366f1;
    --accent-dim: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.18);
    --accent-hover: #4f46e5;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    /* Kimi 开放平台类：正文 16px、辅助 14px、脚注/代码块可 13px */
    --font-base: 1rem;
    --font-size-body: 16px;
    --font-size-secondary: 14px;
    --font-size-caption: 13px;
    --top-header-h: 56px;
    --sidebar-w: 224px;
    --content-max: 1240px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    color-scheme: light;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px;
    padding-left: max(24px, env(safe-area-inset-left, 0px));
    padding-right: max(24px, env(safe-area-inset-right, 0px));
    padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
    color: var(--text-primary);
    font-size: var(--font-base);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

body.console-body {
    padding: 0;
    background: var(--bg-base);
}

body.auth-page-body {
    min-height: 100vh;
    padding: 0;
    background: #f3f4f6;
}

.auth-page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 56px 20px 22px;
}

.auth-page-main {
    width: 100%;
    max-width: 560px;
    margin-bottom: 22px;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    width: 100%;
}

.app-main .container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
}

/* —— 顶栏 + 侧栏布局（开放平台式） —— */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-header {
    height: var(--top-header-h);
    flex-shrink: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 max(20px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.top-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    max-width: calc(var(--content-max) + var(--sidebar-w));
    margin: 0 auto;
}

.top-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.top-brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1px;
    line-height: 1.2;
}

.top-brand-name {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.top-brand-tagline {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.top-brand:hover {
    color: var(--accent);
}

.top-brand:hover .top-brand-tagline {
    color: var(--text-secondary);
}

@media (max-width: 480px) {
    .top-brand-tagline {
        display: none;
    }
}

.top-brand-mark {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dim));
}

.top-header-spacer {
    flex: 1;
    min-width: 0;
}

.top-nav-right {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.top-nav-link {
    padding: 8px 14px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.top-nav-link:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.top-nav-link.active {
    color: var(--accent);
    font-weight: 600;
    background: rgba(99, 102, 241, 0.08);
}

.top-nav-link-ghost {
    color: var(--text-muted);
}

.top-header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-info {
    color: var(--text-muted);
    font-size: 0.8125rem;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-body-row {
    display: flex;
    flex: 1;
    min-height: 0;
}

.sidebar-nav {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    padding: 14px 0 24px;
}

.sidebar-section-label {
    padding: 12px 20px 8px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sidebar-link {
    display: block;
    margin: 2px 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.sidebar-link-external {
    opacity: 0.95;
}

.sidebar-link.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    font-weight: 600;
}

.app-main {
    flex: 1;
    min-width: 0;
    overflow: auto;
    padding: 26px 28px 42px;
    background: var(--bg-base);
}

/* 接口文档页：隐藏控制台左侧导航（保留顶栏），主内容区占满 */
body.console-page-no-sidebar .sidebar-nav,
body.console-page-no-sidebar .sidebar-backdrop {
    display: none !important;
}
body.console-page-no-sidebar .sidebar-toggle {
    display: none !important;
}
body.console-page-no-sidebar .app-body-row .app-main {
    width: 100%;
}

/* 接口文档页顶栏与控制台其它页一致（同一 max-width 居中），仅隐藏侧栏 */

/* 登录页标题区（无控制台壳） */
header {
    text-align: center;
    margin-bottom: 28px;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
    color: var(--text-primary);
}

header p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    margin-bottom: 20px;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
    border-color: #d9dee4;
    box-shadow: 0 3px 14px rgba(2, 6, 23, 0.06);
}

.auth-card {
    max-width: 860px;
    margin: 0 auto;
    border: 1px solid #e3e5e8;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
    background: #fff;
    border-radius: 14px;
    padding: 26px 34px 24px;
}

.auth-header {
    text-align: center;
    margin-bottom: 18px;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #0f172a;
}

.auth-logo-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    margin: 0;
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.2);
}

.auth-header p {
    margin: 0;
    font-size: 0.95rem;
    color: #6b7280;
}

.auth-card-title {
    margin-bottom: 18px;
    font-size: 1rem;
    color: #111827;
}

.auth-main-btn {
    height: 42px;
}

.auth-tabs {
    display: flex;
    gap: 26px;
    justify-content: center;
    border-bottom: 1px solid var(--border-subtle);
    margin: 0 0 18px;
}

.auth-tab {
    border: none;
    background: transparent;
    color: #9aa0a6;
    font-size: 0.95rem;
    padding: 8px 0 11px;
    cursor: pointer;
    position: relative;
}

.auth-tab.auth-tab-disabled {
    color: #c3c7cd;
    cursor: not-allowed;
}

.auth-tab.active {
    color: #111827;
    font-weight: 600;
}

.auth-tab.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: #111827;
}

.auth-panel {
    display: none !important;
}

.auth-panel.active {
    display: block !important;
}

.wechat-iframe-wrap {
    width: 100%;
    max-width: 560px;
    height: 460px;
    margin: 8px auto 8px;
    border: 1px solid #e6e9ee;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.wechat-login-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.wechat-qr-hint {
    text-align: center;
    color: #8b9097;
    font-size: 0.8rem;
    margin-bottom: 14px;
}

.wechat-agree {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: #8b9097;
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0 auto;
    max-width: 560px;
}

.wechat-agree input {
    margin-top: 3px;
}

.page-title,
.card h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 600;
}

.card h3 {
    color: var(--text-primary);
    font-weight: 600;
}

.text-muted {
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.8125rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: var(--bg-input);
    color: var(--text-primary);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

select {
    cursor: pointer;
}

.btn {
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn-primary {
    background: linear-gradient(180deg, #6366f1 0%, var(--accent-dim) 100%);
    color: #fff;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn-danger {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #fee2e2;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 0.8125rem;
}

.code-input-group {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.code-input-group input {
    flex: 1;
}

.auth-switch {
    margin-top: 20px;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--accent-hover);
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-divider {
    position: relative;
    text-align: center;
    margin: 14px 0 12px;
}

.auth-divider::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--border-subtle);
}

.auth-divider span {
    position: relative;
    background: var(--bg-surface);
    color: var(--text-muted);
    padding: 0 10px;
    font-size: 0.8125rem;
}

.btn-wechat {
    background: #16a34a;
    color: #fff;
    border: 1px solid #15803d;
}

.btn-wechat:hover {
    background: #15803d;
    transform: translateY(-1px);
}

@media (max-width: 520px) {
    .auth-page-container {
        padding-top: 40px;
    }

    .auth-card {
        max-width: 100%;
        padding: 16px 14px 18px;
    }

    .auth-tabs {
        gap: 10px;
    }

    .auth-tab {
        font-size: 0.9rem;
    }

    .wechat-iframe-wrap {
        height: 360px;
        max-width: 100%;
    }

    .wechat-agree {
        max-width: 100%;
        font-size: 0.75rem;
    }
}

.auth-footer {
    margin-top: auto;
    padding-top: 10px;
    text-align: center;
    color: #a0a5ab;
    font-size: 0.75rem;
    line-height: 1.7;
}

.auth-footer a {
    color: #8f959c;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-footer-sep {
    margin: 0 8px;
    color: #c0c4c9;
}

/* 仪表盘网格 */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.dashboard-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-subtle);
    text-align: left;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
}

.dashboard-card:hover {
    border-color: rgba(139, 92, 246, 0.45);
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.2), 0 16px 48px rgba(0, 0, 0, 0.35);
    transform: translateY(-2px);
}

.dashboard-icon {
    font-size: 1.75rem;
    margin-bottom: 12px;
    opacity: 0.95;
}

.dashboard-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.dashboard-card p {
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.45;
}

.memory-item {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 12px;
    background: var(--bg-elevated);
    transition: border-color 0.2s;
}

.memory-item:hover {
    border-color: rgba(139, 92, 246, 0.35);
}

.memory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.memory-type {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(139, 92, 246, 0.12);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--accent-hover);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.memory-date {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.memory-content {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 10px;
}

.memory-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: var(--bg-base);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.search-result {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 12px;
    background: var(--bg-elevated);
}

.search-result.memory {
    border-left: 3px solid var(--accent);
}

.search-result.web {
    border-left: 3px solid #38bdf8;
}

.result-source {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.result-source.memory {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-hover);
}

.result-source.web {
    background: rgba(56, 189, 248, 0.12);
    color: #7dd3fc;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.loading {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
}

.spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.row .form-group {
    flex: 1;
    min-width: 160px;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    table-layout: auto;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
}

.user-table th,
.user-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.user-table th {
    background: var(--bg-elevated);
    font-weight: 600;
    color: var(--text-primary);
}

.admin-badge {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-hover);
    border-radius: 4px;
    font-size: 0.75rem;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* 套餐卡片 */
.plan-tier-card {
    flex: 1;
    min-width: 240px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.plan-tier-card.featured {
    border-color: rgba(139, 92, 246, 0.45);
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.15);
}

.plan-tier-card h3 {
    text-align: center;
    margin-bottom: 8px;
}

.plan-tier-card .price {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.plan-tier-card ul {
    color: var(--text-muted);
    margin-left: 18px;
    margin-bottom: 18px;
    font-size: 0.875rem;
    flex: 1;
}

/* 弹窗 */
.result-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    justify-content: center;
    align-items: center;
    z-index: 1001;
    padding: 20px;
}

.result-card {
    max-width: 400px;
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-align: center;
    box-shadow: var(--shadow-card);
}

.result-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    line-height: 1;
}

.success-icon {
    color: var(--success);
}

.fail-icon {
    color: var(--danger);
}

.result-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.result-desc {
    color: var(--text-muted);
    margin-bottom: 22px;
    font-size: 0.875rem;
}

.modal-card-inner {
    max-width: 440px;
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

/* 工具类 */
.btn-block {
    width: 100%;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.modal-actions .btn {
    flex: 1;
}

.modal-actions-lg {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions-lg .btn {
    flex: 1;
    padding: 12px;
}

.text-danger {
    color: var(--danger);
}

.link-accent {
    color: var(--accent-hover);
    text-decoration: none;
}

.link-accent:hover {
    text-decoration: underline;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-gap {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.flex-wrap {
    flex-wrap: wrap;
}

.mt-20 {
    margin-top: 20px;
}

.section-head {
    margin-bottom: 20px;
}

.payment-modal-card {
    max-width: 520px;
    width: 90%;
    padding: 30px;
    position: relative;
}

.payment-modal-title {
    margin-bottom: 24px;
    text-align: center;
}

.payment-info-panel {
    background: var(--bg-elevated);
    padding: 18px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border: 1px solid var(--border-subtle);
}

.payment-info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    align-items: center;
    gap: 12px;
}

.payment-info-row:last-child {
    margin-bottom: 0;
}

.payment-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.payment-value-name {
    font-weight: 600;
    color: var(--accent-hover);
}

.payment-amount-lg {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fb7185;
}

.payment-order-mono {
    font-family: ui-monospace, "SF Mono", monospace;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: right;
    word-break: break-all;
}

.payment-center-block {
    text-align: center;
    margin-bottom: 24px;
}

.payment-lead {
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-pay-alipay {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35);
}

.btn-pay-alipay:hover {
    filter: brightness(1.05);
}

.payment-footnote {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.payment-status-panel {
    padding: 20px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: var(--radius-md);
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.payment-status-title {
    font-size: 1.1rem;
    color: #1d4ed8;
    margin-bottom: 12px;
    display: block;
}

.payment-status-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.usage-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 12px;
}

.usage-title {
    color: var(--accent-hover);
    margin-bottom: 5px;
    font-size: 1.05rem;
    font-weight: 600;
}

.usage-bar-bg {
    background: var(--bg-base);
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.usage-bar-fill {
    background: linear-gradient(90deg, var(--accent-dim) 0%, var(--accent) 100%);
    height: 100%;
    transition: width 0.3s;
}

.usage-percent {
    text-align: center;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.plan-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: stretch;
}

.plan-tier-card h3.plan-name-muted {
    text-align: center;
    margin-bottom: 10px;
    color: var(--text-muted);
}

.plan-tier-card .price.price-muted {
    text-align: center;
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.plan-tier-card.plan-pro h3,
.plan-tier-card.plan-pro .price {
    color: var(--accent-hover);
}

.plan-tier-card.plan-max h3,
.plan-tier-card.plan-max .price {
    color: #5b21b6;
}

.btn-max-plan {
    background: linear-gradient(135deg, var(--accent-dim) 0%, var(--accent) 100%);
    color: #fff;
}

.btn-max-plan:hover {
    filter: brightness(1.06);
}

.timeline-month-title {
    color: var(--accent-hover);
    margin-bottom: 15px;
    border-bottom: 2px solid rgba(139, 92, 246, 0.4);
    padding-bottom: 8px;
    font-size: 1.05rem;
    font-weight: 600;
}

.code-sample {
    background: var(--bg-base);
    padding: 15px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.6;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-family: ui-monospace, "SF Mono", monospace;
}

.token-code-wrap {
    background: var(--bg-base);
    padding: 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border: 1px solid var(--border-subtle);
}

.token-code {
    word-break: break-all;
    font-size: 0.9rem;
    color: var(--accent-hover);
    font-family: ui-monospace, "SF Mono", monospace;
}

.memory-actions {
    margin-top: 10px;
}

.loading-caption {
    margin-top: 10px;
    color: var(--text-muted);
}

.modal-nested {
    max-width: 400px;
    width: 90%;
}

.modal-hint {
    margin-bottom: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.text-right {
    text-align: right;
}

.email-row {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.btn-inline-sm {
    margin-left: 10px;
    padding: 2px 8px;
}

.modal-wide {
    max-width: 500px;
    width: 90%;
}

.timeline-day-group {
    margin-bottom: 30px;
}

label input[type="checkbox"] {
    margin-right: 6px;
    accent-color: var(--accent);
    vertical-align: middle;
}

/* —— 响应式：窄屏侧栏抽屉 + 顶栏导航横向滚动 —— */
.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-right: 6px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--bg-elevated);
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 1024px) {
    .top-header {
        padding: 0 12px 0 10px;
    }

    .top-nav-link {
        padding: 8px 10px;
        font-size: 0.8125rem;
    }
}

@media (max-width: 900px) {
    .sidebar-toggle {
        display: inline-flex;
    }

    .top-nav-right {
        flex: 1 1 auto;
        min-width: 0;
        overflow-x: auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 0;
        padding: 0 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .top-header-user {
        gap: 6px;
    }

    .top-header-user .user-info {
        display: none;
    }

    .top-header-user .btn-sm {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .app-body-row {
        position: relative;
    }

    .sidebar-nav {
        position: fixed;
        top: var(--top-header-h);
        left: 0;
        bottom: 0;
        z-index: 300;
        width: min(288px, 86vw);
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 4px 0 24px rgba(15, 23, 42, 0.12);
        overflow-y: auto;
        padding-bottom: 32px;
    }

    body.sidebar-drawer-open .sidebar-nav {
        transform: translateX(0);
    }

    body.sidebar-drawer-open .sidebar-backdrop {
        display: block;
        position: fixed;
        top: var(--top-header-h);
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 250;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(3px);
    }

    .app-main {
        padding: 16px 14px 32px;
    }

    .card {
        padding: 18px 16px;
    }

    .app-main .container {
        max-width: 100%;
    }

    .flex-between {
        gap: 10px;
        flex-wrap: wrap;
    }

    .modal-actions-lg,
    .modal-actions {
        flex-wrap: wrap;
    }

    .modal-actions-lg .btn,
    .modal-actions .btn {
        min-width: 140px;
    }
}

@media (max-width: 480px) {
    .top-brand span:last-child {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .code-input-group {
        flex-direction: column;
    }

    .code-input-group .btn {
        width: 100%;
    }

    .account-dl {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .account-dl dt {
        margin-top: 8px;
    }
}

/* ===== 登录页 V2（对齐参考站布局） ===== */
body.auth-page-body {
    background: #f2f3f5;
}

.auth-page-container {
    padding-top: 44px;
    padding-bottom: 16px;
}

.auth-page-main {
    max-width: 760px;
}

.auth-header {
    margin-bottom: 22px;
}

.auth-brand {
    gap: 10px;
    margin-bottom: 0;
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
}

.auth-header p {
    margin-top: 8px;
    font-size: 0.88rem;
    color: #8b9097;
}

.auth-logo-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    box-shadow: none;
}

.auth-card {
    max-width: 620px;
    border-radius: 12px;
    border: 1px solid #dcdfe4;
    box-shadow: none;
    padding: 22px 30px 22px;
}

.auth-card:hover {
    border-color: #d6d9de;
    box-shadow: none;
}

.auth-tabs {
    gap: 28px;
    border-bottom: none;
    margin: 0 0 10px;
}

.auth-tab {
    color: #9aa0a6;
    font-size: 1.02rem;
    padding: 8px 0;
}

.auth-tab.active {
    color: #111827;
    font-weight: 600;
}

.auth-tab.active::after {
    left: 4px;
    right: 4px;
    bottom: 1px;
    height: 2px;
}

.wechat-iframe-wrap {
    max-width: 330px;
    height: 330px;
    margin-top: 8px;
    margin-bottom: 12px;
    border: 1px solid #e4e7eb;
    border-radius: 0;
}

.wechat-qr-hint {
    font-size: 0.84rem;
    margin-bottom: 18px;
}

.wechat-agree {
    max-width: 100%;
    color: #8d939b;
    font-size: 0.9rem;
    line-height: 1.65;
}

#accountPanel .form-group {
    margin-bottom: 14px;
}

#accountPanel label {
    color: #6b7280;
}

#accountPanel input[type="text"],
#accountPanel input[type="password"] {
    height: 42px;
    border-radius: 8px;
}

#accountPanel .auth-main-btn {
    margin-top: 8px;
    height: 44px;
}

.auth-switch {
    margin-top: 18px;
    font-size: 0.88rem;
}

.auth-footer {
    font-size: 0.76rem;
    color: #9aa0a6;
    line-height: 1.8;
}

@media (max-width: 700px) {
    .auth-page-main {
        max-width: 100%;
    }

    .auth-card {
        max-width: 100%;
        padding: 16px 14px 18px;
    }

    .auth-tabs {
        gap: 14px;
    }

    .auth-tab {
        font-size: 0.92rem;
    }

    .wechat-iframe-wrap {
        max-width: 100%;
        height: 350px;
    }
}

/* —— 充值明细（参考 Kimi / Moonshot 开放平台账户页：分区卡片 + 浅表头表格） —— */
.billing-page {
    max-width: var(--content-max);
}

.billing-page-header {
    margin-bottom: 24px;
}

.billing-page-title {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.35;
}

.billing-page-desc {
    margin-top: 8px;
    font-size: 0.8125rem;
    color: #86909c;
    line-height: 1.55;
    max-width: 720px;
}

.billing-account-strip {
    padding: 0;
    overflow: hidden;
}

.billing-account-strip-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #fafbfc 0%, #ffffff 100%);
    border-bottom: 1px solid #f2f3f5;
}

.billing-account-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.billing-account-label {
    font-size: 0.75rem;
    color: #86909c;
    font-weight: 500;
}

.billing-account-balance {
    font-size: 1.75rem;
    font-weight: 600;
    color: #1d2129;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.billing-account-meta {
    font-size: 0.8125rem;
    color: #86909c;
    text-align: right;
    max-width: 420px;
}

.billing-account-meta-item {
    line-height: 1.5;
}

.billing-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
}

.billing-section {
    margin-bottom: 20px;
}

.billing-section--table {
    margin-bottom: 0;
}

.billing-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 16px 20px 0;
    margin: 0 0 14px;
    border-left: 3px solid var(--text-primary);
    margin-left: 0;
    padding-left: 17px;
    line-height: 1.4;
}

.billing-balance-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    padding: 0 20px 18px;
}

.billing-balance-hint {
    font-size: 0.75rem;
    color: #86909c;
    flex: 1 1 220px;
    margin: 0;
    line-height: 1.5;
}

.billing-balance-input {
    width: 160px;
}

.billing-field,
.billing-select,
.billing-input {
    min-height: 36px;
    padding: 7px 12px;
    font-size: 0.8125rem;
    border: 1px solid #e5e6eb;
    border-radius: 6px;
    background: #fff;
    color: var(--text-primary);
    transition: border-color 0.15s ease;
}

.billing-field:focus,
.billing-select:focus,
.billing-input:focus {
    outline: none;
    border-color: #c9cdd4;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.04);
}

.billing-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 18px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #fff;
    background: #1d2129;
    border: 1px solid #1d2129;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.billing-btn-primary:hover {
    background: #000;
    border-color: #000;
}

.billing-btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 16px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    background: #fff;
    border: 1px solid #e5e6eb;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.billing-btn-outline:hover {
    background: #f7f8fa;
    border-color: #c9cdd4;
}

.billing-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #1664ff;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.billing-btn-ghost:hover {
    background: rgba(22, 100, 255, 0.06);
}

.billing-btn-sm {
    min-height: 28px;
    padding: 0 10px;
    font-size: 0.75rem;
}

.billing-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px 18px;
    padding: 4px 20px 18px;
}

.billing-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.billing-filter-group label {
    font-size: 0.75rem;
    color: #86909c;
    font-weight: 500;
}

.billing-filter-amount .billing-amount-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.billing-amount-sep {
    color: #c9cdd4;
    font-size: 0.75rem;
}

.billing-toolbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.billing-table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.billing-table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #f2f3f5;
    background: #fafbfc;
}

.billing-table-head-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.billing-table-body {
    min-height: 120px;
}

.billing-table-body .loading,
.billing-table-body .empty-state {
    padding: 48px 24px;
    text-align: center;
    font-size: 0.8125rem;
    color: #86909c;
}

.billing-table-body .empty-state p {
    margin: 0;
}

.billing-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.billing-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    color: #1d2129;
}

.billing-data-table thead th {
    text-align: left;
    font-weight: 500;
    color: #4e5969;
    background: #f7f8fa;
    border-bottom: 1px solid #e5e6eb;
    padding: 11px 16px;
    white-space: nowrap;
}

.billing-data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f2f3f5;
    vertical-align: middle;
}

.billing-data-table tbody tr:last-child td {
    border-bottom: none;
}

.billing-data-table tbody tr:hover td {
    background: #fafafa;
}

.billing-col-amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.billing-amount-cell {
    font-weight: 500;
    color: #1d2129;
}

.billing-cell-time {
    color: #4e5969;
    font-size: 0.8125rem;
}

.billing-cell-id {
    max-width: 200px;
}

.billing-col-actions {
    text-align: right;
    width: 1%;
}

.billing-pkg-cell {
    max-width: 260px;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: #4e5969;
}

.billing-actions-cell {
    white-space: nowrap;
    text-align: right;
}

.billing-actions-cell .btn + .btn {
    margin-left: 6px;
}

.billing-order-link {
    background: none;
    border: none;
    padding: 0;
    color: #1664ff;
    cursor: pointer;
    text-align: left;
    font: inherit;
    font-size: 0.8125rem;
    text-decoration: none;
    max-width: 100%;
}

.billing-order-link:hover {
    text-decoration: underline;
    color: #0e42d2;
}

.billing-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
}

.billing-tag-pending {
    background: #fff7e8;
    color: #d46b08;
}

.billing-tag-paid {
    background: #e8ffea;
    color: #00b42a;
}

.billing-tag-muted {
    background: #f2f3f5;
    color: #86909c;
}

.billing-tag-failed {
    background: #ffece8;
    color: #d03050;
}

.billing-modal-overlay {
    background: rgba(29, 33, 41, 0.45);
    backdrop-filter: blur(2px);
}

.billing-detail-modal {
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 22px 24px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.billing-modal-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f2f3f5;
}

.billing-modal-actions {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid #f2f3f5;
}

.billing-detail-h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    margin: 18px 0 10px;
    color: #4e5969;
}

.billing-detail-h3:first-of-type {
    margin-top: 0;
}

.billing-detail-dl {
    margin-bottom: 0;
}

.billing-detail-body .account-dl {
    font-size: 0.8125rem;
}

.billing-log-list {
    margin: 0;
    padding-left: 18px;
    font-size: 0.8125rem;
    color: #4e5969;
}

.billing-log-time {
    color: #86909c;
    margin-right: 8px;
}

/* 用户中心 / 充值明细（兼容旧类名） */
.account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

.account-dl {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 12px 16px;
    font-size: 0.9375rem;
}

.account-dl dt {
    color: var(--text-muted);
    font-weight: 500;
}

.account-dl dd {
    color: var(--text-primary);
}

.mono-cell {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 0.8125rem;
    word-break: break-all;
}

/* ========== 三端响应式：手机 / 平板 / 桌面 ========== */
@media (max-width: 1024px) {
    .billing-page-title {
        font-size: 1.2rem;
    }

    .billing-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .billing-toolbar-actions {
        margin-left: 0;
        justify-content: flex-start;
    }

    .plan-row {
        flex-direction: column;
    }

    .plan-tier-card {
        min-width: 0;
        width: 100%;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    body:not(.console-body):not(.auth-page-body) {
        padding: 18px max(18px, env(safe-area-inset-right, 0px)) 28px max(18px, env(safe-area-inset-left, 0px));
    }

    .app-main {
        padding: 22px 20px 36px;
    }

    .dashboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 640px) {
    body:not(.console-body):not(.auth-page-body) {
        padding: 12px max(12px, env(safe-area-inset-right, 0px)) max(20px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
    }

    .card {
        padding: 16px 14px;
    }

    .page-title,
    .card h2 {
        font-size: 1rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .usage-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .payment-modal-card {
        width: 100%;
        max-width: none;
        padding: 20px 16px;
    }
}
