* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    font-size: 14px;
}
.navbar {
    background: #fff;
    border-bottom: 2px solid #e2e8f0;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-logo {
    background: #cc0000;
    color: #fff;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
}
.nav-title { font-weight: 700; font-size: 16px; }
/* 导航区域切换（库存监控 / 华丽销售） */
.nav-switch {
    display: flex;
    gap: 2px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
}
.nav-switch .switch-btn {
    text-decoration: none;
    padding: 5px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    transition: all 0.15s;
    white-space: nowrap;
}
.nav-switch .switch-btn:hover { color: #1e293b; }
.nav-switch .switch-btn.active {
    background: #fff;
    color: #cc0000;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
    text-decoration: none;
    color: #64748b;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.15s;
}
.nav-links a:hover { background: #f1f5f9; color: #1e293b; }
.nav-links a.active { background: #fef2f2; color: #cc0000; }
.nav-sep { width: 1px; background: #e2e8f0; margin: 6px 8px; align-self: center; height: 24px; }
.nav-status { font-size: 12px; color: #64748b; }
.nav-status.ok { color: #15803d; }
.nav-status.warn { color: #b45309; }
.nav-logout {
    font-size: 12px; color: #94a3b8; text-decoration: none;
    padding: 4px 10px; border: 1px solid #334155; border-radius: 6px;
    margin-left: 12px; transition: all .15s;
}
.nav-logout:hover { color: #f87171; border-color: #f87171; }

.container { max-width: 1600px; margin: 24px auto; padding: 0 24px; }

.card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 14px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12px; color: #64748b; font-weight: 500; }
input[type="text"], input[type="number"], textarea, select {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
input[type="text"]:focus, input[type="number"]:focus, textarea:focus, select:focus { border-color: #cc0000; }
textarea { resize: vertical; min-height: 80px; }

.btn {
    background: #cc0000;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn:hover { background: #a30000; }
.btn:disabled { background: #cbd5e1; cursor: not-allowed; }
.btn-secondary { background: #64748b; }
.btn-secondary:hover { background: #475569; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-danger-confirm {
    background: #f97316;
    animation: pulse-danger 1s infinite;
}
.btn-danger-confirm:hover { background: #ea580c; }
@keyframes pulse-danger {
    0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.6); }
    50% { box-shadow: 0 0 0 6px rgba(249, 115, 22, 0); }
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
    text-align: left;
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; }
tr:hover td { background: #fafbfc; }

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.badge-in-stock { background: #dcfce7; color: #15803d; }
.badge-out-stock { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #b45309; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 16px 20px;
    border: 1px solid #e2e8f0;
}
.stat-label { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-value.green { color: #15803d; }
.stat-value.red { color: #b91c1c; }

.loading { text-align: center; padding: 40px; color: #64748b; }
.spinner {
    border: 3px solid #e2e8f0;
    border-top: 3px solid #cc0000;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
    position: fixed;
    top: 72px;
    right: 24px;
    background: #1e293b;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 200;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.error { background: #dc2626; }
.toast.success { background: #15803d; }
.toast.warning { background: #d97706; }

.chart-container { position: relative; height: 320px; margin-top: 16px; }
.row-actions { display: flex; gap: 8px; }
.bom-target-input {
    width: 90px;
    padding: 4px 8px;
    font-size: 13px;
    font-family: "Cascadia Code", "Consolas", monospace;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    text-align: right;
}
.bom-target-input:focus { outline: none; border-color: #0ea5e9; box-shadow: 0 0 0 2px rgba(14,165,233,.15); }
.muted { color: #94a3b8; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mono { font-family: "Cascadia Code", "Consolas", monospace; }
.opn-cell { font-weight: 600; font-family: Arial, "Helvetica Neue", sans-serif; font-size: 15px; }
.price-cell { color: #15803d; font-weight: 600; }

.checkbox-group { display: flex; align-items: center; gap: 6px; }
.checkbox-group label { font-size: 13px; cursor: pointer; }

.quote-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(720px, 1fr)); gap: 24px; }
.quote-table {
    background: #fafafa;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: visible;  /* 改：允许按钮可见 */
}
.quote-title {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 14px;
    border-bottom: 1px solid #e2e8f0;
}
.quote-title-opn { flex: 0 0 auto; word-break: break-all; }
.quote-table table { font-size: 13px; table-layout: fixed; min-width: 100%; width: 100%; }
.quote-table thead th { background: #fff; padding: 12px 10px; }
.quote-table td { padding: 10px; }
.quote-table .price-cell { color: #cc0000; font-size: 14px; }

/* A+B 双组报价布局 */
.quote-pair {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    flex-wrap: nowrap;  /* 改：强制左右并排 */
}
.quote-side {
    flex: 1 1 0;       /* 改：平均分配，比例1:1 */
    min-width: 0;
    border-radius: 6px;
    overflow: visible;  /* 改：避免按钮被裁 */
    border: 1px solid #e2e8f0;
    background: #ffffff;
}
.quote-side table { table-layout: fixed; width: 100%; }
/* 列宽固定：数量/未税/含税/销售价/报价内容（含按钮） */
.quote-side table th:nth-child(1), .quote-side table td:nth-child(1) { width: 60px; text-align: center; }
.quote-side table th:nth-child(2), .quote-side table td:nth-child(2) { width: 80px; text-align: right; }
.quote-side table th:nth-child(3), .quote-side table td:nth-child(3) { width: 80px; text-align: right; }
.quote-side table th:nth-child(4), .quote-side table td:nth-child(4) { width: 80px; text-align: right; }
.quote-side table th:nth-child(5), .quote-side table td:nth-child(5) { width: auto; }
.quote-side-a { border-left: 3px solid #b91c1c; }
.quote-side-b { border-left: 3px solid #2563eb; }
.quote-side-tag {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.quote-side-a .quote-side-tag { background: #fee2e2; color: #b91c1c; }
.quote-side-b .quote-side-tag { background: #dbeafe; color: #1d4ed8; }
.quote-side-empty {
    padding: 24px 12px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}
.quote-side-empty .empty-title {
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
}
/* B 组表格内文本颜色统一为蓝色 */
.quote-side-b .quote-table table { color: #1d4ed8; }
.quote-side-b .quote-table .price-cell { color: #1d4ed8; }
.quote-side-b .quote-table thead th { color: #1d4ed8; background: #eff6ff; }
.quote-side-b .quote-table .quote-text { color: #1e3a8a; }
/* A 组表格内文本颜色统一为红色 */
.quote-side-a .quote-table table { color: #b91c1c; }
.quote-side-a .quote-table .price-cell { color: #b91c1c; }
.quote-side-a .quote-table thead th { color: #b91c1c; background: #fef2f2; }
.quote-side-a .quote-table .quote-text { color: #991b1b; }
/* 销售价列和报价内容列底色 */
.quote-table th:nth-child(4), .quote-table td:nth-child(4) { background: #fef9f5; }
.quote-table th:nth-child(5), .quote-table td:nth-child(5) { background: #fef9f5; }

/* 报价内容列 + 复制按钮 */
.quote-content { white-space: normal; word-break: break-all; }
.quote-content .quote-content-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.quote-content .quote-text {
    flex: 1 1 auto;
    min-width: 0;
    font-family: "Cascadia Code", "Consolas", monospace;
    font-size: 11px;
    line-height: 1.4;
    color: #0f172a;
    user-select: all;
    cursor: text;
    padding: 3px 6px;
    border-radius: 4px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    word-break: break-all;
    white-space: normal;
    overflow-wrap: anywhere;
}
.quote-content .btn-copy {
    flex: 0 0 auto;
    margin-left: auto;
    flex-shrink: 0;
    padding: 4px 10px;
    font-size: 11px;
    background: #0ea5e9;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s;
}
.quote-content .btn-copy:hover { background: #0284c7; }
.quote-content .btn-copy.copied { background: #16a34a; }

/* 邮箱设置表单 */
input[type="password"] {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
input[type="password"]:focus { border-color: #cc0000; }
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.settings-grid .full-row { grid-column: 1 / -1; }
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    border-radius: 24px;
    transition: 0.2s;
}
.switch .slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}
.switch input:checked + .slider { background: #cc0000; }
.switch input:checked + .slider::before { transform: translateX(20px); }
.config-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}
.config-banner.ok { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.config-banner.warn { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.config-source { font-size: 12px; color: #94a3b8; }

/* 监控进度条 */
.monitor-progress {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.monitor-progress .progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #1e293b;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}
.monitor-progress .progress-info .progress-pct { font-weight: 700; color: #cc0000; }
.monitor-progress .progress-info .progress-failed { color: #b91c1c; font-size: 12px; }
.monitor-progress .progress-bar-bg {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}
.monitor-progress .progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #cc0000, #f97316);
    border-radius: 6px;
    transition: width 0.3s ease;
}
.monitor-progress.done .progress-bar-fill { background: #15803d; }
.monitor-progress .progress-errors {
    margin-top: 8px;
    font-size: 12px;
    color: #b91c1c;
    max-height: 80px;
    overflow-y: auto;
    background: #fef2f2;
    border-radius: 4px;
    padding: 6px 8px;
}
.monitor-progress .progress-errors .err-row { font-family: "Cascadia Code", "Consolas", monospace; }

/* BOM 重点标记星标按钮 */
.star-btn {
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    user-select: none;
    display: inline-block;
    transition: transform 0.15s ease;
    font-family: "Segoe UI Symbol", "Arial Unicode MS", "DejaVu Sans", Arial, sans-serif;
}
.star-btn:hover { transform: scale(1.2); }
.star-on { color: #dc2626 !important; }
.star-off { color: #cbd5e1; }
.star-off:hover { color: #f87171; }
/* BOM 表格行间距收紧（不影响其他页面表格） */
#bomTable th, #bomTable td { padding: 5px 10px; }
/* 重点行整行淡红背景 */
.row-highlight td { background: #fef2f2 !important; }
.row-highlight .opn-cell { color: #b91c1c !important; }
.row-highlight:hover td { background: #fee2e2 !important; }

/* 进销存 - 模态框 */
.modal-mask {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
.modal-box {
    background: #fff; border-radius: 10px; width: 680px; max-width: 92vw; max-height: 88vh;
    display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}
.modal-head {
    padding: 16px 20px; font-size: 16px; font-weight: 700; color: #1e293b;
    border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center;
}
.modal-close { background: none; border: none; font-size: 26px; color: #94a3b8; cursor: pointer; padding: 0 4px; line-height: 1; }
.modal-close:hover { color: #1e293b; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; gap: 10px; }

/* 进销存 - 表单网格（覆盖默认 .form-row 的 flex 布局） */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 13px; color: #475569; font-weight: 500; }
.form-row .req { color: #dc2626; }
.form-row input, .form-row select {
    padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; font-family: inherit;
}
.form-row input:focus, .form-row select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.form-row input:disabled { background: #f1f5f9; color: #94a3b8; }

/* 利润率预设按钮（查询页利润率B快捷选择） */
.margin-preset-btn { border-radius: 6px; transition: all .15s; }
.margin-preset-btn.active { background: #cc0000; color: #fff; }
.margin-preset-btn.active:hover { background: #a30000; }

/* 预设管理弹窗 */
.preset-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.preset-input {
    padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: 14px; font-family: inherit;
}
.preset-input:focus { outline: none; border-color: #cc0000; box-shadow: 0 0 0 2px rgba(204,0,0,.12); }
