/* FinFlow — 暗色金融工具主题 */
:root {
  --bg: #0b0d10;
  --panel: #12151a;
  --panel2: #171b21;
  --border: #232830;
  --text: #e6e9ee;
  --muted: #9aa3af;
  --accent: #00e589;
  --accent-dim: rgba(0, 229, 137, 0.12);
  --blue: #6ea8fe;
  --red: #ff7a7a;
  --chart-grid: #232830;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans", "Microsoft YaHei", "Noto Sans", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { vertical-align: middle; }

/* ---------- 页头 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 13, 16, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 20px;
  height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 19px; color: var(--text); letter-spacing: 0.2px;
}
.brand:hover { text-decoration: none; }
.brand .logo { width: 28px; height: 28px; }
.brand em { font-style: normal; color: var(--accent); }
.lang-switch { display: flex; gap: 4px; }
.lang-switch a {
  color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 5px 10px; border-radius: 8px;
}
.lang-switch a:hover { color: var(--text); text-decoration: none; }
.lang-switch a.on { color: var(--accent); background: var(--accent-dim); }

/* ---------- 布局 ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 0 20px 40px; }
.breadcrumb { font-size: 13px; color: var(--muted); padding: 18px 0 0; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.hero { padding: 34px 0 10px; }
.hero h1 { font-size: clamp(26px, 4.5vw, 38px); font-weight: 800; line-height: 1.25; letter-spacing: 0.2px; }
.hero .sub { color: var(--muted); margin-top: 10px; max-width: 760px; font-size: 15px; }
.page-sub { color: var(--muted); font-size: 16px; margin-top: 12px; max-width: 820px; }

/* ---------- 首页工具卡片 ---------- */
.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 14px; margin-top: 26px;
}
.tool-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; color: var(--text); display: flex; flex-direction: column; gap: 10px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.tool-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.tool-card .icon {
  width: 42px; height: 42px; border-radius: 11px; background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
}
.tool-card h3 { font-size: 16px; font-weight: 700; }
.tool-card p { font-size: 13px; color: var(--muted); line-height: 1.55; flex: 1; }
.tool-card .go { font-size: 13px; color: var(--accent); font-weight: 600; }

/* ---------- 计算器面板 ---------- */
.calc {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-top: 22px;
}
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field .hint { font-weight: 400; opacity: 0.8; }
.field input, .field select {
  width: 100%; background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 13px; font-size: 15px; outline: none;
  transition: border-color 0.15s ease;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field .affix { position: relative; }
.field .affix span.sym {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 13px; pointer-events: none;
}
.field-note { font-size: 12px; color: var(--muted); margin-top: 5px; }
.error-msg {
  display: none; margin-top: 14px; padding: 10px 14px;
  background: rgba(255, 122, 122, 0.1); border: 1px solid rgba(255, 122, 122, 0.35);
  border-radius: 10px; color: var(--red); font-size: 14px;
}
.error-msg.show { display: block; }

/* 分段选择器 */
.segmented { display: inline-flex; background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; margin-bottom: 18px; }
.segmented button {
  background: transparent; color: var(--muted); border: 0; cursor: pointer;
  padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 600; font-family: inherit;
}
.segmented button.active { background: var(--accent-dim); color: var(--accent); }

/* ---------- 结果 ---------- */
.results { margin-top: 22px; }
.results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px;
}
.stat .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: clamp(19px, 2.6vw, 26px); font-weight: 800; margin-top: 4px; letter-spacing: 0.2px; }
.stat.primary { background: var(--accent-dim); border-color: rgba(0, 229, 137, 0.4); }
.stat.primary .v { color: var(--accent); }
.stat .note { font-size: 12px; color: var(--muted); margin-top: 3px; }

.chart-wrap { margin-top: 20px; background: var(--panel2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.chart-wrap .chart-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.chart-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
canvas.chart { width: 100%; height: 260px; display: block; }

/* ---------- 表格 ---------- */
.table-wrap {
  margin-top: 20px; border: 1px solid var(--border); border-radius: 12px;
  overflow: auto; max-height: 420px; background: var(--panel2);
}
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 9px 14px; text-align: right; white-space: nowrap; }
table.data th {
  position: sticky; top: 0; background: var(--panel);
  color: var(--muted); font-weight: 600; font-size: 12px;
  border-bottom: 1px solid var(--border); z-index: 2;
}
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data tbody tr { border-bottom: 1px solid rgba(35, 40, 48, 0.6); }
table.data tbody tr:hover { background: rgba(0, 229, 137, 0.04); }
table.data td.num { font-variant-numeric: tabular-nums; }
.table-actions { margin-top: 10px; display: flex; justify-content: flex-end; }
.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- 广告位 ---------- */
.ad-slot { display: none; margin: 26px auto; text-align: center; max-width: 970px; }

/* ---------- 内容区 ---------- */
.content { margin-top: 34px; max-width: 820px; }
.content h2 { font-size: 22px; font-weight: 800; margin: 30px 0 12px; }
.content h2:first-child { margin-top: 0; }
.content p, .content li { color: #c3c9d3; font-size: 15px; }
.content ol, .content ul { padding-left: 22px; margin: 10px 0; }
.content li { margin: 7px 0; }
.content .formula {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 20px; margin: 12px 0; overflow-x: auto;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 14px; color: var(--accent); white-space: nowrap;
}
.content .formula-note { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* FAQ */
.faq details {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: 10px; overflow: hidden;
}
.faq summary {
  cursor: pointer; padding: 14px 18px; font-weight: 600; font-size: 15px;
  list-style: none; position: relative; padding-right: 40px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  color: var(--accent); font-size: 20px; font-weight: 400; transition: transform 0.2s ease;
}
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq .faq-a { padding: 0 18px 16px; color: #c3c9d3; font-size: 14px; }

/* 免责声明 */
.disclaimer {
  margin-top: 34px; padding: 14px 18px; border-radius: 12px;
  background: rgba(110, 168, 254, 0.06); border: 1px solid rgba(110, 168, 254, 0.25);
  font-size: 13px; color: var(--muted);
}
.disclaimer strong { color: var(--blue); }

/* 相关工具 */
.related { margin-top: 34px; }
.related h2 { font-size: 18px; margin-bottom: 14px; }
.related .tool-grid { margin-top: 0; }
.related .tool-card { padding: 16px; }

/* ---------- 页脚 ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 48px; }
.footer-inner {
  max-width: 1080px; margin: 0 auto; padding: 28px 20px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px;
  color: var(--muted); font-size: 13px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }
.footer-brand { font-weight: 700; color: var(--text); }

/* 404 */
.notfound { text-align: center; padding: 90px 0; }
.notfound h1 { font-size: 64px; color: var(--accent); }
.notfound p { color: var(--muted); margin: 12px 0 24px; }

@media (max-width: 640px) {
  .calc { padding: 18px; }
  .hero { padding-top: 26px; }
  canvas.chart { height: 210px; }
  .header-inner { height: 54px; }
}

/* ---------- 枢纽首页 ---------- */
.section-title { font-size: 22px; font-weight: 800; margin: 34px 0 14px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.cat-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; color: var(--text); display: flex; flex-direction: column; gap: 12px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.cat-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cat-head h2 { font-size: 20px; font-weight: 800; }
.cat-count { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-dim); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.cat-card p { color: var(--muted); font-size: 14px; flex: 1; }
.cat-card .go { color: var(--accent); font-weight: 600; font-size: 14px; }
.privacy-strip {
  margin-top: 30px; padding: 16px 20px; border-radius: 12px;
  background: var(--accent-dim); border: 1px solid rgba(0, 229, 137, 0.25);
  color: #c3c9d3; font-size: 14px;
}
.nf-links a { margin: 0 8px; }
