/* ========================================
   家具外贸报价管理系统 - Apple Style Design
   简约 · 高级 · 毛玻璃 · 大圆角
   ======================================== */

/* ===== 设计变量 ===== */
:root {
    /* 字体规范：英文 Segoe UI，中文微软雅黑 */
    --font-en: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --font-cn: "Microsoft YaHei", "微软雅黑", sans-serif;
    --font-main: "Segoe UI", "Microsoft YaHei", "微软雅黑", sans-serif;

    /* 侧边栏 */
    --sidebar-width: 240px;
    --sidebar-bg: rgba(255, 255, 255, 0.72);
    --sidebar-border: rgba(0, 0, 0, 0.06);

    /* 顶栏 */
    --topbar-height: 52px;
    --topbar-bg: rgba(255, 255, 255, 0.72);

    /* 主色调 - Apple Blue */
    --primary: #007aff;
    --primary-hover: #0066d6;
    --primary-light: rgba(0, 122, 255, 0.08);
    --primary-glow: rgba(0, 122, 255, 0.2);

    /* 语义色 */
    --success: #34c759;
    --success-light: rgba(52, 199, 89, 0.1);
    --warning: #ff9500;
    --warning-light: rgba(255, 149, 0, 0.1);
    --danger: #ff3b30;
    --danger-light: rgba(255, 59, 48, 0.1);
    --info: #5ac8fa;

    /* 背景与表面 */
    --bg-body: #f5f5f7;
    --bg-card: #ffffff;
    --bg-hover: #f5f5f7;
    --bg-input: #f5f5f7;

    /* 文字 */
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-muted: #aeaeb2;

    /* 边框与分割线 */
    --border-color: rgba(0, 0, 0, 0.06);
    --border-strong: rgba(0, 0, 0, 0.1);
    --divider: rgba(0, 0, 0, 0.04);

    /* 阴影 - 极其柔和 */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.1), 0 8px 24px rgba(0, 0, 0, 0.06);

    /* 圆角 */
    --radius: 14px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --radius-xs: 8px;

    /* 动画 */
    --transition: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);

    /* 模糊 */
    --blur: saturate(180%) blur(20px);
}

/* ===== 基础重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-main);
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    letter-spacing: -0.006em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ===== 布局 ===== */
.app-wrapper { display: flex; min-height: 100vh; }

/* ===== 侧边栏 - 浅色毛玻璃 ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-right: 1px solid var(--sidebar-border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition);
    overflow-y: auto;
}

.sidebar.collapsed { transform: translateX(-100%); }

/* 移动端侧边栏遮罩 */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition);
    display: none;
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; }

.sidebar-header {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--topbar-height);
}

.logo {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 3px 10px var(--primary-glow);
}

.logo-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo-subtitle {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar-nav {
    list-style: none;
    padding: 6px 10px;
    flex: 1;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-xs);
    transition: all var(--transition-fast);
    font-size: 13.5px;
    font-weight: 400;
    margin-bottom: 2px;
    letter-spacing: -0.005em;
}

.sidebar-nav li a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav li a.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

.sidebar-nav li a i {
    font-size: 16px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 14px 16px;
    border-top: 1px solid var(--divider);
}

.exchange-rate-box {
    background: var(--bg-body);
    border-radius: var(--radius-xs);
    padding: 10px 12px;
}

.er-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.er-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 用户信息框 */
.user-info-box {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px 10px;
    background: var(--bg-body);
    border-radius: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.user-detail {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.logout-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 18px;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.logout-btn:hover {
    color: var(--danger);
    background: var(--danger-light);
}

/* ===== 主内容区 ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.main-content.expanded { margin-left: 0; }

/* ===== 顶栏 - 毛玻璃 ===== */
.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.btn-toggle-sidebar {
    background: var(--bg-hover);
    border: 1px solid var(--sidebar-border);
    color: var(--text-primary);
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    flex-shrink: 0;
    user-select: none;
}

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

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

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

/* ===== 页面内容 ===== */
.page-content {
    padding: 24px;
    flex: 1;
}

/* ===== 卡片 - Apple浮层感 ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: none;
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.card-header-custom {
    padding: 16px 20px;
    border-bottom: 1px solid var(--divider);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header-custom h5,
.card-header-custom h6 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin: 0;
}

.card-body-custom { padding: 20px; }

/* ===== 统计卡片 ===== */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: none;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
}

.stat-icon.blue { background: linear-gradient(135deg, #007aff, #0066d6); }
.stat-icon.green { background: linear-gradient(135deg, #34c759, #28a745); }
.stat-icon.orange { background: linear-gradient(135deg, #ff9500, #f08c00); }
.stat-icon.purple { background: linear-gradient(135deg, #af52de, #9b30d6); }
.stat-icon.indigo { background: linear-gradient(135deg, #5856d6, #4240c8); }

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 2px;
    letter-spacing: -0.02em;
}

.stat-info p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
}

/* ===== 快捷入口卡片 ===== */
.card.card-body-custom.text-center {
    transition: all var(--transition);
    cursor: pointer;
}

.card.card-body-custom.text-center:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* ===== 产品卡片 ===== */
.product-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    border: none;
    overflow: hidden;
    transition: all var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.product-card .product-image {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: contain;
    background: #fff;
}

.product-card .product-image-placeholder {
    width: 100%;
    aspect-ratio: 1/1;
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--text-muted);
}

.product-card-body {
    padding: 12px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card-code {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-en);
    margin-bottom: 3px;
    letter-spacing: 0.02em;
}

.product-card-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.008em;
}

.product-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.product-tag {
    font-size: 10.5px;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--bg-body);
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: -0.003em;
}

.product-card-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--divider);
}

.product-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.product-price-usd {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ===== 产品网格：一行 8 个（大屏）响应式回退 ===== */
.product-col-8 {
    flex: 0 0 12.5%;
    max-width: 12.5%;
}
@media (max-width: 1199.98px) {
    .product-col-8 { flex: 0 0 16.666667%; max-width: 16.666667%; } /* 6 个/行 */
}
@media (max-width: 991.98px) {
    .product-col-8 { flex: 0 0 25%; max-width: 25%; } /* 4 个/行 */
}
@media (max-width: 767.98px) {
    .product-col-8 { flex: 0 0 33.333333%; max-width: 33.333333%; } /* 3 个/行 */
}
@media (max-width: 575.98px) {
    .product-col-8 { flex: 0 0 50%; max-width: 50%; } /* 2 个/行 */
}

/* ===== 按钮 - Apple 风格 ===== */
.btn {
    border-radius: var(--radius-xs);
    font-size: 13.5px;
    font-weight: 500;
    padding: 7px 14px;
    transition: all var(--transition-fast);
    letter-spacing: -0.005em;
}

.btn-sm { font-size: 12.5px; padding: 5px 12px; border-radius: 7px; }

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: none;
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-strong);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-outline-success {
    color: var(--success);
    border-color: rgba(52, 199, 89, 0.3);
    background: transparent;
}

.btn-outline-success:hover {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.btn-outline-danger {
    color: var(--danger);
    border-color: rgba(255, 59, 48, 0.3);
    background: transparent;
}

.btn-outline-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.btn-outline-info {
    color: var(--info);
    border-color: rgba(90, 200, 250, 0.3);
    background: transparent;
}

.btn-outline-info:hover {
    background: var(--info);
    border-color: var(--info);
    color: white;
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: white;
    box-shadow: none;
}

.btn-success:hover {
    background: #28a745;
    border-color: #28a745;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    box-shadow: none;
}

.btn-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

/* ===== 搜索栏 ===== */
.search-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 180px;
}

.search-input-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 15px;
}

.search-input-wrapper input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    font-size: 13.5px;
    background: var(--bg-card);
    transition: all var(--transition-fast);
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-input-wrapper input::placeholder { color: var(--text-muted); }

/* ===== 筛选器 ===== */
.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    font-size: 13.5px;
    background: var(--bg-card);
    cursor: pointer;
    min-width: 130px;
    transition: all var(--transition-fast);
    color: var(--text-primary);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ===== 表格 ===== */
.table-custom {
    width: 100%;
    border-collapse: collapse;
}

.table-custom th {
    background: var(--bg-body);
    padding: 10px 16px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--divider);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.table-custom td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--divider);
    font-size: 13.5px;
    color: var(--text-primary);
}

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

.table-custom tr:hover td { background: var(--bg-body); }

/* ===== 状态徽章 ===== */
.badge-status {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-draft { background: var(--bg-body); color: var(--text-secondary); }
.badge-sent { background: var(--primary-light); color: var(--primary); }
.badge-accepted { background: var(--success-light); color: var(--success); }
.badge-expired { background: var(--danger-light); color: var(--danger); }

/* ===== 上传区域 ===== */
.upload-zone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 36px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-body);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-zone i {
    font-size: 40px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.upload-zone p {
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* ===== 报价明细 ===== */
.quotation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    margin-bottom: 6px;
    background: var(--bg-card);
    transition: all var(--transition-fast);
}

.quotation-item:hover { box-shadow: var(--shadow-sm); }
.quotation-item.selected { border-color: var(--primary); background: var(--primary-light); }

.quotation-item img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: var(--radius-xs);
    background: var(--bg-body);
}

/* ===== AI报价结果 ===== */
.ai-result-card {
    background: linear-gradient(135deg, rgba(0,122,255,0.03), rgba(90,200,250,0.05));
    border: 1px solid rgba(0,122,255,0.08);
    border-radius: var(--radius);
    padding: 24px;
}

.cost-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--divider);
}

.cost-breakdown-item:last-child { border-bottom: none; }

.cost-breakdown-label {
    font-size: 13.5px;
    color: var(--text-primary);
    font-weight: 400;
}

.cost-breakdown-detail {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 1px;
}

.cost-breakdown-amount {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.total-price-box {
    background: linear-gradient(135deg, #1d1d1f, #2d2d30);
    border-radius: var(--radius);
    padding: 28px;
    color: white;
    text-align: center;
    border: none;
}

.total-price-box .price-label {
    font-size: 13px;
    opacity: 0.6;
    margin-bottom: 6px;
    font-weight: 500;
}

.total-price-box .price-value {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.total-price-box .price-sub {
    font-size: 13px;
    opacity: 0.5;
    margin-top: 4px;
}

/* ===== 分页 ===== */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
}

.pagination-wrapper .page-btn {
    padding: 6px 12px;
    border: none;
    background: var(--bg-card);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xs);
}

.pagination-wrapper .page-btn:hover:not(:disabled) {
    background: var(--primary-light);
    color: var(--primary);
}

.pagination-wrapper .page-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 6px var(--primary-glow);
}

.pagination-wrapper .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== Toast 通知 ===== */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
}

.toast-item {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 12px 18px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    border: none;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-item.success { border-left: 3px solid var(--success); }
.toast-item.error { border-left: 3px solid var(--danger); }
.toast-item.warning { border-left: 3px solid var(--warning); }

.toast-item .toast-icon { font-size: 18px; }
.toast-item.success .toast-icon { color: var(--success); }
.toast-item.error .toast-icon { color: var(--danger); }
.toast-item.warning .toast-icon { color: var(--warning); }

.toast-item .toast-message {
    font-size: 13.5px;
    color: var(--text-primary);
    font-weight: 400;
}

@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== 加载遮罩 ===== */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(245, 245, 247, 0.7);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.spinner {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.spinner > div {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.spinner .bounce1 { animation-delay: -0.32s; }
.spinner .bounce2 { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
}

/* ===== 模态框 ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-dialog-custom {
    background: var(--bg-card);
    border-radius: var(--radius);
    max-width: 580px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    border: none;
}

.modal-dialog-custom.large { max-width: 860px; }

.modal-header-custom {
    padding: 18px 22px;
    border-bottom: 1px solid var(--divider);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title-custom {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    transition: all var(--transition-fast);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.modal-body-custom { padding: 22px; }

.section-divider {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 8px 0 6px;
    margin-bottom: 4px;
    border-bottom: 1.5px solid var(--divider);
    letter-spacing: -0.01em;
}
.section-divider i { color: var(--primary); }

.modal-footer-custom {
    padding: 14px 22px;
    border-top: 1px solid var(--divider);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ===== 表单 ===== */
.form-label-custom {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    display: block;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.form-input-custom, .form-select-custom, .form-textarea-custom {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    font-size: 13.5px;
    transition: all var(--transition-fast);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
}

.form-input-custom:focus, .form-select-custom:focus, .form-textarea-custom:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input-custom::placeholder { color: var(--text-muted); }

.form-textarea-custom {
    min-height: 72px;
    resize: vertical;
}

.form-control {
    border-radius: var(--radius-xs);
    border-color: var(--border-color);
    font-size: 13.5px;
    transition: all var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ===== Alert 消息条 ===== */
.alert {
    border-radius: var(--radius-xs);
    border: none;
    padding: 12px 16px;
    font-size: 13px;
}

/* ===== 进度条 ===== */
.progress {
    background: var(--bg-body);
    border-radius: 20px;
    overflow: hidden;
}

/* ===== hr ===== */
hr {
    border: none;
    border-top: 1px solid var(--divider);
    margin: 16px 0;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .btn-toggle-sidebar { display: flex; }
    .sidebar-backdrop { display: block; }
    /* 纯 CSS 兜底：勾选开关即展开菜单，不依赖 JS */
    .app-wrapper:has(#navToggle:checked) .sidebar { transform: translateX(0); }
    .app-wrapper:has(#navToggle:checked) .sidebar-backdrop { opacity: 1; visibility: visible; }
}

@media (max-width: 768px) {
    .page-content { padding: 12px; }
    .search-bar { flex-direction: column; align-items: stretch; gap: 8px; }
    .search-bar .search-input-wrapper,
    .search-bar .filter-select,
    .search-bar .btn { width: 100%; }
    .filter-select { min-width: auto; }
    /* 顶栏：窄屏自动增高、按钮换行，避免被截断 */
    .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
    .topbar-title { font-size: 14px; flex: 1 1 auto; min-width: 0; }
    .topbar-actions { width: 100%; margin-left: 0; justify-content: flex-start; flex-wrap: wrap; }
    .topbar-actions .btn { flex: 0 0 auto; }
    /* 模态框在手机上占满更多宽度 */
    .modal-overlay { padding: 10px; }
    /* 无响应式包裹的表格在手机上横向滚动 */
    .table-custom { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .stat-card { padding: 14px; }
    .stat-info h3 { font-size: 22px; }
    .stat-icon { width: 38px; height: 38px; font-size: 17px; }
}

/* 超窄屏：产品卡片保持两列但收紧间距 */
@media (max-width: 380px) {
    .product-col-8 { flex: 0 0 50%; max-width: 50%; gap: 6px; }
    .product-card-body { padding: 8px 8px 10px; }
}

/* ===== 工具类 ===== */
.text-primary-custom { color: var(--primary); }
.text-success-custom { color: var(--success); }
.text-danger-custom { color: var(--danger); }
.text-muted-custom { color: var(--text-muted); }
.text-secondary-custom { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11.5px; }
.cursor-pointer { cursor: pointer; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 56px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 56px;
    margin-bottom: 14px;
    opacity: 0.5;
}

.empty-state h4 {
    font-size: 17px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 600;
}

.empty-state p {
    font-size: 13.5px;
    color: var(--text-muted);
}

/* ===== 选中状态 ===== */
.product-card.selected {
    box-shadow: 0 0 0 2px var(--primary), var(--shadow-md);
}

.product-card .select-checkbox {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    cursor: pointer;
    z-index: 10;
}

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

/* ===== 图片预览 ===== */
.image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-xs);
    margin-top: 10px;
}

/* ===== 参考产品列表 ===== */
.reference-product {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    margin-bottom: 6px;
    background: var(--bg-card);
    transition: all var(--transition-fast);
}

.reference-product:hover { box-shadow: var(--shadow-sm); }

.reference-product img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: var(--radius-xs);
}

.similarity-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--success-light);
    color: var(--success);
    font-weight: 600;
}

/* ===== form-check 圆点 ===== */
.form-check-input {
    accent-color: var(--primary);
    cursor: pointer;
}

.form-check-label { cursor: pointer; }

/* ===== badge ===== */
.badge {
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 3px 10px;
    border-radius: 20px;
}

.badge.bg-primary { background: var(--primary) !important; }
.badge.bg-secondary { background: var(--text-muted) !important; }
.badge.bg-info { background: var(--info) !important; }
.badge.bg-warning { background: var(--warning) !important; color: white !important; }
.badge.bg-success { background: var(--success) !important; }

/* ===== link ===== */
a { color: var(--primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-hover); }
.text-decoration-none { text-decoration: none !important; }

/* ===== Select 样式修正 ===== */
select.form-select-custom,
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ===== 图片缩略图通用 ===== */
.thumbnail-item {
    position: relative;
    width: 76px;
    height: 76px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: border-color var(--transition-fast);
}

.thumbnail-item:hover { border-color: var(--text-muted); }
.thumbnail-item.active { border-color: var(--primary); }
.thumbnail-item:hover .img-download-overlay button { opacity: 1 !important; }
.thumbnail-item.editing .img-download-overlay { display: none; }

/* ========================================
   新建报价单 - 产品库分类 & 交互优化
   ======================================== */

/* ========================================
   系统设置 - 条款编辑行
   ======================================== */
.terms-edit-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px;
    background: var(--bg-body);
    border-radius: 10px;
    transition: background var(--transition-fast);
}
.terms-edit-row:hover {
    background: rgba(0, 122, 255, 0.04);
}
.terms-edit-row .terms-input-en {
    flex: 2;
    min-width: 0;
}
.terms-edit-row .terms-input-cn {
    flex: 1.5;
    min-width: 0;
}
.terms-edit-row .btn {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}
.terms-edit-row .terms-move-btn {
    width: 32px;
    height: 32px;
    padding: 0;
}
/* 产品库Tab */
.library-tabs {
    display: flex;
    gap: 8px;
    padding: 4px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.lib-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    position: relative;
}

.lib-tab i { font-size: 15px; }
.lib-tab span { white-space: nowrap; }

.lib-tab .lib-count {
    font-style: normal;
    font-size: 11px;
    background: rgba(0,0,0,0.06);
    color: var(--text-secondary);
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.lib-tab:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.6);
}

.lib-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-xs);
}

.lib-tab.active .lib-count {
    background: var(--primary-light);
    color: var(--primary);
}

/* 产品列表网格 */
.quotation-product-grid {
    max-height: 760px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 2px;
    align-content: start;
}

@media (max-width: 1400px) {
    .quotation-product-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 992px) {
    .quotation-product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
    .quotation-product-grid { grid-template-columns: repeat(2, 1fr); }
}

.quotation-product-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    min-width: 0;
}

.quotation-product-item:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-xs);
}

.quotation-product-item.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary), var(--shadow-xs);
}

.quotation-product-item img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: var(--radius-xs);
    background: var(--bg-body);
    flex-shrink: 0;
}

.qpi-image-placeholder {
    width: 72px;
    height: 72px;
    background: var(--bg-body);
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
}

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

.qpi-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qpi-meta {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qpi-price {
    font-size: 12px;
}

.qpi-toggle {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    font-size: 14px;
}

/* 库标识徽章 */
.lib-badge {
    display: inline-block;
    font-size: 9.5px;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-right: 4px;
    letter-spacing: 0.02em;
    vertical-align: middle;
}

.lib-badge-new {
    background: rgba(255, 149, 0, 0.12);
    color: #c2740a;
}

.lib-badge-inquiry {
    background: rgba(175, 82, 222, 0.12);
    color: #8b3eb0;
}

/* 价格类型切换按钮组 */
.price-type-switch {
    display: flex;
    gap: 6px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.price-type-switch input[type="radio"] {
    display: none;
}

.price-type-switch label {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    color: var(--text-secondary);
}

.price-type-switch label small {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 1px;
}

.price-type-switch input[type="radio"]:checked + label {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-xs);
}

.price-type-switch input[type="radio"]:checked + label strong {
    font-size: 15px;
}

/* 报价汇总面板 */
.quotation-summary-card {
    position: sticky;
    top: 70px;
}

.quotation-summary-list {
    max-height: 320px;
    overflow-y: auto;
}

.quotation-empty-hint {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
}

.quotation-empty-hint i {
    font-size: 36px;
    margin-bottom: 8px;
    opacity: 0.4;
}

.quotation-empty-hint p {
    font-size: 13px;
}

.quotation-summary-item {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    margin-bottom: 6px;
    background: var(--bg-card);
    transition: all var(--transition-fast);
}

.quotation-summary-item:hover {
    border-color: var(--border-strong);
}

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

.qsi-name {
    font-size: 13px;
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qsi-remove {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 11px;
}

.qsi-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qsi-control-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.qsi-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.qsi-input {
    width: 64px;
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 12px;
    text-align: center;
}

.qsi-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
    outline: none;
}

.qsi-total {
    text-align: right;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 4px;
}

/* 生成报价单按钮 */
.btn-generate {
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.btn-generate:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--primary-glow);
}

/* ===== 仪表盘增强 ===== */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--stat-glow, transparent) 0%, transparent 70%);
    opacity: 0.3;
    pointer-events: none;
}

.stat-icon.blue ~ .stat-info { --stat-glow: rgba(0,122,255,0.15); }
.stat-icon.green ~ .stat-info { --stat-glow: rgba(52,199,89,0.15); }
.stat-icon.orange ~ .stat-info { --stat-glow: rgba(255,149,0,0.15); }
.stat-icon.purple ~ .stat-info { --stat-glow: rgba(175,82,222,0.15); }
.stat-icon.indigo ~ .stat-info { --stat-glow: rgba(88,86,214,0.15); }

/* 快捷入口卡片增强 */
.card.card-body-custom.text-center {
    position: relative;
    overflow: hidden;
}

.card.card-body-custom.text-center::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--quick-color, var(--primary));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition);
}

.card.card-body-custom.text-center:hover::before {
    transform: scaleX(1);
}

/* ===== 报价单详情页增强 ===== */
.total-price-box {
    position: relative;
    overflow: hidden;
}

.total-price-box::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.22) 0%, transparent 70%);
    pointer-events: none;
}

/* ===== 全局表单输入增强 ===== */
.form-input-custom,
.form-select-custom,
.form-textarea-custom {
    transition: all var(--transition-fast);
}

.form-input-custom:hover,
.form-select-custom:hover,
.form-textarea-custom:hover {
    border-color: var(--border-strong);
}

/* 卡片悬浮增强 */
.card {
    transition: box-shadow var(--transition);
}

/* 导入结果统计卡片 */
.stat-mini {
    text-align: center;
    padding: 12px 8px;
    border-radius: 12px;
    background: var(--bg-secondary);
}
.stat-mini .stat-num {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}
.stat-mini .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ========================================
   主题设置 - 分段控件（浅色/深色通用）
   ======================================== */
.theme-segment {
    display: flex;
    gap: 6px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 4px;
}
.theme-segment label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
}
.theme-segment input[type="radio"] { display: none; }
.theme-segment input[type="radio"]:checked + label {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-xs);
}
.theme-segment label i { font-size: 16px; }

/* ========================================
   深色模式 - 仅覆盖设计变量，组件样式零改动
   浅色模式完全不受任何影响
   ======================================== */
[data-theme="dark"] {
    --sidebar-bg: rgba(28, 28, 30, 0.78);
    --sidebar-border: rgba(255, 255, 255, 0.1);
    --topbar-bg: rgba(28, 28, 30, 0.78);

    --primary: #0a84ff;
    --primary-hover: #409cff;
    --primary-light: rgba(10, 132, 255, 0.16);
    --primary-glow: rgba(10, 132, 255, 0.4);

    --success: #30d158;
    --success-light: rgba(48, 209, 88, 0.16);
    --warning: #ff9f0a;
    --warning-light: rgba(255, 159, 10, 0.16);
    --danger: #ff453a;
    --danger-light: rgba(255, 69, 58, 0.16);
    --info: #64d2ff;

    --bg-body: #161618;
    --bg-card: #232326;
    --bg-hover: #2c2c2e;
    --bg-input: #2c2c2e;
    --bg-secondary: #2c2c2e;

    --text-primary: #f5f5f7;
    --text-secondary: rgba(235, 235, 245, 0.62);
    --text-muted: rgba(235, 235, 245, 0.38);

    --border-color: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.2);
    --divider: rgba(255, 255, 255, 0.08);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.65), 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* 深色专用修正：硬编码颜色 / Bootstrap 默认类 */
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }
[data-theme="dark"] .product-card .product-image { background: #1c1c1e; }
[data-theme="dark"] select.form-select-custom,
[data-theme="dark"] select.form-control,
[data-theme="dark"] select.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aeaeb2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}
[data-theme="dark"] .badge.bg-secondary { background: #636366 !important; color: #fff !important; }

/* Bootstrap 默认类在深色下的覆盖 */
[data-theme="dark"] .text-muted { color: var(--text-muted) !important; }
[data-theme="dark"] .table { color: var(--text-primary); }
[data-theme="dark"] .alert { color: var(--text-primary); }
[data-theme="dark"] .alert-info { background: var(--primary-light); color: var(--primary); border: none; }
[data-theme="dark"] .form-control { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-color); }
[data-theme="dark"] .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
[data-theme="dark"] .form-select { background-color: var(--bg-card); color: var(--text-primary); border-color: var(--border-color); }
[data-theme="dark"] .modal-content { background: var(--bg-card); color: var(--text-primary); border: none; }
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer { border-color: var(--divider); }
[data-theme="dark"] .modal-title { color: var(--text-primary); }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(1.3); }
[data-theme="dark"] .toast-item { background: rgba(35, 35, 38, 0.92); }
[data-theme="dark"] .loading-overlay { background: rgba(22, 22, 24, 0.7); }
[data-theme="dark"] .lib-tab:hover { background: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .lib-tab .lib-count { background: rgba(255, 255, 255, 0.08); color: var(--text-secondary); }
[data-theme="dark"] .sidebar-backdrop { background: rgba(0, 0, 0, 0.5); }

/* ===== 深色专用修正：Bootstrap 文本工具类 + 写死色组件 ===== */
/* 1. Bootstrap 文本工具类在深色下用我们的变量（原固定深色会糊底） */
[data-theme="dark"] .text-dark { color: var(--text-primary) !important; }
[data-theme="dark"] .text-secondary { color: var(--text-secondary) !important; }
[data-theme="dark"] .text-body { color: var(--text-primary) !important; }
[data-theme="dark"] .text-body-secondary { color: var(--text-secondary) !important; }
[data-theme="dark"] .text-white-50 { color: rgba(235, 235, 245, 0.5) !important; }
[data-theme="dark"] .form-text { color: var(--text-muted) !important; }
[data-theme="dark"] small { color: var(--text-muted); }
[data-theme="dark"] code,
[data-theme="dark"] pre { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-color); }

/* 2. Alert 变体文字色（避免固定深色/内联色在暗底上消失） */
[data-theme="dark"] .alert { color: var(--text-primary); }
[data-theme="dark"] .alert-warning { background: var(--warning-light); color: #ffd28a; border-color: rgba(255, 159, 10, 0.3); }
[data-theme="dark"] .alert-success { background: var(--success-light); color: #6be585; border-color: rgba(48, 209, 88, 0.3); }
[data-theme="dark"] .alert-danger { background: var(--danger-light); color: #ff8a82; border-color: rgba(255, 69, 58, 0.3); }
[data-theme="dark"] .alert-info { background: var(--primary-light); color: var(--primary); border-color: rgba(10, 132, 255, 0.3); }
[data-theme="dark"] .alert-secondary { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-color); }

/* 3. 库标识徽章文字在深色下提亮（原固定深橙/深紫在暗底上糊掉） */
[data-theme="dark"] .lib-badge-new { color: #ffd28a; background: rgba(255, 159, 10, 0.18); }
[data-theme="dark"] .lib-badge-inquiry { color: #d9a6ff; background: rgba(175, 82, 222, 0.22); }

/* 4. 价格类型切换按钮组文字（原固定深色标签在暗底可见性弱） */
[data-theme="dark"] .price-type-switch label { color: var(--text-secondary); }
[data-theme="dark"] .price-type-switch input[type="radio"]:checked + label { color: var(--primary); background: var(--bg-card); }

/* 5. Badge 文字兜底：浅/亮色底统一用深字保证对比（仅覆盖亮底变体） */
[data-theme="dark"] .badge.bg-warning { color: #1d1d1f !important; }
[data-theme="dark"] .badge.bg-info { color: #1d1d1f !important; }
[data-theme="dark"] .badge.bg-success { color: #1d1d1f !important; }
[data-theme="dark"] .badge.bg-secondary { background: #636366 !important; color: #f5f5f7 !important; }

/* 6. 产品图底色跟随深色（白底方块在暗卡片里突兀） */
[data-theme="dark"] .product-card .product-image { background: #1c1c1e; }
[data-theme="dark"] .product-card .product-image-placeholder { background: #1c1c1e; }
[data-theme="dark"] .quotation-product-item img { background: #1c1c1e; }
[data-theme="dark"] .qpi-image-placeholder { background: #1c1c1e; }
[data-theme="dark"] .quotation-item img { background: #1c1c1e; }
[data-theme="dark"] .reference-product img { background: #1c1c1e; }

/* ===== 治本：深色下重定义 Bootstrap 根变量 =====
   让所有 Bootstrap 组件（卡片/模态框/表格/表单/进度条/标题/链接）
   的文字与背景自动跟随我们的深色令牌，杜绝"深底黑字"隐形问题 */
[data-theme="dark"] {
    --bs-body-bg: var(--bg-body);
    --bs-body-color: var(--text-primary);
    --bs-emphasis-color: var(--text-primary);
    --bs-secondary-color: var(--text-secondary);
    --bs-tertiary-color: var(--text-muted);
    --bs-border-color: var(--border-color);
    --bs-border-color-translucent: var(--border-strong);
    --bs-card-bg: var(--bg-card);
    --bs-card-cap-bg: var(--bg-card);
    --bs-card-color: var(--text-primary);
    --bs-card-cap-color: var(--text-primary);
    --bs-modal-bg: var(--bg-card);
    --bs-modal-color: var(--text-primary);
    --bs-modal-header-border-color: var(--border-color);
    --bs-code-color: var(--text-primary);
    --bs-code-bg: var(--bg-hover);
    --bs-heading-color: var(--text-primary);
    --bs-link-color: var(--primary);
    --bs-link-hover-color: var(--primary-hover);
    --bs-body-color-rgb: 245, 245, 247;
    --bs-emphasis-color-rgb: 245, 245, 247;
    --bs-secondary-color-rgb: 174, 174, 178;
    --bs-tertiary-color-rgb: 99, 99, 102;
}
