/* ZUNYUE · 上游成本核对终端 */

:root {
    --bg: #f4f6f9;
    --panel: #ffffff;
    --line: #e7eaf0;
    --line-soft: #f0f2f6;
    --ink: #171a20;
    --ink-2: #5c6675;
    --ink-3: #98a1b0;
    --brand: #2f6bff;
    --brand-soft: #eef3ff;
    --ok: #0fa971;
    --ok-soft: #e7f7f1;
    --warn: #e8930c;
    --warn-soft: #fdf3e2;
    --bad: #e5484d;
    --bad-soft: #fdeced;
    --r: 10px;
    --r-sm: 6px;
    --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "Source Han Sans SC", sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- 登录 ---------- */

.gate {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--bg);
}

.gate-card {
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 36px 32px 30px;
}

.gate-mark {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
}

.gate-mark .logo { width: 34px; height: 34px; border-radius: 8px; }

.gate-mark h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: .2px; }

.gate-mark p { font-size: 12px; margin: 1px 0 0; color: var(--ink-3); }

.field { margin-bottom: 14px; }

.field label {
    display: block;
    font-size: 12px;
    color: var(--ink-2);
    margin-bottom: 6px;
    font-weight: 500;
}

.input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    background: #fbfcfd;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    outline: none;
    transition: border-color .15s, background .15s;
}

.input:focus { border-color: var(--brand); background: #fff; }

textarea.input { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    border-radius: var(--r-sm);
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
    transition: background .15s, border-color .15s, opacity .15s;
}

.btn:hover:not(:disabled) { background: #f7f9fc; border-color: #d8dde7; }

.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn-primary:hover:not(:disabled) { background: #2258e0; border-color: #2258e0; }

.btn-block { width: 100%; height: 40px; }

.btn svg { width: 15px; height: 15px; }

/* 导出按钮：贴在板块底部，视觉上比主操作轻一档 */
.btn-xls {
    flex: none;
    height: 30px;
    padding: 0 11px;
    font-size: 12.5px;
    font-weight: 550;
    color: var(--ink-2);
}

.btn-xls svg { width: 14px; height: 14px; color: var(--ink-3); }

.btn-xls:hover:not(:disabled) { color: var(--brand); border-color: #c9d8ff; background: var(--brand-soft); }

.btn-xls:hover:not(:disabled) svg { color: var(--brand); }

.cap-field[hidden] { display: none; }

.cap-row { display: flex; align-items: center; gap: 10px; }

.cap-row .input { flex: 1; min-width: 0; letter-spacing: 3px; font-weight: 600; text-transform: uppercase; }

.cap-img {
    width: 132px;
    height: 44px;
    flex: none;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    cursor: pointer;
    background: #fbfcfd;
    display: block;
    user-select: none;
    transition: border-color .15s;
}

.cap-img:hover { border-color: var(--brand); }

.gate-err {
    display: none;
    margin-bottom: 12px;
    padding: 9px 11px;
    background: var(--bad-soft);
    color: #b42318;
    border-radius: var(--r-sm);
    font-size: 12.5px;
}

.gate-err.on { display: block; }

.gate-foot { margin-top: 20px; text-align: center; font-size: 11.5px; color: var(--ink-3); }

/* ---------- 框架 ---------- */

.top {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(1.6) blur(8px);
    border-bottom: 1px solid var(--line);
}

.top-in {
    max-width: 1480px;
    margin: 0 auto;
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand { display: flex; align-items: center; gap: 9px; }

.brand .logo { width: 28px; height: 28px; border-radius: 7px; }

.brand b { font-size: 15px; font-weight: 650; letter-spacing: .2px; }

.brand span { font-size: 12px; color: var(--ink-3); }

.top-sp { flex: 1; }

.tabs {
    display: flex;
    gap: 2px;
    background: var(--line-soft);
    padding: 3px;
    border-radius: 8px;
}

.tab {
    border: 0;
    background: transparent;
    padding: 6px 13px;
    border-radius: var(--r-sm);
    cursor: pointer;
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.tab:hover { color: var(--ink); }

.tab.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 30, 60, .07); }

.freshness {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--ink-2);
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel);
}

.pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 0 rgba(15, 169, 113, .5);
}

.pulse.live { animation: pulse 2.4s infinite; }

.pulse.stale { background: var(--warn); }

.pulse.dead { background: var(--bad); }

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(15, 169, 113, .45); }
    70%  { box-shadow: 0 0 0 6px rgba(15, 169, 113, 0); }
    100% { box-shadow: 0 0 0 0 rgba(15, 169, 113, 0); }
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: var(--r-sm);
    cursor: pointer;
    color: var(--ink-2);
    transition: background .15s, color .15s;
}

.icon-btn:hover { background: #f7f9fc; color: var(--ink); }

.icon-btn svg { width: 16px; height: 16px; }

.spin { animation: spin .9s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.wrap { max-width: 1480px; margin: 0 auto; padding: 18px 20px 60px; }

.view { display: none; }

.view.on { display: block; }

/* ---------- 卡片 ---------- */

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r);
}

.card-hd {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line-soft);
}

.card-hd h3 { margin: 0; font-size: 13.5px; font-weight: 600; }

.card-hd .sp { flex: 1; }

.card-hd svg { width: 15px; height: 15px; color: var(--ink-3); }

.card-bd { padding: 16px; }

/* ---------- 毛利概览 ---------- */

.mg { margin-bottom: 14px; }

.mg-hd {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    flex-wrap: wrap;
}

.mg-ic { width: 16px; height: 16px; color: var(--brand); flex: none; }

.mg-hd h3 { margin: 0; font-size: 13.5px; font-weight: 650; flex: none; }

.mg-nums {
    display: flex;
    align-items: stretch;
    margin-left: auto;
    flex-wrap: wrap;
}

.mg-stat {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2px 18px;
    border-left: 1px solid var(--line-soft);
}

.mg-stat:first-child { border-left: 0; }

.mg-stat .k { font-size: 11px; color: var(--ink-3); line-height: 1.4; }

.mg-stat .v {
    font-size: 18px;
    font-weight: 680;
    letter-spacing: -.3px;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mg-stat.hot .v { color: var(--ok); }

.mg-stat.hot.neg .v { color: var(--bad); }

.mg-rate {
    display: inline-block;
    margin-left: 6px;
    padding: 0 7px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    vertical-align: 2px;
    background: var(--ok-soft);
    color: #067a51;
}

.mg-stat.neg .mg-rate { background: var(--bad-soft); color: #b42318; }

.mg-toggle { flex: none; }

.mg-toggle svg { transition: transform .2s; }

.mg.open .mg-toggle svg { transform: rotate(180deg); }

.mg-body { display: none; border-top: 1px solid var(--line-soft); }

.mg.open .mg-body { display: block; }

.mg-foot {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 10px 16px;
    border-top: 1px solid var(--line-soft);
    font-size: 11.5px;
    color: var(--ink-3);
    line-height: 1.7;
}

.mg-note { flex: 1; min-width: 0; }

.grid-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.metric {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 16px;
}

.metric + .metric { border-top: 1px solid var(--line-soft); }

.badge-ic {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex: none;
}

.badge-ic svg { width: 15px; height: 15px; }

.m-txt { min-width: 0; flex: 1; }

.m-label { font-size: 11.5px; color: var(--ink-3); line-height: 1.35; }

.m-value {
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -.2px;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.m-value.sm { font-size: 16px; }

.m-spark { width: 62px; height: 26px; flex: none; }

/* ---------- 图表 ---------- */

/* align-items:start 很关键：否则左侧图表卡会被右侧长侧栏拉伸出大片空白 */
.grid-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 14px;
    margin-bottom: 14px;
    align-items: start;
}

.grid-split {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.chart-panel { padding-top: 16px; }

.chart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px 18px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.chart-head-l { min-width: 0; flex: 1 1 200px; }

.chart-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 550;
    letter-spacing: .02em;
}

.chart-kicker svg {
    width: 14px;
    height: 14px;
    flex: none;
}

.chart-seg {
    flex: none;
    align-self: flex-start;
    margin-top: 2px;
}

.chart-seg button { padding: 6px 12px; font-size: 12.5px; }

.chart-title {
    font-size: 16px;
    font-weight: 650;
    margin: 0;
    letter-spacing: .01em;
    line-height: 1.35;
}

.chart-sub {
    font-size: 12.5px;
    color: var(--ink-3);
    margin: 4px 0 0;
    line-height: 1.45;
}

.chart-host { width: 100%; height: 280px; position: relative; }

.chart-host.tall { height: 320px; }

.chart-host.short { height: 218px; }

.chart-host svg { display: block; }

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 0 0;
    border-top: 1px solid var(--line-soft);
    margin-top: 12px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f7f9fc;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 12.5px;
    color: var(--ink);
    cursor: pointer;
    user-select: none;
    transition: background .15s, border-color .15s, opacity .15s;
    max-width: 100%;
}

/* 没有系列时不留一条空的分隔线 */
.legend:empty { display: none; }

.legend-item:hover { border-color: var(--line); background: #f0f3f8; }

.legend-item.off { opacity: .4; background: transparent; color: var(--ink-3); }

.legend-item.off .legend-sw { background: #c2c8d2 !important; }

.legend-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

.legend-item .vl {
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    margin-left: 2px;
}

.legend-sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }

/* 图表面板底部的说明 + 导出 */
.panel-foot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid var(--line-soft);
    font-size: 11.5px;
    line-height: 1.6;
}

.panel-foot > .muted { flex: 1; min-width: 0; }

/* ---------- 成本计算器 ---------- */

/* 模型厂商图标 */
.mi {
    width: 14px;
    height: 14px;
    flex: none;
    vertical-align: -2.5px;
}

.mi-lg { width: 16px; height: 16px; }

/* 自定义下拉：原生 select 无法在选项里放图标与分组图示 */
.sel { position: relative; }

.sel-btn {
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    background: #fbfcfd;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    cursor: pointer;
    text-align: left;
    transition: border-color .15s, background .15s;
}

.sel-btn:hover { border-color: #d3dae6; }

.sel.open .sel-btn { border-color: var(--brand); background: #fff; }

.sel-cur {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 550;
}

.sel-chev { width: 15px; height: 15px; color: var(--ink-3); flex: none; transition: transform .2s; }

.sel.open .sel-chev { transform: rotate(180deg); }

.sel-menu {
    display: none;
    position: absolute;
    z-index: 45;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 300px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 14px 36px rgba(20, 30, 60, .18);
    overflow: hidden;
}

.sel.open .sel-menu { display: block; }

.sel-search-wrap { padding: 8px; border-bottom: 1px solid var(--line-soft); }

.sel-search {
    width: 100%;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: #fbfcfd;
    outline: none;
}

.sel-search:focus { border-color: var(--brand); background: #fff; }

.sel-list { max-height: 296px; overflow-y: auto; padding: 5px; }

.sel-group + .sel-group { border-top: 1px solid var(--line-soft); margin-top: 4px; padding-top: 4px; }

.sel-group-hd {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 9px 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ink-3);
    letter-spacing: .2px;
}

.sel-opt {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border: 0;
    background: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    text-align: left;
    font-size: 13px;
}

.sel-opt:hover { background: var(--line-soft); }

.sel-opt.on { background: var(--brand-soft); color: #1f4fd0; font-weight: 600; }

.sel-opt .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sel-meta { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; flex: none; }

/* ---------- 单价与试算 ---------- */

/* ---------- 渠道单价卡片墙 ---------- */

.pc-sec + .pc-sec { margin-top: 20px; }

.pc-hd {
    display: flex;
    align-items: center;
    gap: 9px;
    padding-bottom: 9px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--line-soft);
}

.pc-hd .nm { font-size: 13.5px; font-weight: 650; letter-spacing: .1px; }

.pc-hd .cnt { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.pc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
    gap: 12px;
}

.pc {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 12px 14px 11px;
    background: var(--panel);
    cursor: pointer;
    text-align: left;
    width: 100%;
    font: inherit;
    color: inherit;
    transition: border-color .15s, box-shadow .15s, transform .12s;
}

.pc:hover {
    border-color: #bed0f6;
    box-shadow: 0 4px 14px rgba(47, 107, 255, .09);
    transform: translateY(-1px);
}

.pc.on {
    border-color: var(--brand);
    background: linear-gradient(180deg, #f6f9ff 0%, #fff 60%);
    box-shadow: 0 0 0 1px rgba(47, 107, 255, .18);
}

.pc-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    row-gap: 4px;
    gap: 7px;
    margin-bottom: 9px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line-soft);
}

/* 模型名一律完整展示：留足最小宽度，位置不够时把倍率标签挤到下一行，
   仍不够才换行撑高卡片，同一行的卡片由 grid 自动等高 */
.pc-top .nm {
    font-size: 12.5px;
    font-weight: 650;
    flex: 1 1 auto;
    min-width: 96px;
    line-height: 1.35;
    overflow-wrap: break-word;
}

.pc-top .rt {
    margin-left: auto;
    flex: none;
    font-size: 10.5px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    background: var(--line-soft);
    border-radius: 20px;
    padding: 1px 7px;
}

.pc-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 3.5px 0;
    font-variant-numeric: tabular-nums;
}

.pc-row .k { font-size: 11.5px; color: var(--ink-3); flex: none; }

.pc-row .v { margin-left: auto; font-size: 13.5px; font-weight: 620; letter-spacing: -.1px; }

.pc-row .u { font-size: 10.5px; color: var(--ink-3); flex: none; width: 24px; }

.pc-row.hi .v { color: var(--brand); }

.pc-call { padding: 6px 0 2px; }

.pc-call .v { font-size: 17px; font-weight: 680; letter-spacing: -.3px; }

/* ---------- 下游未上架：整体灰掉，价格仍保留供参考（悬停可看原因） ---------- */

.pc.off { background: var(--bg); border-style: dashed; }

.pc.off .pc-top .nm,
.pc.off .pc-row .k,
.pc.off .pc-row .v,
.pc.off .pc-row.hi .v { color: var(--ink-3); font-weight: 560; }

.pc.off .mi { opacity: .45; }

.sel-opt.off .nm,
.sel-opt.off .sel-meta { color: var(--ink-3); }

.sel-opt.off .mi { opacity: .45; }

td.off .price-val,
td.off .price-val.out,
tbody tr.off .model-cell span,
tbody tr.off .price-val,
tbody tr.off .price-val.out { color: var(--ink-3); font-weight: 500; }

tbody tr.off .mi { opacity: .45; }

.calc-form {
    display: grid;
    grid-template-columns: minmax(190px, 1.5fr) repeat(4, minmax(94px, 1fr));
    gap: 12px;
    align-items: end;
}

.calc-form .field { margin: 0; }

.calc-form .input { height: 36px; }

.calc-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.cc {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 13px 15px;
    background: #fcfdfe;
    transition: border-color .15s, background .15s;
}

.cc.best {
    border-color: #9dbcff;
    background: linear-gradient(180deg, #f5f8ff 0%, #fdfeff 100%);
    box-shadow: 0 0 0 1px rgba(47, 107, 255, .12);
}

.cc.na { opacity: .62; }

.cc-hd { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }

.cc-hd .nm { font-size: 13px; font-weight: 600; }

.cc-hd .rt { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.cc-main {
    font-size: 25px;
    font-weight: 680;
    letter-spacing: -.6px;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
}

.cc-sub { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.cc-rows { margin-top: 9px; border-top: 1px solid var(--line-soft); padding-top: 8px; }

.cc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 2.5px 0;
    font-variant-numeric: tabular-nums;
}

.cc-row .k { color: var(--ink-3); }

.cc-row .v { margin-left: auto; }

.cc-badge {
    position: absolute;
    top: -8px;
    right: 12px;
    padding: 1px 9px;
    border-radius: 20px;
    background: var(--brand);
    color: #fff;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .3px;
}

.calc-note {
    margin-top: 13px;
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink-2);
    background: #fbfcfe;
    border: 1px solid var(--line-soft);
    border-radius: var(--r-sm);
    padding: 9px 11px;
    line-height: 1.75;
    overflow-x: auto;
}

/* ---------- 按充值试算 ---------- */

.rc-form {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(110px, 1fr) minmax(110px, 1fr);
    gap: 12px;
    align-items: end;
}

.rc-form .field { margin: 0; }

.rc-form .input { height: 36px; }

.rc-form .seg { display: flex; height: 36px; }

.rc-form .seg button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1 1 0;
    white-space: nowrap;
    min-width: 0;
}

.rc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.rc-grid .cc-main { font-size: 22px; }

.rc-grid .cc-hd .rt { font-size: 11px; }

#rcTbl tr.cur td { background: var(--brand-soft); }

@media (prefers-reduced-motion: reduce) {
    .pulse.live { animation: none; }
}

/* ---------- 每日成本 ---------- */

.days-input {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--ink-2);
    white-space: nowrap;
}

.days-input .input {
    width: 62px;
    height: 30px;
    padding: 0 8px;
    text-align: center;
}

.hd-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border: 1px solid var(--line);
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 550;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

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

.daynav .nav-btn {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: var(--r-sm);
    cursor: pointer;
    color: var(--ink-2);
}

.daynav .nav-btn:hover:not(:disabled) { background: #f7f9fc; color: var(--ink); }

.daynav .nav-btn:disabled { opacity: .4; cursor: not-allowed; }

.daynav .nav-btn svg { width: 14px; height: 14px; }

.daynav select {
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--panel);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.day-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.day-box {
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: #fcfdfe;
}

.day-box .k { font-size: 11.5px; color: var(--ink-3); }

.day-box .v {
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -.2px;
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
}

.day-box .s { font-size: 11px; color: var(--ink-3); }

.tip {
    position: fixed;
    z-index: 90;
    pointer-events: none;
    background: #fff;
    color: var(--ink);
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.7;
    box-shadow: 0 10px 30px rgba(20, 30, 60, .16);
    opacity: 0;
    transition: opacity .12s;
    max-width: 300px;
}

.tip.on { opacity: 1; }

.tip-hd { font-weight: 650; font-size: 12.5px; margin-bottom: 3px; }

.tip-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; }

.tip-row .sw { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.tip-row .k { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; max-width: 158px; }

.tip-row .v { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 500; }

.tip-total {
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid var(--line-soft);
    font-weight: 650;
}

.tip-total .v { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---------- 表格 ---------- */

.tbl-wrap { overflow-x: auto; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }

table.tbl th {
    text-align: left;
    font-weight: 500;
    font-size: 11.5px;
    color: var(--ink-3);
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    background: #fcfdfe;
    position: sticky;
    top: 0;
}

table.tbl td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--line-soft);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

table.tbl tbody tr:hover td { background: #fafbfd; }

table.tbl tbody tr:last-child td { border-bottom: 0; }

.r { text-align: right; }

.c { text-align: center; }

.model-cell { display: inline-flex; align-items: center; gap: 8px; max-width: 280px; }

.model-cell .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }

.model-cell span {
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    color: var(--ink);
}

/* ---------- 渠道标签 / 价格表 ---------- */

.ch-lab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    vertical-align: middle;
    max-width: 100%;
}

.ch-lab .ch-nm {
    font-weight: 550;
    color: var(--ink);
}

.ch-lab .ch-ratio {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    margin-left: 2px;
}

.ch-pill {
    display: inline-flex;
    align-items: center;
    margin: 0 4px 0 0;
    padding: 2px 8px 2px 6px;
    background: #f4f6f9;
    border: 1px solid var(--line-soft);
    border-radius: 20px;
    font-size: 12px;
    line-height: 18px;
}

.ch-pill .ch-nm { font-weight: 500; font-size: 12px; }

.ch-pill .mi { width: 12px; height: 12px; }

.price-intro {
    padding-top: 0;
    padding-bottom: 10px;
}

.price-intro .hint { margin: 0; }

.price-toolbar { gap: 10px; }

.price-toolbar .input {
    width: 168px;
    min-width: 140px;
}

.price-seg button { padding: 6px 12px; }

.price-tbl { font-size: 12.5px; }

.price-tbl th {
    vertical-align: middle;
}

.price-tbl .price-sticky {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fcfdfe;
    box-shadow: 4px 0 8px -6px rgba(23, 26, 32, .12);
}

.price-tbl td.price-sticky {
    background: #fff;
    z-index: 1;
    font-weight: 500;
}

.price-tbl tbody tr:hover td.price-sticky { background: #fafbfd; }

.price-ch-hd {
    border-left: 1px solid var(--line) !important;
    padding-top: 11px !important;
    padding-bottom: 8px !important;
}

.price-ch-hd .ch-lab {
    justify-content: center;
    gap: 7px;
}

.price-ch-hd .ch-nm {
    font-size: 12.5px;
    font-weight: 600;
}

.price-ch-hd .mi {
    width: 15px;
    height: 15px;
}

.price-sub {
    font-size: 11px !important;
    font-weight: 500 !important;
    color: var(--ink-3) !important;
    padding-top: 4px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid var(--line) !important;
}

.price-sub.ch-0,
.price-ch-hd.ch-0 { border-left: 1px solid var(--line) !important; }

.price-col {
    border-left: 1px solid transparent;
}

.price-col.ch-0,
.price-col.ch-1,
.price-col.ch-2 {
    border-left-color: var(--line-soft);
}

/* 三渠道列底色微差，方便横比扫读 */
.price-compare .ch-0 { background: #fbfcfe; }
.price-compare .ch-1 { background: #f7faf8; }
.price-compare .ch-2 { background: #f8f7fb; }

.price-compare thead .ch-0 { background: #f4f6fa; }
.price-compare thead .ch-1 { background: #eef6f2; }
.price-compare thead .ch-2 { background: #f2f0f8; }

.price-compare tbody tr:hover .ch-0 { background: #f3f5f9; }
.price-compare tbody tr:hover .ch-1 { background: #e9f3ee; }
.price-compare tbody tr:hover .ch-2 { background: #eeeaf6; }

.price-val {
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    letter-spacing: .01em;
    color: var(--ink);
}

.price-val.out { color: #1f4fd0; }

.price-others {
    white-space: normal !important;
    min-width: 180px;
}

.price-others .ch-pill { margin: 2px 4px 2px 0; }

/* 双行表头时第二行也要 sticky */
.price-compare thead tr:nth-child(2) th {
    top: 37px;
}

.bar-cell { min-width: 108px; }

.bar-track { height: 5px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }

.bar-fill { height: 100%; border-radius: 3px; }

.pill {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 20px;
    font-size: 11px;
    line-height: 17px;
    font-weight: 500;
    background: var(--line-soft);
    color: var(--ink-2);
}

.pill.ok { background: var(--ok-soft); color: #067a51; }

.pill.bad { background: var(--bad-soft); color: #b42318; }

.pill.warn { background: var(--warn-soft); color: #9a6206; }

.pill.brand { background: var(--brand-soft); color: #1f4fd0; }

.muted { color: var(--ink-3); }

.ok-t { color: var(--ok); }

.bad-t { color: var(--bad); }

/* ---------- 侧栏 ---------- */

.side { display: flex; flex-direction: column; gap: 14px; }

.kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 13px; }

.kv + .kv { border-top: 1px solid var(--line-soft); }

.kv .k { color: var(--ink-3); font-size: 12.5px; }

.kv .v { font-weight: 550; font-variant-numeric: tabular-nums; text-align: right; overflow: hidden; text-overflow: ellipsis; }

.empty { padding: 26px 10px; text-align: center; color: var(--ink-3); font-size: 12.5px; }

.notice {
    display: flex;
    gap: 9px;
    padding: 10px 13px;
    border-radius: var(--r-sm);
    font-size: 12.5px;
    margin-bottom: 14px;
    align-items: flex-start;
}

.notice svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }

.notice.warn { background: var(--warn-soft); color: #8a5800; }

.notice.bad { background: var(--bad-soft); color: #b42318; }

.notice.ok { background: var(--ok-soft); color: #067a51; }

.audit-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.audit-box { padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }

.audit-box .k { font-size: 11.5px; color: var(--ink-3); }

.audit-box .v { font-size: 20px; font-weight: 650; letter-spacing: -.2px; font-variant-numeric: tabular-nums; }

.formula {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink-2);
    background: #fbfcfe;
    border: 1px solid var(--line-soft);
    border-radius: var(--r-sm);
    padding: 9px 11px;
    line-height: 1.7;
    overflow-x: auto;
    white-space: nowrap;
}

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.toolbar .input { width: auto; height: 32px; min-width: 130px; }

.toolbar .btn { height: 32px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }

.seg button {
    border: 0;
    background: var(--panel);
    padding: 5px 11px;
    cursor: pointer;
    font-size: 12.5px;
    color: var(--ink-2);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.seg button + button { border-left: 1px solid var(--line); }

.seg button.on { background: var(--brand-soft); color: #1f4fd0; font-weight: 550; }

.seg button.on .ch-nm { color: inherit; }

.seg button .mi { width: 13px; height: 13px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.hint { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; line-height: 1.6; }

.skel {
    background: linear-gradient(90deg, #eef1f5 25%, #f6f8fa 37%, #eef1f5 63%);
    background-size: 400% 100%;
    animation: sk 1.3s ease infinite;
    border-radius: 5px;
    color: transparent !important;
    pointer-events: none;
    user-select: none;
}

@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

table.tbl td .skel { display: inline-block; vertical-align: middle; }

.legend-item.skel { background-clip: padding-box; }

@media (prefers-reduced-motion: reduce) {
    .skel { animation: none; }
}

.page-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--ink-2); }

.pager {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pager .pg {
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 12.5px;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
    transition: background .15s, border-color .15s, color .15s;
}

.pager .pg:hover:not(:disabled):not(.on) {
    background: #f7f9fc;
    border-color: #d8dde7;
    color: var(--ink);
}

.pager .pg.on {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 600;
    cursor: default;
}

.pager .pg:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.pager .pg-gap {
    min-width: 20px;
    text-align: center;
    color: var(--ink-3);
    font-size: 13px;
    user-select: none;
}

@media (max-width: 1180px) {
    .grid-main,
    .grid-split { grid-template-columns: minmax(0, 1fr); }
    .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .day-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .audit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 移动端 ---------- */

@media (max-width: 760px) {
    body { font-size: 13.5px; }

    .top-in {
        height: auto;
        flex-wrap: wrap;
        padding: 9px 12px;
        gap: 8px;
        row-gap: 9px;
    }

    .brand b { font-size: 14px; }

    .brand span { display: none; }

    .top-sp { display: none; }

    /* 标签行独占一行并可横向滑动，避免挤压 */
    .tabs {
        order: 5;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
    }

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

    .tab { padding: 6px 12px; flex: none; }

    .freshness {
        order: 2;
        margin-left: auto;
        font-size: 11px;
        padding: 4px 9px;
        max-width: 60vw;
        overflow: hidden;
        white-space: nowrap;
    }

    .icon-btn { order: 3; width: 32px; height: 32px; }

    .wrap { padding: 12px 12px 44px; }

    .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

    /* 毛利概览在窄屏改为整行三等分，切换与折叠留在标题行 */
    .mg-hd { padding: 11px 13px; gap: 9px; row-gap: 10px; }

    .mg-hd h3 { font-size: 13px; }

    .mg-nums { width: 100%; margin-left: 0; order: 5; }

    .mg-stat { flex: 1 1 0; min-width: 0; padding: 2px 8px; text-align: center; align-items: center; }

    .mg-stat .v { font-size: 15.5px; }

    .mg-rate { display: block; margin: 2px 0 0; }

    .mg-toggle { margin-left: auto; }

    /* 区间档位在窄屏放不下，改为可横滑 */
    #mgRange, #dailyRange {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    #mgRange::-webkit-scrollbar, #dailyRange::-webkit-scrollbar { display: none; }

    #mgRange button, #dailyRange button { flex: none; white-space: nowrap; padding: 6px 10px; }

    /* 说明文字与导出按钮改为上下排布，按钮靠右 */
    .mg-foot, .panel-foot { flex-wrap: wrap; row-gap: 10px; }

    .mg-note, .panel-foot > .muted { flex: 1 1 100%; }

    .mg-foot .btn-xls, .panel-foot .btn-xls { margin-left: auto; }

    .card-hd { padding: 11px 13px; flex-wrap: wrap; row-gap: 8px; }

    .card-bd { padding: 13px; }

    .metric { padding: 9px 12px; gap: 9px; }

    .badge-ic { width: 26px; height: 26px; }

    .m-value { font-size: 16px; }

    .m-value.sm { font-size: 14px; }

    .m-spark { display: none; }

    .chart-host { height: 226px; }

    .chart-host.tall { height: 252px; }

    .chart-host.short { height: 192px; }

    .chart-head { gap: 10px; margin-bottom: 12px; }

    .chart-title { font-size: 15px; }

    .chart-seg { width: 100%; }

    .chart-seg button { flex: 1; padding: 6px 8px; font-size: 12px; text-align: center; }

    .legend-item { font-size: 12px; padding: 4px 8px; }

    .legend-item .nm { max-width: 118px; }

    .day-stats, .audit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

    .day-box .v, .audit-box .v { font-size: 17px; }

    .form-grid { grid-template-columns: minmax(0, 1fr); }

    .calc-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

    .calc-form .calc-model { grid-column: 1 / -1; }

    .calc-cards { grid-template-columns: minmax(0, 1fr); gap: 10px; }

    .rc-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

    .rc-form .rc-ch { grid-column: 1 / -1; }

    .rc-form .seg {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .rc-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }

    /* 卡片墙在窄屏两列，过窄时退回单列 */
    .pc-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

    /* 渠道／排序切换在窄屏改为可横滑，避免撑破卡片 */
    #pcChannel, #pcSort {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    #pcChannel::-webkit-scrollbar, #pcSort::-webkit-scrollbar { display: none; }

    #pcChannel button, #pcSort button { flex: none; white-space: nowrap; }

    #pcSearch { flex: 1 1 100%; }

    .pc { padding: 10px 12px; }

    .pc-top .nm { font-size: 12px; }

    .pc-row .v { font-size: 13px; }

    .pc-hd { flex-wrap: wrap; row-gap: 4px; }

    .sel-menu { min-width: 0; }

    .sel-list { max-height: 244px; }

    .cc-main { font-size: 22px; }

    .calc-note { font-size: 11px; }

    .toolbar { width: 100%; }

    .toolbar .input { flex: 1 1 130px; min-width: 0; }

    /* 自定义天数保持紧凑，不参与工具栏的弹性伸展 */
    .days-input .input { flex: 0 0 58px; width: 58px; }

    .price-toolbar { width: 100%; }

    .price-toolbar .input { width: 100%; flex: 1 1 100%; }

    .price-seg {
        width: 100%;
        flex-wrap: wrap;
        overflow: visible;
        border: 0;
        gap: 6px;
        background: transparent;
    }

    .price-seg button {
        flex: 1 1 auto;
        justify-content: center;
        border: 1px solid var(--line) !important;
        border-radius: var(--r-sm);
        padding: 7px 10px;
    }

    .price-seg button + button { border-left: 1px solid var(--line) !important; }

    .price-compare thead tr:nth-child(2) th { top: 34px; }

    .price-ch-hd .ch-nm { font-size: 11.5px; }

    .tbl-wrap { -webkit-overflow-scrolling: touch; }

    table.tbl th, table.tbl td { padding: 8px 10px; }

    .tip { max-width: 74vw; font-size: 11.5px; }

    .page-bar { padding: 11px 13px; flex-wrap: wrap; row-gap: 8px; }

    .formula { font-size: 11px; white-space: normal; }

    .daynav select { max-width: 170px; }
}

@media (max-width: 420px) {
    .grid-stats { grid-template-columns: minmax(0, 1fr); }
    .day-stats, .audit-grid { grid-template-columns: minmax(0, 1fr); }
    .freshness { max-width: 52vw; }
}

/* 触屏设备没有 hover，悬浮气泡改为不显示，避免残留 */
@media (hover: none) {
    .tip { display: none; }
}
