:root {
  /* 华港财富品牌颜色使用规范指南 2025 */
  --brand-red: #e60000;
  --table-red: #c0504d;
  --table-red-deep: #a8403d;
  --black: #000000;
  --grey: #a6a6a6;
  --grey-light: #f2f2f2;
  --sand: #d5d0c2;
  --taupe: #87796c;
  --ink: #000000;
  --ink-2: #404040;
  --ink-3: #87796c;
  --line: #e6e6e6;
  --line-strong: #d5d0c2;
  --down: #c0504d;
  --header-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--grey-light); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--header-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 0 28px; color: var(--ink); background: #fff;
  border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
.brand { display: flex; align-items: center; }
.brand img { height: 30px; width: auto; display: block; }
.tabs { display: flex; gap: 4px; }
.tab {
  position: relative; border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  font: inherit; font-size: 15px; padding: 8px 18px; white-space: nowrap; transition: color .2s;
}
.tab::after {
  content: ""; position: absolute; left: 18px; right: 18px; bottom: 0; height: 3px;
  background: var(--table-red); transform: scaleX(0); transition: transform .2s;
}
.tab:hover { color: var(--table-red-deep); }
.tab.active { color: var(--table-red); font-weight: 600; }
.tab.active::after { transform: scaleX(1); }
.top-meta { justify-self: end; text-align: right; display: flex; flex-direction: column; line-height: 1.35; }
.top-meta b { font-size: 13.5px; letter-spacing: .06em; color: var(--black); }
.top-meta small { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- panel ---------- */
.page { padding: 18px 20px 28px; }
.panel { background: #fff; border-radius: 4px; overflow: clip; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px 10px; }
.panel-title { border-left: 4px solid var(--brand-red); padding-left: 12px; }
.panel-title h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: .03em; }
.panel-title p { margin: 4px 0 0; font-size: 12px; color: var(--ink-3); }
.count { font-size: 12.5px; color: var(--brand-red); border: 1px solid var(--brand-red); background: #fff; padding: 4px 12px; border-radius: 999px; font-weight: 600; font-variant-numeric: tabular-nums; }

.scroll-hint {
  position: sticky; top: var(--sticky-top, 64px); z-index: 10;
  display: flex; align-items: center; gap: 14px; padding: 8px 24px 10px; background: #fff;
}
.hint-text { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.hint-text svg { color: var(--brand-red); width: 16px; height: 16px; }
.rail { position: relative; flex: 1; height: 10px; border-radius: 5px; background: var(--grey-light); cursor: pointer; }
.rail.hidden { visibility: hidden; }
.thumb { position: absolute; top: 0; left: 0; height: 100%; border-radius: 5px; background: var(--table-red); cursor: grab; min-width: 40px; transition: background .2s; }
.thumb:hover, .thumb.dragging { background: var(--table-red-deep); }
.thumb.dragging { cursor: grabbing; }

/* ---------- table ---------- */
.table-wrap {
  overflow-x: auto; overflow-y: hidden;
  border-top: 1px solid var(--line); overscroll-behavior-x: contain;
}
.table-wrap::-webkit-scrollbar { height: 10px; width: 10px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--grey); border-radius: 5px; border: 2px solid #fff; }
.table-wrap::-webkit-scrollbar-track { background: #fff; }

table { border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 0 10px; height: 27px; border-bottom: 1px solid #f3f3f3; text-align: center; white-space: nowrap; }
thead th {
  position: sticky; top: 0; z-index: 3; height: 58px; background: var(--table-red); color: #fff;
  font-size: 13px; font-weight: 600; line-height: 1.3; white-space: normal; min-width: 150px; max-width: 190px;
  border-right: 1px solid rgba(255,255,255,.25); border-bottom: 0;
}
thead th.corner { left: 0; z-index: 5; background: var(--table-red-deep); min-width: 156px; }
tbody th {
  position: sticky; left: 0; z-index: 2; background: #fafafa; text-align: left; font-weight: 600; color: var(--ink);
  border-right: 1px solid #ededed; min-width: 156px; font-size: 12.5px;
}
tbody td { color: var(--ink); border-right: 1px solid #f5f5f5; background: #fff; }
td.empty { color: var(--grey); }
td.neg { color: var(--brand-red); }
td.info { color: var(--ink-2); font-size: 12.5px; }
td.cn { color: var(--ink-2); white-space: normal; line-height: 1.25; max-width: 190px; padding-top: 4px; padding-bottom: 4px; }
.est { font-size: 11px; color: var(--ink-3); margin-left: 1px; }

tr.g-info td, tr.g-info th { background: #fbf8f4; }
tr.g-metric td, tr.g-metric th { background: #f7f7f7; }
tr.g-metric td { font-weight: 600; }
tr.ytd td, tr.ytd th { background: #fcefee; font-weight: 700; }
tr.ytd th { color: var(--brand-red); }
tr.g-end td, tr.g-end th { border-bottom: 1px solid #cfcfcf; }
tbody tr:hover td, tbody tr:hover th { background: #faf0ef; }
tbody td.col-hover { background-color: #faf0ef; }
thead th.col-hover { background: var(--table-red-deep); }

.notes { display: flex; flex-direction: column; gap: 4px; padding: 10px 24px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
.notes:empty { display: none; }
.notes div { display: flex; align-items: center; gap: 6px; }
.notes div::before { content: "i"; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--brand-red); color: var(--brand-red); font-size: 10px; font-weight: 700; display: grid; place-items: center; font-style: italic; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  :root { --header-h: auto; }
  .topbar { grid-template-columns: 1fr auto; grid-template-areas: "brand meta" "tabs tabs"; height: auto; padding: 10px 14px 8px; row-gap: 8px; }
  .brand { grid-area: brand; }
  .top-meta { grid-area: meta; }
  .tabs { grid-area: tabs; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { font-size: 14px; padding: 6px 14px; }
  .tab::after { left: 14px; right: 14px; }
  .brand img { height: 24px; }
  .page { padding: 10px 8px 20px; }
  .panel-head { padding: 14px 14px 8px; }
  .panel-title h1 { font-size: 18px; }
  .scroll-hint { padding: 4px 14px 10px; }
  .hint-text { display: none; }
  thead th { min-width: 128px; font-size: 12px; }
  thead th.corner, tbody th { min-width: 104px; }
  tbody th { font-size: 12px; white-space: normal; line-height: 1.2; }
}
