:root {
  --ink: #14231e;
  --muted: #64716b;
  --paper: #f4f1e8;
  --card: #fffdf7;
  --line: #d9d6cb;
  --green: #164f3b;
  --mint: #b9d9c7;
  --orange: #e86f3b;
  --red: #b33d36;
  --shadow: 0 18px 50px rgba(20, 35, 30, .08);
}
* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif; }
body { margin: 0; background: radial-gradient(circle at 85% 4%, #dce9df 0, transparent 30rem), var(--paper); }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; max-width: 1240px; margin: auto; padding: 0 28px; border-bottom: 1px solid rgba(20,35,30,.12); }
.brand { color: var(--ink); text-decoration: none; font-weight: 750; display: flex; align-items: center; gap: 11px; letter-spacing: .02em; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; background: var(--ink); color: var(--paper); border-radius: 50%; font-family: Georgia, serif; }
.live-pill { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); background: rgba(255,255,255,.55); border: 1px solid var(--line); padding: 8px 12px; border-radius: 999px; }
.pulse { width: 8px; height: 8px; background: #c29336; border-radius: 50%; box-shadow: 0 0 0 4px rgba(194,147,54,.15); }
.pulse.live { background: #2a8b62; box-shadow: 0 0 0 4px rgba(42,139,98,.15); }
.pulse.bad { background: var(--red); box-shadow: 0 0 0 4px rgba(179,61,54,.15); }
main { max-width: 1240px; margin: auto; padding: 56px 28px 80px; }
.hero { display: grid; grid-template-columns: 1.25fr .75fr; gap: 72px; align-items: center; min-height: 420px; }
.eyebrow,.section-kicker { color: var(--orange); font-size: 11px; font-weight: 800; letter-spacing: .16em; margin: 0 0 14px; }
h1 { font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(48px, 7vw, 86px); line-height: .98; letter-spacing: -.045em; margin: 0; font-weight: 500; }
h1 em { color: var(--green); display: inline-block; font-size: clamp(38px, 6.3vw, 1em); font-weight: 500; white-space: nowrap; }
.intro { color: var(--muted); font-size: 17px; line-height: 1.8; max-width: 620px; margin: 28px 0 0; }
.quote-card { background: var(--ink); color: var(--paper); padding: 28px; border-radius: 24px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.quote-card::after { content: ""; position: absolute; right: -45px; bottom: -70px; width: 190px; height: 190px; border: 28px solid rgba(185,217,199,.12); border-radius: 50%; }
.quote-head { display: flex; justify-content: space-between; align-items: center; color: #b8c2bd; font-weight: 700; letter-spacing: .08em; font-size: 13px; }
.source-badge { border: 1px solid #50615a; border-radius: 999px; padding: 5px 9px; font-size: 10px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main-rate { font-family: Georgia, serif; font-size: 72px; line-height: 1; margin: 30px 0 8px; font-variant-numeric: tabular-nums; }
.rate-change { min-height: 22px; color: #b9d9c7; font-size: 14px; }
.rate-change.negative { color: #ff9b83; }
.bid-ask { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 32px; position: relative; z-index: 1; }
.bid-ask div { background: rgba(255,255,255,.06); padding: 14px; border-radius: 12px; }
.bid-ask span { display: block; font-size: 9px; color: #9ba7a1; letter-spacing: .12em; }
.bid-ask strong { display: block; margin-top: 5px; font-size: 18px; font-variant-numeric: tabular-nums; }
.freshness { margin-top: 20px; color: #9ba7a1; font-size: 11px; position: relative; z-index: 1; }
.metrics { display: grid; grid-template-columns: repeat(5,1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; margin: 30px 0 28px; }
.metrics article { padding: 24px; background: rgba(255,253,247,.88); display: flex; flex-direction: column; align-items: flex-start; }
.metrics span,.metrics small { display: block; color: var(--muted); font-size: 11px; }
.metrics strong { display: block; font-family: Georgia, serif; font-size: 26px; margin: 8px 0 5px; font-weight: 500; }
.metric-action { margin-top: auto; transform: translateY(14px); border: 1px solid var(--line); background: transparent; color: var(--green); border-radius: 999px; padding: 6px 10px; font-size: 11px; font-weight: 700; cursor: pointer; }
.metric-action:hover { background: #edf3ee; border-color: #adc6b8; }
.panel { background: rgba(255,253,247,.9); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: 0 8px 30px rgba(20,35,30,.03); }
.chart-panel { margin-top: 28px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; }
h2 { font-family: Georgia, "Noto Serif SC", serif; font-weight: 500; font-size: 30px; margin: 0; }
.range-tabs { display: flex; background: #ece9df; padding: 3px; border-radius: 10px; }
.range-tabs button { border: 0; background: transparent; color: var(--muted); padding: 7px 11px; border-radius: 8px; cursor: pointer; }
.range-tabs button.active { background: var(--card); color: var(--ink); box-shadow: 0 2px 8px rgba(20,35,30,.08); }
.chart-wrap { height: 330px; width: 100%; }
.chart-wrap svg { width: 100%; height: 100%; overflow: visible; }
.chart-note,.forecast-meta { margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.legend { color: var(--muted); font-size: 11px; display: flex; gap: 7px; align-items: center; }
.forecast-target-tabs { margin-bottom: 10px; background: transparent; padding: 0; }
.forecast-target-tabs button.active { border: 1px solid var(--line); }
.forecast-target-tabs + .legend { justify-content: flex-end; }
.legend-line { width: 22px; border-top: 2px solid var(--green); }
.legend-band { width: 22px; height: 10px; background: var(--mint); opacity: .55; margin-left: 8px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 28px; align-items: start; }
.timeline { display: grid; gap: 0; }
.event { display: grid; grid-template-columns: 75px 1fr; gap: 16px; padding: 15px 0; border-top: 1px solid var(--line); }
.event time { color: var(--orange); font-size: 11px; }
.event a { color: var(--ink); text-decoration: none; line-height: 1.45; font-size: 14px; }
.event a:hover { color: var(--green); text-decoration: underline; }
.event small { display: block; color: var(--muted); margin-top: 5px; }
.health-row { display: grid; grid-template-columns: 12px 90px 1fr; gap: 10px; align-items: start; border-top: 1px solid var(--line); padding: 14px 0; font-size: 13px; }
.health-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: #2a8b62; }
.health-dot.error { background: var(--red); }
.health-row small { color: var(--muted); line-height: 1.45; }
.alert-log { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 18px; }
.alert-log h3 { font-size: 13px; margin: 0 0 12px; }
.alert-item { padding: 10px 12px; border-left: 3px solid var(--orange); background: #f5eee4; margin-top: 8px; font-size: 12px; }
.empty { color: var(--muted); font-size: 13px; }
footer { border-top: 1px solid var(--line); max-width: 1184px; margin: auto; padding: 28px 0 50px; color: var(--muted); font-size: 11px; display: flex; justify-content: space-between; gap: 20px; }
footer p { margin: 0; }
.chart-grid { stroke: #dedbd1; stroke-width: 1; }
.chart-label { fill: #7b847f; font-size: 10px; font-family: Inter, sans-serif; }
.history-line,.forecast-line { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.forecast-band { fill: var(--mint); opacity: .48; }
.forecast-mid-band { fill: #73a98a; opacity: .22; }
.chart-dot { fill: var(--orange); stroke: var(--card); stroke-width: 2; }
dialog { width: min(980px, calc(100% - 32px)); max-height: calc(100vh - 40px); overflow: auto; border: 1px solid var(--line); border-radius: 24px; padding: 28px; background: var(--card); color: var(--ink); box-shadow: 0 30px 90px rgba(20,35,30,.25); }
dialog::backdrop { background: rgba(20,35,30,.48); backdrop-filter: blur(4px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.icon-button { border: 0; background: #ece9df; color: var(--ink); width: 36px; height: 36px; border-radius: 50%; font-size: 24px; line-height: 1; cursor: pointer; }
.settings-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.setting-card { border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.setting-card:focus-within { border-color: #8eae9c; box-shadow: 0 0 0 3px rgba(22,79,59,.08); }
.setting-card h3 { font-family: Georgia, "Noto Serif SC", serif; font-size: 21px; font-weight: 500; margin: 5px 0 0; }
.setting-card p { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0; min-height: 58px; }
.setting-index { color: var(--orange); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.setting-card label { color: var(--muted); font-size: 11px; font-weight: 700; }
.setting-card input { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fbfaf4; color: var(--ink); padding: 11px 12px; font: inherit; font-variant-numeric: tabular-nums; }
.setting-card input:focus { outline: 2px solid rgba(22,79,59,.18); border-color: var(--green); }
.primary-button,.secondary-button,.danger-button { border-radius: 10px; padding: 10px 12px; font-weight: 750; font-size: 12px; cursor: pointer; }
.primary-button { border: 1px solid var(--green); background: var(--green); color: white; }
.secondary-button { border: 1px solid var(--line); background: transparent; color: var(--ink); }
.danger-button { border: 1px solid #d6aaa6; background: #fff7f5; color: var(--red); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.form-message { min-height: 20px; color: var(--green); margin: 18px 2px 0; font-size: 12px; }
.form-message.error { color: var(--red); }
button:disabled { opacity: .48; cursor: not-allowed; }
@media (max-width: 850px) {
  .hero { grid-template-columns: 1fr; gap: 38px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .two-column { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .setting-card p { min-height: 0; }
  footer { margin: 0 24px; flex-direction: column; }
}
@media (max-width: 540px) {
  .topbar { padding: 0 18px; }
  main { padding: 40px 16px 60px; }
  h1 { font-size: 48px; }
  .main-rate { font-size: 58px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics article { padding: 18px; }
  .panel { padding: 20px 16px; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .chart-wrap { height: 260px; }
  dialog { padding: 22px 16px; }
}
