/* ==========================================================================
   冰淇淋配比计算 · ice-cream-mix-ratio
   独立设计系统「配方实验室」：奶油白 / 莓紫 / 薄荷 / 焦糖
   100% 堆叠条、甜筒膨化球、区间对照条，与前面所有页面的结构不同。
   ========================================================================== */
.icm-page, .icm-modal, .icm-sheet, .icm-toast {
    --icm-bg: #fdf7f2;
    --icm-card: #ffffff;
    --icm-card2: #faf2ec;
    --icm-ink: #33243a;
    --icm-ink2: #75657c;
    --icm-ink3: #a496a9;
    --icm-line: #e9dce6;
    --icm-line2: #f3e9f1;
    --icm-plum: #6d3b7a;
    --icm-mint: #2e9c8f;
    --icm-caramel: #c98539;
    --icm-pink: #d97a9e;
    --icm-blue: #6f96c9;
    --icm-red: #c04a5c;
    --icm-green: #4f9b6a;
    --icm-shadow: 0 14px 34px rgba(90, 50, 90, .10);
    --icm-shadow-s: 0 3px 12px rgba(90, 50, 90, .07);
    --icm-mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
:root[data-theme="dark"] .icm-page,
:root[data-theme="dark"] .icm-modal,
:root[data-theme="dark"] .icm-sheet,
:root[data-theme="dark"] .icm-toast {
    --icm-bg: #17121a;
    --icm-card: #211a26;
    --icm-card2: #2a212f;
    --icm-ink: #f3e9f4;
    --icm-ink2: #bda8c4;
    --icm-ink3: #8a7692;
    --icm-line: #3a2d40;
    --icm-line2: #302539;
    --icm-plum: #c493e0;
    --icm-mint: #64d3c4;
    --icm-caramel: #efb468;
    --icm-pink: #f2a0c0;
    --icm-blue: #9bc0f0;
    --icm-red: #ff8fa0;
    --icm-green: #83d3a1;
    --icm-shadow: 0 14px 34px rgba(0, 0, 0, .42);
    --icm-shadow-s: 0 3px 12px rgba(0, 0, 0, .32);
}
.icm-page { background: var(--icm-bg); color: var(--icm-ink); font-size: 15px; line-height: 1.82;
    padding-bottom: 60px; -webkit-font-smoothing: antialiased; }
.icm-page b { color: var(--icm-plum); }
.icm-wrap { max-width: 1200px; margin: 0 auto; padding: 0 22px; }
.detail-breadcrumb { font-size: 13px; color: var(--icm-ink2); padding: 18px 0 14px; }
.detail-breadcrumb a { color: var(--icm-ink2); text-decoration: none; }
.detail-breadcrumb a:hover { color: var(--icm-plum); }
.detail-breadcrumb .sep { margin: 0 8px; color: var(--icm-ink3); }
.detail-breadcrumb .current { color: var(--icm-ink); font-weight: 700; }

/* ---------- 首屏 ---------- */
.icm-hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 0;
    background: var(--icm-card); border: 1px solid var(--icm-line); border-radius: 22px;
    box-shadow: var(--icm-shadow); overflow: hidden; }
.icm-hero-copy { padding: 38px 40px; display: flex; flex-direction: column; justify-content: center; }
.icm-kicker { display: inline-block; align-self: flex-start; font: 700 10px/1 var(--icm-mono);
    letter-spacing: .18em; color: var(--icm-plum); background: rgba(109,59,122,.10);
    border-radius: 20px; padding: 8px 13px; margin-bottom: 18px; }
.icm-hero h1 { font-size: clamp(25px, 2.8vw, 35px); line-height: 1.42; margin: 0 0 14px; }
.icm-sub { font-size: 14.5px; line-height: 2; color: var(--icm-ink2); margin: 0 0 22px; }
.icm-hero-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.icm-fact { border: 1px solid var(--icm-line); border-radius: 12px; padding: 12px 14px; background: var(--icm-card2); }
.icm-fact.hot { background: rgba(109,59,122,.09); border-color: rgba(109,59,122,.3); }
.icm-fact b { display: block; font: 700 20px/1.3 var(--icm-mono); color: var(--icm-plum); }
.icm-fact span { font-size: 11.5px; color: var(--icm-ink2); }
.icm-visual { background: linear-gradient(165deg, #f6ecf3, #fdf6ef); border-left: 1px dashed var(--icm-line);
    padding: 28px 30px; display: flex; flex-direction: column; }
:root[data-theme="dark"] .icm-visual { background: linear-gradient(165deg, #2a2030, #211a26); }
.icm-stack-title { display: flex; justify-content: space-between; font-size: 12px; color: var(--icm-ink2); }
.icm-stack-title b { font-family: var(--icm-mono); color: var(--icm-plum); }
.icm-stack { display: flex; height: 34px; border-radius: 18px; overflow: hidden; margin-top: 10px; background: var(--icm-line2); }
.icm-stack i { display: block; height: 100%; transition: width .3s; }
.icm-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 11px; color: var(--icm-ink2); }
.icm-legend span { display: inline-flex; align-items: center; gap: 4px; }
.icm-legend em { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.icm-cone { align-self: center; margin-top: 18px; display: flex; flex-direction: column; align-items: center; }
.icm-scoop { width: 96px; height: 96px; border-radius: 50% 50% 46% 46%;
    background: radial-gradient(circle at 35% 28%, #fff6ea, #e9c9a8 70%, #d5a97e);
    display: grid; place-items: center; box-shadow: inset -8px -10px 18px rgba(160,110,70,.24), 0 8px 16px rgba(120,70,60,.18);
    transition: transform .3s; }
.icm-scoop span { font: 700 15px/1 var(--icm-mono); color: #7a4630; }
.icm-cone-base { width: 76px; height: 78px; margin-top: -12px;
    background: repeating-linear-gradient(48deg, #dfae74 0 9px, #c98d50 9px 14px);
    clip-path: polygon(0 0, 100% 0, 50% 100%); border-radius: 0 0 5px 5px;
    box-shadow: 0 6px 12px rgba(120, 70, 60, .18); }
:root[data-theme="dark"] .icm-cone-base { background: repeating-linear-gradient(48deg, #a97c4d 0 9px, #825c36 9px 14px); }
.icm-visual-cap { margin-top: 14px; font-size: 11px; color: var(--icm-ink3); text-align: center; line-height: 1.7; }

/* ---------- 操作台 ---------- */
.icm-console { margin-top: 20px; background: var(--icm-card); border: 1px solid var(--icm-line);
    border-radius: 18px; padding: 24px 28px 26px; box-shadow: var(--icm-shadow-s); }
.icm-console-head, .icm-block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.icm-console-head h2, .icm-block-head h2 { font-size: 17px; margin: 0; }
.icm-console-head span, .icm-block-head p { font-size: 12px; color: var(--icm-ink3); }
.icm-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 20px; }
.icm-chip { font: 600 12.5px/1.4 inherit; padding: 8px 15px; border-radius: 20px; cursor: pointer;
    border: 1px solid var(--icm-line); background: var(--icm-card2); color: var(--icm-ink2); }
.icm-chip:hover { border-color: var(--icm-plum); }
.icm-chip.is-on { background: var(--icm-plum); border-color: var(--icm-plum); color: #fff; }
:root[data-theme="dark"] .icm-chip.is-on { color: #22142a; }
.icm-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.icm-field label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.icm-field label em { font-style: normal; font-weight: 400; color: var(--icm-ink3); font-size: 11.5px; }
.icm-field input, .icm-field select { width: 100%; box-sizing: border-box; border: 1px solid var(--icm-line);
    border-radius: 9px; background: var(--icm-card2); color: var(--icm-ink);
    padding: 9px 11px; font-size: 14px; font-family: inherit; outline: none; }
.icm-field input:focus, .icm-field select:focus { border-color: var(--icm-plum); box-shadow: 0 0 0 3px rgba(109,59,122,.12); }
.icm-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.icm-btn { font: 600 13.5px/1.4 inherit; padding: 10px 18px; border-radius: 20px; cursor: pointer;
    border: 1px solid var(--icm-line); background: var(--icm-card2); color: var(--icm-ink); transition: .15s; }
.icm-btn:hover { border-color: var(--icm-plum); }
.icm-btn--main { background: linear-gradient(135deg, var(--icm-plum), #a3548f); border-color: transparent;
    color: #fff; padding: 11px 24px; font-size: 14px; }
.icm-btn--ghost { border-style: dashed; }
.icm-err { margin-top: 12px; padding: 10px 14px; border-radius: 9px; font-size: 13px;
    background: rgba(192,74,92,.09); border: 1px solid var(--icm-red); color: var(--icm-red); }

/* ---------- 平衡报告 ---------- */
.icm-report { margin-top: 20px; background: var(--icm-card); border: 1px solid var(--icm-line);
    border-radius: 18px; padding: 26px 30px 30px; box-shadow: var(--icm-shadow-s); }
.icm-report-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    border-bottom: 2px solid var(--icm-plum); padding-bottom: 14px; margin-bottom: 22px; }
.icm-report-no { font: 700 10px/1 var(--icm-mono); letter-spacing: .18em; color: var(--icm-mint); }
.icm-report h2 { font-size: 20px; margin: 8px 0 0; }
.icm-report-head > b { font-size: 13px; padding: 7px 14px; border-radius: 20px; background: rgba(79,155,106,.12); color: var(--icm-green); }
.icm-report-head > b.warn { background: rgba(201,133,57,.13); color: var(--icm-caramel); }
.icm-report-head > b.bad { background: rgba(192,74,92,.12); color: var(--icm-red); }
.icm-bars { display: grid; gap: 18px; }
.icm-bar-row .lbl { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--icm-ink2); margin-bottom: 6px; }
.icm-bar-row .lbl b { font-family: var(--icm-mono); color: var(--icm-ink); }
.icm-bar-track { position: relative; height: 12px; border-radius: 8px; background: var(--icm-line2); }
.icm-bar-zone { position: absolute; top: 0; height: 100%; background: rgba(79,155,106,.22); border-left: 1px dashed var(--icm-green); border-right: 1px dashed var(--icm-green); }
.icm-bar-fill { position: absolute; top: 2px; height: 8px; border-radius: 6px; background: var(--icm-plum); transition: width .3s; }
.icm-bar-fill.low { background: var(--icm-blue); }
.icm-bar-fill.high { background: var(--icm-red); }
.icm-bar-scale { display: flex; justify-content: space-between; font: 10px/1.5 var(--icm-mono); color: var(--icm-ink3); margin-top: 3px; }
.icm-advice { margin-top: 22px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.icm-tip { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 11px 13px;
    border: 1px solid var(--icm-line2); border-radius: 10px; background: var(--icm-card2); font-size: 12.5px; color: var(--icm-ink2); line-height: 1.75; }
.icm-tip i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
    font-style: normal; font: 700 11px/1 var(--icm-mono); background: rgba(109,59,122,.12); color: var(--icm-plum); }
.icm-tip.ok i { background: rgba(79,155,106,.14); color: var(--icm-green); }
.icm-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.icm-kpis div { border: 1px solid var(--icm-line2); border-bottom: 3px solid var(--icm-mint); border-radius: 10px;
    padding: 11px 13px; background: var(--icm-card2); }
.icm-kpis b { display: block; font: 700 17px/1.35 var(--icm-mono); color: var(--icm-plum); }
.icm-kpis span { font-size: 11.5px; color: var(--icm-ink2); }

/* ---------- 表格 ---------- */
.icm-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.icm-block { margin-top: 20px; background: var(--icm-card); border: 1px solid var(--icm-line);
    border-radius: 16px; padding: 22px 26px 26px; box-shadow: var(--icm-shadow-s); }
.icm-block-head { border-bottom: 2px solid var(--icm-mint); padding-bottom: 10px; margin-bottom: 16px; }
.icm-table-scroll { overflow-x: auto; }
.icm-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 540px; }
.icm-table th { text-align: left; font-size: 11px; color: var(--icm-ink2); background: var(--icm-card2);
    padding: 9px 10px; border-bottom: 2px solid var(--icm-line); white-space: nowrap; }
.icm-table td { padding: 9px 10px; border-bottom: 1px solid var(--icm-line2); }
.icm-table .num { text-align: right; font-family: var(--icm-mono); }
.icm-table tr.is-on td { background: rgba(109,59,122,.09); }
.icm-table tbody tr { cursor: pointer; }
.icm-table tbody tr:hover { background: var(--icm-card2); }
.icm-fine { font-size: 11.5px; color: var(--icm-ink3); line-height: 1.8; margin: 12px 0 0; }
.icm-table input { width: 100%; box-sizing: border-box; border: 1px solid var(--icm-line); border-radius: 6px;
    background: var(--icm-card2); color: var(--icm-ink); padding: 5px 7px; font-size: 12px; font-family: inherit; }
.icm-del { border: none; background: transparent; color: var(--icm-red); cursor: pointer; font-size: 18px; }
.icm-batch-actions { margin-top: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.icm-batch-actions span { font-size: 12px; color: var(--icm-ink3); }

/* ---------- 浮层 ---------- */
.icm-modal[hidden], .icm-toast[hidden], .icm-err[hidden] { display: none !important; }
.icm-modal { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center;
    padding: 20px; background: rgba(40, 22, 45, .62); }
.icm-sheet { position: relative; width: min(520px, 100%); background: var(--icm-card); color: var(--icm-ink);
    border: 1px solid var(--icm-line); border-radius: 18px; padding: 28px 30px; box-shadow: var(--icm-shadow); }
.icm-sheet h3 { font-size: 19px; margin: 0 0 8px; }
.icm-sheet p { font-size: 13px; color: var(--icm-ink2); line-height: 1.85; margin: 0 0 16px; }
.icm-code { display: block; font: 12px/1.7 var(--icm-mono); word-break: break-all; background: var(--icm-card2);
    border: 1px dashed var(--icm-line); border-radius: 9px; padding: 11px 13px; color: var(--icm-plum); }
.icm-modal-x { position: absolute; right: 14px; top: 10px; border: none; background: transparent;
    font-size: 25px; color: var(--icm-ink3); cursor: pointer; }
.icm-sheet-actions { margin-top: 18px; display: flex; justify-content: flex-end; }
.icm-toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); z-index: 9100;
    background: var(--icm-plum); color: #fff; padding: 11px 20px; border-radius: 22px; font-size: 13px; box-shadow: var(--icm-shadow); }

@media (max-width: 1000px) {
    .icm-hero { grid-template-columns: 1fr; }
    .icm-visual { border-left: none; border-top: 1px dashed var(--icm-line); }
    .icm-fields { grid-template-columns: 1fr 1fr; }
    .icm-advice, .icm-cols { grid-template-columns: 1fr; }
    .icm-kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
    .icm-wrap { padding: 0 12px; }
    .icm-hero-copy, .icm-visual, .icm-console, .icm-report, .icm-block { padding-left: 16px; padding-right: 16px; }
    .icm-hero h1 { font-size: 23px; }
    .icm-fields, .icm-hero-facts, .icm-advice { grid-template-columns: 1fr; }
    .icm-kpis { grid-template-columns: 1fr 1fr; }
    .icm-actions .icm-btn { flex: 1 1 45%; }
}
@media print { .icm-page { background: #fff; } .icm-actions, .icm-modal, .icm-toast, .icm-batch-actions { display: none !important; } }

/* ===== 窄屏溢出兜底：grid/flex 子项 min-width:0，公共推荐位不撑宽页面 ===== */
.tool-rec-item { min-width: 0; max-width: 100%; box-sizing: border-box; }
@media (max-width: 1000px) {
    .icm-cols > *, .icm-two-col > *, .icm-c > *, .icm-report > *, .icm-hero > *,
    .icm-grid-wrap > *, .icm-console-grid > *, .icm-dual > *, .icm-report-grid > * { min-width: 0; }
}
@media (max-width: 620px) {
    .icm-page, .icm-wrap, .icm-block, .icm-report, .icm-console, .icm-hero { max-width: 100%; }
    .icm-table-scroll { max-width: 100%; }
    .icm-cols > *, .icm-two-col > *, .icm-report > *, .icm-grid-wrap > *, .icm-block { min-width: 0; max-width: 100%; }
    .icm-page .tskb-related .tskb-rel-grid { grid-template-columns: 1fr 1fr; min-width: 0; }
}
