/* ===== 钢小算·精简版 样式 ===== */
:root {
    --brand: #D93625;
    --brand-light: #fef2f2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 10px;
    --radius-sm: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    font-size: 15px;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
    height: 100vh;
}

/* ======================================
   移动端默认布局 (≤1023px)
   ====================================== */
#app {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    height: 100vh;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* 顶部栏 */
.mini-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}
.mini-logo { display: flex; align-items: center; gap: 6px; }
.mini-logo-dot { width: 8px; height: 8px; background: var(--brand); border-radius: 50%; }
.mini-logo-text { font-size: 20px; font-weight: 900; letter-spacing: 1px; }
.mini-tagline { font-size: 12px; color: var(--gray-500); margin-left: 4px; }
.mini-header-actions { display: flex; gap: 8px; }
.mini-btn-icon {
    background: none; border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
    padding: 6px 10px; cursor: pointer; font-size: 14px; color: var(--gray-500);
    transition: all .15s;
}
.mini-btn-icon:hover { border-color: var(--brand); color: var(--brand); }
.mini-btn-text {
    background: none; border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
    padding: 6px 10px; cursor: pointer; font-size: 13px; color: var(--gray-600);
    transition: all .15s; font-weight: 500;
}
.mini-btn-text:hover { border-color: var(--brand); color: var(--brand); }

/* 移动端：右栏计算器+左栏统计列表竖排 */
.calc-left-panel, .calc-right-panel { display: block; }
.calc-left-panel {
    margin-top: 8px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}
.calc-right-panel { padding: 12px 16px 4px; }
.right-bottom { display: block; padding: 8px 10px; }
.calc-split-layout { display: block; }

/* 移动端隐藏右栏内按钮（使用底部固定栏） */
.btn-add-right { display: none; }
.center-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 10px;
}
.realtime-card { }
.center-card-title {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-700);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
}
#realtime-data { padding: 8px 12px; }
.realtime-empty { text-align: center; padding: 12px 10px; color: #9ca3af; font-size: 15px; }
.rt-row { display: flex; justify-content: flex-start; align-items: baseline; padding: 2px 0; gap: 6px; }
.rt-label { font-size: 14px; color: var(--gray-500); white-space: nowrap; min-width: 56px; }
.rt-value { font-size: 15px; font-weight: 600; color: var(--gray-900); text-align: left; flex: 1; }
.rt-type { color: var(--brand); }
.rt-divider { height: 1px; background: var(--gray-100); margin: 3px 0; }
.rt-row-total .rt-value { font-size: 20px; color: var(--brand); font-weight: 900; }

/* 钢材类型选择 */
.type-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}
.type-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 8px 2px; border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm); background: #fff; cursor: pointer; transition: all .15s;
}
.type-btn:hover { border-color: var(--brand); }
.type-btn.active { border-color: var(--brand); background: var(--brand-light); }
.type-btn svg { width: 28px; height: 28px; }
.type-btn .type-name { font-size: 14px; color: var(--gray-700); font-weight: 500; }
.type-btn.active .type-name { color: var(--brand); font-weight: 700; }
/* 自定义入口：虚线边框 */
.type-btn-custom { border-style: dashed; border-color: var(--gray-200); background: #fafafa; }
.type-btn-custom:hover { border-color: var(--brand); border-style: dashed; background: #fff; }
.type-btn-custom .type-name { color: var(--gray-500, #6b7280); }

/* 输入区域 */
.input-section { background: var(--gray-50); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.input-row:last-child { margin-bottom: 0; }
/* 工艺/材质开关标签 */
.mod-tags { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.mod-tags-label { font-size: 12px; color: var(--gray-400, #9ca3af); flex-shrink: 0; }
.mod-tag {
    border: 1.5px solid var(--gray-200); background: #fff; color: var(--gray-500, #6b7280);
    border-radius: 6px; padding: 3px 12px; font-size: 13px; font-family: inherit;
    cursor: pointer; transition: all .15s; line-height: 1.5;
}
.mod-tag:active { transform: scale(.95); }
.mod-tag.on { border-color: var(--brand); color: var(--brand); background: var(--brand-light); font-weight: 600; }
.input-field { display: flex; flex-direction: column; gap: 4px; }
.input-field.full { grid-column: 1 / -1; }
.input-field label { font-size: 14px; color: var(--gray-500); font-weight: 500; }
.input-field input, .input-field select {
    width: 100%; padding: 10px 12px; border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm); font-size: 17px; font-family: inherit;
    color: var(--gray-900); background: #fff; transition: border-color .15s;
    -webkit-appearance: none;
}
.input-field input:focus, .input-field select:focus { outline: none; border-color: var(--brand); }
.input-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px;
}

/* 公式提示 */
.formula-hint { font-size: 13px; color: var(--gray-500); padding: 6px 0 2px; line-height: 1.5; }

/* 可选字段 */
.input-row-optional {
    background: #fffbeb; border: 1px dashed #fcd34d; border-radius: var(--radius-sm);
    padding: 10px; margin: 0 -4px 10px;
}
.input-row-optional .input-field input { border-color: #fde68a; background: #fff; }
.input-row-optional .input-field input:focus { border-color: #f59e0b; }
.opt-tag {
    font-size: 11px; color: #d97706; background: #fef3c7;
    padding: 1px 5px; border-radius: 3px; font-weight: 500; margin-left: 2px;
}

/* 移动端底部按钮 */
.right-actions-mobile {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border-top: 1px solid var(--gray-100);
    position: sticky;
    bottom: 0;
    z-index: 10;
}
.right-actions-mobile .btn-add {
    flex: 2;
    width: auto;
    padding: 12px;
    font-size: 16px;
}
.btn-add {
    width: 100%; padding: 14px; background: var(--brand); color: #fff; border: none;
    border-radius: var(--radius); font-size: 18px; font-weight: 700; cursor: pointer;
    transition: opacity .15s; font-family: inherit;
}
.btn-add:hover { opacity: .9; }
.btn-add:active { transform: scale(.98); }

.btn-export {
    flex: 1; padding: 12px; border: 1.5px solid var(--brand); border-radius: var(--radius);
    background: #fff; color: var(--brand); font-size: 15px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.btn-clear {
    flex: 1; padding: 12px; border: 1.5px solid var(--gray-200); border-radius: var(--radius);
    background: #fff; color: var(--gray-500); font-size: 15px; font-weight: 500;
    cursor: pointer; font-family: inherit;
}

/* 移动端统计列表 */
#stats-list-body { min-height: 120px; max-height: 60vh; overflow-y: auto; }
.sl-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.list-header {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
}
.list-empty { text-align: center; padding: 30px 20px; color: #9ca3af; font-size: 14px; }
.center-actions {
    padding: 8px 10px;
    display: flex;
    gap: 6px;
    align-items: center;
}
.center-actions .btn-add-center { flex: 0 0 auto; padding: 8px 12px; font-size: 13px; }
.center-btns-full { flex: 1; }
.center-btns-full .btn-export-sm,
.center-btns-full .btn-clear-sm {
    flex: 1; padding: 6px; font-size: 12px; border: 1.5px solid var(--brand);
    border-radius: 6px; background: #fff; color: var(--brand); cursor: pointer;
    font-weight: 600;
}
.center-btns-full .btn-clear-sm { border-color: var(--gray-200); color: var(--gray-500); }
/* 移动端表格 */
.sl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sl-table thead { position: sticky; top: 0; z-index: 2; }
.sl-table th {
    background: #374151; padding: 6px 4px; font-size: 11px;
    color: #fff; font-weight: 600; text-align: center;
    border-bottom: 2px solid var(--brand); white-space: nowrap;
    cursor: pointer;
}
.sl-th-num { width: 24px; }
.sl-th-del { width: 28px; }
.sl-table td {
    padding: 4px 4px; font-size: 12px;
    border-bottom: 1px dashed #e5e7eb;
    color: var(--gray-700); vertical-align: middle;
}
.sl-table tbody tr:nth-child(even) { background: #f9fafb; }
.sl-td-center { text-align: center; }
.sl-td-right { text-align: right; }
.sl-td-num { color: var(--gray-500); font-size: 11px; }
.sl-td-name { min-width: 70px; }
.sl-type { display: inline; font-weight: 600; font-size: 12px; color: var(--gray-900); }
.sl-spec { display: inline; font-size: 11px; color: var(--gray-500); margin-left: 3px; }
.sl-td-edit {
    text-align: center; cursor: text; font-weight: 600;
    color: var(--gray-900); outline: none;
}
.sl-td-edit:focus { box-shadow: inset 0 0 0 2px var(--brand); }
.sl-td-calc { color: var(--gray-900); }
.sl-td-amount { color: var(--brand); font-weight: 700; font-size: 13px; }
.sl-unit { font-size: 10px; color: var(--gray-500); font-weight: 400; }
.sl-del-btn {
    background: none; border: none; color: #9ca3af; cursor: pointer;
    padding: 2px 4px; font-size: 12px; border-radius: 4px; line-height: 1;
}
.sl-del-btn:hover { color: #fff; background: var(--brand); }
.hidden { display: none !important; }

/* 自定义快速添加行 */
.sl-custom-row { background: #fffbeb; }
.sl-custom-row td { border-bottom: 2px dashed var(--brand); }
.sl-custom-inp { outline: none; font-family: inherit; }
.sl-custom-inp:focus { background: #fff; box-shadow: inset 0 0 0 1px var(--brand); border-radius: 2px; }
.sl-add-btn {
  background: var(--brand); color: #fff; border: none; border-radius: 4px;
  width: 22px; height: 22px; font-size: 14px; font-weight: 700;
  cursor: pointer; line-height: 1; padding: 0;
}
.sl-add-btn:hover { opacity: .9; }

/* 表格底部自定义添加栏 */
.custom-add-bar {
    background: #fff;
    padding: 8px 12px;
    border-top: 1px dashed var(--gray-300);
    position: sticky;
    left: 0;
}
.cab-form {
    display: flex;
    gap: 4px;
    align-items: center;
}
.cab-inp {
    flex: 1;
    min-width: 0;
    padding: 6px 4px;
    border: none;
    border-bottom: 1px dashed var(--gray-400);
    border-radius: 0;
    font-size: 14px;
    font-family: inherit;
    background: transparent;
    color: var(--gray-900);
}
.cab-inp::placeholder { color: var(--gray-400); }
.cab-inp:focus {
    outline: none;
    border-bottom: 1px solid var(--brand);
}
.cab-inp-num {
    flex: 0 0 55px;
    text-align: center;
}
.cab-inp-unit {
    flex: 0 0 36px;
    text-align: center;
    padding: 6px 2px;
}
.cab-btn {
    flex: 0 0 32px;
    height: 32px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-left: 4px;
}
.cab-btn:hover { opacity: 0.9; }

/* 列切换 */
.col-toggle-btn {
    float: right; background: var(--gray-100); border: 1px solid var(--gray-200);
    color: var(--gray-600); font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 4px; cursor: pointer; line-height: 1.5;
}
.col-toggle-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.col-toggle-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
#col-toggles {
    display: none; padding: 5px 10px; background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100); gap: 8px; flex-wrap: wrap;
}
#col-toggles.show { display: flex; }
#col-toggles label { font-size: 11px; color: var(--gray-600); cursor: pointer; display: flex; align-items: center; gap: 2px; }

/* 单价精度/结算方式面板 */
#precision-panel, #settle-panel {
    display: none; padding: 5px 10px; background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100); gap: 6px; flex-wrap: wrap; align-items: center;
}
#precision-panel.show, #settle-panel.show { display: flex; }
#precision-panel label, #settle-panel label { font-size: 11px; color: var(--gray-600); font-weight: 600; }
.precision-btn {
    background: var(--gray-100); border: 1px solid var(--gray-200);
    color: var(--gray-600); font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 4px; cursor: pointer; line-height: 1.5;
}
.precision-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.precision-btn.on { background: var(--brand); color: #fff; border-color: var(--brand); }
#col-toggles input[type="checkbox"] { width: 11px; height: 11px; accent-color: var(--brand); }
/* 底部汇总 */
.list-footer { background: var(--gray-50); border-bottom: 1px solid var(--gray-200); }
.sl-summary {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 16px;
    font-size: 13px; color: var(--gray-700); padding: 8px 14px;
    flex-wrap: nowrap;
}
.sl-sum-label { font-weight: 500; color: var(--gray-500); }
.sl-sum-val { font-weight: 700; color: var(--gray-900); }
.sl-sum-sep { color: var(--gray-300); margin: 0 2px; }
.sl-total-amount { color: #FFD700 !important; font-size: 14px; font-weight: 900; }


/* ======================================
   桌面端两栏布局 (≥1024px)
   ====================================== */
@media (min-width: 1024px) {
    #app {
        max-width: none;
        height: 100vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    /* 顶部栏全宽 */
    .mini-header {
        max-width: none;
        padding: 8px 16px;
    }
    .mini-logo-dot { width: 6px; height: 6px; }
    .mini-logo-text { font-size: 17px; }
    .mini-tagline { font-size: 11px; }

    /* 两栏可见 */
    .calc-left-panel { display: flex; }
    .calc-right-panel { display: flex; }
    .right-actions-mobile { display: none; }

    /* 两栏容器 */
    .calc-split-layout {
        flex: 1;
        display: flex;
        flex-direction: row;
        gap: 8px;
        padding: 8px 12px;
        min-height: 0;
        overflow: hidden;
    }

    /* ===== 左栏：统计列表 + 统计汇总 (52%) ===== */
    .calc-left-panel {
        flex: 1.08 1 0;
        min-width: 320px;
        max-width: 55%;
        background: #fff;
        border-radius: 10px;
        border: 1px solid var(--gray-200);
        overflow: hidden;
        flex-direction: column;
    }
    .left-top {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }
    .left-bottom {
        flex-shrink: 0;
    }

    /* 紧凑化类型选择（桌面端2行×5列） */
    .type-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
        margin-bottom: 10px;
    }
    .type-btn { padding: 6px 2px; }
    .type-btn svg { width: 24px; height: 24px; }
    .type-btn .type-name { font-size: 13px; }

    /* 紧凑化输入 */
    .input-section { padding: 10px 12px; margin-bottom: 0; }
    .input-row { gap: 8px; margin-bottom: 8px; }
    .input-field label { font-size: 13px; }
    .input-field input, .input-field select {
        padding: 7px 10px;
        font-size: 14px;
    }
    .formula-hint { font-size: 11px; padding: 4px 0 0; }
    .input-row-optional { padding: 6px 8px; margin: 0 -2px 8px; }

    /* 卡片通用样式 */
    .center-card {
        background: #fff;
        border-top: 1px solid var(--gray-200);
        overflow: hidden;
    }
    .center-card-title {
        padding: 8px 12px;
        font-size: 13px;
        font-weight: 700;
        color: var(--gray-700);
        background: var(--gray-50);
        border-bottom: 1px solid var(--gray-100);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    #stats-count-mid {
        font-size: 12px;
        font-weight: 400;
        color: var(--gray-500);
    }

    /* 实时数据（右栏底部） */
    #realtime-data { padding: 8px 12px; }
    .realtime-empty {
        text-align: center;
        padding: 12px 10px;
        color: #9ca3af;
        font-size: 13px;
    }
    .rt-row {
        display: flex;
        justify-content: flex-start;
        align-items: baseline;
        padding: 1px 0;
        gap: 6px;
    }
    .rt-label { font-size: 12px; color: var(--gray-500); white-space: nowrap; min-width: 56px; }
    .rt-value { font-size: 13px; font-weight: 600; color: var(--gray-900); text-align: left; flex: 1; }
    .rt-type { color: var(--brand); }
    .rt-divider { height: 1px; background: var(--gray-100); margin: 3px 0; }
    .rt-row-total .rt-value { font-size: 17px; color: var(--brand); font-weight: 900; }

    /* 统计汇总（跟随表格） */
    #stats-summary-inner { padding: 8px 12px; }
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    .stats-item {
        background: var(--gray-50);
        border-radius: 6px;
        padding: 8px 6px;
        text-align: center;
    }
    .si-val { font-size: 17px; font-weight: 700; color: var(--gray-900); }
    .si-val.brand { color: var(--brand); font-size: 15px; }
    .si-lbl { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

/* 移动端统计汇总优化 */
@media (max-width: 1023px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .stats-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 12px;
        text-align: left;
    }
    .si-val { font-size: 15px; }
    .si-val.brand { font-size: 15px; }
    .si-lbl { font-size: 12px; margin-top: 0; }
}

    /* 操作按钮（左栏底部，横排） */
    .center-actions {
        padding: 6px 10px 8px;
        display: flex;
        flex-direction: row;
        gap: 6px;
        align-items: center;
    }
    .btn-add-center {
        flex: 0 0 auto;
        padding: 8px 16px;
        font-size: 13px;
        border-radius: 8px;
    }
    .btn-add-right {
        display: block;
        width: 100%;
        padding: 10px;
        font-size: 14px;
        font-weight: 700;
        border-radius: 8px;
        margin-bottom: 8px;
        border: none;
        background: var(--brand);
        color: #fff;
        cursor: pointer;
        font-family: inherit;
    }
    .center-btns { display: flex; gap: 4px; flex: 1; }
    .center-btns-full { flex: 1; }
    .btn-export-sm {
        flex: 1;
        padding: 6px;
        font-size: 12px;
        border: 1.5px solid var(--brand);
        border-radius: 6px;
        background: #fff;
        color: var(--brand);
        cursor: pointer;
        font-family: inherit;
        font-weight: 600;
    }
    .btn-clear-sm {
        flex: 1;
        padding: 6px;
        font-size: 12px;
        border: 1.5px solid var(--gray-200);
        border-radius: 6px;
        background: #fff;
        color: var(--gray-500);
        cursor: pointer;
        font-family: inherit;
    }

    /* ===== 右栏：计算器 + 实时数据 (48%) ===== */
    .calc-right-panel {
        flex: 1 1 0;
        min-width: 280px;
        max-width: 45%;
        background: #fff;
        border-radius: 10px;
        border: 1px solid var(--gray-200);
        overflow: hidden;
        flex-direction: column;
    }
    .right-top {
        flex: 0 0 auto;
        overflow-y: auto;
        padding: 10px 14px;
        min-height: 0;
    }
    .right-bottom {
        display: block;
        flex-shrink: 0;
        padding: 8px 10px;
        margin-top: 8px;
    }

    /* 列表头 */
    .list-header {
        flex-shrink: 0;
        padding: 10px 16px;
        font-size: 15px;
        font-weight: 700;
        color: var(--gray-700);
        border-bottom: 1px solid var(--gray-100);
        background: var(--gray-50);
    }
    .list-header span {
        font-size: 13px;
        font-weight: 400;
        color: var(--gray-500);
    }

    /* 列表空状态 */
    .list-empty {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 60px 20px;
        color: #9ca3af;
        font-size: 14px;
    }

    /* 统计列表表格 — 红深灰配色 */
    #stats-list-body { flex: 1; overflow-y: auto; }
    .sl-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 15px;
    }
    .sl-table thead {
        position: sticky;
        top: 0;
        z-index: 2;
    }
    .sl-table th {
        background: #374151;
        padding: 8px 6px;
        font-size: 14px;
        color: #fff;
        font-weight: 600;
        text-align: center;
        border-bottom: 2px solid var(--brand);
        white-space: nowrap;
    }
    .sl-th-num { width: 30px; }
    .sl-th-del { width: 34px; }
    .sl-th-edit { color: #fca5a5; cursor: pointer; }
    .sl-th-edit:hover { color: #fff; }
    .sl-unit { font-size: 11px; color: #9ca3af; margin-left: 2px; font-weight: 400; }
    .sl-table th { cursor: pointer; user-select: none; }
    .sl-table th:hover { background: #1f2937; }
    .sl-table td {
        padding: 5px 6px;
        font-size: 14px;
        border-bottom: 1px dashed #e5e7eb;
        color: var(--gray-700);
        vertical-align: middle;
    }
    .sl-table tbody tr:nth-child(even) { background: #f9fafb; }
    .sl-table tbody tr:hover { background: var(--brand-light); }
    .sl-td-center { text-align: center; }
    .sl-td-right { text-align: right; }
    .sl-td-num { color: var(--gray-500); font-size: 13px; }
    .sl-td-name { min-width: 80px; }
    .sl-type { display: inline; font-weight: 600; font-size: 14px; color: var(--gray-900); }
    .sl-spec { display: inline; font-size: 13px; color: var(--gray-500); margin-left: 4px; }

    /* 可编辑单元格 */
    .sl-td-edit {
        text-align: center;
        cursor: text;
        font-weight: 600;
        color: var(--gray-900);
        outline: none;
    }
    .sl-td-edit:focus {
        box-shadow: inset 0 0 0 2px var(--brand);
    }
    .sl-td-calc { color: var(--gray-900); }
    .sl-td-amount { color: var(--brand); font-weight: 700; font-size: 15px; }

    /* 删除按钮 */
    .sl-del-btn {
        background: none;
        border: none;
        color: #9ca3af;
        cursor: pointer;
        padding: 2px 6px;
        font-size: 13px;
        border-radius: 4px;
        transition: all .15s;
        line-height: 1;
    }
    .sl-del-btn:hover {
        color: #fff;
        background: var(--brand);
    }

    /* 隐藏列 */
    .sl-table .hidden { display: none !important; }

    /* 列切换面板 */
    .col-toggle-btn {
        float: right;
        background: var(--gray-100);
        border: 1px solid var(--gray-200);
        color: var(--gray-600);
        font-size: 12px;
        font-weight: 600;
        padding: 2px 10px;
        border-radius: 4px;
        cursor: pointer;
        line-height: 1.5;
        transition: all .15s;
    }
    .col-toggle-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
    .col-toggle-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
    #col-toggles {
        display: none;
        flex-shrink: 0;
        padding: 6px 16px;
        background: var(--gray-50);
        border-bottom: 1px solid var(--gray-100);
        gap: 10px;
        flex-wrap: wrap;
    }
    #col-toggles.show { display: flex; }
    #col-toggles label {
        font-size: 12px;
        color: var(--gray-600);
        cursor: pointer;
        user-select: none;
        display: flex;
        align-items: center;
        gap: 3px;
    }
    #col-toggles input[type="checkbox"] {
        width: 12px;
        height: 12px;
        accent-color: var(--brand);
        cursor: pointer;
    }

    /* 表格底部汇总 — 红底白字（跟随表格内容） */
    .sl-summary {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        font-size: 12px;
        padding: 6px 10px;
        flex-wrap: nowrap;
        min-width: 0;
    }
    .sl-sum-label { font-weight: 500; white-space: nowrap; color: rgba(255,255,255,0.9); }
    .sl-sum-val { font-weight: 700; color: #fff; white-space: nowrap; }
    .sl-sum-sep { color: rgba(255,255,255,0.5); margin: 0 2px; white-space: nowrap; }
    .sl-total-amount { color: #FFD700 !important; font-size: 13px; white-space: nowrap; font-weight: 900; }
}

/* 平板竖屏：保持单栏 */
@media (min-width: 641px) and (max-width: 1023px) {
    .type-grid { grid-template-columns: repeat(10, 1fr); }
}

/* ===== 草稿箱弹窗 ===== */
.draft-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.draft-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    overflow: hidden;
}
.draft-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}
.draft-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
}
.draft-modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--gray-500);
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.draft-modal-close:hover { background: var(--gray-200); color: var(--gray-900); }
.draft-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 18px;
}
/* 保存行 */
.draft-save-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--gray-100);
}
.draft-name-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-900);
    outline: none;
}
.draft-name-input:focus { border-color: var(--brand); }
.draft-name-input::placeholder { color: var(--gray-400); }
.draft-save-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.draft-save-btn:hover { opacity: 0.9; }
/* 草稿列表 */
.draft-list { display: flex; flex-direction: column; gap: 8px; }
.draft-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--gray-50);
    border-radius: 8px;
    gap: 8px;
}
.draft-info { flex: 1; min-width: 0; }
.draft-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.draft-meta {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 3px;
}
.draft-actions { display: flex; gap: 6px; flex-shrink: 0; }
.draft-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.draft-btn-load { background: var(--brand); color: #fff; }
.draft-btn-load:hover { opacity: 0.9; }
.draft-btn-del { background: var(--gray-200); color: var(--gray-700); }
.draft-btn-del:hover { background: var(--gray-300); }
/* 草稿按钮高亮 */
.mini-btn-draft {
    font-size: 16px;
    line-height: 1;
}

/* ========== 型号下拉：可搜索 combo ========== */
.combo { position: relative; }
.combo-btn {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    width: 100%; padding: 10px 12px; border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm); font-size: 17px; font-family: inherit;
    color: var(--gray-900); background: #fff; transition: border-color .15s;
    cursor: pointer; box-sizing: border-box; min-height: 44px;
}
.combo.open .combo-btn { border-color: var(--brand); }
.combo-txt.ph { color: var(--gray-400, #9ca3af); }
.combo-caret { color: var(--gray-400, #9ca3af); font-size: 14px; flex-shrink: 0; }
.combo-list {
    display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: #fff; border: 1px solid var(--gray-200); border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.14); z-index: 60; overflow: hidden;
}
.combo.open .combo-list { display: block; }
.combo-search {
    display: block; width: 100%; padding: 9px 12px; font-size: 15px; font-family: inherit;
    border: none; border-bottom: 1px solid var(--gray-100, #f3f4f6); outline: none;
    box-sizing: border-box; color: var(--gray-900);
}
.combo-search:focus { border-bottom-color: var(--brand); }
.combo-opts { max-height: 264px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.combo-opt {
    padding: 9px 12px; font-size: 15px; color: var(--gray-900);
    cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.combo-opt:active { background: var(--brand); color: #fff; }
.combo-opt:active .combo-w { color: rgba(255,255,255,.8); }
.combo-opt.sel { color: var(--brand); font-weight: 600; }
.combo-w { color: var(--gray-400, #9ca3af); font-size: 12px; flex-shrink: 0; }
.combo-empty { padding: 14px 12px; font-size: 13px; color: var(--gray-400, #9ca3af); text-align: center; }

/* ========== 品牌弹窗辅助 ========== */
.hf-section-title { font-size: 13px; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; }
.hf-radio-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.hf-radio-row label { font-size: 12px; color: var(--gray-500); cursor: pointer; display: flex; align-items: center; gap: 4px; }
.hf-input { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: 13px; font-family: inherit; margin-bottom: 6px; outline: none; }
.hf-input:focus { border-color: var(--brand); }
.hf-file { font-size: 12px; }
.hf-preview img { max-width: 100%; max-height: 120px; border-radius: 4px; border: 1px solid var(--gray-200); }
@media (max-width: 640px) {
    .combo-btn { padding: 7px 10px; font-size: 14px; min-height: 38px; }
    .combo-opts { max-height: 240px; }
    .combo-opt { padding: 8px 10px; font-size: 14px; }
    .combo-search { padding: 8px 10px; font-size: 14px; }
}

/* ===== 付费升级弹窗 - 收款+客服 ===== */
.pay-section{margin-top:6px;padding-top:14px;border-top:1px dashed #e5e7eb;}
.pay-title{font-size:13px;font-weight:700;color:#1f2937;margin-bottom:10px;text-align:center;}
.pay-body{display:flex;gap:12px;align-items:flex-start;}
.pay-qr{flex-shrink:0;width:124px;height:124px;border:1px solid #e5e7eb;border-radius:8px;background:#fff;display:flex;align-items:center;justify-content:center;overflow:hidden;}
.pay-qr img{width:100%;height:100%;object-fit:contain;}
.pay-side{flex:1;display:flex;flex-direction:column;gap:6px;min-width:0;}
.pay-step{font-size:11px;color:#666;line-height:1.4;}
.pay-step:nth-child(1){color:#D93625;font-weight:600;}
.pay-kefu-btn{display:block;margin-top:4px;padding:9px 10px;background:linear-gradient(135deg,#D93625 0%,#B82B1D 100%);color:#fff!important;text-decoration:none;text-align:center;font-size:12px;font-weight:700;border-radius:6px;box-shadow:0 2px 6px rgba(217,54,37,.25);transition:transform .15s;}
.pay-kefu-btn:active{transform:scale(0.97);}
@media (max-width:380px){
  .pay-body{flex-direction:column;align-items:center;}
  .pay-qr{width:140px;height:140px;}
  .pay-side{width:100%;}
}

/* ===== 工艺/材质 自定义输入 ===== */
.mat-custom-input{width:110px;padding:4px 10px;border:1px solid #D93625;border-radius:14px;font-size:11px;color:#1f2937;outline:none;background:#fff;}
.mat-custom-input::placeholder{color:#c0c4cc;font-size:10px;}
