/* ==========================================================================
   打印耗材与张数成本计算器 /tool/print-ink-cost-calc
   视觉主题：晒图纸 —— 晒图蓝 + 荧光橙 + 制图纸灰白 + 网点纹理
   深浅双主题；深色模式跟随导航栏 #themeToggle，页面内不另设切换开关
   ========================================================================== */

.pic-page {
    /* ---- 浅色（默认） ---- */
    --pic-bg: #edf1f8;
    --pic-bg-2: #e1e9f4;
    --pic-card: #fdfeff;
    --pic-card-2: #f3f7fc;
    --pic-ink: #16294d;
    --pic-ink-2: #46587c;
    --pic-ink-3: #7b8aa8;
    --pic-line: #d4deec;
    --pic-line-2: #e4ebf5;
    --pic-blue: #1c4e9e;
    --pic-blue-2: #2f6cc4;
    --pic-blue-soft: #e2ecfa;
    --pic-orange: #ff7a1a;
    --pic-orange-soft: #fff0e2;
    --pic-green: #1d7a4f;
    --pic-green-soft: #e2f3ea;
    --pic-red: #c23b2e;
    --pic-red-soft: #fbe9e6;
    --pic-shadow: 0 16px 36px rgba(22, 41, 77, .12);
    --pic-shadow-sm: 0 5px 16px rgba(22, 41, 77, .08);
    --pic-radius: 18px;
    --pic-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

:root[data-theme="dark"] .pic-page {
    /* ---- 深色 ---- */
    --pic-bg: #0b1220;
    --pic-bg-2: #0f1829;
    --pic-card: #131e33;
    --pic-card-2: #182640;
    --pic-ink: #e6edf8;
    --pic-ink-2: #a7b6d1;
    --pic-ink-3: #7687a8;
    --pic-line: #25355a;
    --pic-line-2: #1e2c4a;
    --pic-blue: #7fa8e8;
    --pic-blue-2: #9cbff2;
    --pic-blue-soft: #16253f;
    --pic-orange: #ffa25e;
    --pic-orange-soft: #32200f;
    --pic-green: #6cc794;
    --pic-green-soft: #12291d;
    --pic-red: #e6887c;
    --pic-red-soft: #331d19;
    --pic-shadow: 0 16px 40px rgba(0, 0, 0, .5);
    --pic-shadow-sm: 0 5px 16px rgba(0, 0, 0, .38);
}

.pic-page {
    color: var(--pic-ink);
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.75;
    font-variant-numeric: tabular-nums;
    padding: 26px 26px 30px;
    margin-top: 22px;
    background:
        radial-gradient(rgba(28, 78, 158, .06) 1px, transparent 1.6px),
        linear-gradient(180deg, var(--pic-bg-2), var(--pic-bg));
    background-size: 14px 14px, auto;
    border: 1px solid var(--pic-line);
    border-radius: var(--pic-radius);
    box-shadow: var(--pic-shadow);
}

.pic-page * { box-sizing: border-box; }

.pic-page h1,
.pic-page h2,
.pic-page h3 { margin: 0; line-height: 1.35; letter-spacing: .3px; }
.pic-page h1 { font-size: 31px; font-weight: 800; color: var(--pic-blue); }
.pic-page h2 { font-size: 20px; font-weight: 800; color: var(--pic-ink); }
.pic-page h3 { font-size: 15px; font-weight: 700; color: var(--pic-ink); }

/* ===================== 首屏 ===================== */
.pic-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 26px;
    align-items: start;
    margin-bottom: 18px;
}

.pic-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--pic-blue);
    background: var(--pic-blue-soft);
    border: 1px solid var(--pic-line);
    border-radius: 999px;
    padding: 3px 13px;
    margin-bottom: 12px;
}

.pic-lead {
    margin: 10px 0 14px;
    font-size: 15px;
    color: var(--pic-ink-2);
    max-width: 58ch;
    line-height: 1.85;
}
.pic-lead b { color: var(--pic-blue); font-weight: 700; }

.pic-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pic-tags li {
    font-size: 12px;
    color: var(--pic-ink-2);
    background: var(--pic-card);
    border: 1px solid var(--pic-line);
    border-radius: 999px;
    padding: 3px 11px;
}

/* ===================== 速算卡 ===================== */
.pic-meter {
    background: var(--pic-card);
    border: 1px solid var(--pic-line);
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: var(--pic-shadow-sm);
    position: relative;
    overflow: hidden;
}
.pic-meter::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--pic-blue), var(--pic-orange));
}
.pic-meter-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--pic-line);
    margin-bottom: 12px;
}
.pic-meter-head b { font-size: 15px; color: var(--pic-blue); }
.pic-meter-head span { font-size: 12px; color: var(--pic-ink-3); }

.pic-meter-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.pic-num {
    background: var(--pic-card-2);
    border: 1px solid var(--pic-line-2);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pic-num-label { font-size: 12px; color: var(--pic-ink-3); }
.pic-num-val { font-family: var(--pic-mono); font-size: 24px; font-weight: 700; color: var(--pic-blue); line-height: 1.2; }
.pic-num.is-color .pic-num-val { color: var(--pic-orange); }
.pic-num-unit { font-size: 11px; color: var(--pic-ink-3); }

/* 成本构成条 */
.pic-bar {
    display: flex;
    height: 18px;
    border-radius: 9px;
    overflow: hidden;
    background: var(--pic-card-2);
    border: 1px solid var(--pic-line-2);
    margin-bottom: 8px;
}
.pic-bar-seg { height: 100%; min-width: 0; transition: width .25s ease; }
.pic-bar-seg.is-supply { background: var(--pic-blue-2); }
.pic-bar-seg.is-paper { background: var(--pic-green); }
.pic-bar-seg.is-elec { background: var(--pic-orange); }
.pic-bar-seg.is-fixed { background: var(--pic-ink-3); }

.pic-legend { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.pic-legend li { font-size: 12px; color: var(--pic-ink-2); display: inline-flex; align-items: center; gap: 5px; }
.pic-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.pic-legend i.is-supply { background: var(--pic-blue-2); }
.pic-legend i.is-paper { background: var(--pic-green); }
.pic-legend i.is-elec { background: var(--pic-orange); }
.pic-legend i.is-fixed { background: var(--pic-ink-3); }

.pic-meter-rows { border-top: 1px dashed var(--pic-line); padding-top: 10px; }
.pic-meter-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    padding: 4px 0;
    font-size: 13px;
}
.pic-meter-row .k { color: var(--pic-ink-2); }
.pic-meter-row .v { font-family: var(--pic-mono); font-weight: 700; color: var(--pic-ink); }
.pic-meter-row.is-year .v { color: var(--pic-blue); font-size: 16px; }
.pic-meter-row.is-year .k { color: var(--pic-ink); font-weight: 700; }

/* ===================== 预置示例 ===================== */
.pic-presets {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.pic-presets-label { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--pic-ink-3); }
.pic-presets button {
    font: inherit;
    font-size: 13px;
    color: var(--pic-blue);
    background: var(--pic-card);
    border: 1px solid var(--pic-line);
    border-radius: 999px;
    padding: 5px 14px;
    cursor: pointer;
    transition: all .15s ease;
}
.pic-presets button:hover { border-color: var(--pic-blue); background: var(--pic-blue-soft); }

/* ===================== 校验条 ===================== */
.pic-errbar {
    border-radius: 12px;
    border: 1px solid var(--pic-red);
    background: var(--pic-red-soft);
    color: var(--pic-red);
    font-size: 13px;
    line-height: 1.7;
    padding: 10px 14px;
    margin-bottom: 16px;
}
.pic-errbar.is-warn { border-color: var(--pic-orange); background: var(--pic-orange-soft); color: var(--pic-orange); }
.pic-errbar ul { margin: 0; padding-left: 18px; }

/* ===================== 面板 ===================== */
.pic-panel {
    background: var(--pic-card);
    border: 1px solid var(--pic-line);
    border-radius: 16px;
    padding: 22px 24px;
    margin-bottom: 18px;
    box-shadow: var(--pic-shadow-sm);
}
.pic-panel-head { margin-bottom: 16px; }
.pic-pk {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--pic-orange);
    background: var(--pic-orange-soft);
    border: 1px solid var(--pic-line);
    border-radius: 6px;
    padding: 1px 9px;
    margin-bottom: 8px;
}
.pic-panel-head h2 { margin-bottom: 4px; }
.pic-panel-head p { margin: 0; font-size: 13px; color: var(--pic-ink-2); }

.pic-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.pic-col { min-width: 0; }

.pic-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    margin: 0 0 10px;
}
.pic-sub + .pic-sub { margin-top: 18px; }
.pic-sub i {
    font-style: normal;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: var(--pic-blue);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}
.pic-sub-note { font-size: 12px; font-weight: 400; color: var(--pic-ink-3); }

.pic-mini-btn {
    margin-left: auto;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    color: var(--pic-blue);
    background: var(--pic-blue-soft);
    border: 1px dashed var(--pic-blue);
    border-radius: 999px;
    padding: 3px 12px;
    cursor: pointer;
    transition: all .15s ease;
}
.pic-mini-btn:hover { background: var(--pic-blue); color: #fff; }

.pic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pic-field { display: flex; flex-direction: column; gap: 5px; }
.pic-label { font-size: 13px; font-weight: 600; color: var(--pic-ink-2); }
.pic-unit { font-size: 11px; font-weight: 400; color: var(--pic-ink-3); }
.pic-input {
    font: inherit;
    font-size: 14px;
    color: var(--pic-ink);
    background: var(--pic-card-2);
    border: 1px solid var(--pic-line);
    border-radius: 10px;
    padding: 8px 12px;
    width: 100%;
    outline: none;
    transition: border-color .15s ease;
}
.pic-input:focus { border-color: var(--pic-blue); }
.pic-mono { font-family: var(--pic-mono); }

/* 耗材行 */
.pic-supply {
    background: var(--pic-card-2);
    border: 1px solid var(--pic-line-2);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
}
.pic-supply-top { display: flex; gap: 8px; align-items: center; margin-bottom: 9px; }
.pic-supply-name {
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    color: var(--pic-ink);
    background: transparent;
    border: none;
    border-bottom: 1px dashed var(--pic-line);
    flex: 1;
    min-width: 0;
    padding: 2px 0;
    outline: none;
}
.pic-supply-name:focus { border-bottom-color: var(--pic-blue); }
.pic-supply-del {
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--pic-red-soft);
    color: var(--pic-red);
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}
.pic-supply-del:hover { background: var(--pic-red); color: #fff; }
.pic-supply-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.pic-supply-grid .pic-select,
.pic-supply-grid .pic-input { font-size: 13px; padding: 6px 9px; }
.pic-supply-per {
    margin-top: 8px;
    font-size: 12px;
    color: var(--pic-ink-3);
}
.pic-supply-per b { color: var(--pic-blue); font-family: var(--pic-mono); }
.pic-supply-note { font-size: 12px; color: var(--pic-ink-3); margin: 10px 0 0; line-height: 1.7; }

.pic-select {
    font: inherit;
    font-size: 14px;
    color: var(--pic-ink);
    background: var(--pic-card-2);
    border: 1px solid var(--pic-line);
    border-radius: 10px;
    padding: 8px 12px;
    width: 100%;
    outline: none;
}

/* ===================== 事实清单 ===================== */
.pic-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.pic-fact {
    background: var(--pic-card-2);
    border: 1px solid var(--pic-line-2);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.75;
    color: var(--pic-ink-2);
}
.pic-fact b { color: var(--pic-blue); font-family: var(--pic-mono); }
.pic-fact.is-tip { border-left: 3px solid var(--pic-orange); }
.pic-fact.is-save { border-left: 3px solid var(--pic-green); }
.pic-fact.is-save b { color: var(--pic-green); }

/* ===================== 按钮 ===================== */
.pic-btn {
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    color: var(--pic-ink);
    background: var(--pic-card);
    border: 1px solid var(--pic-line);
    border-radius: 10px;
    padding: 9px 18px;
    cursor: pointer;
    transition: all .15s ease;
}
.pic-btn:hover { border-color: var(--pic-blue); color: var(--pic-blue); }
.pic-btn--primary {
    background: var(--pic-blue);
    border-color: var(--pic-blue);
    color: #fff;
}
.pic-btn--primary:hover { background: var(--pic-blue-2); border-color: var(--pic-blue-2); color: #fff; }
.pic-btn--orange {
    background: var(--pic-orange);
    border-color: var(--pic-orange);
    color: #fff;
}
.pic-btn--orange:hover { filter: brightness(1.06); color: #fff; }
.pic-btn--ghost { background: transparent; }
.pic-btn:disabled { opacity: .55; cursor: not-allowed; }

.pic-month-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.pic-month-bar .pic-input { max-width: 260px; }

/* ===================== 表格 ===================== */
.pic-table-wrap { overflow-x: auto; border: 1px solid var(--pic-line); border-radius: 12px; }
.pic-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.pic-table th, .pic-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--pic-line-2); }
.pic-table th {
    font-size: 12px;
    color: var(--pic-ink-3);
    background: var(--pic-card-2);
    white-space: nowrap;
}
.pic-table td { color: var(--pic-ink); }
.pic-table td.pic-mono, .pic-table .pic-mono { font-family: var(--pic-mono); }
.pic-table tbody tr:last-child td { border-bottom: none; }
.pic-table tbody tr:hover { background: var(--pic-card-2); }
.pic-op { white-space: nowrap; }
.pic-del {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--pic-red-soft);
    color: var(--pic-red);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.pic-del:hover { background: var(--pic-red); color: #fff; }
.pic-table .empty-row td { text-align: center; color: var(--pic-ink-3); padding: 18px 0; }

.pic-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* ===================== AI / CSV 预览 ===================== */
.pic-pre {
    margin: 0;
    background: var(--pic-card-2);
    border: 1px solid var(--pic-line-2);
    border-radius: 12px;
    padding: 14px 16px;
    font-family: var(--pic-mono);
    font-size: 12.5px;
    line-height: 1.8;
    color: var(--pic-ink-2);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 380px;
    overflow: auto;
}

/* ===================== FAQ ===================== */
.pic-faq { display: flex; flex-direction: column; gap: 10px; }
.pic-faq-item {
    background: var(--pic-card-2);
    border: 1px solid var(--pic-line-2);
    border-radius: 12px;
    overflow: hidden;
}
.pic-faq-item summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    color: var(--pic-ink);
    padding: 12px 16px;
    list-style: none;
    position: relative;
    padding-right: 40px;
}
.pic-faq-item summary::-webkit-details-marker { display: none; }
.pic-faq-item summary::after {
    content: "+";
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pic-blue);
    font-size: 18px;
    font-weight: 800;
}
.pic-faq-item[open] summary::after { content: "−"; }
.pic-faq-a {
    padding: 0 16px 14px;
    font-size: 13px;
    line-height: 1.9;
    color: var(--pic-ink-2);
}
.pic-faq-a b { color: var(--pic-blue); }

/* ===================== 留言板 ===================== */
.pic-comments { margin-bottom: 20px; }

/* ===================== A4 成本单（仅打印可见） ===================== */
.pic-sheet { display: none; }

/* ===================== Toast ===================== */
.pic-toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    transform: translateX(-50%) translateY(16px);
    background: rgba(22, 41, 77, .95);
    color: #fff;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 10px;
    opacity: 0;
    pointer-events: none;
    transition: all .3s ease;
    z-index: 9999;
    max-width: 86vw;
}
.pic-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===================== 响应式 ===================== */
@media (max-width: 960px) {
    .pic-page { padding: 20px 16px 24px; }
    .pic-hero { grid-template-columns: 1fr; }
    .pic-cols { grid-template-columns: 1fr; }
    .pic-page h1 { font-size: 25px; }
}
@media (max-width: 560px) {
    .pic-grid { grid-template-columns: 1fr; }
    .pic-supply-grid { grid-template-columns: 1fr 1fr; }
    .pic-meter-nums { grid-template-columns: 1fr; }
}

/* ===================== 打印样式：A4 成本单 ===================== */
@media print {
    body > *:not(.detail-wrap) { display: none !important; }
    .detail-wrap .container > *:not(.pic-sheet) { display: none !important; }
    .pic-sheet {
        display: block !important;
        color: #000;
        font-size: 12px;
        line-height: 1.8;
    }
    .pic-sheet h1 { font-size: 20px; color: #000; margin: 0 0 4px; }
    .pic-sheet .pic-sheet-meta { font-size: 11px; color: #444; margin-bottom: 14px; }
    .pic-sheet table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
    .pic-sheet th, .pic-sheet td { border: 1px solid #999; padding: 5px 8px; text-align: left; }
    .pic-sheet th { background: #eee; }
    .pic-sheet .pic-sheet-sign { margin-top: 26px; display: flex; gap: 60px; color: #333; }
    .pic-toast, .pic-comments, .pic-errbar { display: none !important; }
}
