/* ============================================================
   Quotation System — main.css
   Single CSS file for both price panels
   All units in em/rem (1em = 16px base)
   ============================================================ */

/* === 1. Responsive text helpers === */
.d-only { display: inline; }
.m-only { display: none; }

/* === 2. Container — two panels side by side === */
#price-panels-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5em;
    width: 100%;
}
#price-panels-container .parameter-section-wrapper {
    flex: 0 0 calc(50% - 0.25em);
    width: calc(50% - 0.25em);
    min-width: 0;
    box-sizing: border-box;
}

/* === 3. Panel shell === */
.qt-panel { margin: 0; }
.qt-panel-summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85em;
    color: #333;
    background: #fafbfc;
    border-bottom: 1px solid #e4e7ed;
    padding: 0.5em 0.875em;
    list-style: none;
    user-select: none;
}
.qt-panel-summary::-webkit-details-marker { display: none; }
.qt-panel-body { padding: 0.625em; background: #fff; }
.qt-section-label {
    font-size: 0.72em;
    color: #909399;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375em;
}

/* === 4. Factor table === */
.ft-grid {
    display: grid;
    grid-template-columns: 7.5em 1fr 1fr;
    gap: 1px;
    background: #e4e7ed;
    border: 1px solid #e4e7ed;
    border-radius: 0.25em;
    overflow: hidden;
}
.ft-grid > div {
    background: #fff;
    padding: 0.3em 0.5em;
    display: flex;
    align-items: center;
    font-size: 0.8em;
}
.ft-hdr {
    background: #fafbfc !important;
    font-weight: 600;
    font-size: 0.72em !important;
    color: #606266;
    justify-content: center;
}
.ft-lbl { font-weight: 600; font-size: 0.76em !important; color: #555; }
.ft-input {
    border: 1px solid #dcdfe6;
    border-radius: 0.2em;
    padding: 0.25em 0.375em;
    text-align: center;
    font-size: 0.8em;
    width: 100%;
    height: 1.75em;
    box-sizing: border-box;
    max-width: 6em;
}
.ft-input:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 0.125em rgba(24,144,255,0.15);
}

/* === 5. Section spacer === */
.qt-sp-section { margin-top: 0.875em; }

/* === 6. Special products — card layout === */
.sp-tbl {
    display: block;
    background: transparent;
    border: none;
    margin-top: 10px;
}
.sp-header, .sp-tbl-row.sp-header {
    display: none !important;
}

.sp-rule-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #dcdfe6;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}
.sp-rule-card:hover {
    border-color: #1890ff;
    box-shadow: 0 3px 8px rgba(24,144,255,0.1);
}
.sp-rule-card:nth-child(even) { background: #f9faff; }

.sp-rule-main {
    display: grid;
    grid-template-columns: 1.2fr 1.1fr 1.1fr 1fr 1fr 40px;
    padding: 12px 10px;
    gap: 12px;
    align-items: flex-end;
}
.sp-rule-extra {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 12px;
    background: #fffdf5;
    border-top: 1px dashed #ffe58f;
    font-size: 0.75em;
    color: #666;
    flex-wrap: wrap;
}
.sp-rule-col {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.sp-rule-col label {
    font-size: 10px;
    color: #909399;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 2px;
    white-space: nowrap;
}
.sp-rule-action {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 5px;
}
.sp-rule-extra-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.sp-rule-extra-item span { font-weight: 600; color: #555; }
.sp-rule-extra-item input.sp-cext-inp {
    width: 55px;
    height: 24px;
    border: 1px solid #dcdfe6;
    border-radius: 3px;
    text-align: center;
    padding: 0 4px;
    font-size: 1em;
}
.sp-del, .sp-remove-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #ff4d4f;
    color: #ff4d4f;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    padding: 0;
    transition: all 0.2s;
}
.sp-del:hover, .sp-remove-btn:hover { background: #ff4d4f; color: #fff; }

.sp-select {
    border: 1px solid #dcdfe6;
    border-radius: 3px;
    padding: 3px 5px;
    font-size: 0.85em;
    width: 100%;
    height: 28px;
    background: #fff;
}
.sp-input, .sp-rule-main input[type="number"] {
    border: 1px solid #dcdfe6;
    border-radius: 3px;
    padding: 3px 2px;
    text-align: center;
    font-size: 0.9em;
    width: 100%;
    height: 28px;
    box-sizing: border-box;
}

.sp-segmented, .sp-seg {
    display: flex;
    border: 1px solid #dcdfe6;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
    height: 28px;
}
.sp-segmented label, .sp-seg label {
    padding: 0 8px;
    font-size: 0.72em;
    cursor: pointer;
    background: #fff;
    color: #606266;
    border-right: 1px solid #dcdfe6;
    margin: 0;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sp-segmented label:last-child, .sp-seg label:last-child { border-right: none; }
.sp-segmented input, .sp-seg input { display: none; }
.sp-segmented label:has(input:checked), .sp-seg label:has(input:checked) { background: #1890ff; color: #fff; }
.sp-select {
    border: 1px solid #dcdfe6;
    border-radius: 0.2em;
    padding: 0.2em 0.3em;
    font-size: inherit;
    width: 100%;
    height: 1.625em;
}
.sp-input {
    border: 1px solid #dcdfe6;
    border-radius: 0.2em;
    padding: 0.2em 0.3em;
    text-align: center;
    font-size: inherit;
    width: 100%;
    height: 1.625em;
    box-sizing: border-box;
    max-width: 5em;
}
.sp-seg {
    display: flex;
    border: 1px solid #dcdfe6;
    border-radius: 0.2em;
    overflow: hidden;
    flex-shrink: 0;
}
.sp-seg label {
    padding: 0.15em 0.4em;
    font-size: 0.9em;
    cursor: pointer;
    background: #fff;
    color: #606266;
    border-right: 1px solid #dcdfe6;
    margin: 0;
    white-space: nowrap;
}
.sp-seg label:last-child { border-right: none; }
.sp-seg input[type=radio] { display: none; }
.sp-seg label:has(input:checked) { background: #1890ff; color: #fff; }
.sp-del {
    width: 1.375em;
    height: 1.375em;
    border: 1px solid #f5c6cb;
    background: #fff5f5;
    color: #e74c3c;
    border-radius: 0.2em;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    font-size: 0.9em;
    line-height: 1;
}
.sp-del:hover { background: #fde2e2; }
.sp-cext {
    grid-column: 1 / -1;
    padding: 0.2em 0.5em;
    background: #fffdf5;
    border-top: 1px dashed #ffe58f;
    font-size: 0.72em;
    color: #8c8c8c;
    display: flex;
    gap: 0.625em;
    flex-wrap: wrap;
    align-items: center;
}
.sp-cext span { white-space: nowrap; }
.sp-cext input {
    width: 3em;
    height: 1.25em;
    padding: 0.06em 0.2em;
    border: 1px solid #d9d9d9;
    border-radius: 0.125em;
    font-size: 0.85em;
    text-align: center;
}
.sp-cext-promo {
    cursor: pointer;
    color: #e74c3c;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.125em;
}
.sp-cext-promo input[type=checkbox] {
    width: 0.8em;
    height: 0.8em;
    margin: 0;
}
.qt-sp-btns {
    margin-top: 0.5em;
    display: flex;
    gap: 0.375em;
    align-items: center;
    flex-wrap: wrap;
}
.qt-sp-btn {
    border: 1px dashed #1890ff;
    background: #f0f7ff;
    color: #1890ff;
    border-radius: 0.25em;
    cursor: pointer;
    font-size: 0.78em;
    padding: 0.3em 0.75em;
}
.qt-sp-btn:hover { background: #e6f4ff; }
.qt-sp-btn-save {
    background: #2b7aa2;
    color: #fff;
    border: none;
}
.sp-temp-pat { font-weight: 600; color: #0056b3; font-size: 0.85em; }
.sp-temp-sz,
.sp-temp-md { font-size: 0.85em; color: #555; }

/* === 7. Fluctuation controller === */
.fluct {
    display: flex;
    flex-direction: column;
    gap: 0.45em;
    background: #f0f7ff;
    border: 1px solid #b3d8ff;
    border-radius: 0.35em;
    padding: 0.5em 0.65em;
    margin-top: 0.875em;
    box-sizing: border-box;
}
.fluct-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.5em;
    flex-wrap: wrap;
}
.fluct-title {
    font-weight: 700;
    color: #0369a1;
    font-size: 0.85em;
    flex-shrink: 0;
}
.fluct-mode-seg {
    display: inline-flex;
    border: 1px solid #93c5fd;
    border-radius: 4px;
    overflow: hidden;
    background: #e0f2fe;
}
.fluct-mode-btn {
    border: none;
    background: transparent;
    padding: 2px 8px;
    font-size: 0.72em;
    font-weight: 600;
    color: #0369a1;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.4;
}
.fluct-mode-btn.active {
    background: #0284c7;
    color: #fff;
}
.fluct-group {
    display: flex;
    align-items: center;
    gap: 0.4em;
    background: #fff;
    padding: 0.25em 0.5em;
    border-radius: 0.25em;
    border: 1px solid #bbe5fd;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}
.fluct-btns {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex-shrink: 0;
}
.fluct-btn {
    width: 1.25em;
    height: 0.875em;
    border: 1px solid #a1d8fd;
    background: #f0f9ff;
    border-radius: 0.125em;
    cursor: pointer;
    font-size: 0.5em;
    color: #0369a1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}
.fluct-val {
    min-width: 2.2em;
    text-align: center;
    font-size: 0.92em;
    font-weight: 700;
    color: #0284c7;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}
.fluct-val.negative {
    color: #ea580c;
}
.fluct-unit {
    font-size: 0.75em;
    font-weight: 600;
    color: #0369a1;
    margin-right: 0.2em;
}
.fluct-chips {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    flex-grow: 1;
}
.fluct-chip {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 12px;
    padding: 1px 7px;
    font-size: 0.72em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.35;
}
.fluct-chip:hover {
    background: #dbeafe;
}
.fluct-chip.active {
    background: #2563eb;
    color: #fff;
    border-color: #1d4ed8;
}
.fluct-ctrl-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    width: 100%;
    margin-top: 0.1em;
}
.fluct-ctrl-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.fluct-ctrl-lbl {
    font-weight: 600;
    color: #0369a1;
    font-size: 0.75em;
    white-space: nowrap;
}
.fluct-seg-group {
    display: inline-flex;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    overflow: hidden;
    background: #f8fafc;
}
.fluct-seg-btn {
    border: none;
    background: transparent;
    padding: 2px 7px;
    font-size: 0.72em;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    line-height: 1.35;
}
.fluct-seg-btn:hover {
    background: #e2e8f0;
}
.fluct-seg-btn.active {
    background: #0284c7;
    color: #fff;
}
.fluct-seg-btn.warn {
    color: #b45309;
}
.fluct-seg-btn.warn.active {
    background: #d97706;
    color: #fff;
}
.fluct-preview {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72em;
    background: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px dashed #93c5fd;
    color: #475569;
    box-sizing: border-box;
    overflow-x: auto;
}
.fluct-preview-tag {
    background: #e0f2fe;
    color: #0369a1;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 0.9em;
    white-space: nowrap;
}
.fluct-preview-math {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.95em;
    color: #1e293b;
    white-space: nowrap;
}
.fluct-preview-math .highlight {
    font-weight: 700;
    color: #0284c7;
}
.fluct-preview-math .highlight-neg {
    font-weight: 700;
    color: #ea580c;
}
.fluct-chk {
    display: none;
}
.fluct-save {
    height: 1.625em;
    padding: 0 0.5em;
    border: 1px solid #ddd;
    background: #fafafa;
    border-radius: 0.2em;
    cursor: pointer;
    font-weight: 600;
    color: #555;
    font-size: 0.78em;
    white-space: nowrap;
    flex-shrink: 0;
}
.fluct-save:hover { background: #f0f0f0; }
.fluct-info {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
    font-size: 0.72em;
    color: #0c4a6e;
    margin-top: 0.1em;
    padding-top: 0.25em;
    border-top: 1px dashed #b3d8ff;
    flex-wrap: wrap;
}
.fluct-v { font-weight: 700; color: #0284c7; }
#fluctuationStatus { font-size: 0.65em; color: #64748b; }

/* === 8. MOBILE (max-width: 768px) === */
@media (max-width: 768px) {
    .d-only { display: none; }
    .m-only { display: inline; }

    #price-panels-container {
        flex-direction: column;
        flex-wrap: wrap;
        gap: 0.375em;
    }
    #price-panels-container .parameter-section-wrapper {
        flex: none;
        width: 100%;
    }

    .ft-grid { grid-template-columns: 5.3em 1fr 1fr; }
    .ft-grid > div { padding: 0.25em 0.3em; font-size: 0.72em; }
    .ft-lbl { font-size: 0.72em !important; }
    .ft-input { height: 1.625em; font-size: 0.75em; padding: 0.125em 0.25em; max-width: 5em; }
    .ft-hdr { font-size: 0.68em !important; }

    .sp-tbl-row { grid-template-columns: 1fr 0.55fr 0.65fr 0.75fr 0.75fr 1.75em; }
    .sp-tbl-row > div { padding: 0.2em 0.25em; font-size: 0.72em; }
    .sp-select { height: 1.5em; font-size: 0.72em; }
    .sp-input { height: 1.5em; font-size: 0.72em; max-width: 4em; }
    .sp-seg label { padding: 0.125em 0.25em; font-size: 0.68em; }
    .sp-del { width: 1.125em; height: 1.125em; font-size: 0.75em; }
    .sp-cext { gap: 0.25em; padding: 0.125em 0.3em; font-size: 0.65em; }
    .sp-cext input { width: 2.5em; height: 1.125em; font-size: 0.75em; }

    .fluct { padding: 0.4em 0.5em; gap: 0.4em; }
    .fluct-header-row { flex-wrap: wrap; gap: 0.3em; }
    .fluct-title { font-size: 0.78em; }
    .fluct-group { flex-wrap: wrap; gap: 0.35em; padding: 0.25em 0.4em; }
    .fluct-chips { width: 100%; }
    .fluct-save { height: 1.625em; padding: 0 0.4em; font-size: 0.72em; }
    .fluct-ctrl-row { flex-direction: column; align-items: flex-start; gap: 6px; }
    .fluct-ctrl-item { width: 100%; justify-content: space-between; }
    .fluct-info { width: 100%; text-align: right; margin-top: 0.125em; font-size: 0.68em; }

    .qt-panel-summary { font-size: 0.8em; padding: 0.4em 0.75em; }
    .qt-panel-body { padding: 0.5em; }

    /* Section 8 mobile: 气泡面板全宽 */
    .price-strategy-popup {
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-width: calc(100vw - 16px) !important;
    }
}

/* ═══════════════════════════════════════════════════
   Section 8: 独立定价策略 — 按钮、标签、气泡面板
   ═══════════════════════════════════════════════════ */

/* ── 靶心策略按钮 ── */
.price-strategy-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    padding: 0;
    transition: color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    flex-shrink: 0;
}
.price-strategy-btn:hover {
    background: #f1f5f9;
}

/* 默认态：灰色 */
.price-strategy-btn.state-global {
    color: #94a3b8;
}
.price-strategy-btn.state-global:hover {
    color: #64748b;
}

/* 独立%策略激活态：橙色 */
.price-strategy-btn.state-pct {
    color: #f97316;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
    background: #fff7ed;
}
.price-strategy-btn.state-pct:hover {
    background: #ffedd5;
}

/* 固定价格激活态：绿色 */
.price-strategy-btn.state-fixed {
    color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
    background: #f0fdf4;
}
.price-strategy-btn.state-fixed:hover {
    background: #dcfce7;
}

/* ── 策略状态标签 ── */
.price-strategy-label {
    display: block;
    font-size: 0.65em;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-align: center;
    line-height: 1;
    min-height: 0.9em;
    transition: color 0.15s;
}
.price-strategy-label.state-pct {
    color: #f97316;
}
.price-strategy-label.state-fixed {
    color: #22c55e;
}

/* ── 气泡面板容器 ── */
.price-strategy-popup {
    position: absolute;
    z-index: 99999;
    width: 290px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.13), 0 2px 8px rgba(0,0,0,0.07);
    font-size: 0.88em;
    overflow: hidden;
    animation: psPopupIn 0.14s ease;
}
@keyframes psPopupIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 气泡头部 */
.ps-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px 8px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.ps-title {
    font-weight: 700;
    font-size: 0.95em;
    color: #1e293b;
}
.ps-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.9em;
    padding: 2px 4px;
    border-radius: 3px;
    line-height: 1;
}
.ps-close-btn:hover { color: #475569; background: #f1f5f9; }

/* 产品名 */
.ps-product-name {
    padding: 6px 12px 0;
    font-size: 0.82em;
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 气泡内容区 */
.ps-body {
    padding: 8px 12px 4px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* 单选行 */
.ps-option {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    padding: 3px 0;
    color: #334155;
    font-weight: 500;
}
.ps-option input[type="radio"] {
    accent-color: #3b82f6;
    cursor: pointer;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.ps-hint {
    margin-left: auto;
    font-size: 0.82em;
    color: #94a3b8;
    font-weight: 400;
}

/* 固定价格输入框 */
.ps-fixed-input {
    width: 72px;
    height: 26px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    padding: 2px 5px;
    text-align: center;
    font-size: 0.95em;
    font-weight: 600;
    color: #0f172a;
    margin-left: 4px;
    transition: border-color 0.15s;
}
.ps-fixed-input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34,197,94,0.15);
}
.ps-fixed-input:disabled {
    background: #f8fafc;
    color: #cbd5e1;
    border-color: #e2e8f0;
}

/* % 快捷 Chips 行 */
.ps-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 2px 0 4px 22px;
}
.ps-chip {
    padding: 3px 9px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #f8fafc;
    color: #475569;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.13s;
    line-height: 1.4;
}
.ps-chip:hover {
    border-color: #f97316;
    color: #f97316;
    background: #fff7ed;
}
.ps-chip.active {
    border-color: #f97316;
    background: #f97316;
    color: #ffffff;
    box-shadow: 0 1px 4px rgba(249,115,22,0.25);
}

/* 价格预览 */
.ps-preview {
    margin: 4px 12px 8px;
    padding: 7px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.82em;
    color: #64748b;
    line-height: 1.5;
}
.ps-preview strong {
    color: #1e293b;
    font-weight: 700;
}

/* 底部按钮行 */
.ps-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px 10px;
    border-top: 1px solid #e2e8f0;
    gap: 8px;
}
.ps-btn-reset {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.85em;
    color: #64748b;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.13s;
}
.ps-btn-reset:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #334155;
}
.ps-btn-confirm {
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    padding: 5px 16px;
    font-size: 0.85em;
    color: #ffffff;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.13s;
    flex: 1;
}
.ps-btn-confirm:hover {
    background: #2563eb;
}

