/* ============================================================
   拼豆图纸转换 Pro - 设计系统
   像素工艺风：暖色画布 + 像素网格背景 + 珊瑚红强调色
   ============================================================ */

:root {
    /* 配色 */
    --bg: #FFF8F0;
    --surface: #FFFFFF;
    --surface-alt: #FAF4EC;
    --text: #1A1A2E;
    --text-secondary: #6B6B80;
    --text-muted: #A0A0B0;
    --accent: #FF6B6B;
    --accent-dark: #E55555;
    --accent-light: #FFE8E8;
    --success: #4ECDC4;
    --success-dark: #36B5AC;
    --warning: #FFB84D;
    --info: #6B8AFE;
    --border: #EEE8E0;
    --border-strong: #D8D0C4;
    --shadow-sm: 0 1px 3px rgba(26, 26, 46, 0.06);
    --shadow-md: 0 4px 16px rgba(26, 26, 46, 0.08);
    --shadow-lg: 0 12px 40px rgba(26, 26, 46, 0.12);

    /* 尺寸 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --max-width: 1180px;
    --header-height: 64px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 像素网格背景（全局） */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(214, 200, 180, 0.25) 1px, transparent 1px),
        linear-gradient(90deg, rgba(214, 200, 180, 0.25) 1px, transparent 1px);
    background-size: 24px 24px;
    background-position: -1px -1px;
}

/* ============================================================
   顶部导航栏
   ============================================================ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    background: rgba(255, 248, 240, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 32px;
}

.navbar-inner {
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-brand .brand-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 2px;
    box-shadow: 2px 2px 0 var(--accent-dark);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.navbar-user .username {
    font-weight: 600;
    color: var(--text);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-premium {
    background: #FFF3CD;
    color: #856404;
}

.badge-credits {
    background: #E0F7F5;
    color: var(--success-dark);
}

.badge-test {
    background: var(--accent-light);
    color: var(--accent-dark);
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 0 var(--accent-dark);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 3px 0 var(--accent-dark);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 1px 0 var(--accent-dark);
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 2px 0 var(--success-dark);
}

.btn-success:hover:not(:disabled) {
    background: var(--success-dark);
    transform: translateY(-1px);
}

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

.btn-ghost:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.btn-link {
    background: transparent;
    color: var(--accent);
    padding: 6px 12px;
}

.btn-link:hover {
    background: var(--accent-light);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

/* ---- 调节滑块（亮度/对比度/鲜艳度） ---- */
.adjust-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.adjust-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.adjust-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.adjust-value {
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 600;
    min-width: 32px;
    text-align: right;
}
.adjust-row input[type="range"] {
    margin: 0;
    height: 6px;
    accent-color: var(--accent);
}

/* ============================================================
   首页 Hero
   ============================================================ */
.hero {
    min-height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
    position: relative;
}

.hero-brand {
    font-size: clamp(3rem, 8vw, 5.5rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 16px;
    color: #6C5CD2;
    display: flex;
    align-items: center;
    gap: 16px;
}

.hero-logo {
    flex-shrink: 0;
    filter: drop-shadow(0 4px 12px rgba(231, 106, 90, 0.25));
}

.hero-brand .accent {
    color: #8C7BF0;
}

.hero-tagline {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin-bottom: 40px;
    line-height: 1.7;
}

.hero-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.hero-upload-btn {
    padding: 18px 48px;
    font-size: 1.15rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 4px 0 var(--accent-dark), 0 8px 24px rgba(255, 107, 107, 0.3);
    transition: all 0.2s ease;
    font-family: inherit;
}

.hero-upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--accent-dark), 0 12px 32px rgba(255, 107, 107, 0.4);
}

.hero-upload-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--accent-dark);
}

.hero-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* 首页装饰：漂浮的彩色像素方块 */
.hero-deco {
    position: absolute;
    pointer-events: none;
    border-radius: 3px;
    opacity: 0.7;
}

.hero-deco.d1 { top: 15%; left: 10%; width: 16px; height: 16px; background: #FF6B6B; animation: float 4s ease-in-out infinite; }
.hero-deco.d2 { top: 20%; right: 12%; width: 20px; height: 20px; background: #4ECDC4; animation: float 5s ease-in-out infinite 0.5s; }
.hero-deco.d3 { bottom: 18%; left: 14%; width: 14px; height: 14px; background: #FFE66D; animation: float 4.5s ease-in-out infinite 1s; }
.hero-deco.d4 { bottom: 22%; right: 16%; width: 18px; height: 18px; background: #6B8AFE; animation: float 5.5s ease-in-out infinite 1.5s; }
.hero-deco.d5 { top: 40%; left: 6%; width: 12px; height: 12px; background: #FF9F43; animation: float 6s ease-in-out infinite 0.8s; }
.hero-deco.d6 { top: 60%; right: 8%; width: 14px; height: 14px; background: #A55EEA; animation: float 4.8s ease-in-out infinite 2s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(15deg); }
}

/* ============================================================
   步骤指示器
   ============================================================ */
.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 24px 0;
    max-width: var(--max-width);
    margin: 0 auto;
    flex-wrap: wrap;
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface-alt);
    border: 2px solid var(--border-strong);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.step.active .step-num {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.step.active {
    color: var(--text);
}

.step.done .step-num {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.step-arrow {
    color: var(--border-strong);
    font-size: 1rem;
}

/* ============================================================
   页面主容器
   ============================================================ */
.page {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px 24px 60px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 28px;
}

/* 页面头部：标题与操作区横向排列（Issue 10：补充未定义类） */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

/* ============================================================
   工作台布局
   ============================================================ */
.workspace {
    display: grid;
    gap: 24px;
}

.workspace-2col {
    grid-template-columns: 1fr 340px;
}

@media (max-width: 900px) {
    .workspace-2col {
        grid-template-columns: 1fr;
    }
}

.workspace-main {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.workspace-side {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    align-self: start;
}

/* ============================================================
   表单元素
   ============================================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
}

select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236B6B80' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ============================================================
   选项卡片（用于图片类型选择等）
   ============================================================ */
.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.option-card {
    padding: 16px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    background: var(--surface);
}

.option-card:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.option-card.selected {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.15);
}

.option-card .icon {
    font-size: 1.8rem;
    margin-bottom: 6px;
}

.option-card .label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.option-card .desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================================
   裁切/预览区域
   ============================================================ */
.crop-area {
    position: relative;
    background:
        linear-gradient(45deg, #F0EBE3 25%, transparent 25%),
        linear-gradient(-45deg, #F0EBE3 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #F0EBE3 75%),
        linear-gradient(-45deg, transparent 75%, #F0EBE3 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: auto;
    min-height: 480px;
    height: calc(100vh - 280px);
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    cursor: grab;
}

.crop-area:active { cursor: grabbing; }

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

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.zoom-label {
    min-width: 48px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    font-family: monospace;
}

.crop-stage {
    position: relative;
    display: inline-block;
    line-height: 0;
    max-width: 100%;
}

.crop-area canvas, .crop-stage canvas {
    display: block;
    max-width: 100%;
}

.crop-frame {
    position: absolute;
    border: 2px solid var(--accent);
    background: rgba(255, 107, 107, 0.1);
    cursor: move;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.3);
    touch-action: none;
}

.crop-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    touch-action: none;
}

.crop-handle.tl { top: -7px; left: -7px; cursor: nwse-resize; }
.crop-handle.tr { top: -7px; right: -7px; cursor: nesw-resize; }
.crop-handle.bl { bottom: -7px; left: -7px; cursor: nesw-resize; }
.crop-handle.br { bottom: -7px; right: -7px; cursor: nwse-resize; }

.crop-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(26, 26, 46, 0.85);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-family: monospace;
    z-index: 10;
}

/* 图片预览区 */
.image-preview {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-alt);
    overflow: auto;
    min-height: 120px;
    max-height: 200px;
    text-align: center;
    padding: 8px;
}

.image-preview img {
    max-width: 100%;
    max-height: 180px;
    display: inline-block;
    object-fit: contain;
}

.image-preview .placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 40px;
}

/* ============================================================
   结果展示
   ============================================================ */
.result-preview {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    overflow: auto;
    min-height: 400px;
    text-align: center;
}

.result-preview img {
    max-width: none;
    height: auto;
    display: inline-block;
}

.result-preview canvas {
    display: inline-block;
    margin: 0 auto;
}

.result-preview .placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 40px 0;
}

/* 编辑工具栏 */
.edit-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

/* 颜色选择器带色块 */
.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.color-picker-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid var(--border-strong);
    flex-shrink: 0;
    background: #ccc;
}

/* 自定义颜色下拉（带色块） */
.color-dropdown {
    position: relative;
    display: inline-block;
    min-width: 160px;
}

.color-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    cursor: pointer;
    font-size: 0.85rem;
    min-height: 34px;
}

.color-dropdown-trigger:hover {
    border-color: var(--accent);
}

.color-dropdown-swatch {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 1px solid var(--border-strong);
    flex-shrink: 0;
    background: #ccc;
}

.color-dropdown-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-dropdown-arrow {
    color: var(--text-muted);
    font-size: 0.7rem;
    flex-shrink: 0;
}

.color-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    margin-top: 2px;
    padding: 4px;
}

.color-dropdown-menu.open {
    display: block;
}

.color-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
}

.color-dropdown-item:hover {
    background: var(--surface-alt);
}

.color-dropdown-item.selected {
    background: var(--accent-light);
}

.color-dropdown-item .item-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid var(--border-strong);
    flex-shrink: 0;
}

.color-dropdown-item .item-code {
    font-weight: 600;
    color: var(--text);
}

.color-dropdown-item .item-name {
    color: var(--text-secondary);
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-dropdown-item .item-count {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* 全宽颜色清单区域 */
.color-list-section {
    max-width: var(--max-width);
    margin: 24px auto 0;
    padding: 0 24px 40px;
}

.color-list-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
}

.color-list-compact {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
}

.color-item-compact {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    gap: 6px;
}

.color-item-compact .color-box {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-right: 0;
    border: 1px solid var(--border-strong);
    flex-shrink: 0;
}

.color-item-compact .color-code {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-item-compact .color-count {
    margin-left: auto;
    font-weight: 700;
    color: var(--accent-dark);
    white-space: nowrap;
}

.edit-hint {
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.edit-dirty-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #FFF3CD;
    color: #856404;
}

.result-preview canvas:active { cursor: grabbing; }
.result-preview img:active { cursor: grabbing; }

/* Tab 栏 */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 18px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: inherit;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--accent);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 颜色清单 */
.color-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.color-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.color-box {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    margin-right: 10px;
    border: 1px solid var(--border-strong);
    flex-shrink: 0;
}

.color-item .count {
    margin-left: auto;
    font-weight: 700;
    color: var(--text-secondary);
}

/* 统计信息 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    padding: 14px;
    background: var(--surface-alt);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card .stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
    margin-top: 2px;
}

/* ============================================================
   认证页面
   ============================================================ */
.auth-page {
    min-height: calc(100vh - var(--header-height));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text);
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 28px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

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

/* ============================================================
   提示框
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success { background: #E0F7F5; color: var(--success-dark); border: 1px solid #B8EAE4; }
.alert-error { background: var(--accent-light); color: var(--accent-dark); border: 1px solid #FFC7C7; }
.alert-warning { background: #FFF4E0; color: #B8730A; border: 1px solid #FFE0B0; }
.alert-info { background: #EBEEFF; color: #4258C0; border: 1px solid #D0D6FF; }

/* 浮动提示 (toast) */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 600;
    animation: toastIn 0.3s ease;
    max-width: 360px;
}

.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--accent); color: white; }
.toast-warning { background: var(--warning); color: white; }
.toast-info { background: var(--info); color: white; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   加载遮罩
   ============================================================ */
#loadingOverlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 248, 240, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#loadingOverlay.active {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    position: absolute;
    margin-top: 80px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
}

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

/* ============================================================
   个人中心
   ============================================================ */
.profile-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 24px 60px;
}

.profile-header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    flex-shrink: 0;
}

.profile-info h2 {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.profile-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.usage-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.usage-table th,
.usage-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.usage-table th {
    background: var(--surface-alt);
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.usage-table tr:last-child td {
    border-bottom: none;
}

/* ============================================================
   套餐页
   ============================================================ */
.test-banner {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    text-align: center;
    font-weight: 600;
}

/* ============================================================
   数据表格
   ============================================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.data-table th {
    background: var(--surface-alt);
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

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

/* ============================================================
   套餐卡片
   ============================================================ */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.plan-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
}

.plan-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.plan-featured {
    border-color: var(--warning);
    background: linear-gradient(180deg, #FFFBEC 0%, var(--surface) 60%);
}

.plan-tag {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--warning);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 20px;
    letter-spacing: 0.05em;
}

.plan-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
}

.plan-price {
    font-size: 2.25rem;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.plan-price span {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.plan-features {
    list-style: none;
    margin-bottom: 24px;
    text-align: left;
}

.plan-features li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.plan-features li:last-child {
    border-bottom: none;
}

/* ============================================================
   支付结果卡片
   ============================================================ */
.result-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
}

.result-success { background: var(--success); }
.result-pending { background: var(--warning); }

.result-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 12px;
}

.result-message {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 28px;
    font-size: 0.95rem;
}

.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================================
   工具类
   ============================================================ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.hidden { display: none; }

/* 分隔线 */
.divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
    border: none;
}

/* 文件输入隐藏 */
.file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

/* 响应式 */
@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }
    .page {
        padding: 16px 16px 40px;
    }
    .hero-brand {
        font-size: 3rem;
    }
    .workspace-2col {
        gap: 16px;
    }
    .option-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .navbar-user .username {
        display: none;
    }
}