/* ============================================================
   performance-bonus-calc · 绩效工资与奖金测算计算器
   设计语言：工资条账本风 —— 米黄账纸、红色双栏线、打孔工资条、骑缝章
   主色 绛红 #8c2f39 / 鎏金 #b98a2f / 账墨 #3a2b28
   ============================================================ */
.pbc-page {
    --pbc-bg: #f6f1e7;
    --pbc-paper: #fffdf7;
    --pbc-ink: #3a2b28;
    --pbc-primary: #8c2f39;
    --pbc-primary-deep: #6d232c;
    --pbc-primary-soft: #f5e3e2;
    --pbc-gold: #b98a2f;
    --pbc-gold-soft: #f3e8cf;
    --pbc-ok: #3d7a4f;
    --pbc-warn: #b4552d;
    --pbc-line: #d9c9ae;
    --pbc-muted: #8a7263;
    --pbc-shadow: 0 10px 26px rgba(58, 43, 40, 0.1);
    margin-top: 18px;
    color: var(--pbc-ink);
    font-variant-numeric: tabular-nums;
}
:root[data-theme="dark"] .pbc-page {
    --pbc-bg: #1c1412;
    --pbc-paper: #261c19;
    --pbc-ink: #efe2d6;
    --pbc-primary: #c96a72;
    --pbc-primary-deep: #e08a90;
    --pbc-primary-soft: #3a2226;
    --pbc-gold: #d9b36a;
    --pbc-gold-soft: #3a2f1d;
    --pbc-ok: #6fbf85;
    --pbc-warn: #e08a5a;
    --pbc-line: #4a3630;
    --pbc-muted: #a8917f;
    --pbc-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

/* ---------- 首屏：账本纸 ---------- */
.pbc-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) 190px minmax(220px, 0.8fr);
    gap: 22px;
    align-items: stretch;
    padding: 30px;
    border: 1px solid var(--pbc-line);
    border-left: 6px double var(--pbc-primary);
    border-radius: 14px;
    background:
        repeating-linear-gradient(0deg, transparent 0 27px, rgba(185, 138, 47, 0.12) 27px 28px),
        var(--pbc-bg);
    box-shadow: var(--pbc-shadow);
}
.pbc-hero-copy { min-width: 0; }
.pbc-kicker {
    display: inline-block;
    padding: 4px 12px;
    background: var(--pbc-primary);
    color: #fff;
    border-radius: 3px;
    font-size: 12px;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}
:root[data-theme="dark"] .pbc-kicker { color: #26100f; }
.pbc-hero-copy h1 {
    margin: 0 0 10px;
    font-size: clamp(22px, 3.2vw, 31px);
    font-weight: 800;
    color: var(--pbc-ink);
}
.pbc-hero-sub { margin: 0 0 14px; font-size: 15px; line-height: 1.75; color: var(--pbc-muted); max-width: 58ch; }
.pbc-hero-sub b { color: var(--pbc-primary-deep); }
.pbc-hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pbc-hero-chips li {
    padding: 5px 12px;
    border-radius: 3px;
    background: var(--pbc-paper);
    border: 1px solid var(--pbc-line);
    color: var(--pbc-muted);
    font-size: 12.5px;
}

/* 工资条装饰 */
.pbc-hero-slip {
    position: relative;
    background: var(--pbc-paper);
    border: 1px solid var(--pbc-line);
    border-radius: 8px;
    padding: 26px 14px 14px;
    box-shadow: var(--pbc-shadow);
    align-self: center;
}
.pbc-slip-holes { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-around; }
.pbc-slip-holes i {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--pbc-bg);
    border: 1px solid var(--pbc-line);
    transform: translateY(-50%);
}
.pbc-slip-row {
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
    color: var(--pbc-muted);
    padding: 7px 4px;
    border-bottom: 1px dashed var(--pbc-line);
}
.pbc-slip-row b { color: var(--pbc-ink); font-weight: 700; }
.pbc-slip-row--total { border-bottom: none; border-top: 2px solid var(--pbc-primary); margin-top: 4px; }
.pbc-slip-row--total span, .pbc-slip-row--total b { color: var(--pbc-primary-deep); font-weight: 800; }
.pbc-slip-stamp {
    position: absolute;
    right: -14px;
    bottom: -16px;
    width: 66px;
    height: 66px;
    border-radius: 50%;
    border: 2.5px solid var(--pbc-primary);
    outline: 1px solid var(--pbc-primary);
    outline-offset: -6px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--pbc-primary);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
    transform: rotate(-12deg);
    opacity: 0.85;
    background: var(--pbc-paper);
}

/* 读数卡 */
.pbc-hero-readout {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 22px 24px;
    border-radius: 12px;
    background: var(--pbc-primary-deep);
    color: #fbeeea;
    box-shadow: var(--pbc-shadow);
}
:root[data-theme="dark"] .pbc-hero-readout { color: #26100f; }
.pbc-readout-label { font-size: 12.5px; letter-spacing: 1.5px; opacity: 0.8; }
.pbc-readout-num { font-size: 38px; font-weight: 800; line-height: 1.1; }
.pbc-readout-avg { font-size: 14px; opacity: 0.92; }
.pbc-readout-meta { font-size: 12px; opacity: 0.7; }
.pbc-readout-tip { margin-top: 4px; font-size: 11px; opacity: 0.55; }

/* ---------- 测算区 ---------- */
.pbc-calc {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: 24px;
    margin-top: 24px;
    align-items: start;
}
.pbc-input-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.pbc-panel {
    background: var(--pbc-paper);
    border: 1px solid var(--pbc-line);
    border-left: 4px double var(--pbc-primary);
    border-radius: 12px;
    padding: 20px 22px;
    box-shadow: var(--pbc-shadow);
}
.pbc-panel-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.pbc-step {
    flex: none;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--pbc-gold-soft);
    border: 1.5px solid var(--pbc-gold);
    color: var(--pbc-primary-deep);
    font-weight: 800;
    font-size: 14px;
}
.pbc-panel-head h2 { margin: 0 0 3px; font-size: 17px; font-weight: 700; }
.pbc-panel-head p { margin: 0; font-size: 12.5px; color: var(--pbc-muted); line-height: 1.6; }

.pbc-grid1, .pbc-grid2, .pbc-grid3 { display: grid; gap: 12px 14px; margin-bottom: 12px; }
.pbc-grid1 { grid-template-columns: 1fr; }
.pbc-grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pbc-grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pbc-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pbc-label { font-size: 12.5px; color: var(--pbc-muted); }
.pbc-input-wrap, .pbc-select-wrap { position: relative; display: block; }
.pbc-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--pbc-line);
    border-radius: 7px;
    background: var(--pbc-bg);
    color: var(--pbc-ink);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.pbc-input:focus {
    outline: none;
    border-color: var(--pbc-primary);
    box-shadow: 0 0 0 3px rgba(140, 47, 57, 0.14);
    background: var(--pbc-paper);
}
.pbc-input:disabled { opacity: 0.5; cursor: not-allowed; }
.pbc-unit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-style: normal;
    font-size: 12px;
    color: var(--pbc-muted);
    pointer-events: none;
}
.pbc-input-wrap .pbc-input { padding-right: 58px; }
select.pbc-input { appearance: none; padding-right: 30px; cursor: pointer; }
.pbc-select-wrap::after {
    content: "▾";
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pbc-muted);
    pointer-events: none;
    font-size: 12px;
}
.pbc-hint { margin: 2px 0 0; font-size: 12px; color: var(--pbc-muted); line-height: 1.65; border-left: 3px solid var(--pbc-gold-soft); padding-left: 10px; }

.pbc-error {
    padding: 12px 16px;
    border-radius: 8px;
    background: #fbeae6;
    border: 1px solid var(--pbc-warn);
    color: var(--pbc-warn);
    font-size: 13.5px;
    line-height: 1.6;
}
:root[data-theme="dark"] .pbc-error { background: #3a201a; }
.pbc-actions { display: flex; gap: 12px; }
.pbc-btn {
    padding: 11px 22px;
    border-radius: 7px;
    border: 1px solid var(--pbc-line);
    background: var(--pbc-paper);
    color: var(--pbc-ink);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
}
.pbc-btn:hover { transform: translateY(-1px); box-shadow: var(--pbc-shadow); }
.pbc-btn--primary { background: var(--pbc-primary); border-color: var(--pbc-primary); color: #fff; }
.pbc-btn--primary:hover { background: var(--pbc-primary-deep); }
:root[data-theme="dark"] .pbc-btn--primary { color: #26100f; }

/* ---------- 结果列 ---------- */
.pbc-result-col { position: sticky; top: 84px; }
.pbc-result-card {
    background: var(--pbc-paper);
    border: 1px solid var(--pbc-line);
    border-top: 4px solid var(--pbc-primary);
    border-radius: 12px;
    padding: 20px 22px;
    box-shadow: var(--pbc-shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.pbc-result-head { display: flex; justify-content: space-between; align-items: center; }
.pbc-result-tag {
    padding: 4px 12px;
    border-radius: 3px;
    background: var(--pbc-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
}
:root[data-theme="dark"] .pbc-result-tag { color: #26100f; }
.pbc-result-note { font-size: 12.5px; color: var(--pbc-muted); }
.pbc-result-note b { color: var(--pbc-primary-deep); }
.pbc-result-main { text-align: center; padding: 8px 0 4px; border-bottom: 1px dashed var(--pbc-line); }
.pbc-result-label { display: block; font-size: 13px; color: var(--pbc-muted); margin-bottom: 4px; }
.pbc-result-total { display: block; font-size: 36px; font-weight: 800; color: var(--pbc-primary-deep); line-height: 1.15; }
.pbc-result-mid { display: block; margin-top: 4px; font-size: 13.5px; color: var(--pbc-muted); }

.pbc-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pbc-metric {
    padding: 12px 14px;
    border: 1px solid var(--pbc-line);
    border-radius: 9px;
    background: var(--pbc-bg);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pbc-metric-k { font-size: 12px; color: var(--pbc-muted); }
.pbc-metric-v { font-size: 17px; font-weight: 800; color: var(--pbc-ink); }
.pbc-metric-v.is-good { color: var(--pbc-ok); }
.pbc-metric-v.is-warn { color: var(--pbc-warn); }

.pbc-breakdown h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--pbc-primary-deep); }
.pbc-table-scroll { overflow-x: auto; }
.pbc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pbc-table th, .pbc-table td { padding: 8px 10px; border: 1px solid var(--pbc-line); text-align: right; white-space: nowrap; }
.pbc-table th { background: var(--pbc-gold-soft); color: var(--pbc-primary-deep); font-weight: 700; }
.pbc-table th:first-child, .pbc-table td:first-child { text-align: left; }
.pbc-table tr.is-current td { background: var(--pbc-primary-soft); font-weight: 700; }
.pbc-table tr.is-good td { background: rgba(61, 122, 79, 0.1); }
.pbc-table-empty { text-align: center !important; color: var(--pbc-muted); }
.pbc-table .is-price { font-weight: 700; color: var(--pbc-primary-deep); }
.pbc-table .is-delta-pos { color: var(--pbc-ok); font-weight: 700; }
.pbc-table .is-delta-neg { color: var(--pbc-warn); font-weight: 700; }

.pbc-verdict {
    padding: 14px 16px;
    border-radius: 9px;
    border: 1px dashed var(--pbc-line);
    background: var(--pbc-bg);
    font-size: 13.5px;
    line-height: 1.7;
}
.pbc-verdict.is-good { border-color: var(--pbc-ok); background: rgba(61, 122, 79, 0.08); }
.pbc-verdict.is-warn { border-color: var(--pbc-warn); background: rgba(180, 85, 45, 0.08); }
.pbc-verdict b { color: var(--pbc-primary-deep); }
.pbc-notes { display: flex; flex-direction: column; gap: 8px; }
.pbc-notes p { margin: 0; font-size: 12.5px; color: var(--pbc-muted); line-height: 1.65; }
.pbc-result-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.pbc-result-actions .pbc-btn { flex: 1; text-align: center; }
.pbc-result-foot { margin: 0; font-size: 11.5px; color: var(--pbc-muted); }

/* ---------- A4 测算单 ---------- */
.pbc-sheet-wrap { margin-top: 30px; }
.pbc-sheet-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.pbc-sheet-kicker { font-size: 12px; letter-spacing: 2px; color: var(--pbc-primary); }
.pbc-sheet-head h2 { margin: 4px 0 6px; font-size: 20px; }
.pbc-sheet-head p { margin: 0; font-size: 13px; color: var(--pbc-muted); max-width: 62ch; }
.pbc-sheet-badge {
    flex: none;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--pbc-line);
    font-size: 12px;
    color: var(--pbc-muted);
    background: var(--pbc-paper);
}
.pbc-sheet {
    position: relative;
    background: #fffdf7;
    color: #3a2b28;
    border: 2px solid #8c2f39;
    border-radius: 6px;
    padding: 26px 30px;
    box-shadow: var(--pbc-shadow);
    font-variant-numeric: tabular-nums;
}
.pbc-sheet-top { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #b98a2f; padding-bottom: 12px; margin-bottom: 14px; }
.pbc-sheet-top h3 { margin: 0 0 4px; font-size: 19px; color: #6d232c; }
.pbc-sheet-top p { margin: 0; font-size: 12px; color: #8a7263; }
.pbc-sheet-meta { text-align: right; font-size: 12px; color: #8a7263; display: flex; flex-direction: column; gap: 4px; }
.pbc-sheet-meta b { color: #3a2b28; }
.pbc-sheet-info { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: #8a7263; margin-bottom: 14px; }
.pbc-sheet-info b { color: #3a2b28; }
.pbc-sheet-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 14px; }
.pbc-sheet-table th, .pbc-sheet-table td { border: 1px solid #d9c9ae; padding: 7px 9px; text-align: right; }
.pbc-sheet-table th { background: #f3e8cf; color: #6d232c; }
.pbc-sheet-table th:first-child, .pbc-sheet-table td:first-child { text-align: center; width: 34px; }
.pbc-sheet-table th:nth-child(2), .pbc-sheet-table td:nth-child(2) { text-align: left; }
.pbc-sheet-table .w-no { width: 34px; }
.pbc-sheet-table .w-sub { width: 104px; }
.pbc-sheet-summary { border: 1px solid #8c2f39; border-radius: 6px; overflow: hidden; margin-bottom: 14px; }
.pbc-sheet-row { display: flex; justify-content: space-between; padding: 8px 14px; font-size: 13px; border-bottom: 1px dashed #d9c9ae; }
.pbc-sheet-row:last-child { border-bottom: none; }
.pbc-sheet-row b { color: #6d232c; }
.pbc-sheet-row--total { background: #f5e3e2; font-weight: 700; }
.pbc-sheet-notes p { margin: 0 0 6px; font-size: 11.5px; color: #6f5b4f; line-height: 1.7; }
.pbc-sheet-notes b { color: #3a2b28; }
.pbc-sheet-foot { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #d9c9ae; font-size: 11px; color: #9c8776; text-align: center; }
.pbc-sheet::after {
    content: "测算参考";
    position: absolute;
    right: 26px;
    bottom: 54px;
    width: 78px;
    height: 78px;
    border: 2.5px solid rgba(140, 47, 57, 0.6);
    border-radius: 50%;
    outline: 1px solid rgba(140, 47, 57, 0.5);
    outline-offset: -7px;
    display: grid;
    place-items: center;
    color: rgba(140, 47, 57, 0.65);
    font-size: 15px;
    font-weight: 800;
    transform: rotate(-14deg);
    pointer-events: none;
}

/* ---------- 参考 / 规则 / FAQ ---------- */
.pbc-reference, .pbc-rules { margin-top: 34px; }
.pbc-section-head { margin-bottom: 16px; }
.pbc-section-kicker { font-size: 12px; letter-spacing: 2px; color: var(--pbc-primary); }
.pbc-section-head h2 { margin: 4px 0 8px; font-size: 21px; }
.pbc-section-head p { margin: 0; font-size: 13.5px; color: var(--pbc-muted); line-height: 1.7; }
.pbc-ref-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.pbc-ref-card { background: var(--pbc-paper); border: 1px solid var(--pbc-line); border-radius: 12px; padding: 18px 20px; box-shadow: var(--pbc-shadow); }
.pbc-ref-card h3 { margin: 0 0 2px; font-size: 15.5px; }
.pbc-ref-sub { margin: 0 0 12px; font-size: 12px; color: var(--pbc-muted); }
.pbc-ref-note { margin-top: 14px; font-size: 12.5px; color: var(--pbc-muted); line-height: 1.7; background: var(--pbc-gold-soft); border-left: 3px solid var(--pbc-gold); padding: 10px 14px; border-radius: 0 8px 8px 0; }
.pbc-rule-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.pbc-rule { background: var(--pbc-paper); border: 1px solid var(--pbc-line); border-radius: 12px; padding: 18px; box-shadow: var(--pbc-shadow); }
.pbc-rule-no { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--pbc-primary); color: #fff; font-weight: 800; margin-bottom: 10px; }
:root[data-theme="dark"] .pbc-rule-no { color: #26100f; }
.pbc-rule h3 { margin: 0 0 6px; font-size: 14.5px; }
.pbc-rule p { margin: 0; font-size: 12.5px; color: var(--pbc-muted); line-height: 1.7; }
.pbc-example { margin-top: 18px; background: var(--pbc-paper); border: 1px dashed var(--pbc-primary); border-radius: 12px; padding: 20px 22px; }
.pbc-example h3 { margin: 0 0 8px; font-size: 15px; color: var(--pbc-primary-deep); }
.pbc-example p { margin: 0 0 6px; font-size: 13.5px; line-height: 1.8; color: var(--pbc-ink); }
.pbc-example b { color: var(--pbc-primary-deep); }
.pbc-example-note { font-size: 12px !important; color: var(--pbc-muted) !important; }
.pbc-faq { margin-top: 34px; }

/* ---------- 返回顶部 ---------- */
.pbc-top {
    position: fixed;
    right: 22px;
    bottom: 26px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--pbc-line);
    background: var(--pbc-paper);
    color: var(--pbc-primary);
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--pbc-shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    z-index: 60;
}
.pbc-top.is-show { opacity: 1; pointer-events: auto; }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
    .pbc-calc { grid-template-columns: 1fr; }
    .pbc-result-col { position: static; }
    .pbc-hero { grid-template-columns: 1fr; }
    .pbc-hero-slip { display: none; }
    .pbc-rule-grid { grid-template-columns: repeat(2, 1fr); }
    .pbc-ref-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .pbc-grid3, .pbc-grid2 { grid-template-columns: 1fr; }
    .pbc-metrics { grid-template-columns: 1fr; }
    .pbc-rule-grid { grid-template-columns: 1fr; }
    .pbc-hero { padding: 22px 18px; }
    .pbc-sheet { padding: 18px 14px; }
}

/* ---------- 打印：只保留 A4 测算单 ---------- */
@media print {
    body * { visibility: hidden !important; }
    .pbc-sheet, .pbc-sheet * { visibility: visible !important; }
    .pbc-sheet {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        box-shadow: none;
        color: #000;
    }
    .pbc-top { display: none !important; }
}
