:root {
  --bg: #f4f7fa;
  --surface: #fff;
  --text: #263445;
  --muted: #6c7a89;
  --line: #e4ebf2;
  --blue: #1b365d;
  --teal: #176b5d;
  --green: #31a66a;
  --orange: #f59e0b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 34px clamp(18px, 4vw, 56px);
  background: linear-gradient(135deg, #173a4d, #1d7b62);
  color: #fff;
}

h1, h2, p { margin: 0; }
h1 { font-size: clamp(28px, 4vw, 46px); line-height: 1.15; }
.topbar p { max-width: 760px; margin-top: 12px; color: rgba(255,255,255,.86); line-height: 1.7; }
nav { display: flex; gap: 10px; flex-wrap: wrap; }
nav a, button {
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  background: rgba(255,255,255,.16);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}
.text-btn {
  display: inline;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--teal);
  font: inherit;
  font-weight: 800;
}

main { width: min(1180px, calc(100% - 32px)); margin: 28px auto 56px; }
.tool-section { margin-bottom: 34px; }
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  margin-bottom: 16px;
}
.section-head h2 { font-size: 26px; color: var(--blue); }
.section-head p { margin-top: 8px; color: var(--muted); line-height: 1.6; }
.layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr); gap: 18px; align-items: start; }
.panel {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(15, 35, 55, .06);
  padding: 22px;
}
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
label { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-weight: 700; font-size: 14px; }
input, select {
  min-height: 42px;
  border: 1px solid #dce6ef;
  border-radius: 8px;
  background: #f9fbfd;
  padding: 9px 11px;
  font: inherit;
  color: var(--text);
}
.check { flex-direction: row; align-items: center; color: var(--text); }
.check input { min-height: auto; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.metric { padding: 16px; background: #f6fafc; border: 1px solid var(--line); border-radius: 8px; }
.metric b { display: block; color: var(--teal); font-size: 24px; line-height: 1.2; }
.metric span { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; }
.bars { margin-top: 18px; display: grid; gap: 12px; }
.bar-label { display: flex; justify-content: space-between; color: var(--muted); font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.bar { height: 12px; border-radius: 999px; background: #edf2f7; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--green); }
.bar.blue i { background: #2f9bd8; }
.bar.orange i { background: var(--orange); }
.bar.gray i { background: #94a3b8; }
.stock-head button { background: var(--blue); }
.stock-groups { display: grid; gap: 16px; }
.stock-card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 4px 16px rgba(15, 35, 55, .06); }
.stock-card h3 { margin: 0; color: var(--blue); font-size: 22px; }
.stock-card .desc { margin-top: 6px; color: var(--muted); }
.stock-table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.stock-table th, .stock-table td { padding: 12px 10px; border-top: 1px solid #edf2f7; text-align: left; }
.stock-table th { color: var(--muted); font-size: 13px; }
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, .48);
}
.modal-mask.show { display: flex; }
.modal-panel {
  width: min(980px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 24px 80px rgba(15, 35, 55, .24);
}
.modal-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 16px; }
.modal-head h2 { margin: 0; color: var(--blue); }
.modal-head p { margin-top: 8px; color: var(--muted); line-height: 1.6; }
.close-btn { background: var(--teal); color: #fff; }
.assumption-copy { display: grid; gap: 10px; color: var(--muted); line-height: 1.7; margin-bottom: 16px; }
.table-wrap { overflow-x: auto; }
.assumption-table { width: 100%; min-width: 860px; border-collapse: collapse; }
.assumption-table th, .assumption-table td { padding: 10px 12px; border: 1px solid #e2e8f0; text-align: left; }
.assumption-table th { background: var(--teal); color: #fff; }
.stock-table td:nth-child(3), .stock-table td:nth-child(4) { text-align: right; font-weight: 800; }
.stock-table small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.up { color: #c2410c; } .down { color: #16803c; } .flat { color: #64748b; }
footer { text-align: center; color: var(--muted); padding: 28px; }

@media (max-width: 860px) {
  .topbar, .section-head { align-items: flex-start; flex-direction: column; }
  .layout { grid-template-columns: 1fr; }
  .grid-form, .metric-grid { grid-template-columns: 1fr; }
  .stock-table { font-size: 13px; }
  .stock-table th, .stock-table td { padding: 10px 6px; }
}
