/**
 * 布局样式
 */

/* ========== 应用整体布局 ========== */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== 汉堡菜单按钮 - 高对比度可见样式 ========== */
.hamburger-btn {
    display: none;
    width: 44px;
    height: 44px;
    border: 2px solid #3d3225;
    background: var(--surface);
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
    z-index: 110;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: background 0.2s ease, transform 0.2s ease;
}

.hamburger-btn:hover {
    transform: scale(1.05);
    background: var(--surface-hover);
}

.hamburger-btn:active {
    transform: scale(0.96);
}

.hamburger-btn svg {
    display: block;
    width: 24px;
    height: 24px;
}

.hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ========== 侧边栏导航（移动端）========== */
.mobile-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 105;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
}

.mobile-sidebar.open {
    transform: translateX(0);
}

.mobile-sidebar-nav {
    flex: 1;
    padding: var(--space-md) 0;
    overflow-y: auto;
}

.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 104;
    backdrop-filter: blur(4px);
}

.mobile-sidebar-overlay.show {
    display: block;
}

.mobile-sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface-gold-tint) 0%, var(--surface) 100%);
}

.mobile-sidebar-header .app-logo {
    font-size: 1rem;
    justify-content: center;
}

.mobile-sidebar-nav {
    padding: var(--space-md) 0;
}

.mobile-sidebar-nav .nav-item {
    display: block;
    padding: var(--space-md) var(--space-lg);
    font-size: 0.9rem;
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.mobile-sidebar-nav .nav-item:hover {
    background: var(--surface-hover);
}

.mobile-sidebar-nav .nav-item.active {
    background: var(--primary-50);
    color: var(--primary);
    border-left: 3px solid var(--primary-500);
}

.mobile-sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-md) 0;
}

.mobile-sidebar-user {
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.mobile-sidebar-user .flex {
    align-items: center;
    gap: var(--space-md);
}

.mobile-sidebar-user .user-avatar {
    width: 44px;
    height: 44px;
}

/* ========== 顶部导航 ========== */
.app-header {
    height: var(--header-height);
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-gold-tint) 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 var(--space-lg);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: var(--space-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 4px rgba(166, 124, 82, 0.06);
}

.app-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--primary-300) 20%, var(--primary-400) 50%, var(--primary-300) 80%, transparent 100%);
    pointer-events: none;
}

.app-logo {
    font-family: var(--font-title);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    position: relative;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.05em;
}

.app-logo .logo-icon {
    font-size: 1.4rem;
    -webkit-text-fill-color: initial;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex: 1;
    position: relative;
}

.nav-item {
    padding: var(--space-sm) var(--space-md);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    position: relative;
    font-family: var(--font-title);
    letter-spacing: 0.02em;
}

.nav-item:hover {
    color: var(--text);
    background-color: var(--primary-50);
}

.nav-item.active {
    color: var(--primary);
    background-color: var(--primary-100);
    font-weight: 600;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 2px;
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* 用户头像 */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

/* 在线状态指示器 */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-online { background-color: var(--success); }
.status-offline { background-color: var(--text-muted); }
.status-syncing { background-color: var(--warning); animation: pulse 1s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ========== 主内容区 ========== */
.app-main {
    flex: 1;
    padding: var(--space-lg);
    max-width: var(--content-max-width);
    width: 100%;
    margin: 0 auto;
    position: relative;
}

.app-main.narrow {
    max-width: 800px;
}

/* ========== 页面容器 ========== */
.page {
    animation: page-in var(--transition-normal) ease-out;
}

@keyframes page-in {
    from { 
        opacity: 0; 
        transform: translateY(12px); 
    }
    to   { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.page-header {
    margin-bottom: var(--space-xl);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
    position: relative;
    padding-bottom: var(--space-md);
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--primary-300) 0%, var(--primary-200) 30%, transparent 70%);
}

.page-title-wrap {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    font-family: var(--font-title);
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.page-title::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 28px;
    background: var(--primary-gradient);
    border-radius: 3px;
    flex-shrink: 0;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: var(--space-xs);
    padding-left: calc(5px + var(--space-sm));
}

/* 页面装饰元素 */
.page-decoration {
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background: radial-gradient(ellipse at top right, var(--primary-100) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0.5;
}

/* 内容区块间距 */
.section {
    margin-bottom: var(--space-xl);
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    font-family: var(--font-title);
    margin-bottom: var(--space-md);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    letter-spacing: 0.02em;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 20px;
    background: var(--primary-gradient);
    border-radius: 2px;
}

.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-200), transparent);
    margin: var(--space-lg) 0;
}

/* ========== 网格布局 ========== */
.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* ========== 登录/注册页面布局 ========== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(212, 175, 55, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(166, 124, 82, 0.08) 0%, transparent 50%),
        var(--bg);
    padding: var(--space-lg);
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-100) 0%, transparent 70%);
    opacity: 0.5;
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: 
        0 8px 32px rgba(166, 124, 82, 0.12),
        0 2px 8px rgba(166, 124, 82, 0.08);
    padding: var(--space-xl);
    position: relative;
    z-index: 1;
    animation: auth-card-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes auth-card-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.auth-logo {
    text-align: center;
    margin-bottom: var(--space-lg);
    position: relative;
}

.auth-logo-icon {
    font-size: 3rem;
    margin-bottom: var(--space-sm);
    display: block;
    filter: drop-shadow(0 2px 8px rgba(166, 124, 82, 0.2));
}

.auth-logo-text {
    font-family: var(--font-title);
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.08em;
}

.auth-title {
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: var(--space-sm);
    font-family: var(--font-title);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.03em;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: var(--space-lg);
    line-height: 1.6;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin: var(--space-md) 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-200), transparent);
}

.auth-divider span {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.auth-field label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-family: var(--font-title);
    letter-spacing: 0.02em;
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-lg);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-footer a {
    font-weight: 600;
    color: var(--primary);
}

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

/* 记住密码复选框 */
.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-sm);
}

.auth-options .checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.auth-options .forgot-link {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 500;
}

/* 登录按钮 */
.auth-btn {
    width: 100%;
    margin-top: var(--space-sm);
    padding: 14px var(--space-lg);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-title);
    letter-spacing: 0.05em;
}

/* ========== 待审核页面 ========== */
.pending-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.pending-card {
    text-align: center;
    max-width: 400px;
}

.pending-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

/* ========== 响应式 ========== */
/* 桌面端：显示表格，隐藏卡片 */
.table-cards {
    display: none;
}

.mobile-table table {
    display: table;
}

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    /* 手机端：隐藏表格，显示卡片 */
    .mobile-table table {
        display: none !important;
    }

    .mobile-table .table-cards {
        display: block !important;
    }

    html {
        font-size: 15px;
    }

    /* 显示汉堡菜单按钮 */
    .hamburger-btn {
        display: flex !important;
        background: var(--surface) !important;
        border: 2px solid #3d3225 !important;
        border-radius: var(--radius-md);
    }

    /* 侧边栏容器在手机端存在（但用 transform 隐藏），遮罩层默认不显示 */
    .mobile-sidebar {
        display: flex;
    }

    .mobile-sidebar-overlay {
        display: none;
    }

    .mobile-sidebar-overlay.show {
        display: block;
    }

    /* 顶部导航：极简模式 */
    .app-header {
        padding: 0 var(--space-sm);
        gap: var(--space-xs);
        height: var(--header-height-sm, 52px);
        flex-wrap: nowrap;
        justify-content: space-between;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
    }

    .app-logo {
        font-size: 0.9rem;
        white-space: nowrap;
        flex-shrink: 0;
        max-width: 130px;
        overflow: hidden;
        text-overflow: ellipsis;
        /* 手机端 logo 用实色，避免渐变看不清 */
        -webkit-text-fill-color: var(--primary);
        color: var(--primary);
        font-weight: 700;
    }

    /* 隐藏顶部导航的导航项 */
    .app-nav {
        display: none !important;
    }

    /* 头部操作区：隐藏用户名和头像，只保留核心按钮 */
    .app-header-actions .flex.flex-col {
        display: none;
    }

    .app-header-actions {
        gap: 2px;
        flex-shrink: 0;
    }

    .app-header-actions .user-avatar {
        display: none;
    }

    .app-header-actions .btn-icon {
        width: 40px;
        height: 40px;
        min-height: 40px;
        color: var(--text);
        background: var(--surface-alt);
        border: 1px solid var(--border);
        font-size: 1.1rem;
    }

    .app-header-actions .btn-icon:hover {
        background: var(--primary-50);
        color: var(--primary);
    }

    /* 主内容区 */
    .app-main {
        padding: var(--space-xs);
        max-width: 100%;
    }

    /* 网格布局改为单列 */
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

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

    /* 页面标题区 */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
        margin-bottom: var(--space-md);
    }

    .page-title {
        font-size: 1.1rem;
    }

    .page-header .flex {
        width: 100%;
        flex-wrap: wrap;
        gap: var(--space-xs);
    }

    .page-header .btn {
        flex: 1;
        min-width: 0;
    }

    /* 卡片样式优化 */
    .card {
        border-radius: var(--radius-lg);
        overflow: hidden;
    }

    .card-body {
        padding: var(--space-md);
    }

    .card-header {
        padding: var(--space-sm) var(--space-md);
        flex-wrap: wrap;
    }

    /* 按钮优化 */
    .btn {
        min-height: 44px;
        padding: var(--space-md) var(--space-lg);
        font-size: 0.9rem;
    }

    .btn-sm {
        min-height: 36px;
        padding: var(--space-xs) var(--space-md);
        font-size: 0.85rem;
    }

    .btn-icon {
        width: 44px;
        height: 44px;
    }

    .btn-icon.btn-sm {
        width: 36px;
        height: 36px;
    }

    /* 输入框优化 */
    .input, .select, .textarea {
        padding: var(--space-md);
        font-size: 0.95rem;
    }

    .input-sm, .select.input-sm {
        padding: var(--space-sm);
        font-size: 0.85rem;
    }

    /* 模态框全屏显示 */
    .modal {
        width: 100%;
        max-width: none;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .modal-overlay {
        padding: 0;
        align-items: stretch;
    }

    .modal-body {
        padding: var(--space-md);
    }

    .modal-header, .modal-footer {
        padding: var(--space-sm) var(--space-md);
    }

    .modal-header h3 {
        font-size: 1rem;
    }

    .modal .grid-2 {
        grid-template-columns: 1fr;
    }

    /* Toast 提示 */
    .toast-container {
        top: var(--space-md);
        right: var(--space-sm);
        left: var(--space-sm);
    }

    .toast {
        min-width: auto;
        max-width: none;
    }

    .grid {
        gap: var(--space-md);
    }

    /* 统计卡片 */
    .card-stat {
        padding: var(--space-md);
    }

    .card-stat-value {
        font-size: 1.3rem;
    }

    /* Tab 切换 */
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab {
        flex-shrink: 0;
    }

    /* 登录卡片 */
    .auth-card {
        padding: var(--space-lg);
        margin: var(--space-xs);
    }

    /* 工作台：卡片式布局 */
    .workbench-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .workbench-card {
        background: var(--surface);
        border-radius: var(--radius-lg);
        border: 1px solid var(--border);
        padding: var(--space-md);
        transition: all 0.3s ease;
    }

    .workbench-card:active {
        transform: scale(0.98);
    }

    .workbench-card-icon {
        font-size: 1.8rem;
        margin-bottom: var(--space-sm);
    }

    .workbench-card-title {
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: var(--space-xs);
        font-family: var(--font-title);
    }

    .workbench-card-desc {
        font-size: 0.8rem;
        color: var(--text-muted);
        line-height: 1.4;
    }

    /* 筛选区 */
    .card-body .flex.flex-wrap {
        gap: var(--space-sm);
    }

    /* 预设按钮区 */
    .card-body .flex.flex-wrap.items-center:has(.btn-preset) {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .card-body .flex.flex-wrap.items-center:has(.btn-preset)::-webkit-scrollbar {
        display: none;
    }

    .btn-preset {
        flex-shrink: 0;
        min-width: 140px;
    }

    /* 表格页脚 */
    .table-footer {
        padding: var(--space-sm) var(--space-md);
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    /* 折叠产品卡片 */
    .product-card-collapse {
        background: var(--surface);
        border-radius: var(--radius-md);
        border: 1px solid var(--border);
        margin-bottom: var(--space-sm);
        overflow: hidden;
        transition: box-shadow 0.2s ease, border-color 0.2s ease;
    }

    .product-card-collapse.card-selected {
        border-color: var(--primary);
        box-shadow: 0 0 0 2px rgba(166, 124, 82, 0.15);
    }

    .product-card-collapse:active {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .product-card-checkbox {
        flex-shrink: 0;
        width: 22px;
        height: 22px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .row-checkbox-card {
        width: 18px;
        height: 18px;
        cursor: pointer;
        accent-color: var(--primary);
    }

    .product-card-header {
        display: flex;
        align-items: center;
        padding: var(--space-md);
        cursor: pointer;
        gap: var(--space-sm);
        user-select: none;
    }

    .product-card-summary {
        flex: 1;
        min-width: 0;
    }

    .product-card-name {
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .product-card-meta {
        display: flex;
        align-items: center;
        gap: 4px;
        flex-wrap: nowrap;
        overflow: hidden;
    }

    .product-card-meta .badge {
        font-size: 0.7rem;
        padding: 2px 6px;
        flex-shrink: 0;
    }

    .product-card-spec {
        font-size: 0.75rem;
        color: var(--text-muted);
        white-space: nowrap;
    }

    .product-card-price-info {
        text-align: right;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 2px;
    }

    .product-card-price {
        font-size: 1rem;
        font-weight: 700;
        color: var(--primary);
    }

    .product-card-cost {
        font-size: 0.7rem;
        color: var(--text-muted);
    }

    .product-card-price-info .badge {
        font-size: 0.7rem;
        padding: 1px 6px;
    }

    .product-card-arrow {
        font-size: 0.7rem;
        color: var(--text-muted);
        flex-shrink: 0;
        transition: transform 0.2s ease;
        margin-left: var(--space-xs);
    }

    /* 详情区默认隐藏 */
    .product-card-details {
        display: none;
        padding: 0 var(--space-md) var(--space-md);
        border-top: 1px solid var(--border-light);
        margin-top: 0;
    }

    .product-card-details.open {
        display: block;
        padding-top: var(--space-sm);
    }

    .product-card-details .table-card-row {
        display: flex;
        justify-content: space-between;
        padding: var(--space-xs) 0;
        border-bottom: 1px dashed var(--border-light);
    }

    .product-card-details .table-card-row:last-of-type {
        border-bottom: none;
    }

    .product-card-details .table-card-label {
        font-size: 0.8rem;
        color: var(--text-muted);
        font-weight: 600;
        min-width: 70px;
        flex-shrink: 0;
    }

    .product-card-details .table-card-value {
        font-size: 0.85rem;
        color: var(--text-primary);
        text-align: right;
        flex: 1;
        margin-left: var(--space-sm);
        word-break: break-all;
    }

    .product-card-details .table-card-actions {
        display: flex;
        gap: var(--space-sm);
        justify-content: center;
        margin-top: var(--space-md);
        padding-top: var(--space-sm);
        border-top: 1px solid var(--border-light);
    }

    .product-card-details .table-card-actions .btn {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .app-header-actions .btn {
        padding: var(--space-sm);
        min-height: auto;
        font-size: 0.8rem;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .app-main {
        padding: var(--space-xs);
    }

    .page-header {
        margin-bottom: var(--space-md);
    }

    .btn-group {
        flex-wrap: wrap;
        gap: var(--space-xs);
    }

    .btn-group .btn {
        flex: 1;
        min-width: calc(50% - 4px);
    }

    /* 登录卡片更紧凑 */
    .auth-card {
        padding: var(--space-md);
    }

    .auth-title {
        font-size: 1.3rem;
    }

    /* 统计卡片数字 */
    .card-stat-value {
        font-size: 1.1rem;
    }

    /* 模态框标题 */
    .modal-title {
        font-size: 1rem;
    }

    /* 手机端不隐藏任何导航项（侧边栏需要全部显示） */
}

/* ========== 可折叠区域 ========== */
.collapsible-section {
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: var(--space-md);
    gap: var(--space-sm);
    transition: background 0.2s ease;
}

.collapsible-header:hover {
    background: var(--surface-hover);
}

.collapsible-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    flex-shrink: 0;
    width: 14px;
    text-align: center;
}

.collapsible-section .collapsible-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-out, padding 0.35s ease-out;
    padding: 0 var(--space-md);
}

.collapsible-section .collapsible-body.open {
    max-height: 800px;
    padding-bottom: var(--space-md);
}

/* ========== 仪表盘网格（数据概览卡片）========== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.dash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
    opacity: 0;
    animation: dashCardIn 0.5s ease forwards;
    cursor: default;
    position: relative;
    overflow: hidden;
}

.dash-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.2s;
}

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

.dash-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(166, 124, 82, 0.12);
    border-color: var(--primary-300);
}

.dash-card:hover::before {
    opacity: 1;
}

.dash-card-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
    opacity: 0.9;
    filter: drop-shadow(0 2px 4px rgba(166, 124, 82, 0.15));
}

.dash-card-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.dash-card-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-family: 'Songti SC', 'STSong', serif;
    font-variant-numeric: tabular-nums;
}

.dash-card-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.dash-card-good {
    border-left: 3px solid var(--success);
    background: linear-gradient(135deg, rgba(74, 179, 112, 0.05) 0%, var(--surface-alt) 100%);
}

.dash-card-good .dash-card-value {
    color: var(--success);
}

.dash-card-warn {
    border-left: 3px solid var(--warning);
    background: linear-gradient(135deg, rgba(240, 181, 73, 0.05) 0%, var(--surface-alt) 100%);
}

.dash-card-warn .dash-card-value {
    color: var(--warning);
}

.dash-card-critical {
    border-left: 3px solid var(--danger);
    background: linear-gradient(135deg, rgba(235, 96, 96, 0.05) 0%, var(--surface-alt) 100%);
}

.dash-card-critical .dash-card-value {
    color: var(--danger);
}

/* ========== 定价公式可视化 ========== */
.formula-visualization {
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.formula-section {
    flex: 1;
    min-width: 280px;
}

.formula-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.formula-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.formula-item {
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 4px;
    background: var(--surface-alt);
    color: var(--text);
    font-weight: 500;
}

.formula-op {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 20px;
    text-align: center;
}

.formula-cost {
    background: rgba(235, 96, 96, 0.15);
    color: var(--danger);
}

.formula-success {
    background: rgba(74, 179, 112, 0.15);
    color: var(--success);
}

.formula-danger {
    background: rgba(240, 181, 73, 0.15);
    color: var(--warning);
}

.formula-premium {
    background: rgba(145, 100, 210, 0.15);
    color: var(--primary);
}

.formula-markup {
    background: rgba(70, 130, 180, 0.15);
    color: #4682b4;
}

.formula-rate {
    background: rgba(255, 140, 0, 0.15);
    color: #ff8c00;
}

.formula-primary {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.formula-highlight {
    background: rgba(74, 179, 112, 0.08);
    color: var(--text-primary);
    border: 1px dashed var(--border);
}

.formula-divider {
    width: 1px;
    background: var(--border);
    min-height: 100px;
    flex-shrink: 0;
}

.formula-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

/* ========== 套装定价计算器 ========== */
.bundle-calculator {
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.bundle-left, .bundle-right {
    flex: 1;
    min-width: 280px;
}

.bundle-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.bundle-product-list {
    max-height: 200px;
    overflow-y: auto;
}

.bundle-product-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    margin-bottom: 4px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.bundle-product-item:hover {
    background: var(--surface-hover);
}

.bundle-product-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

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

.bundle-product-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bundle-product-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.bundle-config {
    margin-bottom: var(--space-md);
}

.bundle-result {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
}

.bundle-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}

.bundle-result-row:last-child {
    border-bottom: none;
}

.bundle-result-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.bundle-result-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.bundle-price {
    font-size: 1.2rem;
    color: var(--primary);
}

.bundle-saved-section {
    margin-top: var(--space-md);
}

.bundle-saved-list {
    max-height: 240px;
    overflow-y: auto;
}

.bundle-saved-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--surface);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}

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

.bundle-saved-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bundle-saved-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.bundle-saved-price {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    flex-shrink: 0;
}

.bundle-saved-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.bundle-empty {
    text-align: center;
    padding: var(--space-md);
}

/* ========== 中式报价单 ========== */
.bundle-quote {
    background: linear-gradient(135deg, #fdf9f3 0%, #f5ede0 100%);
    padding: 32px 28px;
    font-family: "Songti SC", "SimSun", "STSong", serif;
    color: #3d2b1f;
    position: relative;
}

.bundle-quote-header {
    text-align: center;
    margin-bottom: 20px;
}

.bundle-quote-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.bundle-quote-seal {
    width: 48px;
    height: 48px;
    border: 2px solid #a62c2a;
    color: #a62c2a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    font-family: "Songti SC", serif;
}

.bundle-quote-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: #5c2e1c;
    text-align: left;
}

.bundle-quote-subtitle {
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: #a67c52;
    text-align: left;
    margin-top: 2px;
}

.bundle-quote-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #5c2e1c;
    margin: 8px 0;
    letter-spacing: 2px;
}

.bundle-quote-date {
    font-size: 0.8rem;
    color: #8b6914;
}

.bundle-quote-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #c4a076, transparent);
    margin: 16px 0;
}

.bundle-quote-items {
    margin: 12px 0;
}

.bundle-quote-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed rgba(166, 124, 82, 0.3);
}

.bundle-quote-item:last-child {
    border-bottom: none;
}

.bundle-quote-item-no {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(166, 124, 82, 0.15);
    color: #a67c52;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

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

.bundle-quote-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #3d2b1f;
}

.bundle-quote-item-spec {
    font-size: 0.75rem;
    color: #8b6914;
    margin-top: 2px;
}

.bundle-quote-item-price {
    text-align: right;
    flex-shrink: 0;
}

.bundle-quote-item-orig {
    font-size: 0.75rem;
    color: #999;
    text-decoration: line-through;
}

.bundle-quote-item-final {
    font-size: 0.95rem;
    font-weight: 600;
    color: #a62c2a;
}

.bundle-quote-summary {
    margin-top: 8px;
}

.bundle-quote-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.9rem;
}

.bundle-quote-total {
    font-size: 1.1rem;
    font-weight: 700;
    color: #a62c2a;
    padding-top: 10px;
    border-top: 2px solid #c4a076;
    margin-top: 4px;
}

.bundle-quote-footer {
    margin-top: 20px;
    text-align: center;
    position: relative;
}

.bundle-quote-note {
    font-size: 0.7rem;
    color: #8b6914;
    margin-bottom: 16px;
}

.bundle-quote-seal-bottom {
    display: inline-block;
    padding: 8px 20px;
    border: 2px solid #a62c2a;
    color: #a62c2a;
    font-size: 0.85rem;
    letter-spacing: 4px;
    transform: rotate(-5deg);
    opacity: 0.7;
    font-family: "Songti SC", serif;
}

@media (max-width: 768px) {
    .bundle-quote {
        padding: 24px 16px;
    }
    .bundle-quote-title {
        font-size: 1.2rem;
    }
}

/* ========== 成本构成分析 ========== */
.cost-analysis {
    padding: var(--space-sm);
}

.cost-summary {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
    padding: var(--space-sm);
    background: var(--surface);
    border-radius: var(--radius-sm);
}

.cost-summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 var(--space-md);
}

.cost-summary-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.cost-summary-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cost-bars {
    margin-bottom: var(--space-md);
}

.cost-bar-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: 8px;
    padding: 6px 0;
}

.cost-bar-label {
    font-size: 0.75rem;
    color: var(--text);
    width: 80px;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cost-bar-track {
    flex: 1;
    height: 18px;
    background: var(--border);
    border-radius: 9px;
    overflow: hidden;
}

.cost-bar-fill {
    height: 100%;
    display: flex;
    border-radius: 9px;
    transition: width 0.3s ease;
}

.cost-bar-segment {
    height: 100%;
    flex-shrink: 0;
}

.cost-mat {
    background: linear-gradient(90deg, #e87d7d, #e55a5a);
}

.cost-labor {
    background: linear-gradient(90deg, #7daae8, #5a7de5);
}

.cost-acc {
    background: linear-gradient(90deg, #aee87d, #7de55a);
}

.cost-pack {
    background: linear-gradient(90deg, #e8d77d, #e5c05a);
}

.cost-bar-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 60px;
    text-align: right;
    flex-shrink: 0;
}

.cost-legend {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border);
}

.cost-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cost-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* 响应式：仪表盘 */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-xs);
    }

    .dash-card {
        padding: var(--space-sm);
    }

    .dash-card-value {
        font-size: 1.1rem;
    }

    .dash-card-label {
        font-size: 0.7rem;
    }

    .dash-card-sub {
        font-size: 0.65rem;
    }
}
