/* ============================================================
   tripartite-penalty-calc · 三方协议违约金测算
   三方盖章合同风（tpc-）：纸白底 + 墨黑正文 + 蓝黑钢笔字 + 印章红
   hero 装饰为纯 CSS 合同页（居中标题 + 横线 + 红圆章 rotate）
   标题一律衬线，「第X条」区块头
   ============================================================ */
.tpc-page {
    --tpc-bg: #f7f4ec;
    --tpc-paper: #fffdf6;
    --tpc-panel: #fbf8f0;
    --tpc-ink: #2b2e35;
    --tpc-sub: #6d7078;
    --tpc-line: #ddd6c2;
    --tpc-line-strong: #b8ad8f;
    --tpc-pen: #23486b;
    --tpc-pen-deep: #16324d;
    --tpc-pen-soft: rgba(35, 72, 107, 0.10);
    --tpc-seal: #bf3b2e;
    --tpc-seal-deep: #9a2c21;
    --tpc-seal-soft: rgba(191, 59, 46, 0.10);
    --tpc-good: #3f7d4e;
    --tpc-good-soft: rgba(63, 125, 78, 0.12);
    --tpc-warn: #b07a1e;
    --tpc-warn-soft: rgba(176, 122, 30, 0.14);
    --tpc-shadow: 0 6px 18px rgba(70, 66, 48, 0.14);

    color: var(--tpc-ink);
    font-size: 15px;
    line-height: 1.8;
}

:root[data-theme="dark"] .tpc-page {
    --tpc-bg: #201f1b;
    --tpc-paper: #292822;
    --tpc-panel: #2e2d25;
    --tpc-ink: #e7e4d6;
    --tpc-sub: #a5a28c;
    --tpc-line: #474436;
    --tpc-line-strong: #625d47;
    --tpc-pen: #8fb4d6;
    --tpc-pen-deep: #b3cfe6;
    --tpc-pen-soft: rgba(143, 180, 214, 0.13);
    --tpc-seal: #e0796a;
    --tpc-seal-deep: #ef9486;
    --tpc-seal-soft: rgba(224, 121, 106, 0.13);
    --tpc-good: #7fbf72;
    --tpc-good-soft: rgba(127, 191, 114, 0.14);
    --tpc-warn: #d9b463;
    --tpc-warn-soft: rgba(217, 180, 99, 0.15);
    --tpc-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.tpc-page h1, .tpc-page h2, .tpc-page h3 {
    line-height: 1.45;
    font-family: Georgia, "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
}
.tpc-page b, .tpc-page strong { color: var(--tpc-pen-deep); }

/* ---------- 首屏：合同 + 判定 ---------- */
.tpc-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(190px, 0.6fr) minmax(220px, 0.78fr);
    gap: 22px 26px;
    align-items: center;
    padding: 30px 32px 26px;
    margin-bottom: 26px;
    border-radius: 14px;
    border: 1px solid var(--tpc-line-strong);
    background:
        radial-gradient(circle at 92% 10%, var(--tpc-seal-soft) 0, transparent 32%),
        linear-gradient(180deg, var(--tpc-bg) 0%, var(--tpc-paper) 100%);
    box-shadow: var(--tpc-shadow);
    overflow: hidden;
}
/* 合同骑缝虚线 */
.tpc-hero::before {
    content: "";
    position: absolute;
    inset: 10px;
    border: 1px dashed var(--tpc-line-strong);
    border-radius: 8px;
    opacity: 0.45;
    pointer-events: none;
}
.tpc-hero > * { position: relative; z-index: 1; }

.tpc-kicker {
    display: inline-block;
    padding: 5px 14px;
    margin-bottom: 12px;
    border-radius: 4px;
    background: var(--tpc-pen);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.16em;
}
.tpc-hero h1 { margin: 0 0 10px; font-size: clamp(26px, 3.2vw, 37px); font-weight: 900; color: var(--tpc-pen-deep); }
.tpc-hero-sub { margin: 0 0 14px; max-width: 56ch; color: var(--tpc-sub); font-size: 15px; }
.tpc-hero-sub b { color: var(--tpc-seal-deep); }

.tpc-hero-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 14px;
    align-items: flex-end;
}
.tpc-field { display: block; min-width: 0; }
.tpc-field--amount { flex: 1 1 190px; }
.tpc-field > select { width: 100%; }
.tpc-label {
    display: block;
    font-size: 12.5px;
    font-weight: 800;
    color: var(--tpc-pen-deep);
    margin-bottom: 5px;
    letter-spacing: 0.03em;
}
.tpc-input {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--tpc-line-strong);
    border-radius: 8px;
    background: var(--tpc-paper);
    color: var(--tpc-ink);
    font-size: 15px;
    font-family: inherit;
    box-sizing: border-box;
}
.tpc-input:focus { outline: none; border-color: var(--tpc-pen); box-shadow: 0 0 0 3px var(--tpc-pen-soft); }

.tpc-btn {
    padding: 10px 22px;
    border-radius: 8px;
    border: 1.5px solid var(--tpc-line-strong);
    background: var(--tpc-panel);
    color: var(--tpc-ink);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
}
.tpc-btn:hover { border-color: var(--tpc-pen); color: var(--tpc-pen-deep); }
.tpc-btn--primary { background: var(--tpc-pen); border-color: var(--tpc-pen); color: #fff; }
.tpc-btn--primary:hover { background: var(--tpc-pen-deep); border-color: var(--tpc-pen-deep); color: #fff; }
.tpc-btn--seal {
    background: var(--tpc-seal);
    border-color: var(--tpc-seal);
    color: #fff;
    font-weight: 900;
    letter-spacing: 0.2em;
    border-radius: 50%;
    width: 74px; height: 74px;
    padding: 0;
    font-size: 15px;
    box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, 0.55), var(--tpc-shadow);
}
.tpc-btn--seal:hover { background: var(--tpc-seal-deep); border-color: var(--tpc-seal-deep); color: #fff; }
.tpc-btn:disabled { opacity: 0.55; cursor: wait; }

.tpc-error {
    margin: 12px 0 0;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--tpc-seal);
    background: var(--tpc-seal-soft);
    color: var(--tpc-seal-deep);
    font-size: 13px;
}

/* 合同装饰 */
.tpc-hero-contract { text-align: center; }
.tpc-contract {
    position: relative;
    height: 188px;
    padding: 20px 16px;
    border: 2px solid var(--tpc-line-strong);
    border-radius: 4px;
    background:
        linear-gradient(180deg, var(--tpc-paper) 0%, var(--tpc-bg) 100%);
    box-shadow: var(--tpc-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}
.tpc-contract-title {
    font-family: Georgia, "Songti SC", serif;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.5;
    letter-spacing: 0.12em;
    color: var(--tpc-ink);
}
.tpc-contract-line {
    width: 78%;
    border-top: 1.5px solid var(--tpc-line-strong);
}
.tpc-contract-line--short { width: 52%; }
.tpc-contract-clause {
    margin-top: auto;
    font-size: 12px;
    color: var(--tpc-pen);
    font-weight: 700;
    letter-spacing: 0.05em;
}
.tpc-seal {
    position: absolute;
    right: 10px; bottom: 14px;
    width: 74px; height: 74px;
    border: 3px solid var(--tpc-seal);
    border-radius: 50%;
    color: var(--tpc-seal);
    font-size: 12px;
    font-weight: 900;
    line-height: 1.35;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-16deg);
    opacity: 0.82;
}
.tpc-contract-note { margin-top: 10px; font-size: 12px; color: var(--tpc-sub); letter-spacing: 0.08em; }

/* 首屏读数 */
.tpc-hero-readout {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px 22px;
    border: 2px solid var(--tpc-pen);
    border-radius: 10px;
    background: var(--tpc-panel);
    box-shadow: var(--tpc-shadow);
}
.tpc-readout-label { font-size: 12px; color: var(--tpc-sub); letter-spacing: 0.14em; }
.tpc-readout-num { font-size: 21px; font-weight: 900; color: var(--tpc-pen-deep); font-family: Georgia, "Songti SC", serif; }
.tpc-readout-meta { font-size: 13px; color: var(--tpc-ink); }
.tpc-readout-tip { font-size: 11.5px; color: var(--tpc-sub); line-height: 1.7; }

/* ---------- 通用区块 ---------- */
.tpc-section { margin-bottom: 26px; }
.tpc-sec-head { margin-bottom: 14px; }
.tpc-sec-head h2 {
    margin: 0 0 6px;
    font-size: clamp(19px, 2.2vw, 24px);
    color: var(--tpc-pen-deep);
    display: flex;
    align-items: center;
    gap: 10px;
}
.tpc-sec-head h2::after {
    content: "";
    flex: 1;
    border-top: 1.5px solid var(--tpc-line-strong);
    opacity: 0.6;
}
.tpc-sec-head p { margin: 0; color: var(--tpc-sub); font-size: 14px; }

.tpc-panel {
    padding: 20px 22px;
    border: 1px solid var(--tpc-line);
    border-radius: 12px;
    background: var(--tpc-panel);
    box-shadow: var(--tpc-shadow);
}

/* ---------- ① 口径标尺 ---------- */
.tpc-scale { margin-bottom: 18px; }
.tpc-scale-track {
    position: relative;
    height: 16px;
    margin: 30px 8px 26px;
    border-radius: 8px;
    border: 1px solid var(--tpc-line-strong);
    background: var(--tpc-paper);
    overflow: visible;
}
.tpc-scale-zone { position: absolute; top: 0; bottom: 0; }
.tpc-scale-zone--low { left: 0; width: 10%; background: var(--tpc-good-soft); border-radius: 7px 0 0 7px; }
.tpc-scale-zone--mid { left: 10%; width: 40%; background: var(--tpc-pen-soft); }
.tpc-scale-zone--high { left: 50%; width: 50%; background: var(--tpc-seal-soft); border-radius: 0 7px 7px 0; }
.tpc-scale-mark {
    position: absolute;
    top: -24px;
    transform: translateX(-50%);
    font-size: 11.5px;
    color: var(--tpc-sub);
    white-space: nowrap;
}
.tpc-scale-mark b { color: var(--tpc-ink); font-weight: 800; }
.tpc-scale-mark:last-of-type { transform: translateX(-100%); }
.tpc-scale-mark:first-of-type { transform: translateX(0); }
.tpc-scale-cursor {
    position: absolute;
    top: -8px; bottom: -8px;
    width: 3px;
    margin-left: -1.5px;
    border-radius: 2px;
    background: var(--tpc-seal);
    transition: left 0.35s ease;
}
.tpc-scale-cursor::after {
    content: "";
    position: absolute;
    left: 50%; top: -7px;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--tpc-seal);
}
.tpc-hint { margin: 10px 0 0; font-size: 12.5px; color: var(--tpc-sub); }

/* 判定卡 */
.tpc-verdict {
    padding: 18px 20px;
    border: 2px solid var(--tpc-pen);
    border-left-width: 8px;
    border-radius: 10px;
    background: var(--tpc-paper);
    box-shadow: var(--tpc-shadow);
}
.tpc-verdict h3 { margin: 0 0 8px; font-size: 18px; color: var(--tpc-pen-deep); }
.tpc-verdict p { margin: 0; font-size: 14px; }
.tpc-verdict.tpc-verdict--low { border-color: var(--tpc-good); }
.tpc-verdict.tpc-verdict--low h3 { color: var(--tpc-good); }
.tpc-verdict.tpc-verdict--mid { border-color: var(--tpc-pen); }
.tpc-verdict.tpc-verdict--high { border-color: var(--tpc-seal); }
.tpc-verdict.tpc-verdict--high h3 { color: var(--tpc-seal-deep); }
.tpc-verdict.tpc-verdict--none { border-color: var(--tpc-warn); }
.tpc-verdict.tpc-verdict--none h3 { color: var(--tpc-warn); }

.tpc-risk {
    margin-top: 16px;
    padding: 14px 16px;
    border: 1.5px dashed var(--tpc-seal);
    border-radius: 10px;
    background: var(--tpc-seal-soft);
    font-size: 13.5px;
    line-height: 1.85;
}
.tpc-risk b { color: var(--tpc-seal-deep); }

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

/* ---------- ② AI ---------- */
.tpc-textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--tpc-line-strong);
    border-radius: 8px;
    background: var(--tpc-paper);
    color: var(--tpc-ink);
    font-size: 14px;
    line-height: 1.78;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}
.tpc-textarea:focus { outline: none; border-color: var(--tpc-pen); box-shadow: 0 0 0 3px var(--tpc-pen-soft); }
.tpc-ai-count { font-weight: 400; font-style: normal; color: var(--tpc-sub); }
.tpc-ai-error { margin-top: 0; }
.tpc-ai-out {
    margin-top: 14px;
    padding: 16px 18px;
    border: 1.5px dashed var(--tpc-pen);
    border-radius: 10px;
    background: var(--tpc-paper);
    font-size: 14px;
    line-height: 1.85;
    white-space: normal;
}

/* ---------- ③ 毁约四步 ---------- */
.tpc-flow {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: 14px;
}
.tpc-flow-step {
    position: relative;
    padding: 18px 16px 14px;
    border: 1.5px solid var(--tpc-line-strong);
    border-radius: 10px;
    background: var(--tpc-paper);
    box-shadow: var(--tpc-shadow);
}
.tpc-flow-step + .tpc-flow-step::before {
    content: "›";
    position: absolute;
    left: -12px; top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    font-weight: 900;
    color: var(--tpc-seal);
    z-index: 2;
}
.tpc-flow-no {
    display: inline-flex;
    width: 34px; height: 34px;
    border: 2px solid var(--tpc-seal);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    color: var(--tpc-seal);
    font-weight: 900;
    font-size: 15px;
    transform: rotate(-8deg);
    margin-bottom: 8px;
}
.tpc-flow-step h3 { margin: 0 0 6px; font-size: 16px; }
.tpc-flow-step p { margin: 0; font-size: 13px; color: var(--tpc-sub); }
.tpc-flow-step p b { color: var(--tpc-pen-deep); }

/* ---------- ④ 对照表 ---------- */
.tpc-table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--tpc-line); }
.tpc-table { width: 100%; min-width: 620px; border-collapse: collapse; background: var(--tpc-paper); font-size: 13.5px; }
.tpc-table th {
    padding: 11px 13px;
    text-align: left;
    background: var(--tpc-pen);
    color: #fff;
    font-weight: 800;
    white-space: nowrap;
}
.tpc-table td { padding: 11px 13px; border-top: 1px solid var(--tpc-line); vertical-align: top; }
.tpc-table tbody tr:nth-child(even) { background: var(--tpc-panel); }

/* ---------- ⑤ 影响卡 ---------- */
.tpc-impact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 14px;
}
.tpc-impact-card {
    padding: 18px 18px 16px;
    border: 1px solid var(--tpc-line-strong);
    border-top: 4px solid var(--tpc-pen);
    border-radius: 10px;
    background: var(--tpc-paper);
    box-shadow: var(--tpc-shadow);
}
.tpc-impact-card:nth-child(2) { border-top-color: var(--tpc-seal); }
.tpc-impact-card:nth-child(3) { border-top-color: var(--tpc-warn); }
.tpc-impact-ico { font-size: 24px; line-height: 1; display: block; margin-bottom: 8px; }
.tpc-impact-card h3 { margin: 0 0 8px; font-size: 16px; }
.tpc-impact-card p { margin: 0; font-size: 13.5px; color: var(--tpc-sub); }
.tpc-impact-card p b { color: var(--tpc-pen-deep); }

/* ---------- toast ---------- */
.tpc-toast {
    position: fixed;
    left: 50%; bottom: 34px;
    transform: translateX(-50%) translateY(16px);
    z-index: 999;
    padding: 10px 22px;
    border-radius: 999px;
    border: 1px solid var(--tpc-pen);
    background: var(--tpc-pen);
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.tpc-toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ---------- 返回顶部 ---------- */
.tpc-top {
    position: fixed;
    right: 22px; bottom: 26px;
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 2px solid var(--tpc-pen);
    background: var(--tpc-paper);
    color: var(--tpc-pen-deep);
    font-size: 19px;
    font-weight: 900;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: all 0.28s ease;
    z-index: 900;
    box-shadow: var(--tpc-shadow);
}
.tpc-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.tpc-top:hover { background: var(--tpc-pen); color: #fff; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
    .tpc-hero { grid-template-columns: minmax(0, 1fr) minmax(220px, 0.7fr); }
    .tpc-hero-contract { display: none; }
}
@media (max-width: 720px) {
    .tpc-hero { grid-template-columns: minmax(0, 1fr); padding: 22px 18px; }
    .tpc-hero-form { flex-direction: column; align-items: stretch; }
    .tpc-btn--seal { align-self: flex-start; }
    .tpc-panel { padding: 16px 15px; }
    .tpc-flow-step + .tpc-flow-step::before { display: none; }
    .tpc-scale-mark { font-size: 10.5px; }
}
