/* ==========================================================================
   工具页通用样式（换热 / 管道 / 储罐 / 甲醇 / 蒸汽 / SULCOL 等）
   与 CAS 查询页保持同一套视觉：介绍头 + 卡片 + 结果区
   ========================================================================== */
.tp-page { max-width: 1100px; }

/* ---- 介绍头 ---- */
.tp-hero {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 20px 24px 22px;
    margin-bottom: 18px;
    background:
        radial-gradient(560px 240px at 6% -30%, rgba(102,126,234,.24), transparent 70%),
        radial-gradient(460px 220px at 98% -10%, rgba(26,188,156,.15), transparent 68%),
        var(--panel);
    box-shadow: var(--shadow-2);
}
.tp-hero .back-link { margin-bottom: 14px; }
.tp-hero-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.tp-icon {
    width: 56px; height: 56px; flex: none;
    display: grid; place-items: center;
    font-size: 27px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(102,126,234,.22), rgba(118,75,162,.22));
    border: 1px solid var(--line);
}
.tp-titles { flex: 1 1 300px; min-width: 220px; }
.tp-titles h1 { font-size: clamp(1.35em, 2.2vw, 1.7em); color: var(--ink-2); line-height: 1.25; }
.tp-titles p { color: var(--muted); font-size: 13.5px; margin-top: 5px; }
.tp-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.tp-badge {
    font-size: 12px; color: var(--brand-1);
    background: rgba(102,126,234,.10);
    border: 1px solid rgba(102,126,234,.28);
    padding: 3px 11px; border-radius: 999px;
}

/* ---- 卡片 ---- */
.tp-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 20px 22px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-1);
}
.tp-card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.tp-card-head h2 { font-size: 1.02em; color: var(--ink-2); }
.tp-card-head .hint { margin-left: auto; font-size: 12.5px; color: var(--muted); }

/* ---- 两栏 ---- */
.tp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .tp-grid { grid-template-columns: 1fr; } }
.tp-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .tp-grid-3 { grid-template-columns: 1fr; } }

/* ---- 字段 ---- */
.tp-field { margin-bottom: 13px; }
.tp-field > label {
    display: flex; align-items: baseline; gap: 6px;
    margin: 0 0 6px;
    font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.tp-field > label .u { font-weight: 400; font-size: 11.5px; color: var(--muted); opacity: .85; }
.tp-field > input,
.tp-field > select {
    height: 42px;
    font-size: 15px;
}
.tp-field > input[readonly] {
    background: var(--bg);
    border-style: dashed;
    color: var(--ink);
    font-family: var(--mono);
    font-weight: 600;
}

/* ---- 选项胶囊 ---- */
.tp-radio-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.tp-radio {
    display: inline-flex; align-items: center; gap: 8px;
    margin: 0; padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 13.5px; font-weight: 600; color: var(--muted);
    cursor: pointer;
    transition: all .18s;
}
.tp-radio:hover { border-color: var(--brand-1); color: var(--brand-1); }
.tp-radio input {
    width: auto; height: auto;
    margin: 0; padding: 0;
    flex: none;
    accent-color: var(--brand-1);
}
.tp-radio:has(input:checked) {
    border-color: var(--brand-1);
    color: var(--brand-1);
    background: rgba(102,126,234,.10);
}

/* ---- 结果区 ---- */
.tp-results {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--line);
}
@media (max-width: 640px) { .tp-results { grid-template-columns: 1fr; } }
.tp-ri {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 13px;
}
.tp-ri .k { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.tp-ri input,
.tp-ri .v {
    display: block; width: 100%;
    height: auto; min-height: 26px;
    padding: 0; margin: 0;
    border: 0; background: transparent;
    box-shadow: none;
    font-family: var(--mono);
    font-size: 18px; font-weight: 700;
    color: var(--ink);
    line-height: 1.35;
}
.tp-ri input:focus { box-shadow: none; }
.tp-ri .u { font-size: 11.5px; color: var(--muted); }
.tp-ri.hl {
    background: linear-gradient(135deg, rgba(102,126,234,.12), rgba(26,188,156,.10));
    border-color: rgba(102,126,234,.38);
}
.tp-ri.hl input,
.tp-ri.hl .v { color: var(--brand-1); }
.tp-ri.hl .k { color: var(--brand-1); opacity: .85; }

/* ---- 操作与说明 ---- */
.tp-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.tp-actions .btn { flex: 0 0 auto; }
@media (max-width: 640px) { .tp-actions .btn { flex: 1 1 46%; } }
.tp-note { font-size: 12.5px; color: var(--muted); line-height: 1.7; margin-top: 10px; }
.tp-note b { color: var(--ink); }

/* ---- 示意图 ---- */
.tp-figure {
    display: flex; align-items: center; justify-content: center;
    padding: 12px;
    margin-bottom: 16px;
    background: var(--bg);
    border: 1px dashed var(--line);
    border-radius: 14px;
}
.tp-figure img { max-width: 100%; height: auto; border-radius: 8px; }

/* ---- 卧式储罐示意图（内联 SVG） ---- */
.tank-svg { width: 100%; max-width: 540px; height: auto; display: block; }
.tank-shell { fill: rgba(102,126,234,.06); stroke: var(--brand-1); stroke-width: 2; }
.tank-surface { stroke: #38bdf8; stroke-width: 1.5; stroke-dasharray: 5 4; opacity: .9; }
.tank-dim { stroke: #94a3b8; stroke-width: 1.2; }
.tank-label { fill: var(--muted); font-size: 13px; font-family: var(--font); }
.tank-label-v { fill: var(--brand-1); font-weight: 700; font-size: 16px; }

/* 深色模式下，结果卡里的输入框不继承表单底色，保持“纯文字”观感 */
html[data-theme="dark"] body.ds .tp-ri input,
html[data-theme="dark"] body.ds .tp-ri input[readonly] {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0;
    color: var(--ink);
}
html[data-theme="dark"] body.ds .tp-ri.hl input { color: var(--brand-1); }

/* 操作行里的次要按钮改成描边胶囊，避免一排深灰块 */
.tp-actions .btn-secondary {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    box-shadow: none;
}
.tp-actions .btn-secondary:hover {
    border-color: var(--brand-1);
    color: var(--brand-1);
    background: rgba(102,126,234,.08);
    transform: none;
}

/* 工具条上的“清空”按钮：默认低调，悬停变红 */
.btn-clear {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    box-shadow: none;
}
.btn-clear:hover {
    border-color: #dc3545;
    color: #dc3545;
    background: rgba(220,53,69,.07);
    transform: none;
}

/* ---- 打印：只留内容，去掉工具条与主题开关 ---- */
@media print {
    @page { margin: 12mm; }
    .theme-switch, .back-link, .tp-actions, .row-actions,
    .hx-toolbar, .pipe-toolbar, .tank-toolbar, .toolbar,
    .hx-tools-right, .pipe-tools, .tank-tools { display: none !important; }
    body { background: #fff !important; color: #000 !important; }
    .tp-card, .tp-hero, .hx-card, .table-container, .pipe-table-wrap, .tank-table-wrap {
        box-shadow: none !important;
        border-color: #999 !important;
        background: #fff !important;
    }
    .tp-page { max-width: none !important; }
    a { color: #000 !important; text-decoration: none !important; }
    .tp-badge, .hx-badge {
        border-color: #999 !important; color: #000 !important; background: #fff !important;
    }
    table th { background: #eee !important; color: #000 !important; }
}

/* 线上只读提示条 */
.readonly-banner {
    display: flex; gap: 12px; align-items: baseline;
    padding: 12px 16px; margin-bottom: 16px;
    border: 1px solid rgba(245,158,11,.35); background: rgba(245,158,11,.10);
    border-radius: 12px; font-size: 13px; color: var(--ink);
}
.readonly-banner strong { color: #b45309; white-space: nowrap; }
html[data-theme="dark"] .readonly-banner strong { color: #fcd34d; }

/* hidden 属性优先于自定义 display */
[hidden] { display: none !important; }
