/* ============================================================
   MerciMarket — neutral functional theme
   浅色实用界面 · 无衬线 · 中性蓝强调，贴合工具站定位（规划 9.2/9.3）
   ============================================================ */
:root {
    --bg: #F0F1F0;
    --surface: #FFFFFF;
    --surface-2: #E5E7E4;
    --ink: #171A20;
    --muted: #5D6470;
    --line: #E5E7E4;
    --line-strong: #C9CCC6;
    --brand: #0C6B3D;          /* 账本绿，主强调 */
    --brand-ink: #0A5C34;
    --brand-soft: #E2EAE4;
    --brand-2: #0C6B3D;        /* 与主强调同色 */
    --good: #0C6B3D;
    --bad: #A33B2E;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(23, 26, 32, .04), 0 12px 30px -20px rgba(23, 26, 32, .22);
    --maxw: 1080px;
    --serif: "Bodoni Moda", "Times New Roman", serif;
    --sans: "Jost", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: var(--serif);
    color: var(--ink);
    line-height: 1.2;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 10;
}
.nav-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 66px;
    gap: 16px;
}
.brand {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 24px;
    color: var(--brand);
    letter-spacing: -.3px;
}
.brand:hover { text-decoration: none; color: var(--brand-ink); }
.nav { display: flex; gap: 18px; flex-wrap: wrap; }
.nav a {
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
    padding: 4px 2px;
    border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--brand); text-decoration: none; border-bottom-color: var(--brand); }

/* Main */
.site-main { padding: 36px 20px 56px; }

.hero { text-align: center; padding: 40px 0 28px; }
.hero h1 { font-size: 46px; margin: 0 0 10px; letter-spacing: -.5px; }
.tagline {
    font-family: var(--serif);
    font-style: italic;
    font-size: 20px;
    color: var(--brand);
    margin: 0 0 12px;
}
.hero-sub { color: var(--muted); max-width: 620px; margin: 0 auto; }

/* Tool grid */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 28px;
}
.tool-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
    color: var(--ink);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.tool-card:hover { transform: translateY(-3px); border-color: var(--brand); text-decoration: none; box-shadow: 0 16px 36px -20px rgba(70,45,20,.40); }
.tool-card h3 { margin: 0; font-size: 19px; }
.tool-card p { margin: 0; color: var(--muted); font-size: 14px; }
.tool-arrow { color: var(--brand); font-weight: 700; margin-top: auto; }

/* Tool header */
.tool-header { max-width: 720px; margin: 0 auto 24px; text-align: center; }
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 12px;
    color: var(--brand);
    font-weight: 700;
    margin: 0 0 8px;
}
.tool-header h1 { font-size: 34px; margin: 0 0 10px; letter-spacing: -.3px; }
.lead { color: var(--muted); }

/* Calculator */
.calc { max-width: 920px; margin: 0 auto; }
.calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

/* 9.2 桌面端：左输入分组 / 右固定结果摘要 */
.calc-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 28px;
    align-items: start;
}
.calc-inputs {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}
.calc-summary {
    position: sticky;
    top: 84px;
}
.result-details {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.result-summary {
    padding: 14px 18px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.result-summary::-webkit-details-marker { display: none; }
.result-summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.result-details[open] .result-summary::after { content: "\2013"; }
.result-details .result { border: 0; box-shadow: none; }

@media (max-width: 860px) {
    .calc-layout { grid-template-columns: 1fr; }
    .calc-summary { position: static; }
}
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 18px 8px;
    box-shadow: var(--shadow);
    margin: 0;
}
.card legend {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 15px;
    color: var(--brand-ink);
    padding: 0 6px;
}
.card label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 12px;
}
.card label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.card input[type="number"], .card select {
    width: 100%;
    margin-top: 4px;
    padding: 9px 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: #FFFDF8;
    color: var(--ink);
}
.card input:focus, .card select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(178,58,46,.15); }
.row2 { display: flex; gap: 8px; }
.row2 input { flex: 1; }
.row2 select { width: 90px; margin-top: 4px; }

.actions { display: flex; gap: 10px; justify-content: center; margin: 22px 0; flex-wrap: wrap; }
.btn {
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}
.btn:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }

/* Result receipt */
.result {
    max-width: 760px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 4px solid var(--brand);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}
.result h2 { margin: 0 0 14px; font-size: 22px; }
.receipt { width: 100%; border-collapse: collapse; font-size: 14px; }
.receipt th, .receipt td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.receipt td.num, .receipt th.num { text-align: right; font-variant-numeric: tabular-nums; }
.receipt tr.group td { font-weight: 700; color: var(--brand-ink); padding-top: 14px; }
.receipt tr.total td { font-weight: 800; font-size: 16px; border-top: 2px solid var(--brand); border-bottom: none; }
.receipt .pos { color: var(--good); }
.receipt .neg { color: var(--bad); }

/* Placeholder */
.placeholder { max-width: 640px; margin: 40px auto; text-align: center; }
.placeholder h1 { font-size: 30px; margin: 6px 0 10px; }
.lead { color: var(--muted); font-size: 17px; }
.badge {
    display: inline-block;
    background: var(--brand-soft);
    color: var(--brand-ink);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    margin: 10px 0;
}

/* Disclaimer */
.disclaimer { color: var(--muted); font-size: 12px; }
.disclaimer.inline { max-width: 760px; margin: 18px auto 0; text-align: center; }

/* Footer */
.site-footer {
    background: var(--surface-2);
    border-top: 1px solid var(--line);
    padding: 30px 0;
    margin-top: 48px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}
.site-footer .links a { color: var(--muted); margin: 0 2px; }
.site-footer .links a:hover { color: var(--brand); }
.site-footer .copy { margin: 10px 0 0; font-family: var(--serif); }

@media (max-width: 560px) {
    .hero h1 { font-size: 32px; }
    .nav { gap: 12px; }
    .nav a { font-size: 13px; }
    .tool-card { border-left-width: 3px; }

    /* 计算器表单在窄屏下的密度优化 */
    .calc-grid { grid-template-columns: 1fr; gap: 14px; }
    .card { padding: 14px 14px 6px; }
    .card label { margin-bottom: 10px; }
    .card input[type="number"], .card select { padding: 11px 10px; font-size: 16px; }
    .result { padding: 18px 14px; }
    .receipt th, .receipt td { padding: 7px 4px; }
}

/* Suggested result figure */
.suggested { font-size: 30px; font-weight: 800; font-family: var(--serif); margin: 0 0 14px; color: var(--ink); }
.suggested span { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 6px; font-family: var(--sans); }

/* Receipt header cells */
.receipt th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
}
.receipt th.num { text-align: right; }

/* Package comparison dynamic rows */
.box-rows { display: flex; flex-direction: column; gap: 16px; max-width: none; margin: 0 0 16px; }
.box-row { position: relative; }
.box-row .remove-btn { width: auto; margin-top: 4px; }

/* Content pages (Guides / Methodology / Sources / About) */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    max-width: 980px;
    margin: 0 auto 24px;
}
.guide-card {
    text-decoration: none;
    color: inherit;
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand-2);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform .15s ease, box-shadow .15s ease;
}
.guide-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px -20px rgba(16,20,27,.22); }
.guide-card h3 { margin: 0 0 8px; color: var(--ink); font-size: 19px; }
.guide-card p { margin: 0; color: var(--muted); font-size: 14px; }
.article { max-width: 860px; margin: 0 auto; }
.article h2 { margin: 28px 0 10px; font-size: 26px; }
.article h2::after {
    content: "";
    display: block;
    width: 48px;
    height: 3px;
    background: var(--brand);
    margin-top: 8px;
    border-radius: 2px;
}
.article p, .article li { color: var(--ink); line-height: 1.75; }
.article ul, .article ol { padding-left: 22px; }
.article ul li { margin: 6px 0; }
.source-list { list-style: none; padding: 0; }
.source-list li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.source-list a { font-weight: 600; color: var(--brand); }
.source-list p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.merci-embed { margin: 24px 0; }

/* Fee reference table on Methodology */
.fee-reference:empty { display: none; }
.fee-table { margin-top: 12px; }
