:root {
  --bg: #06100d;
  --rail: #040c0a;
  --panel: #0a1a15;
  --line: rgba(144, 220, 170, .14);
  --line-strong: rgba(167, 243, 90, .24);
  --text: #f2f7f4;
  --muted: #789487;
  --lime: #a7f35a;
  --cyan: #5ce1e6;
  --amber: #ffbd59;
  --red: #ff6262;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; color: var(--text); background: radial-gradient(circle at 80% 0, rgba(92,225,230,.05), transparent 32rem), var(--bg); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 16px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
img { display: block; max-width: 100%; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 99; padding: .75rem 1rem; color: #07110d; background: var(--lime); font-weight: 800; }
.skip-link:focus { top: 1rem; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.rail { min-height: 100vh; position: sticky; top: 0; align-self: start; height: 100vh; padding: 28px 20px; border-right: 1px solid var(--line); background: rgba(4,12,10,.92); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: .7rem; }
.brand img { width: 44px; height: 44px; object-fit: contain; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 1.04rem; letter-spacing: -.02em; }
.brand span { margin-top: .12rem; color: var(--muted); font-size: .74rem; }
.rail nav { display: grid; gap: .4rem; margin-top: 3rem; }
.nav-item { display: flex; align-items: center; gap: .8rem; min-height: 45px; padding: 0 .8rem; border: 1px solid transparent; color: #8fa99d; border-radius: 9px; font-size: .88rem; }
.nav-item i { width: 18px; color: var(--lime); font-style: normal; }
.nav-item:hover, .nav-item.active { color: var(--text); border-color: var(--line); background: rgba(167,243,90,.05); }
.rail-proof { margin-top: auto; padding: 1.1rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(10,26,21,.7); }
.eyebrow { display: block; color: #80af9a; font: 800 .67rem/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .14em; }
.rail-proof > div { display: flex; gap: .55rem; align-items: center; margin-top: .9rem; }
.rail-proof > div i, .snapshot-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); }
.rail-proof strong { font-size: .82rem; }
.rail-proof p { margin: .7rem 0 0; color: var(--muted); font-size: .72rem; }

main { min-width: 0; padding: 30px 34px 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin-bottom: 1.3rem; }
h1 { margin: .22rem 0 0; font-size: clamp(2rem, 3.5vw, 3.2rem); line-height: 1; letter-spacing: -.055em; }
.top-actions { display: flex; align-items: center; gap: .75rem; }
.portfolio-link { min-height: 40px; display: inline-flex; align-items: center; gap: .55rem; padding: .6rem 1rem; border-radius: 999px; background: var(--lime); color: #07100c; font-weight: 850; font-size: .8rem; }
.portfolio-link:hover { background: #baff73; transform: translateY(-1px); }
.x-link { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--text); background: rgba(9,24,19,.78); font: 850 .9rem/1 Arial, sans-serif; transition: color .18s ease, border-color .18s ease, transform .18s ease; }
.x-link:hover { color: var(--lime); border-color: var(--lime); transform: translateY(-1px); }
.snapshot-badge { min-height: 39px; display: inline-flex; gap: .55rem; align-items: center; padding: 0 .9rem; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--lime); font: 800 .7rem ui-monospace, monospace; }

.control-strip { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; padding: 3px; background: rgba(3,11,8,.55); }
.segmented button { border: 0; border-radius: 6px; min-width: 68px; padding: .55rem .8rem; color: #668477; background: transparent; cursor: pointer; font-weight: 800; font-size: .78rem; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--lime); color: #07100c; box-shadow: 0 0 0 1px rgba(167,243,90,.25); }
.freshness { margin-left: auto; text-align: right; }
.freshness strong, .freshness small { display: block; }
.freshness strong { font-size: .78rem; }
.freshness small { color: var(--muted); font-size: .68rem; margin-top: .2rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 12px; }
.kpi-card, .panel { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(10,27,21,.96), rgba(9,24,19,.96)); border-radius: 13px; }
.kpi-card { min-height: 115px; padding: 1.1rem 1.2rem; position: relative; overflow: hidden; }
.kpi-card.accent-lime { --card-accent: var(--lime); }
.kpi-card.accent-cyan { --card-accent: var(--cyan); }
.kpi-card.accent-amber { --card-accent: var(--amber); }
.kpi-card::after { content: ""; position: absolute; inset: auto -2rem -3rem auto; width: 7rem; height: 7rem; border-radius: 50%; background: color-mix(in srgb, var(--card-accent) 11%, transparent); filter: blur(18px); }
.kpi-card > span, .kpi-card > strong, .kpi-card > small { display: block; }
.kpi-card > span { color: var(--muted); font-size: .74rem; }
.kpi-card > strong { margin-top: .42rem; font-size: clamp(1.4rem, 2.2vw, 2rem); line-height: 1.1; }
.kpi-card > small { margin-top: .45rem; color: #719083; font-size: .7rem; }
.positive { color: #5ee0a0 !important; }
.negative { color: var(--red) !important; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .72fr); gap: 12px; margin-bottom: 12px; }
.panel { padding: 1.3rem; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.panel h2 { margin: .15rem 0 0; font-size: 1.08rem; letter-spacing: -.02em; }
.chart-summary { text-align: right; }
.chart-summary strong, .chart-summary span { display: block; }
.chart-summary strong { font-size: 1.45rem; color: var(--lime); }
.chart-summary span { color: #77a28f; font-size: .72rem; }
.chart { height: 260px; margin-top: 1rem; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart-grid { stroke: rgba(140,190,165,.1); stroke-width: 1; }
.chart-zero { stroke: rgba(255,255,255,.18); stroke-dasharray: 4 5; }
.chart-line { fill: none; stroke: var(--lime); stroke-width: 3; vector-effect: non-scaling-stroke; }
.chart-area { fill: url(#areaGradient); }
.chart-label { fill: #769083; font-size: 10px; }
.chart-empty { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: .82rem; }

.proof-panel { display: flex; flex-direction: column; }
.proof-panel .panel-head img { width: 42px; height: 42px; }
.proof-account { margin: auto 0 1rem; padding: 1.1rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(4,13,10,.5); }
.proof-account span, .proof-account strong { display: block; }
.proof-account span { color: var(--muted); font-size: .7rem; }
.proof-account strong { margin-top: .3rem; font-size: 1.5rem; }
.proof-panel > p { color: var(--muted); font-size: .78rem; margin: 0 0 1rem; }
.record-link { color: var(--lime); font-weight: 800; font-size: .78rem; }

.strategies-panel { margin-bottom: 12px; }
.note { color: var(--muted); font-size: .72rem; }
.strategy-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-top: 1.2rem; }
.strategy-card { min-height: 160px; padding: 1rem; border: 1px solid var(--line); border-top: 2px solid var(--tone); border-radius: 10px; background: rgba(4,13,10,.36); }
.strategy-card.tone-lime { --tone: var(--lime); }
.strategy-card.tone-cyan { --tone: var(--cyan); }
.strategy-card.tone-amber { --tone: var(--amber); }
.strategy-title { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.strategy-title strong { font-size: 1rem; }
.strategy-title span { color: var(--tone); font: 800 .68rem ui-monospace, monospace; }
.strategy-note { margin: .35rem 0 1.25rem; color: var(--muted); font-size: .7rem; }
.strategy-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: .6rem; }
.strategy-stats span, .strategy-stats strong { display: block; }
.strategy-stats span { color: #6c8a7c; font-size: .65rem; }
.strategy-stats strong { margin-top: .3rem; font-size: .88rem; }

.bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compact-panel { min-height: 220px; }
.compact-panel h2 { margin-top: .4rem; font-size: 1.55rem; }
.status-list { margin-top: 1.35rem; }
.status-list > div { display: flex; justify-content: space-between; gap: 1rem; padding: .72rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.status-list strong { color: #789184; }
.status-list strong.is-live { color: var(--lime); }
.risk-panel { border-color: rgba(255,98,98,.15); }
.risk-panel .eyebrow { color: var(--red); }
.risk-panel p { max-width: 42rem; color: var(--muted); font-size: .8rem; }

footer { min-height: 90px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: #627b70; font-size: .7rem; }
footer a { color: #94b3a5; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 84px minmax(0,1fr); }
  .rail { padding-inline: 12px; align-items: center; }
  .brand div, .nav-item:not(:focus) { font-size: 0; }
  .brand img { width: 46px; height: 46px; }
  .rail nav { width: 100%; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-item i { width: auto; font-size: 1rem; }
  .rail-proof { padding: .7rem; text-align: center; }
  .rail-proof .eyebrow, .rail-proof p, .rail-proof strong { display: none; }
  .rail-proof > div { margin: 0; justify-content: center; }
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  body { font-size: 15px; }
  .shell { display: block; }
  .rail { position: static; width: 100%; height: 64px; min-height: 0; padding: 8px 14px; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; align-items: center; }
  .brand img { width: 38px; height: 38px; }
  .brand div { display: block; font-size: initial; }
  .brand span { display: none; }
  .rail nav { margin: 0 0 0 auto; width: auto; display: flex; }
  .nav-item { width: 34px; min-height: 34px; }
  .nav-item:nth-child(2), .nav-item:nth-child(3) { display: none; }
  .rail-proof { display: none; }
  main { padding: 20px 14px 0; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 1rem; }
  .top-actions { width: 100%; }
  .portfolio-link { flex: 1; justify-content: center; }
  .x-link { flex: 0 0 40px; }
  .snapshot-badge { display: none; }
  .control-strip { flex-wrap: wrap; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; min-width: 0; padding-inline: .4rem; }
  .freshness { margin-left: 0; text-align: left; }
  .kpi-grid { gap: 8px; }
  .kpi-card { min-height: 105px; padding: .9rem; }
  .kpi-card > strong { font-size: 1.35rem; }
  .panel { padding: 1rem; }
  .chart { height: 220px; }
  .proof-panel { min-height: 280px; }
  .strategy-grid, .bottom-grid { grid-template-columns: 1fr; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
