/* ==========================================================================
   122 · 3D 打印耗材用量与成本
   视觉概念：打印工坊配方卡 —— 暖纸底、熔融橙、大圆角、分层剖面
   ========================================================================== */

:root {
    --tp-bg: #faf6f1;
    --tp-panel: #ffffff;
    --tp-panel-2: #f4ece4;
    --tp-ink: #221912;
    --tp-ink-2: #4a3c31;
    --tp-muted: #8b7a6c;
    --tp-line: #ece0d4;
    --tp-line-2: #dccbb9;
    --tp-orange: #cf4f0e;
    --tp-orange-2: #ad3f08;
    --tp-orange-soft: #fdeee1;
    --tp-green: #1d6b52;
    --tp-green-soft: #e4f2ec;
    --tp-blue: #2f5d8a;
    --tp-blue-soft: #e9f0f7;
    --tp-bad: #a83322;
    --tp-bad-soft: #fbe9e5;
    --tp-glow: rgba(207, 79, 14, .1);
    --tp-shadow: 0 1px 2px rgba(34, 25, 18, .04), 0 22px 44px -36px rgba(120, 60, 20, .5);
    --tp-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    --tp-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
    --tp-bg: #120e0b;
    --tp-panel: #1c1612;
    --tp-panel-2: #241c16;
    --tp-ink: #f3ebe3;
    --tp-ink-2: #c2b1a3;
    --tp-muted: #8d7c6e;
    --tp-line: #2c231c;
    --tp-line-2: #3d3027;
    --tp-orange: #ff8a4c;
    --tp-orange-2: #ffa472;
    --tp-orange-soft: #2a1a10;
    --tp-green: #5fbf98;
    --tp-green-soft: #10241d;
    --tp-blue: #7aa9d6;
    --tp-blue-soft: #131e28;
    --tp-bad: #e2907f;
    --tp-bad-soft: #28150f;
    --tp-glow: rgba(255, 138, 76, .12);
    --tp-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 24px 50px -36px rgba(0, 0, 0, .9);
}

.tp-wrap {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 22px;
}

/* ---------------- 首屏 ---------------- */
.tp-hero {
    position: relative;
    padding: 20px 0 26px;
    background:
        radial-gradient(620px 300px at 12% -6%, var(--tp-glow), transparent 70%),
        radial-gradient(520px 240px at 92% 0%, rgba(47, 93, 138, .08), transparent 72%),
        var(--tp-bg);
}
.tp-hero::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--tp-line-2), transparent);
}

.tp-crumb {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 16px;
    font-size: 12.5px;
    color: var(--tp-muted);
}
.tp-crumb a { color: var(--tp-muted); text-decoration: none; }
.tp-crumb a:hover { color: var(--tp-orange); }
.tp-crumb i { font-style: normal; opacity: .5; }

.tp-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 26px;
    align-items: end;
    margin-bottom: 20px;
}
.tp-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 11px;
    padding: 4px 10px 4px 8px;
    border-radius: 100px;
    background: var(--tp-orange-soft);
    font-family: var(--tp-mono);
    font-size: 10px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--tp-orange);
}
.tp-eyebrow i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    font-style: normal;
}
.tp-h1 {
    margin: 0 0 11px;
    font-family: var(--tp-sans);
    font-size: clamp(27px, 3.5vw, 40px);
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--tp-ink);
}
.tp-h1 em {
    font-style: normal;
    color: var(--tp-orange);
    background: linear-gradient(180deg, transparent 62%, var(--tp-orange-soft) 62%);
    padding: 0 2px;
}
.tp-sub {
    margin: 0;
    max-width: 58ch;
    font-size: 14.6px;
    line-height: 1.86;
    color: var(--tp-ink-2);
}
.tp-sub b { color: var(--tp-ink); font-weight: 600; white-space: nowrap; }

.tp-side { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }
.tp-theme {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--tp-line);
    border-radius: 9px;
    background: var(--tp-panel);
}
.tp-theme button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--tp-muted);
    font: inherit;
    font-size: 11.5px;
    padding: 5px 11px;
    border-radius: 7px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.tp-theme button:hover { color: var(--tp-ink); }
.tp-theme button[aria-pressed="true"] {
    background: var(--tp-orange);
    color: #fff;
    font-weight: 600;
}
.tp-live {
    font-family: var(--tp-mono);
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--tp-muted);
}

/* ---------------- 工作台 ---------------- */
.tp-desk {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.tp-panel {
    border: 1px solid var(--tp-line);
    border-radius: 16px;
    background: var(--tp-panel);
    box-shadow: var(--tp-shadow);
    overflow: hidden;
}
.tp-ph {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 17px;
    border-bottom: 1px solid var(--tp-line);
}
.tp-ph h2 {
    margin: 0;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--tp-ink);
}
.tp-ph span {
    margin-left: auto;
    font-family: var(--tp-mono);
    font-size: 9.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--tp-muted);
}

/* 表单 */
.tp-form { padding: 14px 17px 16px; }
.tp-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
}
.tp-field { display: grid; gap: 5px; min-width: 0; }
.tp-field.is-wide { grid-column: 1 / -1; }
.tp-field > label {
    font-size: 11px;
    font-weight: 600;
    color: var(--tp-muted);
    letter-spacing: .02em;
}
.tp-inp {
    display: flex;
    align-items: center;
    border: 1px solid var(--tp-line-2);
    border-radius: 9px;
    background: var(--tp-panel);
    transition: border-color .15s, box-shadow .15s;
}
.tp-inp:focus-within {
    border-color: var(--tp-orange);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tp-orange) 13%, transparent);
}
.tp-inp input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--tp-ink);
    font-family: var(--tp-mono);
    font-size: 14px;
    font-weight: 600;
    padding: 8px 2px 8px 10px;
    outline: none;
    font-variant-numeric: tabular-nums;
}
.tp-inp span {
    flex: 0 0 auto;
    padding-right: 10px;
    font-family: var(--tp-mono);
    font-size: 9.5px;
    color: var(--tp-muted);
    white-space: nowrap;
}
.tp-inp.is-bad { border-color: var(--tp-bad); background: var(--tp-bad-soft); }
.tp-inp.is-bad span { color: var(--tp-bad); }

.tp-sel {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--tp-line-2);
    border-radius: 9px;
    background: var(--tp-panel);
    color: var(--tp-ink);
    font-family: var(--tp-sans);
    font-size: 12.8px;
    padding: 8px 10px;
    outline: none;
    cursor: pointer;
}
.tp-sel:focus { border-color: var(--tp-orange); }

.tp-split {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 3px 0 1px;
    font-family: var(--tp-mono);
    font-size: 9.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tp-muted);
}
.tp-split::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--tp-line);
}

.tp-actions {
    display: flex;
    gap: 7px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--tp-line);
}
.tp-btn {
    appearance: none;
    font: inherit;
    font-size: 12.8px;
    padding: 8px 13px;
    border-radius: 9px;
    border: 1px solid var(--tp-line-2);
    background: var(--tp-panel);
    color: var(--tp-ink-2);
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}
.tp-btn:hover { border-color: var(--tp-ink); color: var(--tp-ink); }
.tp-btn.is-primary {
    flex: 1 1 auto;
    background: var(--tp-orange);
    border-color: var(--tp-orange);
    color: #fff;
    font-weight: 700;
}
.tp-btn.is-primary:hover { background: var(--tp-orange-2); border-color: var(--tp-orange-2); color: #fff; }
.tp-btn.is-ghost { background: transparent; }

.tp-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}
.tp-presets button {
    appearance: none;
    border: 1px dashed var(--tp-line-2);
    background: transparent;
    color: var(--tp-ink-2);
    font: inherit;
    font-size: 11px;
    padding: 4px 9px;
    border-radius: 100px;
    cursor: pointer;
}
.tp-presets button:hover { border-color: var(--tp-orange); color: var(--tp-orange); }

.tp-note {
    margin: 10px 0 0;
    padding: 9px 11px;
    border-radius: 8px;
    background: var(--tp-orange-soft);
    font-size: 11.6px;
    line-height: 1.7;
    color: var(--tp-ink-2);
}
.tp-note.is-bad { background: var(--tp-bad-soft); color: var(--tp-bad); }
.tp-note b { color: var(--tp-ink); }

/* ---------------- 结果 ---------------- */
.tp-out { display: grid; gap: 14px; }

.tp-ticket {
    position: relative;
    border: 1px solid var(--tp-line);
    border-radius: 16px;
    background: var(--tp-panel);
    box-shadow: var(--tp-shadow);
    overflow: hidden;
}
.tp-ticket::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--tp-orange), #f0a24a 45%, var(--tp-blue));
}
.tp-ticket-head {
    display: flex;
    align-items: baseline;
    gap: 9px;
    padding: 15px 18px 0;
}
.tp-ticket-head h2 {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--tp-ink);
}
.tp-ticket-head span {
    margin-left: auto;
    font-family: var(--tp-mono);
    font-size: 10px;
    color: var(--tp-muted);
}

.tp-trio {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    margin: 12px 0 0;
    background: var(--tp-line);
}
.tp-cell { padding: 12px 16px 14px; background: var(--tp-panel); }
.tp-cell span {
    display: block;
    font-family: var(--tp-mono);
    font-size: 9.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tp-muted);
    margin-bottom: 3px;
}
.tp-cell b {
    font-family: var(--tp-mono);
    font-size: clamp(22px, 2.6vw, 29px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.02em;
    color: var(--tp-ink);
    font-variant-numeric: tabular-nums;
}
.tp-cell b small { font-size: 11px; font-weight: 500; color: var(--tp-muted); margin-left: 2px; }
.tp-cell.is-cost b { color: var(--tp-orange); }
.tp-cell i {
    display: block;
    margin-top: 3px;
    font-family: var(--tp-mono);
    font-style: normal;
    font-size: 10px;
    color: var(--tp-muted);
}

/* 剖面 */
.tp-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 158px;
    gap: 14px;
    align-items: center;
    padding: 14px 18px 16px;
    border-top: 1px solid var(--tp-line);
}
.tp-svg { width: 100%; height: auto; display: block; }
.tp-svg-outline { fill: var(--tp-panel-2); stroke: var(--tp-line-2); stroke-width: 1.5; }
.tp-svg-shell { fill: none; stroke: var(--tp-orange); stroke-width: 7; stroke-linejoin: round; opacity: .9; }
.tp-svg-fill { stroke: var(--tp-orange); stroke-width: 1.2; opacity: .45; }
.tp-pat-line {
    stroke: var(--tp-orange);
    stroke-width: 1.2;
    opacity: .5;
}
.tp-svg-support { fill: var(--tp-blue); opacity: .26; }
.tp-svg-label {
    font-family: var(--tp-mono);
    font-size: 9px;
    fill: var(--tp-muted);
    letter-spacing: .06em;
}
.tp-svg-axis { stroke: var(--tp-line-2); stroke-width: 1; stroke-dasharray: 3 3; }

.tp-legend { display: grid; gap: 7px; }
.tp-legend div {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    color: var(--tp-ink-2);
}
.tp-legend i {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    background: var(--tp-orange);
    opacity: .9;
    font-style: normal;
    flex: 0 0 auto;
}
.tp-legend div:nth-child(2) i { background: var(--tp-orange); opacity: .45; }
.tp-legend div:nth-child(3) i { background: var(--tp-blue); opacity: .5; }
.tp-legend b {
    margin-left: auto;
    font-family: var(--tp-mono);
    font-size: 11px;
    color: var(--tp-ink);
    font-variant-numeric: tabular-nums;
}

/* 成本拆解 */
.tp-cost { padding: 14px 18px 16px; border-top: 1px solid var(--tp-line); }
.tp-cost h3 {
    margin: 0 0 9px;
    font-family: var(--tp-mono);
    font-size: 9.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--tp-muted);
}
.tp-cost-bar {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--tp-panel-2);
}
.tp-cost-bar i {
    display: block;
    height: 100%;
    width: 0;
    transition: width .45s cubic-bezier(.22, .8, .3, 1);
}
.tp-cost-bar i:nth-child(1) { background: var(--tp-orange); }
.tp-cost-bar i:nth-child(2) { background: var(--tp-blue); }
.tp-cost-bar i:nth-child(3) { background: var(--tp-green); }
.tp-cost-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--tp-ink-2);
}
.tp-cost-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tp-cost-legend i {
    width: 7px;
    height: 7px;
    border-radius: 2px;
    font-style: normal;
}
.tp-cost-legend i.a { background: var(--tp-orange); }
.tp-cost-legend i.b { background: var(--tp-blue); }
.tp-cost-legend i.c { background: var(--tp-green); }
.tp-cost-legend b {
    font-family: var(--tp-mono);
    color: var(--tp-ink);
    font-variant-numeric: tabular-nums;
}

.tp-tip {
    margin: 0;
    padding: 11px 18px 14px;
    border-top: 1px dashed var(--tp-line);
    font-size: 12px;
    line-height: 1.72;
    color: var(--tp-ink-2);
}
.tp-tip b { color: var(--tp-ink); }
.tp-tip strong { color: var(--tp-orange); font-family: var(--tp-mono); }

/* ---------------- 批量表 ---------------- */
.tp-body { padding-bottom: 8px; }
.tp-card {
    margin-top: 16px;
    border: 1px solid var(--tp-line);
    border-radius: 16px;
    background: var(--tp-panel);
    box-shadow: var(--tp-shadow);
    overflow: hidden;
}
.tp-card-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 13px 17px;
    border-bottom: 1px solid var(--tp-line);
}
.tp-card-head h2 {
    margin: 0;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--tp-ink);
}
.tp-card-head span { font-size: 12px; color: var(--tp-muted); }
.tp-card-head .tp-btn { margin-left: auto; padding: 6px 11px; font-size: 12px; }
.tp-table-scroll { overflow-x: auto; }
.tp-table { width: 100%; min-width: 600px; border-collapse: collapse; font-size: 12.4px; }
.tp-table th,
.tp-table td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px dashed var(--tp-line);
    font-variant-numeric: tabular-nums;
}
.tp-table th:first-child,
.tp-table td:first-child { text-align: left; font-weight: 600; }
.tp-table th {
    font-family: var(--tp-mono);
    font-size: 9.5px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--tp-muted);
    font-weight: 600;
    background: var(--tp-panel-2);
    white-space: nowrap;
}
.tp-table td { font-family: var(--tp-mono); color: var(--tp-ink-2); }
.tp-table tbody tr:hover td { background: var(--tp-panel-2); }
.tp-table tr.is-cur td {
    color: var(--tp-orange);
    font-weight: 700;
    background: var(--tp-orange-soft);
}

/* ---------------- 说明 ---------------- */
.tp-doc {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 26px 0 6px;
}
.tp-doc-block {
    padding: 18px 20px;
    border: 1px solid var(--tp-line);
    border-radius: 16px;
    background: var(--tp-panel);
}
.tp-doc-block h2 {
    margin: 0 0 9px;
    font-size: 15px;
    font-weight: 700;
    color: var(--tp-ink);
}
.tp-doc-block p,
.tp-doc-block li { font-size: 13px; line-height: 1.95; color: var(--tp-ink-2); }
.tp-doc-block p { margin: 0 0 8px; }
.tp-doc-block p:last-child { margin-bottom: 0; }
.tp-doc-block ul, .tp-doc-block ol { margin: 0; padding-left: 18px; }
.tp-doc-block li + li { margin-top: 4px; }
.tp-doc-block b { color: var(--tp-ink); }
.tp-doc-block code {
    font-family: var(--tp-mono);
    font-size: 11.6px;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--tp-panel-2);
    color: var(--tp-orange);
}
.tp-formula {
    margin: 10px 0 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--tp-panel-2);
    font-family: var(--tp-mono);
    font-size: 11.4px;
    line-height: 2;
    color: var(--tp-ink-2);
    overflow-x: auto;
}

.tp-toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translate(-50%, 12px);
    z-index: 90;
    max-width: min(88vw, 440px);
    padding: 10px 18px;
    border-radius: 10px;
    background: var(--tp-ink);
    color: var(--tp-panel);
    font-size: 13px;
    line-height: 1.6;
    box-shadow: 0 18px 36px -22px rgba(0, 0, 0, .7);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}
.tp-toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1040px) {
    .tp-desk { grid-template-columns: minmax(0, 1fr); }
    .tp-top { grid-template-columns: minmax(0, 1fr); gap: 13px; }
    .tp-side { flex-direction: row; align-items: center; justify-content: flex-start; }
    .tp-out { order: -1; }
    .tp-doc { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
    .tp-wrap { padding: 0 14px; }
    .tp-hero { padding: 15px 0 20px; }
    .tp-h1 { font-size: 24px; }
    .tp-sub { font-size: 13.8px; line-height: 1.8; }
    .tp-form { padding: 12px 13px 14px; }
    .tp-trio { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tp-cell { padding: 9px 9px 11px; }
    .tp-cell b { font-size: 19px; }
    .tp-cell b small { font-size: 9px; margin-left: 1px; }
    .tp-cell i { font-size: 9px; }
    .tp-section { grid-template-columns: minmax(0, 1fr); }
    .tp-legend { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .tp-actions { flex-wrap: wrap; }
    .tp-btn.is-primary { flex: 1 1 100%; }
    .tp-card-head span { display: none; }
}
